mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kfile: cleanup KRecentDocument
the QString overload for KRecentDocument::add() should not be needed since https://github.com/fluxer/kdelibs/commit/d1c90f17 Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
c8accd2472
commit
4757091016
2 changed files with 21 additions and 44 deletions
|
@ -62,16 +62,14 @@ QStringList KRecentDocument::recentDocuments()
|
|||
const QStringList list = d.entryList();
|
||||
QStringList fullList;
|
||||
|
||||
for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
||||
QString fileName = *it ;
|
||||
foreach (const QString it, list) {
|
||||
QString pathDesktop;
|
||||
if (fileName.startsWith(":")) {
|
||||
if (it.startsWith(":")) {
|
||||
// FIXME: Remove when Qt will be fixed
|
||||
// http://bugreports.qt.nokia.com/browse/QTBUG-11223
|
||||
pathDesktop = KRecentDocument::recentDocumentDirectory() + *it ;
|
||||
}
|
||||
else {
|
||||
pathDesktop = d.absoluteFilePath( *it );
|
||||
pathDesktop = KRecentDocument::recentDocumentDirectory() + it;
|
||||
} else {
|
||||
pathDesktop = d.absoluteFilePath( it );
|
||||
}
|
||||
KDesktopFile tmpDesktopFile( pathDesktop );
|
||||
KUrl urlDesktopFile(tmpDesktopFile.desktopGroup().readPathEntry("URL", QString()));
|
||||
|
@ -154,23 +152,13 @@ void KRecentDocument::add(const KUrl& url, const QString& desktopEntryName)
|
|||
conf.writeEntry( "Icon", KMimeType::iconNameForUrl( url ) );
|
||||
}
|
||||
|
||||
void KRecentDocument::add(const QString &openStr, bool isUrl)
|
||||
{
|
||||
if( isUrl ) {
|
||||
add( KUrl( openStr ) );
|
||||
} else {
|
||||
KUrl url;
|
||||
url.setPath( openStr );
|
||||
add( url );
|
||||
}
|
||||
}
|
||||
|
||||
void KRecentDocument::clear()
|
||||
{
|
||||
const QStringList list = recentDocuments();
|
||||
QDir dir;
|
||||
for(QStringList::ConstIterator it = list.begin(); it != list.end() ; ++it)
|
||||
dir.remove(*it);
|
||||
foreach(const QString it, list) {
|
||||
dir.remove(it);
|
||||
}
|
||||
}
|
||||
|
||||
int KRecentDocument::maximumItems()
|
||||
|
@ -178,5 +166,3 @@ int KRecentDocument::maximumItems()
|
|||
KConfigGroup cg(KGlobal::config(), QLatin1String("RecentDocuments"));
|
||||
return cg.readEntry(QLatin1String("MaxEntries"), 10);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -79,15 +79,6 @@ public:
|
|||
*/
|
||||
static void add(const KUrl& url, const QString& desktopEntryName);
|
||||
|
||||
/**
|
||||
*
|
||||
* Add a new item to the Recent Document menu. Calls add( url ).
|
||||
*
|
||||
* @param documentStr The full path to the document or URL to add.
|
||||
* @param isURL Set to @p true if @p documentStr is an URL and not a local file path.
|
||||
*/
|
||||
static void add(const QString &documentStr, bool isURL = false);
|
||||
|
||||
/**
|
||||
* Clear the recent document menu of all entries.
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue