Commit 319671ee authored by Clément Fauconnier's avatar Clément Fauconnier

deleted Models Folder and code related + redesign of Documents UI

parent 8ecf99f8
...@@ -54,49 +54,23 @@ ...@@ -54,49 +54,23 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item> <item>
<widget class="QPushButton" name="collapseAll"> <widget class="QComboBox" name="sortOrder">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Collapse All</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../OpenBoard.qrc">
<normaloff>:/images/collapse-all.png</normaloff>:/images/collapse-all.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandAll">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>2</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip"> <item>
<string>Expand All</string> <property name="text">
</property> <string>Ascending order</string>
<property name="text"> </property>
<string notr="true"/> </item>
</property> <item>
<property name="icon"> <property name="text">
<iconset resource="../OpenBoard.qrc"> <string>Descending order</string>
<normaloff>:/images/expand-all.png</normaloff>:/images/expand-all.png</iconset> </property>
</property> </item>
<property name="flat">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
...@@ -107,11 +81,6 @@ ...@@ -107,11 +81,6 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<item>
<property name="text">
<string>Select a sort</string>
</property>
</item>
<item> <item>
<property name="text"> <property name="text">
<string>Creation date</string> <string>Creation date</string>
...@@ -129,26 +98,6 @@ ...@@ -129,26 +98,6 @@
</item> </item>
</widget> </widget>
</item> </item>
<item>
<widget class="QComboBox" name="sortOrder">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Ascending order</string>
</property>
</item>
<item>
<property name="text">
<string>Descending order</string>
</property>
</item>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
...@@ -344,8 +293,6 @@ ...@@ -344,8 +293,6 @@
<header>document/UBDocumentController.h</header> <header>document/UBDocumentController.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources/>
<include location="../OpenBoard.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
...@@ -55,22 +55,25 @@ UBExportAdaptor::~UBExportAdaptor() ...@@ -55,22 +55,25 @@ UBExportAdaptor::~UBExportAdaptor()
// NOOP // NOOP
} }
QString UBExportAdaptor::askForFileName(UBDocumentProxy* pDocument, const QString& pDialogTitle) QString UBExportAdaptor::askForFileName(UBDocumentProxy* pDocument, const QString& pDialogTitle)
{ {
QString defaultName; QString defaultName;
if (pDocument->metaData(UBSettings::documentGroupName).toString().length() > 0)
{
defaultName += pDocument->metaData(UBSettings::documentGroupName).toString() + QString(" ");
}
defaultName += pDocument->metaData(UBSettings::documentName).toString() + exportExtention(); defaultName += pDocument->metaData(UBSettings::documentName).toString() + exportExtention();
defaultName = UBFileSystemUtils::cleanName(defaultName); defaultName = UBFileSystemUtils::cleanName(defaultName);
QString defaultPath = UBSettings::settings()->lastExportFilePath->get().toString() + "/" + defaultName; QString defaultPath = UBSettings::settings()->lastExportFilePath->get().toString() + "/" + defaultName;
QString filename = QFileDialog::getSaveFileName(UBApplication::mainWindow, pDialogTitle, defaultPath); bool useNativeDialog = true;
#ifdef Q_OS_MAC
int versionMac = qMacVersion();
if (versionMac == QSysInfo::MV_Unknown || versionMac >= 11){ // version 11 is MacOSX 10.9 Mavericks
useNativeDialog = false;
}
#endif
QString filename = QFileDialog::getSaveFileName(UBApplication::mainWindow, pDialogTitle, defaultPath, QString(), 0, useNativeDialog?(QFileDialog::Option)0:QFileDialog::DontUseNativeDialog);
if (filename.size() == 0) if (filename.size() == 0)
{ {
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "document/UBDocumentProxy.h" #include "document/UBDocumentProxy.h"
#include "document/UBDocumentController.h"
#include "globals/UBGlobals.h" #include "globals/UBGlobals.h"
...@@ -111,3 +112,13 @@ QString UBExportDocument::exportName() ...@@ -111,3 +112,13 @@ QString UBExportDocument::exportName()
{ {
return tr("Export to OpenBoard Format"); return tr("Export to OpenBoard Format");
} }
bool UBExportDocument::associatedActionactionAvailableFor(const QModelIndex &selectedIndex)
{
const UBDocumentTreeModel *docModel = qobject_cast<const UBDocumentTreeModel*>(selectedIndex.model());
if (!selectedIndex.isValid() || docModel->isCatalog(selectedIndex)) {
return false;
}
return true;
}
...@@ -41,7 +41,7 @@ class UBDocumentProxy; ...@@ -41,7 +41,7 @@ class UBDocumentProxy;
class UBExportDocument : public UBExportAdaptor, public UBProcessingProgressListener class UBExportDocument : public UBExportAdaptor, public UBProcessingProgressListener
{ {
Q_OBJECT; Q_OBJECT
public: public:
UBExportDocument(QObject *parent = 0); UBExportDocument(QObject *parent = 0);
...@@ -54,6 +54,8 @@ class UBExportDocument : public UBExportAdaptor, public UBProcessingProgressList ...@@ -54,6 +54,8 @@ class UBExportDocument : public UBExportAdaptor, public UBProcessingProgressList
virtual bool persistsDocument(UBDocumentProxy* pDocument, const QString& filename); virtual bool persistsDocument(UBDocumentProxy* pDocument, const QString& filename);
virtual void processing(const QString& pObjectName, int pCurrent, int pTotal); virtual void processing(const QString& pObjectName, int pCurrent, int pTotal);
virtual bool associatedActionactionAvailableFor(const QModelIndex &selectedIndex);
}; };
#endif /* UBEXPORTDOCUMENT_H_ */ #endif /* UBEXPORTDOCUMENT_H_ */
...@@ -142,7 +142,7 @@ QString UBExportDocumentSetAdaptor::exportExtention() ...@@ -142,7 +142,7 @@ QString UBExportDocumentSetAdaptor::exportExtention()
QString UBExportDocumentSetAdaptor::exportName() QString UBExportDocumentSetAdaptor::exportName()
{ {
return tr("Export to Sankore UBX Format"); return tr("Export to OpenBoard UBX Format");
} }
bool UBExportDocumentSetAdaptor::addDocumentToZip(const QModelIndex &pIndex, UBDocumentTreeModel *model, QuaZip &zip) bool UBExportDocumentSetAdaptor::addDocumentToZip(const QModelIndex &pIndex, UBDocumentTreeModel *model, QuaZip &zip)
......
...@@ -347,8 +347,8 @@ UBDocumentTreeModel::UBDocumentTreeModel(QObject *parent) : ...@@ -347,8 +347,8 @@ UBDocumentTreeModel::UBDocumentTreeModel(QObject *parent) :
UBDocumentTreeNode *myDocsNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, UBPersistenceManager::myDocumentsName, tr("My documents")); UBDocumentTreeNode *myDocsNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, UBPersistenceManager::myDocumentsName, tr("My documents"));
rootNode->addChild(myDocsNode); rootNode->addChild(myDocsNode);
UBDocumentTreeNode *modelsNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, UBPersistenceManager::modelsName, tr("Models")); //UBDocumentTreeNode *modelsNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, UBPersistenceManager::modelsName, tr("Models"));
rootNode->addChild(modelsNode); //rootNode->addChild(modelsNode);
UBDocumentTreeNode *trashNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, trashName, tr("Trash")); UBDocumentTreeNode *trashNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, trashName, tr("Trash"));
rootNode->addChild(trashNode); rootNode->addChild(trashNode);
UBDocumentTreeNode *untitledDocumentsNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, UBPersistenceManager::untitledDocumentsName, tr("Untitled documents")); UBDocumentTreeNode *untitledDocumentsNode = new UBDocumentTreeNode(UBDocumentTreeNode::Catalog, UBPersistenceManager::untitledDocumentsName, tr("Untitled documents"));
...@@ -358,8 +358,7 @@ UBDocumentTreeModel::UBDocumentTreeModel(QObject *parent) : ...@@ -358,8 +358,7 @@ UBDocumentTreeModel::UBDocumentTreeModel(QObject *parent) :
mRoot = index(0, 0, QModelIndex()); mRoot = index(0, 0, QModelIndex());
mMyDocuments = index(0, 0, QModelIndex()); mMyDocuments = index(0, 0, QModelIndex());
mModels = index(1, 0, QModelIndex()); mTrash = index(1, 0, QModelIndex());
mTrash = index(2, 0, QModelIndex());
mUntitledDocuments = index(0, 0, mMyDocuments); mUntitledDocuments = index(0, 0, mMyDocuments);
mAscendingOrder = true; mAscendingOrder = true;
} }
...@@ -711,13 +710,8 @@ bool UBDocumentTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction act ...@@ -711,13 +710,8 @@ bool UBDocumentTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction act
QList<QModelIndex> incomingIndexes = mimeData->indexes(); QList<QModelIndex> incomingIndexes = mimeData->indexes();
foreach (QModelIndex curIndex, incomingIndexes) { foreach (QModelIndex curIndex, incomingIndexes)
#ifdef Q_WS_MAC {
if (inModel(curIndex)) {
return true;
}
#endif
//Issue N/C - NNE - 20140528 : use just the index on the first column //Issue N/C - NNE - 20140528 : use just the index on the first column
if(curIndex.column() == 0){ if(curIndex.column() == 0){
QModelIndex clonedTopLevel = copyIndexToNewParent(curIndex, parent, action == Qt::MoveAction ? aReference : aContentCopy); QModelIndex clonedTopLevel = copyIndexToNewParent(curIndex, parent, action == Qt::MoveAction ? aReference : aContentCopy);
...@@ -1070,11 +1064,6 @@ bool UBDocumentTreeModel::inTrash(const QModelIndex &index) const ...@@ -1070,11 +1064,6 @@ bool UBDocumentTreeModel::inTrash(const QModelIndex &index) const
return isDescendantOf(index, trashIndex()); return isDescendantOf(index, trashIndex());
} }
bool UBDocumentTreeModel::inModel(const QModelIndex &index) const
{
return isDescendantOf(index, modelsIndex());
}
bool UBDocumentTreeModel::inUntitledDocuments(const QModelIndex &index) const bool UBDocumentTreeModel::inUntitledDocuments(const QModelIndex &index) const
{ {
return isDescendantOf(index, untitledDocumentsIndex()); return isDescendantOf(index, untitledDocumentsIndex());
...@@ -1409,11 +1398,11 @@ void UBDocumentTreeView::dropEvent(QDropEvent *event) ...@@ -1409,11 +1398,11 @@ void UBDocumentTreeView::dropEvent(QDropEvent *event)
bool isUBPage = event->mimeData()->hasFormat(UBApplication::mimeTypeUniboardPage); bool isUBPage = event->mimeData()->hasFormat(UBApplication::mimeTypeUniboardPage);
bool inModel = docModel->inModel(targetIndex) || targetIndex == docModel->modelsIndex(); bool inModel = false;
//just check the first index, because the selection is exclusive between //just check the first index, because the selection is exclusive between
//myDocuments, Model and Tash //myDocuments, Model and Tash
bool isSourceAModel = docModel->inModel(dropIndex.first()); bool isSourceAModel = false;
//issue 1629 - NNE - 20131212 //issue 1629 - NNE - 20131212
bool targetIsInTrash = docModel->inTrash(targetIndex) || docModel->trashIndex() == targetIndex; bool targetIsInTrash = docModel->inTrash(targetIndex) || docModel->trashIndex() == targetIndex;
...@@ -1502,27 +1491,12 @@ bool UBDocumentTreeView::isAcceptable(const QModelIndex &dragIndex, const QModel ...@@ -1502,27 +1491,12 @@ bool UBDocumentTreeView::isAcceptable(const QModelIndex &dragIndex, const QModel
return false; return false;
} }
if (fullModel() && fullModel()->inModel(dragIndexSource)) {
if (atIndexSource == fullModel()->modelsIndex() || fullModel()->inModel(atIndexSource)) {
return false; //do not accept drop from model to itself
}
}
return true; return true;
} }
Qt::DropAction UBDocumentTreeView::acceptableAction(const QModelIndex &dragIndex, const QModelIndex &atIndex) Qt::DropAction UBDocumentTreeView::acceptableAction(const QModelIndex &dragIndex, const QModelIndex &atIndex)
{ {
if (fullModel()->inModel(dragIndex)) { return Qt::MoveAction;
if (atIndex == fullModel()->trashIndex() || fullModel()->inTrash(atIndex)) {
return Qt::MoveAction; //do not accept drop from model to trash, only "delete" command accepted
}
return Qt::CopyAction;
} else {
return Qt::MoveAction;
}
return Qt::IgnoreAction;
} }
void UBDocumentTreeView::updateIndexEnvirons(const QModelIndex &index) void UBDocumentTreeView::updateIndexEnvirons(const QModelIndex &index)
...@@ -1844,9 +1818,7 @@ void UBDocumentController::TreeViewSelectionChanged(const QItemSelection &select ...@@ -1844,9 +1818,7 @@ void UBDocumentController::TreeViewSelectionChanged(const QItemSelection &select
UBDocumentTreeModel *model = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel; UBDocumentTreeModel *model = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel;
bool sameFolder = (model->inModel(sourceIndex1) && model->inModel(sourceIndex2)); bool sameFolder = (model->inTrash(sourceIndex1) && model->inTrash(sourceIndex2));
sameFolder |= (model->inTrash(sourceIndex1) && model->inTrash(sourceIndex2));
sameFolder |= (model->inMyDocuments(sourceIndex1) && model->inMyDocuments(sourceIndex2)); sameFolder |= (model->inMyDocuments(sourceIndex1) && model->inMyDocuments(sourceIndex2));
...@@ -2022,15 +1994,9 @@ void UBDocumentController::setupViews() ...@@ -2022,15 +1994,9 @@ void UBDocumentController::setupViews()
mDocumentUI->documentTreeView->hideColumn(1); mDocumentUI->documentTreeView->hideColumn(1);
mDocumentUI->documentTreeView->hideColumn(2); mDocumentUI->documentTreeView->hideColumn(2);
mDocumentUI->sortOrder->hide();
connect(mDocumentUI->sortKind, SIGNAL(activated(int)), this, SLOT(onSortKindChanged(int))); connect(mDocumentUI->sortKind, SIGNAL(activated(int)), this, SLOT(onSortKindChanged(int)));
connect(mDocumentUI->sortOrder, SIGNAL(activated(int)), this, SLOT(onSortOrderChanged(int))); connect(mDocumentUI->sortOrder, SIGNAL(activated(int)), this, SLOT(onSortOrderChanged(int)));
connect(mDocumentUI->collapseAll, SIGNAL(clicked()), this, SLOT(collapseAll()));
connect(mDocumentUI->expandAll, SIGNAL(clicked()), this, SLOT(expandAll()));
connect(mDocumentUI->documentTreeView->itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint) ), mDocumentUI->documentTreeView, SLOT(adjustSize())); connect(mDocumentUI->documentTreeView->itemDelegate(), SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint) ), mDocumentUI->documentTreeView, SLOT(adjustSize()));
connect(mDocumentUI->documentTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(TreeViewSelectionChanged(QItemSelection,QItemSelection))); connect(mDocumentUI->documentTreeView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(TreeViewSelectionChanged(QItemSelection,QItemSelection)));
connect(UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel, SIGNAL(indexChanged(QModelIndex,QModelIndex)) connect(UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel, SIGNAL(indexChanged(QModelIndex,QModelIndex))
...@@ -2083,22 +2049,12 @@ void UBDocumentController::sortDocuments(int kind, int order) ...@@ -2083,22 +2049,12 @@ void UBDocumentController::sortDocuments(int kind, int order)
if(kind == UBDocumentController::CreationDate){ if(kind == UBDocumentController::CreationDate){
mSortFilterProxyModel->setSortRole(UBDocumentTreeModel::CreationDate); mSortFilterProxyModel->setSortRole(UBDocumentTreeModel::CreationDate);
mSortFilterProxyModel->sort(1, sortOrder); mSortFilterProxyModel->sort(1, sortOrder);
mDocumentUI->documentTreeView->showColumn(1);
mDocumentUI->documentTreeView->hideColumn(2);
}else if(kind == UBDocumentController::UpdateDate){ }else if(kind == UBDocumentController::UpdateDate){
mSortFilterProxyModel->setSortRole(UBDocumentTreeModel::UpdateDate); mSortFilterProxyModel->setSortRole(UBDocumentTreeModel::UpdateDate);
mSortFilterProxyModel->sort(2, sortOrder); mSortFilterProxyModel->sort(2, sortOrder);
mDocumentUI->documentTreeView->hideColumn(1);
mDocumentUI->documentTreeView->showColumn(2);
}else{ }else{
mSortFilterProxyModel->setSortRole(Qt::DisplayRole); mSortFilterProxyModel->setSortRole(Qt::DisplayRole);
mSortFilterProxyModel->sort(0, sortOrder); mSortFilterProxyModel->sort(0, sortOrder);
//alphabetical order or nothing
mDocumentUI->documentTreeView->hideColumn(1);
mDocumentUI->documentTreeView->hideColumn(2);
} }
} }
...@@ -2115,11 +2071,6 @@ void UBDocumentController::onSortKindChanged(int index) ...@@ -2115,11 +2071,6 @@ void UBDocumentController::onSortKindChanged(int index)
{ {
int orderIndex = mDocumentUI->sortOrder->currentIndex(); int orderIndex = mDocumentUI->sortOrder->currentIndex();
if(index == -1 || index == 0)
mDocumentUI->sortOrder->hide();
else
mDocumentUI->sortOrder->show();
sortDocuments(index, orderIndex); sortDocuments(index, orderIndex);
} }
//N/C - NNE - 20140403 : END //N/C - NNE - 20140403 : END
...@@ -2762,10 +2713,7 @@ void UBDocumentController::thumbnailPageDoubleClicked(QGraphicsItem* item, int i ...@@ -2762,10 +2713,7 @@ void UBDocumentController::thumbnailPageDoubleClicked(QGraphicsItem* item, int i
QModelIndex selectedIndex = firstSelectedTreeIndex(); QModelIndex selectedIndex = firstSelectedTreeIndex();
if (selectedIndex.isValid()) { if (selectedIndex.isValid()) {
if (docModel->inModel(selectedIndex)) { if (docModel->inTrash(selectedIndex)) {
UBApplication::showMessage(tr("The model documents are not editable. Copy it to \"My documents\" to be able to work with"));
return;
} else if (docModel->inTrash(selectedIndex)) {
return; return;
} }
} }
...@@ -3070,9 +3018,8 @@ void UBDocumentController::updateActions() ...@@ -3070,9 +3018,8 @@ void UBDocumentController::updateActions()
} }
bool trashSelected = docModel->inTrash(selectedIndex) || selectedIndex == docModel->trashIndex() ? true : false; bool trashSelected = docModel->inTrash(selectedIndex) || selectedIndex == docModel->trashIndex() ? true : false;
bool modelSelected = docModel->inModel(selectedIndex) || selectedIndex == docModel->modelsIndex() ? true : false;
mMainWindow->actionNewDocument->setEnabled(docModel->newNodeAllowed(selectedIndex) && !modelSelected); mMainWindow->actionNewDocument->setEnabled(docModel->newNodeAllowed(selectedIndex));
mMainWindow->actionNewFolder->setEnabled(docModel->newNodeAllowed(selectedIndex)); mMainWindow->actionNewFolder->setEnabled(docModel->newNodeAllowed(selectedIndex));
mMainWindow->actionExport->setEnabled((docSelected || pageSelected || groupSelected) && !trashSelected); mMainWindow->actionExport->setEnabled((docSelected || pageSelected || groupSelected) && !trashSelected);
updateExportSubActions(selectedIndex); updateExportSubActions(selectedIndex);
...@@ -3080,7 +3027,7 @@ void UBDocumentController::updateActions() ...@@ -3080,7 +3027,7 @@ void UBDocumentController::updateActions()
bool firstSceneSelected = false; bool firstSceneSelected = false;
if (docSelected) { if (docSelected) {
mMainWindow->actionDuplicate->setEnabled(!trashSelected && !modelSelected); mMainWindow->actionDuplicate->setEnabled(!trashSelected);
} else if (pageSelected) { } else if (pageSelected) {
QList<QGraphicsItem*> selection = mDocumentUI->thumbnailWidget->selectedItems(); QList<QGraphicsItem*> selection = mDocumentUI->thumbnailWidget->selectedItems();
...@@ -3104,7 +3051,7 @@ void UBDocumentController::updateActions() ...@@ -3104,7 +3051,7 @@ void UBDocumentController::updateActions()
mMainWindow->actionDuplicate->setEnabled(false); mMainWindow->actionDuplicate->setEnabled(false);
} }
mMainWindow->actionOpen->setEnabled((docSelected || pageSelected) && !trashSelected && !modelSelected); mMainWindow->actionOpen->setEnabled((docSelected || pageSelected) && !trashSelected);
mMainWindow->actionRename->setEnabled(docModel->isOkToRename(selectedIndex)); mMainWindow->actionRename->setEnabled(docModel->isOkToRename(selectedIndex));
mMainWindow->actionAddToWorkingDocument->setEnabled(pageSelected mMainWindow->actionAddToWorkingDocument->setEnabled(pageSelected
...@@ -3133,7 +3080,7 @@ void UBDocumentController::updateActions() ...@@ -3133,7 +3080,7 @@ void UBDocumentController::updateActions()
break; break;
} }
mMainWindow->actionDocumentAdd->setEnabled((docSelected || pageSelected) && !trashSelected && !modelSelected); mMainWindow->actionDocumentAdd->setEnabled((docSelected || pageSelected) && !trashSelected);
mMainWindow->actionImport->setEnabled(!trashSelected); mMainWindow->actionImport->setEnabled(!trashSelected);
} }
...@@ -3344,7 +3291,7 @@ void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*) ...@@ -3344,7 +3291,7 @@ void UBDocumentController::refreshDocumentThumbnailsView(UBDocumentContainer*)
mDocumentUI->thumbnailWidget->setGraphicsItems(items, itemsPath, labels, UBApplication::mimeTypeUniboardPage); mDocumentUI->thumbnailWidget->setGraphicsItems(items, itemsPath, labels, UBApplication::mimeTypeUniboardPage);
if (docModel->inTrash(current) || docModel->inModel(current)) { if (docModel->inTrash(current)) {
mDocumentUI->thumbnailWidget->setDragEnabled(false); mDocumentUI->thumbnailWidget->setDragEnabled(false);
} else { } else {
mDocumentUI->thumbnailWidget->setDragEnabled(true); mDocumentUI->thumbnailWidget->setDragEnabled(true);
......
...@@ -199,7 +199,6 @@ public: ...@@ -199,7 +199,6 @@ public:
bool newNodeAllowed(const QModelIndex &pSelectedIndex) const; bool newNodeAllowed(const QModelIndex &pSelectedIndex) const;
QModelIndex goTo(const QString &dir); QModelIndex goTo(const QString &dir);
bool inTrash(const QModelIndex &index) const; bool inTrash(const QModelIndex &index) const;
bool inModel(const QModelIndex &index) const;
bool inUntitledDocuments(const QModelIndex &index) const; bool inUntitledDocuments(const QModelIndex &index) const;
bool isCatalog(const QModelIndex &index) const {return nodeFromIndex(index)->nodeType() == UBDocumentTreeNode::Catalog;} bool isCatalog(const QModelIndex &index) const {return nodeFromIndex(index)->nodeType() == UBDocumentTreeNode::Catalog;}
bool isDocument(const QModelIndex &index) const {return nodeFromIndex(index)->nodeType() == UBDocumentTreeNode::Document;} bool isDocument(const QModelIndex &index) const {return nodeFromIndex(index)->nodeType() == UBDocumentTreeNode::Document;}
...@@ -216,7 +215,6 @@ public: ...@@ -216,7 +215,6 @@ public:
QString adjustNameForParentIndex(const QString &pName, const QModelIndex &pIndex); QString adjustNameForParentIndex(const QString &pName, const QModelIndex &pIndex);
QPersistentModelIndex myDocumentsIndex() const {return mMyDocuments;} QPersistentModelIndex myDocumentsIndex() const {return mMyDocuments;}
QPersistentModelIndex modelsIndex() const {return mModels;}
QPersistentModelIndex trashIndex() const {return mTrash;} QPersistentModelIndex trashIndex() const {return mTrash;}
QPersistentModelIndex untitledDocumentsIndex() const {return mUntitledDocuments;} QPersistentModelIndex untitledDocumentsIndex() const {return mUntitledDocuments;}
UBDocumentTreeNode *nodeFromIndex(const QModelIndex &pIndex) const; UBDocumentTreeNode *nodeFromIndex(const QModelIndex &pIndex) const;
...@@ -251,7 +249,6 @@ private: ...@@ -251,7 +249,6 @@ private:
void updateIndexNameBindings(UBDocumentTreeNode *nd); void updateIndexNameBindings(UBDocumentTreeNode *nd);
QPersistentModelIndex mRoot; QPersistentModelIndex mRoot;
QPersistentModelIndex mMyDocuments; QPersistentModelIndex mMyDocuments;
QPersistentModelIndex mModels;
QPersistentModelIndex mTrash; QPersistentModelIndex mTrash;
QPersistentModelIndex mUntitledDocuments; QPersistentModelIndex mUntitledDocuments;
QList<UBDocumentProxy*> mNewDocuments; QList<UBDocumentProxy*> mNewDocuments;
...@@ -360,7 +357,6 @@ class UBDocumentController : public UBDocumentContainer ...@@ -360,7 +357,6 @@ class UBDocumentController : public UBDocumentContainer
enum SortKind enum SortKind
{ {
Reset = 0,
CreationDate, CreationDate,
UpdateDate, UpdateDate,
Alphabetical Alphabetical
......
...@@ -72,12 +72,9 @@ void UBDocumentTreeWidget::itemChangedValidation(QTreeWidgetItem * item, int col ...@@ -72,12 +72,9 @@ void UBDocumentTreeWidget::itemChangedValidation(QTreeWidgetItem * item, int col
if (column == 0) if (column == 0)
{ {
UBDocumentGroupTreeItem* group = dynamic_cast<UBDocumentGroupTreeItem *>(item);
if(group)
{
UBDocumentGroupTreeItem* group = dynamic_cast<UBDocumentGroupTreeItem *>(item);
if(group)
{
QString name = group->text(0); QString name = group->text(0);
for(int i = 0; i < topLevelItemCount (); i++) for(int i = 0; i < topLevelItemCount (); i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment