Commit 4a256e9b authored by David Faure's avatar David Faure

Fix deprecation warnings, and a TODO now that we're not using a protected method anymore

parent b90b0b03
...@@ -2643,7 +2643,7 @@ void KonqMainWindow::slotCopyFiles() ...@@ -2643,7 +2643,7 @@ void KonqMainWindow::slotCopyFiles()
KIO::CopyJob *job = KIO::copy(currentURLs(), dest); KIO::CopyJob *job = KIO::copy(currentURLs(), dest);
KIO::FileUndoManager::self()->recordCopyJob(job); KIO::FileUndoManager::self()->recordCopyJob(job);
KJobWidgets::setWindow(job, this); KJobWidgets::setWindow(job, this);
job->ui()->setAutoErrorHandlingEnabled(true); job->uiDelegate()->setAutoErrorHandlingEnabled(true);
} }
void KonqMainWindow::slotMoveFiles() void KonqMainWindow::slotMoveFiles()
...@@ -2656,7 +2656,7 @@ void KonqMainWindow::slotMoveFiles() ...@@ -2656,7 +2656,7 @@ void KonqMainWindow::slotMoveFiles()
KIO::CopyJob *job = KIO::move(currentURLs(), dest); KIO::CopyJob *job = KIO::move(currentURLs(), dest);
KIO::FileUndoManager::self()->recordCopyJob(job); KIO::FileUndoManager::self()->recordCopyJob(job);
KJobWidgets::setWindow(job, this); KJobWidgets::setWindow(job, this);
job->ui()->setAutoErrorHandlingEnabled(true); job->uiDelegate()->setAutoErrorHandlingEnabled(true);
} }
QList<QUrl> KonqMainWindow::currentURLs() const QList<QUrl> KonqMainWindow::currentURLs() const
...@@ -4922,6 +4922,8 @@ void KonqMainWindow::closeEvent(QCloseEvent *e) ...@@ -4922,6 +4922,8 @@ void KonqMainWindow::closeEvent(QCloseEvent *e)
case KMessageBox::Cancel : case KMessageBox::Cancel :
e->ignore(); e->ignore();
return; return;
default:
Q_UNREACHABLE();
} }
} }
} }
...@@ -5511,16 +5513,6 @@ bool KonqMainWindow::accept(KonqFrameVisitor *visitor) ...@@ -5511,16 +5513,6 @@ bool KonqMainWindow::accept(KonqFrameVisitor *visitor)
&& visitor->endVisit(this); && visitor->endVisit(this);
} }
void KonqMainWindow::applyWindowSizeFromProfile(const KConfigGroup &profileGroup)
{
// KMainWindow::restoreWindowSize is protected so this logic can't move to KonqViewManager
const QSize size = KonqViewManager::readDefaultSize(profileGroup, this); // example: "Width=80%"
if (size.isValid()) {
resize(size);
}
restoreWindowSize(profileGroup); // example: "Width 1400=1120"
}
QLineEdit *KonqMainWindow::comboEdit() QLineEdit *KonqMainWindow::comboEdit()
{ {
return m_combo ? m_combo->lineEdit() : 0; return m_combo ? m_combo->lineEdit() : 0;
......
...@@ -305,7 +305,6 @@ public: ...@@ -305,7 +305,6 @@ public:
// Not used by konqueror itself; only exists for the Q_PROPERTY, // Not used by konqueror itself; only exists for the Q_PROPERTY,
// which I guess is used by scripts and plugins... // which I guess is used by scripts and plugins...
QString currentURL() const; QString currentURL() const;
void applyWindowSizeFromProfile(const KConfigGroup &profileGroup);
void updateHistoryActions(); void updateHistoryActions();
......
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QStandardPaths> #include <QStandardPaths>
#include <KSharedConfig> #include <KSharedConfig>
#include <KWindowConfig>
//#define DEBUG_VIEWMGR //#define DEBUG_VIEWMGR
...@@ -958,7 +959,7 @@ void KonqViewManager::loadViewConfigFromGroup(const KConfigGroup &profileGroup, ...@@ -958,7 +959,7 @@ void KonqViewManager::loadViewConfigFromGroup(const KConfigGroup &profileGroup,
} else { } else {
// Full screen off // Full screen off
m_pMainWindow->setWindowState(m_pMainWindow->windowState() & ~Qt::WindowFullScreen); m_pMainWindow->setWindowState(m_pMainWindow->windowState() & ~Qt::WindowFullScreen);
m_pMainWindow->applyWindowSizeFromProfile(profileGroup); applyWindowSize(profileGroup);
} }
} }
...@@ -1034,7 +1035,8 @@ void KonqViewManager::emitActivePartChanged() ...@@ -1034,7 +1035,8 @@ void KonqViewManager::emitActivePartChanged()
m_pMainWindow->slotPartActivated(activePart()); m_pMainWindow->slotPartActivated(activePart());
} }
QSize KonqViewManager::readDefaultSize(const KConfigGroup &cfg, QWidget *widget) // Read default size from profile (e.g. Width=80%)
static QSize readDefaultSize(const KConfigGroup &cfg, QWidget *widget)
{ {
QString widthStr = cfg.readEntry("Width"); QString widthStr = cfg.readEntry("Width");
QString heightStr = cfg.readEntry("Height"); QString heightStr = cfg.readEntry("Height");
...@@ -1072,6 +1074,15 @@ QSize KonqViewManager::readDefaultSize(const KConfigGroup &cfg, QWidget *widget) ...@@ -1072,6 +1074,15 @@ QSize KonqViewManager::readDefaultSize(const KConfigGroup &cfg, QWidget *widget)
return QSize(width, height); return QSize(width, height);
} }
void KonqViewManager::applyWindowSize(const KConfigGroup &profileGroup)
{
const QSize size = readDefaultSize(profileGroup, m_pMainWindow); // example: "Width=80%"
if (size.isValid()) {
m_pMainWindow->resize(size);
}
KWindowConfig::restoreWindowSize(m_pMainWindow->windowHandle(), profileGroup); // example: "Width 1400=1120"
}
void KonqViewManager::loadRootItem(const KConfigGroup &cfg, KonqFrameContainerBase *parent, void KonqViewManager::loadRootItem(const KConfigGroup &cfg, KonqFrameContainerBase *parent,
const QUrl &defaultURL, bool openUrl, const QUrl &defaultURL, bool openUrl,
const QUrl &forcedUrl, const QString &forcedService, const QUrl &forcedUrl, const QString &forcedService,
......
...@@ -243,10 +243,7 @@ public: ...@@ -243,10 +243,7 @@ public:
void doSetActivePart(KParts::ReadOnlyPart *part); void doSetActivePart(KParts::ReadOnlyPart *part);
/** void applyWindowSize(const KConfigGroup &profileGroup);
* Read default size from profile (e.g. Width=80%)
*/
static QSize readDefaultSize(const KConfigGroup &cfg, QWidget *window);
#ifndef NDEBUG #ifndef NDEBUG
void printFullHierarchy(); void printFullHierarchy();
......
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