diff --git a/src/frame/framemanager.h b/src/frame/framemanager.h --- a/src/frame/framemanager.h +++ b/src/frame/framemanager.h @@ -106,7 +106,7 @@ void slotSetStatusText(Akregator::Frame *frame, const QString &statusText); private: QPointer m_currentFrame; - QHash m_frames; + QHash> m_frames; }; } // namespace Akregator diff --git a/src/frame/framemanager.cpp b/src/frame/framemanager.cpp --- a/src/frame/framemanager.cpp +++ b/src/frame/framemanager.cpp @@ -277,8 +277,8 @@ { //write children QStringList strlst; - QHash::const_iterator i; - QHash::const_iterator end(m_frames.constEnd()); + QHash>::const_iterator i; + QHash>::const_iterator end(m_frames.constEnd()); for (i = m_frames.constBegin(); i != end; ++i) { // No need to save the main frame Frame *currentFrame = i.value(); diff --git a/src/main.cpp b/src/main.cpp --- a/src/main.cpp +++ b/src/main.cpp @@ -113,14 +113,11 @@ // see if we are starting with session management if (app.isSessionRestored()) { -#undef RESTORE -#define RESTORE(type) { int n = 1; \ - while (KMainWindow::canBeRestored(n)) { \ - (new type)->restore(n, false); \ - n++;} \ -} - - RESTORE(Akregator::MainWindow); + auto mainWindow = new Akregator::MainWindow(); + mainWindow->loadPart(); + if (KMainWindow::canBeRestored(1)) { + mainWindow->restore(1, false); + } } return app.exec(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -115,6 +115,7 @@ m_part->setObjectName(QStringLiteral("akregator_part")); setCentralWidget(m_part->widget()); + m_part->setAutoDeletePart(false); connect(m_part, SIGNAL(setWindowCaption(QString)), this, SLOT(setCaption(QString))); @@ -136,10 +137,8 @@ void MainWindow::saveProperties(KConfigGroup &config) { - if (!m_part) { - if (!loadPart()) { - return; - } + if (!loadPart()) { + return; } m_part->saveProperties(config); @@ -148,11 +147,10 @@ void MainWindow::readProperties(const KConfigGroup &config) { - if (!m_part) { - if (!loadPart()) { - return; - } + if (!loadPart()) { + return; } + m_part->readProperties(config); setVisible(!Settings::showTrayIcon() || !config.readEntry("docked", false)); }