[rkward-cvs] [rkward] rkward/settings: Remove some cruft
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Dec 1 09:58:03 UTC 2014
Git commit d80d24441ba04cfb45d0f88ae43372a194caabba by Thomas Friedrichsmeier.
Committed on 01/12/2014 at 09:14.
Pushed by tfry into branch 'master'.
Remove some cruft
M +1 -70 rkward/settings/rksettingsmoduleplugins.cpp
M +2 -5 rkward/settings/rksettingsmoduleplugins.h
http://commits.kde.org/rkward/d80d24441ba04cfb45d0f88ae43372a194caabba
diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp
index 275da1f..98b5272 100644
--- a/rkward/settings/rksettingsmoduleplugins.cpp
+++ b/rkward/settings/rksettingsmoduleplugins.cpp
@@ -2,7 +2,7 @@
rksettingsmoduleplugins - description
-------------------
begin : Wed Jul 28 2004
- copyright : (C) 2004-2013 by Thomas Friedrichsmeier
+ copyright : (C) 2004-2014 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -372,75 +372,6 @@ void RKSettingsModulePlugins::fixPluginMapLists () {
}
}
-void RKSettingsModulePlugins::installPluginPack (const QString &archive_file) {
- RK_TRACE (SETTINGS);
-
- QString basename = baseNameOfPluginPack (archive_file);
- if (basename.isEmpty ()) return;
-
- // remove any old versions of the same plugin. Unfortunately, KNewStuff does not clean up when installing updates.
- QFileInfo archive_file_info (archive_file);
- QFileInfo base_file_info (basename);
- QDir base_dir = base_file_info.absoluteDir ();
- QString base_filename = base_file_info.fileName ();
- QStringList old_versions = base_dir.entryList (QDir::Files).filter (QRegExp ("^" + base_filename + "(-.*)?\\.(tar\\.gz|\\zip)$"));
- foreach (const QString old_version, old_versions) {
- if (old_version != archive_file_info.fileName ()) QFile::remove (base_dir.absoluteFilePath (old_version));
- }
- // finally, remove the previous unpacked installation, if any, to make sure we have a clean install
- if (QDir().exists (basename)) KIO::del (KUrl::fromLocalFile (basename))->exec ();
-
- KArchive* archive;
- if (archive_file.endsWith (".zip", Qt::CaseInsensitive)) {
- archive = new KZip (archive_file);
- } else {
- archive = new KTar (archive_file);
- }
- if (!archive->open (QIODevice::ReadOnly)) {
- // TODO: show error message
- RK_ASSERT (false);
- return;
- }
- archive->directory ()->copyTo (basename, true);
- delete (archive);
-
- QStringList installed_maps = findPluginMapsRecursive (basename);
- registerPluginMaps (installed_maps, false, false);
-}
-
-void RKSettingsModulePlugins::uninstallPluginPack (const QString &archive_file) {
- RK_TRACE (SETTINGS);
-
- QString basename = baseNameOfPluginPack (archive_file);
- if (basename.isEmpty ()) return;
-
- // Well, calling exec is ugly, but so much simpler than handling this asynchronously...
- KIO::del (KUrl::fromLocalFile (basename))->exec ();
-}
-
-QString RKSettingsModulePlugins::baseNameOfPluginPack (const QString &archive_file) {
- RK_TRACE (SETTINGS);
-
- QFileInfo file_info (archive_file);
- QDir dir = file_info.absoluteDir ();
- QString name = file_info.fileName ();
-
- // strip file-type ending
- if (name.endsWith (".tar.gz", Qt::CaseInsensitive)) {
- name = name.left (name.length () - 7);
- } else if (name.endsWith (".zip", Qt::CaseInsensitive)) {
- name = name.left (name.length () - 4);
- } else {
- return QString ();
- }
-
- // strip version (if any)
- int where = name.indexOf ("-", 1); // must have at least one char of name before version string
- if (where > 0) name = name.left (where);
-
- return dir.absoluteFilePath (name);
-}
-
QStringList RKSettingsModulePlugins::findPluginMapsRecursive (const QString &basedir) {
RK_TRACE (SETTINGS);
diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h
index 994ae71..a22d23e 100644
--- a/rkward/settings/rksettingsmoduleplugins.h
+++ b/rkward/settings/rksettingsmoduleplugins.h
@@ -2,7 +2,7 @@
rksettingsmoduleplugins - description
-------------------
begin : Wed Jul 28 2004
- copyright : (C) 2004-2013 by Thomas Friedrichsmeier
+ copyright : (C) 2004-2014 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -98,10 +98,7 @@ private:
static bool show_code;
static int code_size;
-/* TODO: These are currently unused (leftovers of GHNS-based plugin installation), but might still be of interest */
- static void installPluginPack (const QString &archive_file);
- static void uninstallPluginPack (const QString &archive_file);
- static QString baseNameOfPluginPack (const QString &archive_file);
+/* TODO: This one is currently unused (leftover of GHNS-based plugin installation), but might still be of interest */
static QStringList findPluginMapsRecursive (const QString &basedir);
static void fixPluginMapLists ();
};
More information about the rkward-tracker
mailing list