diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-11-08 10:17:36 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-11-08 10:17:36 +0100 |
commit | 7187da9812bbe6ffb5bf272f18f8e74c8d23d3c7 (patch) | |
tree | 210924711005452a622383dcfadb20c5c4cfb364 /src/application.cpp | |
parent | Let rekonq save file remotely (diff) | |
download | rekonq-7187da9812bbe6ffb5bf272f18f8e74c8d23d3c7.tar.xz |
Application Shortcut
Added an action to manage it in the tools menu,
added initial code to manage icons,
added kwebapp application
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/application.cpp b/src/application.cpp index df99b785..ea0a65e6 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -764,3 +764,35 @@ void Application::queryQuit() // in case of just one window... quit(); } + + +void Application::createWebAppShortcut() +{ + KUrl u = mainWindow()->currentTab()->url(); + QString h = u.host(); + + QString desktop = KGlobalSettings::desktopPath(); + QFile wAppFile(desktop + QL1C('/') + h + QL1S(".desktop")); + + if (!wAppFile.open(QIODevice::WriteOnly | QIODevice::Text)) + { + kDebug() << "oops! " << wAppFile.errorString(); + return; + } + + iconManager()->saveDesktopIconForUrl(u); + + QString iconPath = KStandardDirs::locateLocal("cache" , "favicons/" , true) + h + QL1S("_WEBAPPICON.png"); + + QTextStream out(&wAppFile); + out.setCodec("UTF-8"); + + out << QL1S("[Desktop Entry]\n"); + out << QL1S("name=kwebapp\n"); + out << QL1S("Icon=") << iconPath << QL1S("\n"); + out << QL1S("Exec=kwebapp ") << u.url() << QL1S("\n"); + out << QL1S("Type=Application\n"); + out << QL1S("Categories=Application;\n"); + + wAppFile.close(); +} |