summaryrefslogtreecommitdiffstats
path: root/kicker/menuext/recentdocs
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-11 20:21:27 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-12-11 20:21:27 +0000
commit10e41144596fc9ced40fc349d9ecd099b1c2ea19 (patch)
tree88ab04e475ff5a4cd889cb082f5760b6e0bf5e4e /kicker/menuext/recentdocs
parent4aed2c8219774f5d797760606b8489a92ddc5163 (diff)
downloadtdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.tar.gz
tdebase-10e41144596fc9ced40fc349d9ecd099b1c2ea19.zip
Initial import of Trinity 3.5.11 to kdebase
Extends krandrtray, adds iccconfig kcontrol module, adds run dialog autocomplete and lots of bugfixes Will need to check for commit warnings and repair as encountered Also needs full compile test git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1061475 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kicker/menuext/recentdocs')
-rw-r--r--kicker/menuext/recentdocs/recentdocsmenu.cpp34
1 files changed, 24 insertions, 10 deletions
diff --git a/kicker/menuext/recentdocs/recentdocsmenu.cpp b/kicker/menuext/recentdocs/recentdocsmenu.cpp
index 98357fe52..06c84d7a6 100644
--- a/kicker/menuext/recentdocs/recentdocsmenu.cpp
+++ b/kicker/menuext/recentdocs/recentdocsmenu.cpp
@@ -22,6 +22,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
******************************************************************/
#include <qdragobject.h>
+#include <qstring.h>
+#include <qstringlist.h>
#include <kglobal.h>
#include <kiconloader.h>
@@ -50,8 +52,7 @@ RecentDocsMenu::~RecentDocsMenu()
void RecentDocsMenu::initialize() {
if (initialized()) clear();
- insertItem(SmallIconSet("history_clear"), i18n("Clear History"),
- this, SLOT(slotClearHistory()));
+ insertItem(SmallIconSet("history_clear"), i18n("Clear History"), this, SLOT(slotClearHistory()));
insertSeparator();
_fileList = KRecentDocument::recentDocuments();
@@ -60,17 +61,30 @@ void RecentDocsMenu::initialize() {
insertItem(i18n("No Entries"), 0);
setItemEnabled(0, false);
return;
- }
+ }
int id = 0;
-
- for (QStringList::ConstIterator it = _fileList.begin();
- it != _fileList.end();
- ++it)
- {
+ char alreadyPresentInMenu;
+ QStringList previousEntries;
+ for (QStringList::ConstIterator it = _fileList.begin(); it != _fileList.end(); ++it) {
KDesktopFile f(*it, true /* read only */);
- insertItem(SmallIconSet(f.readIcon()), f.readName().replace('&', QString::fromAscii("&&") ), id++);
- }
+
+ // Make sure this entry is not already present in the menu
+ alreadyPresentInMenu = 0;
+ for ( QStringList::Iterator previt = previousEntries.begin(); previt != previousEntries.end(); ++previt ) {
+ if (QString::localeAwareCompare(*previt, f.readName().replace('&', QString::fromAscii("&&") )) == 0) {
+ alreadyPresentInMenu = 1;
+ }
+ }
+
+ if (alreadyPresentInMenu == 0) {
+ // Add item to menu
+ insertItem(SmallIconSet(f.readIcon()), f.readName().replace('&', QString::fromAscii("&&") ), id++);
+
+ // Append to duplicate checking list
+ previousEntries.append(f.readName().replace('&', QString::fromAscii("&&") ));
+ }
+ }
setInitialized(true);
}