Remember show toolbar option.

Closes #43
This commit is contained in:
Florian Geyer 2012-08-15 19:50:31 +02:00
parent 0bac9752ba
commit 6c695e3fd0
3 changed files with 10 additions and 0 deletions

View File

@ -91,6 +91,7 @@ void Config::init(const QString& fileName)
m_defaults.insert("ModifiedOnExpandedStateChanges", true);
m_defaults.insert("AutoSaveAfterEveryChange", false);
m_defaults.insert("AutoSaveOnExit", false);
m_defaults.insert("ShowToolbar", true);
m_defaults.insert("security/clearclipboard", true);
m_defaults.insert("security/clearclipboardtimeout", 10);
}

View File

@ -41,6 +41,9 @@ MainWindow::MainWindow()
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();
toggleViewAction->setText(tr("Show toolbar"));
m_ui->menuView->addAction(toggleViewAction);
bool showToolbar = config()->get("ShowToolbar").toBool();
m_ui->toolBar->setVisible(showToolbar);
connect(m_ui->toolBar, SIGNAL(visibilityChanged(bool)), this, SLOT(saveToolbarState(bool)));
m_clearHistoryAction = new QAction("Clear history", m_ui->menuFile);
m_lastDatabasesActions = new QActionGroup(m_ui->menuRecentDatabases);
@ -353,6 +356,11 @@ void MainWindow::showGroupContextMenu(const QPoint& globalPos)
m_ui->menuGroups->popup(globalPos);
}
void MainWindow::saveToolbarState(bool value)
{
config()->set("ShowToolbar", value);
}
void MainWindow::setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback)
{
if (!QKeySequence::keyBindings(standard).isEmpty()) {

View File

@ -55,6 +55,7 @@ private Q_SLOTS:
void updateLastDatabasesMenu();
void showEntryContextMenu(const QPoint& globalPos);
void showGroupContextMenu(const QPoint& globalPos);
void saveToolbarState(bool value);
private:
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);