summaryrefslogtreecommitdiff
path: root/src/newtabpage.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-12-16 22:31:48 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-12-16 22:31:48 +0100
commit799758c588d50cb36155da04e825d5b6578156c7 (patch)
treed86fa20a99649709500f7b8d6a7b6deb7ba0ef50 /src/newtabpage.cpp
parentDo NOT search for (probably) non extant favicons (diff)
downloadrekonq-799758c588d50cb36155da04e825d5b6578156c7.tar.xz
Downloads page improvement
Tag a file as removed when it has been removed :)
Diffstat (limited to 'src/newtabpage.cpp')
-rw-r--r--src/newtabpage.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp
index f8d8976d..529a9804 100644
--- a/src/newtabpage.cpp
+++ b/src/newtabpage.cpp
@@ -606,7 +606,7 @@ void NewTabPage::downloadsPage()
KUrl u = KUrl(item->destinationUrl());
QString fName = u.fileName();
QString dir = QL1S("file://") + u.directory();
- QString file = dir + QL1C('/') + fName;
+ QString file = dir + fName;
KIconLoader *loader = KIconLoader::global();
QString iconPath = QL1S("file://") + loader->iconPath(KMimeType::iconNameForUrl(u), KIconLoader::Desktop);
@@ -623,14 +623,21 @@ void NewTabPage::downloadsPage()
div.appendInside(QL1S("<a href=") + item->originUrl() + QL1C('>') + item->originUrl() + QL1S("</a>"));
div.appendInside(QL1S("<br />"));
- div.appendInside(markup(QL1S("a")));
- div.lastChild().setAttribute(QL1S("href"), dir);
- div.lastChild().setPlainText(i18n("Open directory"));
-
- div.appendInside(QL1S(" - "));
- div.appendInside(markup(QL1S("a")));
- div.lastChild().setAttribute(QL1S("href"), file);
- div.lastChild().setPlainText(i18n("Open file"));
+ if (QFile::exists(file))
+ {
+ div.appendInside(markup(QL1S("a")));
+ div.lastChild().setAttribute(QL1S("href"), dir);
+ div.lastChild().setPlainText(i18n("Open directory"));
+
+ div.appendInside(QL1S(" - "));
+ div.appendInside(markup(QL1S("a")));
+ div.lastChild().setAttribute(QL1S("href"), file);
+ div.lastChild().setPlainText(i18n("Open file"));
+ }
+ else
+ {
+ div.appendInside(QL1S("<em>") + QL1S("Removed") + QL1S("</em>"));
+ }
}
}