mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kparts: query the part to close from KParts::MainWindow
because KParts::ReadWritePart::closeUrl() is not called from the KParts::ReadWritePart destructor (and even if it is bad stuff may happen) for most rw parts (exception being okular which does its own query, maybe some other parts too) saving was not actually done (e.g. for ark). now the part will be queried to close, if the upload job fails (e.g. because of insufficient access) the application/part will not close (intentionally) tho and no error is reported via message box which is something that needs to be looked into Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8c8855d9a6
commit
71704a410d
3 changed files with 13 additions and 1 deletions
|
@ -159,6 +159,17 @@ void MainWindow::createShellGUI(bool create)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::queryClose()
|
||||||
|
{
|
||||||
|
// query part first
|
||||||
|
ReadWritePart* rwpart = qobject_cast<ReadWritePart*>(d->m_activePart);
|
||||||
|
if (rwpart && !rwpart->queryClose()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// then KXmlGuiWindow
|
||||||
|
return KXmlGuiWindow::queryClose();
|
||||||
|
}
|
||||||
|
|
||||||
void KParts::MainWindow::saveNewToolbarConfig()
|
void KParts::MainWindow::saveNewToolbarConfig()
|
||||||
{
|
{
|
||||||
createGUI(d->m_activePart);
|
createGUI(d->m_activePart);
|
||||||
|
|
|
@ -80,6 +80,7 @@ protected Q_SLOTS:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void createShellGUI(bool create = true);
|
virtual void createShellGUI(bool create = true);
|
||||||
|
virtual bool queryClose();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindowPrivate* const d;
|
MainWindowPrivate* const d;
|
||||||
|
|
|
@ -662,7 +662,7 @@ bool ReadWritePart::queryClose()
|
||||||
|
|
||||||
switch(res) {
|
switch(res) {
|
||||||
case KMessageBox::Yes: {
|
case KMessageBox::Yes: {
|
||||||
sigQueryClose(&handled,&abortClose);
|
sigQueryClose(&handled, &abortClose);
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
if (d->m_url.isEmpty()) {
|
if (d->m_url.isEmpty()) {
|
||||||
KUrl url = KFileDialog::getSaveUrl(KUrl(), QString(), parentWidget);
|
KUrl url = KFileDialog::getSaveUrl(KUrl(), QString(), parentWidget);
|
||||||
|
|
Loading…
Add table
Reference in a new issue