Commit c0c5d003 authored by Elvis Angelaccio's avatar Elvis Angelaccio

mainwindow: use setupGUI()

This allow use to drop quite a lot of old, buggy and redundant code that is already
provided by setupGUI() for free.

We also gain the standard "Show Toolbar" checkbox in the Settings menu.

BUG: 357660
FIXED-IN: 16.08.0

Differential Revision: D1829
parent 8bbb3628
......@@ -63,14 +63,7 @@ static bool isValidArchiveDrag(const QMimeData *data)
MainWindow::MainWindow(QWidget *)
: KParts::MainWindow()
{
setXMLFile(QStringLiteral("arkui.rc"));
setupActions();
resize(640, 480);
setAutoSaveSettings(QStringLiteral("MainWindow"));
setAcceptDrops(true);
}
......@@ -153,7 +146,10 @@ bool MainWindow::loadPart()
m_part->setObjectName(QStringLiteral("ArkPart"));
setCentralWidget(m_part->widget());
setupGUI(ToolBar | Keys | Save | Create, QStringLiteral("arkui.rc"));
createGUI(m_part);
statusBar()->hide();
connect(m_part, SIGNAL(busy()), this, SLOT(updateActions()));
......@@ -180,8 +176,6 @@ void MainWindow::setupActions()
connect(m_recentFilesAction, SIGNAL(triggered()),
this, SLOT(openArchive()));
KStandardAction::configureToolbars(this, SLOT(editToolbars()), actionCollection());
KStandardAction::keyBindings(this, SLOT(editKeyBindings()), actionCollection());
KStandardAction::preferences(this, SLOT(showSettings()), actionCollection());
}
......@@ -193,30 +187,6 @@ void MainWindow::updateActions()
m_recentFilesAction->setEnabled(!iface->isBusy());
}
void MainWindow::editKeyBindings()
{
KShortcutsDialog dlg(KShortcutsEditor::AllActions, KShortcutsEditor::LetterShortcutsAllowed, this);
dlg.addCollection(actionCollection());
dlg.addCollection(m_part->actionCollection());
dlg.configure();
}
void MainWindow::editToolbars()
{
KConfigGroup cfg(KSharedConfig::openConfig(), "MainWindow");
saveMainWindowSettings(cfg);
QPointer<KEditToolBar> dlg = new KEditToolBar(factory(), this);
dlg.data()->exec();
createGUI(m_part);
applyMainWindowSettings(KSharedConfig::openConfig()->group(QStringLiteral("MainWindow")));
delete dlg.data();
}
void MainWindow::openArchive()
{
Interface *iface = qobject_cast<Interface*>(m_part);
......
......@@ -55,9 +55,6 @@ private slots:
void showSettings();
void writeSettings();
void editKeyBindings();
void editToolbars();
private:
void setupActions();
......
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