[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdegraphics/kolourpaint
From: Clarence Dang <dang () kde ! org>
Date: 2007-05-12 8:42:26
Message-ID: 1178959346.032404.3745.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 663751 by dang:
"File / Open Recent" fixes:
1. Make "File / Open Recent" work consistently when multiple windows are open.
Works around KRecentFilesAction::setItems() not working by using loadConfig()
instead.
IMHO, as of r436207 2005-07-19 09:49:26 UTC, KRecentFilesAction::setItems() does
not work since only its superclass, KSelectAction, implements setItems()
and can't update KRecentFilesAction's d->m_urls map nor insert the square brackets
around the URLs in the submenu.
The bug can be triggered in KolourPaint:
File / Open Recent, followed by another File / Open Recent, results in
File / Open Recent not working in the new window.
It's a bit more difficult to reproduce before the recent kpMainWindow::open()
changes. However, some variant of the bug has been around ever since the
KRecentFilesAction commit (i.e. start of KDE 3.5).
2. Don't select a URL in the "Recent Files" submenu after opening it has failed.
M +3 -0 NEWS
M +0 -1 kpmainwindow.h
M +35 -11 kpmainwindow_file.cpp
--- branches/KDE/3.5/kdegraphics/kolourpaint/NEWS #663750:663751
@@ -12,6 +12,9 @@
* Add global session save/restore (Bug #94651)
+ * Make "File / Open Recent" consistently work when multiple windows are
+ open
+
KolourPaint 1.4.6_relight (Frozen 2007-01-13)
* Fix crash triggered by rapidly deselecting the selection after
--- branches/KDE/3.5/kdegraphics/kolourpaint/kpmainwindow.h #663750:663751
@@ -305,7 +305,6 @@
private:
void addRecentURL (const KURL &url);
- void setRecentURLs (const QStringList &items);
private slots:
void slotNew ();
--- branches/KDE/3.5/kdegraphics/kolourpaint/kpmainwindow_file.cpp #663750:663751
@@ -58,9 +58,13 @@
#include <kpview.h>
#include <kpviewmanager.h>
+
// private
void kpMainWindow::setupFileMenuActions ()
{
+#if DEBUG_KP_MAIN_WINDOW
+ kdDebug () << "kpMainWindow::setupFileMenuActions()" << endl;
+#endif
KActionCollection *ac = actionCollection ();
m_actionNew = KStdAction::openNew (this, SLOT (slotNew ()), ac);
@@ -68,6 +72,9 @@
m_actionOpenRecent = KStdAction::openRecent (this, SLOT (slotOpenRecent (const KURL &)), ac);
m_actionOpenRecent->loadEntries (kapp->config ());
+#if DEBUG_KP_MAIN_WINDOW
+ kdDebug () << "\trecent URLs=" << m_actionOpenRecent->items () << endl;
+#endif
m_actionSave = KStdAction::save (this, SLOT (slotSave ()), ac);
m_actionSaveAs = KStdAction::saveAs (this, SLOT (slotSaveAs ()), ac);
@@ -182,22 +189,26 @@
#endif
if (mw != this)
- mw->setRecentURLs (m_actionOpenRecent->items ());
+ {
+ // WARNING: Do not use KRecentFilesAction::setItems()
+ // - it does not work since only its superclass,
+ // KSelectAction, implements setItems() and can't
+ // update KRecentFilesAction's URL list.
+
+ // Avoid URL memory leak in KRecentFilesAction::loadEntries().
+ mw->m_actionOpenRecent->clearURLList ();
+
+ mw->m_actionOpenRecent->loadEntries (cfg);
+ #if DEBUG_KP_MAIN_WINDOW
+ kdDebug () << "\t\t\tcheck recent URLs="
+ << mw->m_actionOpenRecent->items () << endl;
+ #endif
+ }
}
}
}
-// private
-void kpMainWindow::setRecentURLs (const QStringList &items)
-{
-#if DEBUG_KP_MAIN_WINDOW
- kdDebug () << "kpMainWindow(" << name () << ")::setRecentURLs()" << endl;
- kdDebug () << "\titems=" << items << endl;
-#endif
- m_actionOpenRecent->setItems (items);
-}
-
// private slot
void kpMainWindow::slotNew ()
{
@@ -374,12 +385,25 @@
{
#if DEBUG_KP_MAIN_WINDOW
kdDebug () << "kpMainWindow::slotOpenRecent(" << url << ")" << endl;
+ kdDebug () << "\titems=" << m_actionOpenRecent->items () << endl;
#endif
if (toolHasBegunShape ())
tool ()->endShapeInternal ();
open (url);
+
+ // If the open is successful, addRecentURL() would have bubbled up the
+ // URL in the File / Open Recent action. As a side effect, the URL is
+ // deselected.
+ //
+ // If the open fails, we should deselect the URL:
+ //
+ // 1. for consistency
+ //
+ // 2. because it has not been opened.
+ //
+ m_actionOpenRecent->setCurrentItem (-1);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic