From 10e41144596fc9ced40fc349d9ecd099b1c2ea19 Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 11 Dec 2009 20:21:27 +0000 Subject: 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 --- kicker/menuext/recentdocs/recentdocsmenu.cpp | 34 ++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'kicker/menuext') 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 +#include +#include #include #include @@ -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); } -- cgit v1.2.3