foldersView context menu is now dynamic

This commit is contained in:
Luis Ángel San Martín 2014-06-11 19:38:13 +02:00
parent 7e68a34d7e
commit 169ecd485c
2 changed files with 19 additions and 1 deletions

View File

@ -723,6 +723,7 @@ void LibraryWindow::createConnections()
connect(renameLibraryDialog,SIGNAL(renameLibrary(QString)),this,SLOT(rename(QString)));
//navigations between view modes (tree,list and flow)
connect(foldersView, SIGNAL(pressed(QModelIndex)), this, SLOT(updateFoldersViewConextMenu(QModelIndex)));
connect(foldersView, SIGNAL(clicked(QModelIndex)), this, SLOT(loadCovers(QModelIndex)));
connect(foldersView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateHistory(QModelIndex)));
@ -1805,7 +1806,23 @@ void LibraryWindow::updateHistory(const QModelIndex &mi)
currentFolderNavigation++;
}
forwardAction->setEnabled(false);
forwardAction->setEnabled(false);
}
void LibraryWindow::updateFoldersViewConextMenu(const QModelIndex &mi)
{
if(!mi.isValid())
return;
TreeItem * item = static_cast<TreeItem *>(mi.internalPointer());
bool isFinished = item->data(TreeModel::Finished).toBool();
bool isCompleted = item->data(TreeModel::Completed).toBool();
setFolderAsFinishedAction->setVisible(!isFinished);
setFolderAsNotFinishedAction->setVisible(isFinished);
setFolderAsCompletedAction->setVisible(!isCompleted);
setFolderAsNotCompletedAction->setVisible(isCompleted);
}
void LibraryWindow::libraryAlreadyExists(const QString & name)

View File

@ -279,6 +279,7 @@ public:
void backward();
void forward();
void updateHistory(const QModelIndex & mi);
void updateFoldersViewConextMenu(const QModelIndex & mi);
void libraryAlreadyExists(const QString & name);
void importLibraryPackage();
void updateComicsView(quint64 libraryId, const ComicDB & comic);