[qet] [4556] Element panel widget : Add item to the QTreeView when create a new element or a new directory |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4556
Author: blacksun
Date: 2016-06-17 11:09:46 +0200 (Fri, 17 Jun 2016)
Log Message:
-----------
Element panel widget : Add item to the QTreeView when create a new element or a new directory
Modified Paths:
--------------
trunk/sources/ElementsCollection/elementscollectionwidget.cpp
trunk/sources/elementscategoryeditor.cpp
trunk/sources/elementscategoryeditor.h
Modified: trunk/sources/ElementsCollection/elementscollectionwidget.cpp
===================================================================
--- trunk/sources/ElementsCollection/elementscollectionwidget.cpp 2016-06-17 08:41:09 UTC (rev 4555)
+++ trunk/sources/ElementsCollection/elementscollectionwidget.cpp 2016-06-17 09:09:46 UTC (rev 4556)
@@ -367,9 +367,8 @@
ElementsLocation location(feci->collectionPath());
ElementsCategoryEditor new_dir_editor(location, false, this);
- if (new_dir_editor.exec() == QDialog::Accepted) {
- reload();
- }
+ if (new_dir_editor.exec() == QDialog::Accepted)
+ m_model->addLocation(new_dir_editor.createdLocation());
}
/**
@@ -393,6 +392,9 @@
ElementsLocation loc(feci->collectionPath());
elmt_wizard.preselectedLocation(loc);
elmt_wizard.exec();
+
+ foreach (QETElementEditor *element_editor, QETApp::instance()->elementEditors())
+ connect(element_editor, &QETElementEditor::saveToLocation, this, &ElementsCollectionWidget::locationWasSaved);
}
/**
Modified: trunk/sources/elementscategoryeditor.cpp
===================================================================
--- trunk/sources/elementscategoryeditor.cpp 2016-06-17 08:41:09 UTC (rev 4555)
+++ trunk/sources/elementscategoryeditor.cpp 2016-06-17 09:09:46 UTC (rev 4556)
@@ -86,6 +86,15 @@
}
/**
+ * @brief ElementsCategoryEditor::createdLocation
+ * @return the location of the created directory
+ */
+ElementsLocation ElementsCategoryEditor::createdLocation() const
+{
+ return m_created_location;
+}
+
+/**
* @brief ElementsCategoryEditor::setUpWidget
*/
void ElementsCategoryEditor::setUpWidget()
@@ -150,8 +159,8 @@
ElementCollectionHandler ech_;
NamesList nl = m_names_list->names();
- ElementsLocation loc = ech_.createDir(m_location, dirname, nl);
- if (loc.isNull()) {
+ m_created_location = ech_.createDir(m_location, dirname, nl);
+ if (m_created_location.isNull()) {
QET::QetMessageBox::critical(this,
tr("Erreur", "message box title"),
tr("Impossible de créer la catégorie", "message box content"));
Modified: trunk/sources/elementscategoryeditor.h
===================================================================
--- trunk/sources/elementscategoryeditor.h 2016-06-17 08:41:09 UTC (rev 4555)
+++ trunk/sources/elementscategoryeditor.h 2016-06-17 09:09:46 UTC (rev 4556)
@@ -37,6 +37,8 @@
public:
ElementsCategoryEditor(const ElementsLocation &location, bool edit = true, QWidget *parent = nullptr);
virtual ~ElementsCategoryEditor();
+
+ ElementsLocation createdLocation() const;
private:
ElementsCategoryEditor(const ElementsCategoryEditor &);
@@ -48,6 +50,7 @@
QFileNameEdit *m_file_line_edit;
bool m_edit_mode;
ElementsLocation m_location;
+ ElementsLocation m_created_location;
private:
void setUpWidget();