Skip to content
Permalink
Browse files

add bookmark menu.(refs #78)

  • Loading branch information...
haraki committed Jun 13, 2019
1 parent 9cdfe5d commit 2d72167bd010e4097b5640c9a8972518a6ea39bd
Showing with 76 additions and 23 deletions.
  1. +19 −10 folderform.cpp
  2. +2 −0 folderform.h
  3. +25 −11 mainwindow.cpp
  4. +2 −1 mainwindow.h
  5. +28 −1 mainwindow.ui
@@ -301,16 +301,7 @@ void FolderForm::onDirectoryLoaded(const QString& path)
ui->folderView->setCursor(currentRootIndex);
}

ui->bookmarkToolButton->blockSignals(true);
if(Settings::getInstance()->searchBookmarkDirPath(path) >= 0)
{
ui->bookmarkToolButton->setChecked(true);
}
else
{
ui->bookmarkToolButton->setChecked(false);
}
ui->bookmarkToolButton->blockSignals(false);
checkBookmark();
}

void FolderForm::onLayoutChanged(const QList<QPersistentModelIndex> &parents/* = QList<QPersistentModelIndex>()*/, QAbstractItemModel::LayoutChangeHint hint/* = QAbstractItemModel::NoLayoutChangeHint*/)
@@ -421,6 +412,24 @@ int FolderForm::onBookmarkDir(bool marked)
return 0;
}

void FolderForm::checkBookmark()
{
qDebug() << "FolderForm::checkBookmark()";

const QString& currentPath = getCurrentDirPath();

ui->bookmarkToolButton->blockSignals(true);
if(Settings::getInstance()->searchBookmarkDirPath(currentPath) >= 0)
{
ui->bookmarkToolButton->setChecked(true);
}
else
{
ui->bookmarkToolButton->setChecked(false);
}
ui->bookmarkToolButton->blockSignals(false);
}

void FolderForm::refresh(bool clearSelected/* = false */)
{
if(clearSelected)
@@ -69,6 +69,8 @@ class FolderForm : public QWidget
int onSelectDir();
int onBookmarkDir(bool marked);

void checkBookmark();

void refresh(bool clearSelected = false);

Q_SIGNALS:
@@ -372,17 +372,6 @@ void MainWindow::on_actionSelectFolder_triggered()
activeFolderForm->onSelectDir();
}

void MainWindow::on_actionSelectStorageBookmark_triggered()
{
qDebug() << "MainWindow::on_actionSelectStorageBookmark_triggered()";

DoubleFolderPanel* doubleFolderPanel = ui->mainWidget->findChild<DoubleFolderPanel*>("DoubleFolderPanel");
if(doubleFolderPanel != Q_NULLPTR)
{
doubleFolderPanel->onSelectStorageBookmark();
}
}

void MainWindow::on_actionQuit_triggered()
{
qDebug() << "MainWindow::on_actionQuit_triggered()";
@@ -500,6 +489,31 @@ void MainWindow::on_actionAttributes_triggered()
}
}

void MainWindow::on_actionBookmark_toggled(bool arg1)
{
qDebug() << "MainWindow::on_actionBookmark_toggled()";

DoubleFolderPanel* doubleFolderPanel = ui->mainWidget->findChild<DoubleFolderPanel*>("DoubleFolderPanel");
Q_ASSERT(doubleFolderPanel != Q_NULLPTR);

FolderForm* activeFolderForm = doubleFolderPanel->getActiveFolderForm();
Q_ASSERT(activeFolderForm != Q_NULLPTR);

activeFolderForm->onBookmarkDir(arg1);
activeFolderForm->checkBookmark();
}

void MainWindow::on_actionSelectStorageBookmark_triggered()
{
qDebug() << "MainWindow::on_actionSelectStorageBookmark_triggered()";

DoubleFolderPanel* doubleFolderPanel = ui->mainWidget->findChild<DoubleFolderPanel*>("DoubleFolderPanel");
if(doubleFolderPanel != Q_NULLPTR)
{
doubleFolderPanel->onSelectStorageBookmark();
}
}

void MainWindow::on_actionPreferences_triggered()
{
qDebug() << "MainWindow::on_actionPreferences_triggered()";
@@ -71,7 +71,6 @@ private Q_SLOTS:
void on_actionOpenWithTextEditor_triggered();
void on_actionCreateNewFile_triggered();
void on_actionSelectFolder_triggered();
void on_actionSelectStorageBookmark_triggered();
void on_actionQuit_triggered();
void on_actionSinglePane_triggered();
void on_actionDualPane_triggered();
@@ -83,6 +82,8 @@ private Q_SLOTS:
void on_actionMakeDirectory_triggered();
void on_actionRename_triggered();
void on_actionAttributes_triggered();
void on_actionBookmark_toggled(bool arg1);
void on_actionSelectStorageBookmark_triggered();
void on_actionPreferences_triggered();
void on_actionConsole_triggered(bool checked);
void on_consoleDockWidget_visibilityChanged(bool visible);
@@ -102,7 +102,6 @@
<addaction name="actionCreateNewFile"/>
<addaction name="separator"/>
<addaction name="actionSelectFolder"/>
<addaction name="actionSelectStorageBookmark"/>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
@@ -121,9 +120,18 @@
<addaction name="actionPreferences"/>
<addaction name="actionConsole"/>
</widget>
<widget class="QMenu" name="menuBookmark">
<property name="title">
<string>Bookmark</string>
</property>
<addaction name="actionBookmark"/>
<addaction name="actionSelectStorageBookmark"/>
<addaction name="actionEdit_Bookmark"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
<addaction name="menuOperation"/>
<addaction name="menuBookmark"/>
<addaction name="menuOption"/>
<addaction name="menuHelp"/>
</widget>
@@ -391,6 +399,25 @@
<string>O</string>
</property>
</action>
<action name="actionEdit_Bookmark">
<property name="text">
<string>Edit Bookmark...</string>
</property>
<property name="shortcut">
<string>Ctrl+L</string>
</property>
</action>
<action name="actionBookmark">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Bookmark</string>
</property>
<property name="shortcut">
<string>Ctrl+M</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>

0 comments on commit 2d72167

Please sign in to comment.
You can’t perform that action at this time.