Skip to content

Commit

Permalink
Added separator between root folders
Browse files Browse the repository at this point in the history
  • Loading branch information
medo64 committed Oct 11, 2020
1 parent d52291e commit b651bf6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,14 @@ void MainWindow::onFolderMenuShow() {
QFont italicFont = _folderButton->menu()->font();
italicFont.setItalic(true);

bool isFirst = true;
_folderButton->menu()->clear();
for (FolderItem* folder : *_storage) {
if (isFirst) {
isFirst = false;
} else {
if (folder->isRoot()) { _folderButton->menu()->addSeparator(); }
}
QAction* folderAction = new QAction(folder->title());
folderAction->setData(folder->name());
folderAction->setDisabled(folder == _folder);
Expand Down Expand Up @@ -851,7 +857,13 @@ void MainWindow::onTabMenuRequested(const QPoint& point) {

if (_storage->folderCount() > 1) {
auto moveMenu = menu.addMenu("Move");
bool isFirst = true;
for (FolderItem* folder : *_storage) {
if (isFirst) {
isFirst = false;
} else {
if (folder->isRoot()) { moveMenu->addSeparator(); }
}
auto folderAction = moveMenu->addAction(folder->title(), this, &MainWindow::onFolderMove);
if (!folder->isPrimary()) { folderAction->setFont(italicFont); }
folderAction->setData(folder->key());
Expand Down

0 comments on commit b651bf6

Please sign in to comment.