0.7 changes
authorHeikki Holstila <heikki.holstila@gmail.com>
Mon, 3 Jan 2011 16:50:26 +0000 (18:50 +0200)
committerHeikki Holstila <heikki.holstila@gmail.com>
Mon, 3 Jan 2011 16:50:26 +0000 (18:50 +0200)
21 files changed:
Makefile
TODO.txt
aaptinterface.cpp
aaptinterface.h
debian/changelog
fapman.pro
icons/commit.png
icons/fapman.png
icons/filter_cat.png
icons/filter_stat.png
icons/sort.png
installfile.cpp [new file with mode: 0644]
installfile.h [new file with mode: 0644]
mainwindow.cpp
mainwindow.ui
packageselector.cpp
packageselector.ui
packageview.cpp
packageview.h
repository.cpp
repository.h

index da40232..c31abee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: fapman
-# Generated by qmake (2.01a) (Qt 4.7.0) on: Thu Nov 25 19:13:35 2010
+# Generated by qmake (2.01a) (Qt 4.7.0) on: Mon Jan 3 18:43:44 2011
 # Project:  fapman.pro
 # Template: app
 # Command: /opt/NokiaQtSDK/Maemo/4.6.2/targets/fremantle-pr13/bin/qmake -spec /opt/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/share/qt4/mkspecs/linux-g++-maemo5 -o Makefile fapman.pro
@@ -64,7 +64,8 @@ SOURCES       = main.cpp \
                blacklistselect.cpp \
                rotatingbackground.cpp \
                searchoptions.cpp \
-               dpkginterface.cpp moc_mainwindow.cpp \
+               dpkginterface.cpp \
+               installfile.cpp moc_mainwindow.cpp \
                moc_packageview.cpp \
                moc_filterselect.cpp \
                moc_confirmdialog.cpp \
@@ -104,6 +105,7 @@ OBJECTS       = main.o \
                rotatingbackground.o \
                searchoptions.o \
                dpkginterface.o \
+               installfile.o \
                moc_mainwindow.o \
                moc_packageview.o \
                moc_filterselect.o \
@@ -237,7 +239,7 @@ qmake:  FORCE
 
 dist: 
        @$(CHK_DIR_EXISTS) .tmp/fapman1.0.0 || $(MKDIR) .tmp/fapman1.0.0 
-       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/fapman1.0.0/ && $(COPY_FILE) --parents mainwindow.h package.h packageview.h filterselect.h confirmdialog.h dimmer.h repoview.h packageselector.h help.h settings.h aaptinterface.h repository.h repoedit.h logview.h apt-src/version.h apt-src/strutl.h apt-src/pkgcache.h apt-src/mmap.h apt-src/debversion.h apt-src/fileutl.h apt-src/cacheiterators.h sortselector.h blacklistselect.h rotatingbackground.h searchoptions.h dpkginterface.h .tmp/fapman1.0.0/ && $(COPY_FILE) --parents resources.qrc .tmp/fapman1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp package.cpp packageview.cpp filterselect.cpp confirmdialog.cpp dimmer.cpp repoview.cpp packageselector.cpp help.cpp settings.cpp aaptinterface.cpp repository.cpp repoedit.cpp logview.cpp apt-src/debversion.cc apt-src/version.cc sortselector.cpp blacklistselect.cpp rotatingbackground.cpp searchoptions.cpp dpkginterface.cpp .tmp/fapman1.0.0/ && $(COPY_FILE) --parents mainwindow.ui packageview.ui filterselect.ui confirmdialog.ui repoview.ui packageselector.ui help.ui settings.ui repoedit.ui logview.ui sortselector.ui blacklistselect.ui searchoptions.ui .tmp/fapman1.0.0/ && (cd `dirname .tmp/fapman1.0.0` && $(TAR) fapman1.0.0.tar fapman1.0.0 && $(COMPRESS) fapman1.0.0.tar) && $(MOVE) `dirname .tmp/fapman1.0.0`/fapman1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/fapman1.0.0
+       $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/fapman1.0.0/ && $(COPY_FILE) --parents mainwindow.h package.h packageview.h filterselect.h confirmdialog.h dimmer.h repoview.h packageselector.h help.h settings.h aaptinterface.h repository.h repoedit.h logview.h apt-src/version.h apt-src/strutl.h apt-src/pkgcache.h apt-src/mmap.h apt-src/debversion.h apt-src/fileutl.h apt-src/cacheiterators.h sortselector.h blacklistselect.h rotatingbackground.h searchoptions.h dpkginterface.h installfile.h .tmp/fapman1.0.0/ && $(COPY_FILE) --parents resources.qrc .tmp/fapman1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp package.cpp packageview.cpp filterselect.cpp confirmdialog.cpp dimmer.cpp repoview.cpp packageselector.cpp help.cpp settings.cpp aaptinterface.cpp repository.cpp repoedit.cpp logview.cpp apt-src/debversion.cc apt-src/version.cc sortselector.cpp blacklistselect.cpp rotatingbackground.cpp searchoptions.cpp dpkginterface.cpp installfile.cpp .tmp/fapman1.0.0/ && $(COPY_FILE) --parents mainwindow.ui packageview.ui filterselect.ui confirmdialog.ui repoview.ui packageselector.ui help.ui settings.ui repoedit.ui logview.ui sortselector.ui blacklistselect.ui searchoptions.ui .tmp/fapman1.0.0/ && (cd `dirname .tmp/fapman1.0.0` && $(TAR) fapman1.0.0.tar fapman1.0.0 && $(COMPRESS) fapman1.0.0.tar) && $(MOVE) `dirname .tmp/fapman1.0.0`/fapman1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/fapman1.0.0
 
 
 clean:compiler_clean 
@@ -433,6 +435,7 @@ mainwindow.o: mainwindow.cpp mainwindow.h \
                blacklistselect.h \
                version.h \
                ui_mainwindow.h \
+               rotatingbackground.h \
                packageview.h \
                package.h \
                confirmdialog.h \
@@ -441,8 +444,9 @@ mainwindow.o: mainwindow.cpp mainwindow.h \
                help.h \
                settings.h \
                logview.h \
-               rotatingbackground.h \
-               dpkginterface.h
+               dpkginterface.h \
+               installfile.h \
+               repository.h
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
 
 package.o: package.cpp package.h \
@@ -585,6 +589,10 @@ searchoptions.o: searchoptions.cpp searchoptions.h \
 dpkginterface.o: dpkginterface.cpp dpkginterface.h
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o dpkginterface.o dpkginterface.cpp
 
+installfile.o: installfile.cpp installfile.h \
+               repository.h
+       $(CXX) -c $(CXXFLAGS) $(INCPATH) -o installfile.o installfile.cpp
+
 moc_mainwindow.o: moc_mainwindow.cpp 
        $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
 
index e2d2f7d..55dd749 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,4 +1,4 @@
--------------------------------------------------------------------------------------
+s-------------------------------------------------------------------------------------
  TODO for Faster Application Manager
 
  Note that many of these are just random ideas, not all of them will get implemented
@@ -7,38 +7,32 @@
 
 0.7:
 * prompt for filename when storing/loading selections
-* ability to save all installed user-category packages as a selection list
-* added command line scripts to use apt-get with FAM's cache (fapt-get, fapt-cache)
-- possibility to force reinstall of an already installed package
-- improve package dialog UI in portrait mode
+* ability to save all installed user-category packages as selections
+* added command line helper scripts (fapt-get, fapt-cache)
+* UI tweaks (package list view patch by MohammadAG, icons by joppu)
+
+
+later/uncertain:
+
 - better blacklist editor
 - ability to import/export blacklist?
+- possibility to force reinstall of an already installed package
+- fetch dates from other repositories than maemo.org?
+- support translations
 
-
-0.8:
 - support loading .install files
 - support installing local .debs
-- dbus interface for installing packages by name
 - mime type handling for .install and .deb (can it be done without conflicting HAM?)
-- support translations
 
-
-later/any/uncertain:
-- fetch dates from other repositories than maemo.org?
-- fetch dates for other than user categories?
-- add an option to start fetching changelogs automatically for all upgradeable packages?
-- how to handle package names that end in '-'? (theoretically they are valid but nonexistent?)
-- ability to easily add extras-devel and extras-testing to repos if they don't exist
-- load package lists in the background when the main menu is visible?
-- warn about unauthenticated packages / option to disable installing unauthenticated packages
 - show download speed and current repo for apt-get update (very hard to do since apt-get update output does not show
   all the information needed to get the current list file names?)
-- "problem solver" feature (find broken packages, handle recovery from broken packages better)
 
 
-known bugs:
+
+known bugs/shortcomings:
 - no window menu indicator in stacked windows (probably a Qt bug)
 - updating menu icons after installation does not work or works only sometimes (currently disabled)
 - does not warn about system upgrade?
 - date fetching is quite slow with qt4.7
+- no way to edit the blacklist status of packages that are currently unknown
 
index 73bee4b..bda25dc 100644 (file)
@@ -1954,10 +1954,3 @@ void AAptInterface::readPinnedPackages()
                                                                  "remove such settings as they can result in unexpected behavior of Faster Application Manager.");
        }
 }
-
-bool AAptInterface::loadInstallFiles(QStringList files_)
-{
-       qDebug() << files_;
-
-       return false;
-}
index 23efd1f..7925c55 100644 (file)
@@ -104,8 +104,6 @@ public:
        void setSkipListAndDates() { iSkipRefreshListAndDates=true; }
        bool needListOrDateRefresh();
 
-       bool loadInstallFiles(QStringList files_);
-
        QDateTime lastListUpdate() { return iLastListUpdate; }
        QDateTime lastDpkgUpdate() { return iLastDpkgUpdate; }
 
index 701b626..bdd2dbf 100644 (file)
@@ -1,8 +1,17 @@
 fapman (0.7-1) unstable; urgency=low
 
-  *
+  * prompt for filename when storing/loading selections
+  * ability to save all installed user-category packages as selections
+  * added command line helper scripts (fapt-get, fapt-cache)
+  * UI tweaks (package list view patch by MohammadAG, icons by joppu)
 
- -- Heikki Holstila <heikki.holstila@gmail.com>  Thu, 25 Nov 2010 19:16:17 +0200
+ -- Heikki Holstila <heikki.holstila@gmail.com>  Mon,  3 Jan 2011 18:40:14 +0200
+
+fapman (0.6.8.1-1) unstable; urgency=low
+
+  * fix a problem with changelog fetching
+
+ -- Heikki Holstila <heikki.holstila@gmail.com>  Thu, 25 Nov 2010 20:12:00 +0200
 
 fapman (0.6.8-1) unstable; urgency=low
 
index b641b80..9d34c7a 100644 (file)
@@ -31,7 +31,8 @@ SOURCES += main.cpp\
     blacklistselect.cpp \
     rotatingbackground.cpp \
     searchoptions.cpp \
-    dpkginterface.cpp
+    dpkginterface.cpp \
+    installfile.cpp
 
 HEADERS  += mainwindow.h \
     package.h \
@@ -58,7 +59,8 @@ HEADERS  += mainwindow.h \
     blacklistselect.h \
     rotatingbackground.h \
     searchoptions.h \
-    dpkginterface.h
+    dpkginterface.h \
+    installfile.h
 
 FORMS    += mainwindow.ui \
     packageview.ui \
index 7c5e21f..9188c0d 100644 (file)
Binary files a/icons/commit.png and b/icons/commit.png differ
index 90fdd8c..9f91c9d 100644 (file)
Binary files a/icons/fapman.png and b/icons/fapman.png differ
index 2fd7832..eb826c8 100644 (file)
Binary files a/icons/filter_cat.png and b/icons/filter_cat.png differ
index 9459072..4a2b3cb 100644 (file)
Binary files a/icons/filter_stat.png and b/icons/filter_stat.png differ
index 79a039c..a52ef06 100644 (file)
Binary files a/icons/sort.png and b/icons/sort.png differ
diff --git a/installfile.cpp b/installfile.cpp
new file mode 100644 (file)
index 0000000..159f3f6
--- /dev/null
@@ -0,0 +1,114 @@
+#include <QtCore>
+#include "installfile.h"
+#include "repository.h"
+
+
+InstallFile::InstallFile(QString filename): iIsValid(true)
+{
+    sections sect = sectNone;
+    QStringList catalogues;
+    Repository* newrepo = 0;
+    QString currentRepoSect;
+
+    qDebug() << "--reading install file" << filename;
+
+    QFile f(filename);
+    if( f.open(QIODevice::ReadOnly | QIODevice::Text) )
+    {
+        while( !f.atEnd() && iIsValid )
+        {
+            QString line = f.readLine().simplified();
+            //qDebug() << ">" << line;
+
+            if( line == "[install]" ) {
+                sect = sectInstall;
+                qDebug() << "install section";
+            } else if( line == "[catalogues]" ) {
+                sect = sectCatalogues;
+                qDebug() << "catalogues section";
+            } else if( line.startsWith('[') && line.endsWith(']') ) {
+                sect = sectRepo;
+                currentRepoSect = line.mid(1,line.length()-2);
+                if( !catalogues.contains( currentRepoSect ) )
+                {
+                    iIsValid = false;
+                    iErrorString = "File contains an unknown section";
+                    sect = sectInvalid;
+                    qDebug() << "unknown section" << currentRepoSect;
+                } else {
+                    qDebug() << "repo section" << currentRepoSect;
+                    newrepo = new Repository();
+                    if( !newrepo ) {
+                        qDebug() << "FATAL ERROR";
+                        iIsValid = false;
+                        return;
+                    }
+                    iRepos.append(newrepo);
+                }
+            }
+
+            if( sect == sectCatalogues || sect == sectInstall ) {
+                if( line.startsWith("catalogues") )
+                {
+                    catalogues.append( TrimList( line.mid( line.indexOf('=')+1 ).split(';') ) );
+                    qDebug() << catalogues;
+                }
+            }
+            if( sect == sectInstall ) {
+                if( line.startsWith("package") ) {
+                    iInstallPackages.append( TrimList( line.mid( line.indexOf('=')+1 ).split(';') ) );
+                    qDebug() << iInstallPackages;
+                }
+            }
+            if( sect == sectRepo ) {
+                if( line.startsWith("name") ) {
+                    newrepo->setName( line.mid( line.indexOf('=')+1 ).trimmed() );
+                }
+                if( line.startsWith("uri") ) {
+                    newrepo->setEnabled(true);
+                    newrepo->setUrlDir( line.mid( line.indexOf('=')+1 ).trimmed() );
+                }
+                if( line.startsWith("components") ) {
+                    newrepo->setComponents( line.mid( line.indexOf('=')+1 ).trimmed() );
+                }
+                if( line.startsWith("dist") ) {
+                    newrepo->setDist( line.mid( line.indexOf('=')+1 ).trimmed() );
+                }
+            }
+
+        }
+        f.close();
+    } else {
+        iIsValid = false;
+        iErrorString = "Could not open file";
+        qDebug() << "could not open file";
+    }
+
+    qDebug() << "--done" << filename;
+
+    for(int i=0; i<iRepos.count(); i++) {
+        if( iRepos.at(i) ) {
+            if( iRepos.at(i)->dist().isEmpty() )
+                iRepos.at(i)->setDist("fremantle-1.3");  // this is not exactly the right way...
+        }
+    }
+}
+
+InstallFile::~InstallFile()
+{
+    for(int i=0; i<iRepos.count(); i++) {
+        if( iRepos.at(i) ) {
+            delete iRepos.at(i);
+        }
+    }
+}
+
+QStringList InstallFile::TrimList(QStringList l)
+{
+    QStringList n;
+    for(int i=0; i<l.count(); i++)
+    {
+        n << l.at(i).trimmed();
+    }
+    return n;
+}
diff --git a/installfile.h b/installfile.h
new file mode 100644 (file)
index 0000000..2ab4271
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef INSTALLFILE_H
+#define INSTALLFILE_H
+
+#include <QtCore>
+
+class Repository;
+
+class InstallFile
+{
+public:
+    enum sections { sectNone, sectInstall, sectCatalogues, sectRepo, sectInvalid };
+
+    explicit InstallFile(QString filename);
+    virtual ~InstallFile();
+
+    bool isValid() { return iIsValid; }
+    QString errorString() { return iErrorString; }
+    QList<Repository*> repositories() { return iRepos; }
+    QStringList installPackages() { return iInstallPackages; }
+
+private:
+    InstallFile(const InstallFile& old);
+    InstallFile operator= (const InstallFile& old);
+
+    QStringList TrimList(QStringList l);
+
+    bool iIsValid;
+    QString iErrorString;
+
+    QStringList iInstallPackages;
+    QList<Repository*> iRepos;
+
+};
+
+#endif // INSTALLFILE_H
index 844f065..24a61a5 100644 (file)
@@ -1,27 +1,8 @@
-/*
-       This file is part of Faster Application Manager.
-
-       Faster Application Manager is free software: you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation, either version 3 of the License, or
-       (at your option) any later version.
-
-       Faster Application Manager is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
-
-       You should have received a copy of the GNU General Public License
-       along with Faster Application Manager.  If not, see <http://www.gnu.org/licenses/>.
-
-       (C) Heikki Holstila 2010
-*/
-
 #ifdef MYDEF_GTK_EXISTS
 extern "C"
 {
-       #include <gdk/gdk.h>
-       #include <gtk/gtk.h>
+    #include <gdk/gdk.h>
+    #include <gtk/gtk.h>
 }
 #endif
 
@@ -38,7 +19,7 @@ extern "C"
 
 extern "C"
 {
-       #include <sys/vfs.h>
+    #include <sys/vfs.h>
 }
 
 #include "mainwindow.h"
@@ -54,6 +35,8 @@ extern "C"
 #include "logview.h"
 #include "rotatingbackground.h"
 #include "dpkginterface.h"
+#include "installfile.h"
+#include "repository.h"
 
 
 MainWindow::MainWindow(QWidget *parent) :
@@ -62,127 +45,127 @@ MainWindow::MainWindow(QWidget *parent) :
 {
     ui->setupUi(this);
 
-       iAptInterface = new AAptInterface(this);
-       iWinPackageView = new PackageView(this);
-       iWinPackageView->setAptInterface(iAptInterface);
-       iWinRepoView = new RepoView(this);
-       iWinRepoView->setAptInterface(iAptInterface);
-       iSettings = new Settings(this);
-       iSettings->setAptInterface(iAptInterface);
-       iSettings->setPackageView(iWinPackageView);
-       iWinPackageView->setSettings(iSettings);
-       iAptInterface->setSettings(iSettings);
-       iDpkgInterface = new DpkgInterface(this);
-
-       iWinPackageView->setSortOrder( (PackageView::sortOrder)iSettings->qsettings()->value("default_sort_order",0).toInt() );
-
-       iWinPackageView->setSearchOptions( iSettings->qsettings()->value("search_pkgnames",true).toBool(),
-                                                                          iSettings->qsettings()->value("search_displaynames",true).toBool(),
-                                                                          iSettings->qsettings()->value("search_descshort",true).toBool(),
-                                                                          iSettings->qsettings()->value("search_desclong",false).toBool() );
+    iAptInterface = new AAptInterface(this);
+    iWinPackageView = new PackageView(this);
+    iWinPackageView->setAptInterface(iAptInterface);
+    iWinRepoView = new RepoView(this);
+    iWinRepoView->setAptInterface(iAptInterface);
+    iSettings = new Settings(this);
+    iSettings->setAptInterface(iAptInterface);
+    iSettings->setPackageView(iWinPackageView);
+    iWinPackageView->setSettings(iSettings);
+    iAptInterface->setSettings(iSettings);
+    iDpkgInterface = new DpkgInterface(this);
+
+    iWinPackageView->setSortOrder( (PackageView::sortOrder)iSettings->qsettings()->value("default_sort_order",0).toInt() );
+
+    iWinPackageView->setSearchOptions( iSettings->qsettings()->value("search_pkgnames",true).toBool(),
+                                       iSettings->qsettings()->value("search_displaynames",true).toBool(),
+                                       iSettings->qsettings()->value("search_descshort",true).toBool(),
+                                       iSettings->qsettings()->value("search_desclong",false).toBool() );
 
 #ifdef Q_WS_MAEMO_5
-       if( !iSettings->qsettings()->value("disable_autorotation",false).toBool() ) {
-               this->setAttribute(Qt::WA_Maemo5AutoOrientation);
-       } else {
-               this->setAttribute(Qt::WA_Maemo5LandscapeOrientation);
-       }
-       this->setAttribute(Qt::WA_Maemo5StackedWindow);
+    if( !iSettings->qsettings()->value("disable_autorotation",false).toBool() ) {
+        this->setAttribute(Qt::WA_Maemo5AutoOrientation);
+    } else {
+        this->setAttribute(Qt::WA_Maemo5LandscapeOrientation);
+    }
+    this->setAttribute(Qt::WA_Maemo5StackedWindow);
 #endif
 
-       iDimmer = new dimmer(this);
-
-       iReposAutoUpdating = false;
-       iUpgradeAutoUpdate = true;
-       iNextOperation = OpNone;
-
-       connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
-
-       ui->centralWidget->loadWallpaper();
-
-       /*
-       QString stylesheet_mainscreen =
-                       "QPushButton {"
-                       "border-radius: 16px;"
-                       "border-width: 1px;"
-                       "border-color: palette(light);"
-                       "border-style: outset;"
-                       "padding-right: 10px;"
-                       "padding-left: 10px;"
-                       "color: palette(buttontext);"
-                       "background: rgba(255,255,255,80);"
-                       "}"
-                       "QPushButton:pressed {"
-                       "border-style: inset;"
-                       "background-color: rgba(255,255,255,150);"
-                       "}";
-       */
-
-       if( ((QApplication*)QApplication::instance())->styleSheet().isEmpty() )
-       {
-               QString stylesheet_file;
-               QFile f("/root/.fapman/style.css");
-               if( f.open(QIODevice::ReadOnly | QIODevice::Text ) )
-               {
-                       while(!f.atEnd()) {
-                               stylesheet_file += f.readLine().trimmed();
-                       }
-                       f.close();
-               }
-
-               if( stylesheet_file.isEmpty() ) {
-                       //ui->centralWidget->setStyleSheet(stylesheet_mainscreen);
-               } else {
-                       ((QApplication*)QApplication::instance())->setStyleSheet(stylesheet_file);
-               }
-       }
-
-
-       iMediaObject = new Phonon::MediaObject(this);
-       Phonon::AudioOutput* aout = new Phonon::AudioOutput(Phonon::NotificationCategory, this);
-       Phonon::createPath(iMediaObject, aout);
-
-       showFreeSpace();
-
-       iNetworkConfigurationManager = new QNetworkConfigurationManager(this);
-       iNetworkSession = new QNetworkSession(iNetworkConfigurationManager->defaultConfiguration(),this);
-
-       show();
-       rescaleMenuView();
+    iDimmer = new dimmer(this);
+
+    iReposAutoUpdating = false;
+    iUpgradeAutoUpdate = true;
+    iNextOperation = OpNone;
+
+    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
+
+    ui->centralWidget->loadWallpaper();
+
+    /*
+    QString stylesheet_mainscreen =
+            "QPushButton {"
+            "border-radius: 16px;"
+            "border-width: 1px;"
+            "border-color: palette(light);"
+            "border-style: outset;"
+            "padding-right: 10px;"
+            "padding-left: 10px;"
+            "color: palette(buttontext);"
+            "background: rgba(255,255,255,80);"
+            "}"
+            "QPushButton:pressed {"
+            "border-style: inset;"
+            "background-color: rgba(255,255,255,150);"
+            "}";
+    */
+
+    if( ((QApplication*)QApplication::instance())->styleSheet().isEmpty() )
+    {
+        QString stylesheet_file;
+        QFile f("/root/.fapman/style.css");
+        if( f.open(QIODevice::ReadOnly | QIODevice::Text ) )
+        {
+            while(!f.atEnd()) {
+                stylesheet_file += f.readLine().trimmed();
+            }
+            f.close();
+        }
+
+        if( stylesheet_file.isEmpty() ) {
+            //ui->centralWidget->setStyleSheet(stylesheet_mainscreen);
+        } else {
+            ((QApplication*)QApplication::instance())->setStyleSheet(stylesheet_file);
+        }
+    }
+
+
+    iMediaObject = new Phonon::MediaObject(this);
+    Phonon::AudioOutput* aout = new Phonon::AudioOutput(Phonon::NotificationCategory, this);
+    Phonon::createPath(iMediaObject, aout);
+
+    showFreeSpace();
+
+    iNetworkConfigurationManager = new QNetworkConfigurationManager(this);
+    iNetworkSession = new QNetworkSession(iNetworkConfigurationManager->defaultConfiguration(),this);
+
+    show();
+    rescaleMenuView();
 }
 
 MainWindow::~MainWindow()
 {
-       // save "need repo refresh" status
-       iSettings->qsettings()->setValue("need_repo_refresh", iAptInterface->needRepoRefresh());
-
-       if( iNetworkSession && iNetworkSession->isOpen() ) {
-               iNetworkSession->close();
-       }
-       // iNetworkSession automatically deleted by parent
-
-       delete iWinPackageView; iWinPackageView=0;
-       delete iWinRepoView; iWinRepoView=0;
-       delete iAptInterface; iAptInterface=0;
-       delete iDpkgInterface; iDpkgInterface=0;
-       delete iDimmer; iDimmer=0;
-       delete iSettings; iSettings=0;
-       delete ui; ui=0;
-       //iMediaObject and aout automatically deleted by their parent
+    // save "need repo refresh" status
+    iSettings->qsettings()->setValue("need_repo_refresh", iAptInterface->needRepoRefresh());
+
+    if( iNetworkSession && iNetworkSession->isOpen() ) {
+        iNetworkSession->close();
+    }
+    // iNetworkSession automatically deleted by parent
+
+    delete iWinPackageView; iWinPackageView=0;
+    delete iWinRepoView; iWinRepoView=0;
+    delete iAptInterface; iAptInterface=0;
+    delete iDpkgInterface; iDpkgInterface=0;
+    delete iDimmer; iDimmer=0;
+    delete iSettings; iSettings=0;
+    delete ui; ui=0;
+    //iMediaObject and aout automatically deleted by their parent
 }
 
 void MainWindow::openNetworkConnection()
 {
-       if( iNetworkSession->isOpen() )
-               return;
-
-       iNetworkSession->open();
-       if( !iNetworkSession->waitForOpened(20000) )
-       {
-               ConfirmDialog d(false, this);
-               d.setText("Network error","Unable to open a network connection");
-               d.exec();
-       }
+    if( iNetworkSession->isOpen() )
+        return;
+
+    iNetworkSession->open();
+    if( !iNetworkSession->waitForOpened(20000) )
+    {
+        ConfirmDialog d(false, this);
+        d.setText("Network error","Unable to open a network connection");
+        d.exec();
+    }
 }
 
 void MainWindow::changeEvent(QEvent *e)
@@ -199,500 +182,555 @@ void MainWindow::changeEvent(QEvent *e)
 
 void MainWindow::on_btnRepos_clicked()
 {
-       iWinRepoView->openWin();
+    iWinRepoView->openWin();
 }
 
 void MainWindow::on_btnUpdate_clicked()
-{      
-       // update catalogs
+{
+    // update catalogs
 
-       openNetworkConnection();
+    openNetworkConnection();
 
-       busyDialog(true, tr("Operation in progress"), tr("Updating catalogs"));
+    busyDialog(true, tr("Operation in progress"), tr("Updating catalogs"));
 
-       iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
-       iAptInterface->run(iDimmer);
+    iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
+    iAptInterface->run(iDimmer);
 }
 
 #ifdef Q_WS_MAEMO_5
 int MainWindow::top_application()
 {
-       show();
-       activateWindow();
-       raise();
-       return 0;
+    show();
+    activateWindow();
+    raise();
+    return 0;
 }
 #endif
 
 void MainWindow::dateFetchAsk()
 {
-       if( !iSettings->qsettings()->value("firstrun_asked_fetch_dates",false).toBool() &&
-               !iSettings->qsettings()->value("fetch_dates",false).toBool() )
-       {
-               iSettings->qsettings()->setValue("firstrun_asked_fetch_dates", true);
-               ConfirmDialog d(true, this);
-               d.setText("Fetch date information?","Enable date information fetching for packages? You have to enable it in order to be "
-                                 "able to sort packages by date. The first fetch can be slow but the dates are cached for later use. You can later "
-                                 "change this selection from the options menu.");
-               if( d.exec() )
-                       iSettings->qsettings()->setValue("fetch_dates", true);
-       }
-       if( iSettings->qsettings()->value("fetch_dates",false).toBool() )
-       {
-               iSettings->qsettings()->setValue("firstrun_asked_fetch_dates", true);   // don't ask if the option has already been enabled
-               if( !iAptInterface->dateCacheExists() )
-               {
-                       ConfirmDialog d(false, this);
-                       d.setText("Notice","Date information will be fetched only for packages from maemo.org and only for user categories.");
-                       d.exec();
-               }
-               iAptInterface->addQueuedOperation(AAptInterface::ModeFetchDates);
-       }
+    if( !iSettings->qsettings()->value("firstrun_asked_fetch_dates",false).toBool() &&
+        !iSettings->qsettings()->value("fetch_dates",false).toBool() )
+    {
+        iSettings->qsettings()->setValue("firstrun_asked_fetch_dates", true);
+        ConfirmDialog d(true, this);
+        d.setText("Fetch date information?","Enable date information fetching for packages? You have to enable it in order to be "
+                  "able to sort packages by date. The first fetch can be slow but the dates are cached for later use. You can later "
+                  "change this selection from the options menu.");
+        if( d.exec() )
+            iSettings->qsettings()->setValue("fetch_dates", true);
+    }
+    if( iSettings->qsettings()->value("fetch_dates",false).toBool() )
+    {
+        iSettings->qsettings()->setValue("firstrun_asked_fetch_dates", true);  // don't ask if the option has already been enabled
+        if( !iAptInterface->dateCacheExists() )
+        {
+            ConfirmDialog d(false, this);
+            d.setText("Notice","Date information will be fetched only for packages from maemo.org and only for user categories.");
+            d.exec();
+        }
+        iAptInterface->addQueuedOperation(AAptInterface::ModeFetchDates);
+    }
 }
 
 void MainWindow::on_btnListInstallable_clicked()
 {
-       //install
+    //install
 
-       openNetworkConnection();
+    openNetworkConnection();
 
-       int listupd = -1;
-       int dpkgupd = -1;
-       if( iAptInterface->lastListUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
-               listupd = 1;
-       if( iAptInterface->lastDpkgUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
-               dpkgupd = 1;
-       iAptInterface->setNeedRefresh(-1,listupd,dpkgupd,listupd);
+    int listupd = -1;
+    int dpkgupd = -1;
+    if( iAptInterface->lastListUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
+        listupd = 1;
+    if( iAptInterface->lastDpkgUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
+        dpkgupd = 1;
+    iAptInterface->setNeedRefresh(-1,listupd,dpkgupd,listupd);
 
-       iWinPackageView->setStatFilter( Package::PkgStatNotInstalled );
+    iWinPackageView->setStatFilter( Package::PkgStatNotInstalled );
 
-       if( iAptInterface->needRepoRefresh() && !iSettings->qsettings()->value("no_catalogs_autoupdate",false).toBool() )
-               iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
+    if( iAptInterface->needRepoRefresh() && !iSettings->qsettings()->value("no_catalogs_autoupdate",false).toBool() )
+        iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
 
-       busyDialog(true, tr("Operation in progress"), tr("Reading package lists"));
+    busyDialog(true, tr("Operation in progress"), tr("Reading package lists"));
 
-       iNextOperation = OpOpenPkgView;
-       iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
+    iNextOperation = OpOpenPkgView;
+    iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
 
-       dateFetchAsk();
+    dateFetchAsk();
 
-       iAptInterface->run(iDimmer);
+    iAptInterface->run(iDimmer);
 }
 
 void MainWindow::on_btnUpgrade_clicked()
 {
-       // upgrade
+    // upgrade
 
-       openNetworkConnection();
+    openNetworkConnection();
 
-       int listupd = -1;
-       int dpkgupd = -1;
-       if( iAptInterface->lastListUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
-               listupd = 1;
-       if( iAptInterface->lastDpkgUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
-               dpkgupd = 1;
-       iAptInterface->setNeedRefresh(-1,listupd,dpkgupd,listupd);
+    int listupd = -1;
+    int dpkgupd = -1;
+    if( iAptInterface->lastListUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
+        listupd = 1;
+    if( iAptInterface->lastDpkgUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
+        dpkgupd = 1;
+    iAptInterface->setNeedRefresh(-1,listupd,dpkgupd,listupd);
 
-       iWinPackageView->setStatFilter( Package::PkgStatUpgradeable );
+    iWinPackageView->setStatFilter( Package::PkgStatUpgradeable );
 
-       if( iAptInterface->needRepoRefresh() && !iSettings->qsettings()->value("no_catalogs_autoupdate",false).toBool() )
-               iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
+    if( iAptInterface->needRepoRefresh() && !iSettings->qsettings()->value("no_catalogs_autoupdate",false).toBool() )
+        iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
 
-       busyDialog(true, tr("Operation in progress"), tr("Reading package lists"));
+    busyDialog(true, tr("Operation in progress"), tr("Reading package lists"));
 
-       iNextOperation = OpOpenPkgView;
-       iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
+    iNextOperation = OpOpenPkgView;
+    iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
 
-       dateFetchAsk();
+    dateFetchAsk();
 
-       iAptInterface->run(iDimmer);
+    iAptInterface->run(iDimmer);
 }
 
 void MainWindow::on_btnListInstalled_clicked()
 {
-       //remove
+    //remove
 
-       if( !iSettings->qsettings()->value("remove_readfull",false).toBool() )
-               iAptInterface->setSkipListAndDates();
+    if( !iSettings->qsettings()->value("remove_readfull",false).toBool() )
+        iAptInterface->setSkipListAndDates();
 
-       int dpkgupd = -1;
-       if( iAptInterface->lastDpkgUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
-               dpkgupd = 1;
-       iAptInterface->setNeedRefresh(-1,-1,dpkgupd,-1);
+    int dpkgupd = -1;
+    if( iAptInterface->lastDpkgUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
+        dpkgupd = 1;
+    iAptInterface->setNeedRefresh(-1,-1,dpkgupd,-1);
 
-       iWinPackageView->setStatFilter( Package::PkgStatInstalled );
+    iWinPackageView->setStatFilter( Package::PkgStatInstalled );
 
-       busyDialog(true, tr("Operation in progress"), tr("Reading package lists"));
+    busyDialog(true, tr("Operation in progress"), tr("Reading package lists"));
 
-       iNextOperation = OpOpenPkgView;
-       iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
+    iNextOperation = OpOpenPkgView;
+    iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
 
-       dateFetchAsk();
+    dateFetchAsk();
 
-       iAptInterface->run(iDimmer);
+    iAptInterface->run(iDimmer);
 }
 
 void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> lastModes, bool success, QString title, QStringList msgs)
 {
-       if( lastModes.contains(AAptInterface::ModeAptGetSimulate) && success ) {
-               iNextOperation = OpPromptSimulated;
-       }
-       if( lastModes.contains(AAptInterface::ModeAptGetInstall) && success ) {
-               iWinPackageView->clearSelections();
-               busyDialog(false);
-               iWinPackageView->close();
-               iNextOperation = OpNone;
-
-               GdkEventIconThemeReload();
-       }
-
-       QWidget* dialogParent = this;
-       if( iWinPackageView->isVisible() )
-               dialogParent = iWinPackageView;
-
-       if( iNextOperation == OpOpenPkgView && success )
-       {
-               iWinPackageView->openWin();
-               busyDialog(false);
-               iNextOperation = OpNone;
-       } else if( iNextOperation == OpPromptSimulated && success )
-       {
-               QStringList inst,remv,instver,remvver;
-               QStringList all = iAptInterface->processPackages();
-               QStringList vers = iAptInterface->processPackageVersions();
-               for(int zyx=0; zyx<all.count(); zyx++)
-               {
-                       if( all.at(zyx).endsWith('-') )
-                       {
-                               remv.append( all.at(zyx).left( all.at(zyx).size()-1 ) );
-                               if( vers.count()>zyx )
-                                       remvver.append( vers.at(zyx) );
-                       } else {
-                               inst.append( all.at(zyx) );
-                               if( vers.count()>zyx )
-                                       instver.append( vers.at(zyx) );
-                       }
-               }
-
-               int total_dl_size = 0;
-               for( int i=0; i<inst.count(); i++ ) {
-                       Package* pkg = iAptInterface->packagesAvailable()->value(inst.at(i),0);
-                       if( pkg ) {
-                               total_dl_size += pkg->size()/1024;
-                       }
-               }
-
-               QString pkglist;
-               pkglist = QString("<b>The following operations will be performed:</b><br>"
-                                 "%1 to install/upgrade, %2 to remove<br>").arg(inst.count()).arg(remv.count());
-               if( inst.count()>0 )
-                       pkglist += QString("Total download size: %L1 kB<br>").arg(total_dl_size);
-               bool mismatch = false;
-               bool warn_system_package_remove = false;
-               bool warn_system_package_install = false;
-
-               if( remv.count()>0 ) {
-                       pkglist += "<br><b><u>REMOVE:</u></b><br><font size=\"-1\">";
-                       for( int i=0; i<remv.count(); i++ ) {
-                               pkglist += "<b>" + remv.at(i) + "</b>";
-                               Package* pkg = iAptInterface->packagesInstalled()->value(remv.at(i),0);
-                               if( !pkg ) {
-                                       qDebug() << "Warning: unknown package" << remv.at(i);
-                                       pkglist += "<font color=\"red\">***UNKNOWN***</font>";
-                                       mismatch = true;
-                               }
+    if( lastModes.contains(AAptInterface::ModeAptGetSimulate) && success ) {
+        iNextOperation = OpPromptSimulated;
+    }
+    if( lastModes.contains(AAptInterface::ModeAptGetInstall) && success ) {
+        iWinPackageView->clearSelections();
+        busyDialog(false);
+        iWinPackageView->close();
+        iNextOperation = OpNone;
+
+        GdkEventIconThemeReload();
+    }
+
+    QWidget* dialogParent = this;
+    if( iWinPackageView->isVisible() )
+        dialogParent = iWinPackageView;
+
+    if( iNextOperation == OpOpenPkgView && success )
+    {
+        iWinPackageView->openWin();
+        busyDialog(false);
+        iNextOperation = OpNone;
+    } else if( iNextOperation == OpPromptSimulated && success )
+    {
+        QStringList inst,remv,instver,remvver;
+        QStringList all = iAptInterface->processPackages();
+        QStringList vers = iAptInterface->processPackageVersions();
+        for(int zyx=0; zyx<all.count(); zyx++)
+        {
+            if( all.at(zyx).endsWith('-') )
+            {
+                remv.append( all.at(zyx).left( all.at(zyx).size()-1 ) );
+                if( vers.count()>zyx )
+                    remvver.append( vers.at(zyx) );
+            } else {
+                inst.append( all.at(zyx) );
+                if( vers.count()>zyx )
+                    instver.append( vers.at(zyx) );
+            }
+        }
+
+        int total_dl_size = 0;
+        for( int i=0; i<inst.count(); i++ ) {
+            Package* pkg = iAptInterface->packagesAvailable()->value(inst.at(i),0);
+            if( pkg ) {
+                total_dl_size += pkg->size()/1024;
+            }
+        }
+
+        QString pkglist;
+        pkglist = QString("<b>The following operations will be performed:</b><br>"
+                  "%1 to install/upgrade, %2 to remove<br>").arg(inst.count()).arg(remv.count());
+        if( inst.count()>0 )
+            pkglist += QString("Total download size: %L1 kB<br>").arg(total_dl_size);
+        bool mismatch = false;
+        bool warn_system_package_remove = false;
+        bool warn_system_package_install = false;
+
+        if( remv.count()>0 ) {
+            pkglist += "<br><b><u>REMOVE:</u></b><br><font size=\"-1\">";
+            for( int i=0; i<remv.count(); i++ ) {
+                pkglist += "<b>" + remv.at(i) + "</b>";
+                Package* pkg = iAptInterface->packagesInstalled()->value(remv.at(i),0);
+                if( !pkg ) {
+                    qDebug() << "Warning: unknown package" << remv.at(i);
+                    pkglist += "<font color=\"red\">***UNKNOWN***</font>";
+                    mismatch = true;
+                }
 #ifdef Q_WS_MAEMO_5
-                               if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {
-                                       warn_system_package_remove = true;
-                               }
+                if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {
+                    warn_system_package_remove = true;
+                }
 #endif
-                               if( remvver.count()>i ) {
-                                       pkglist += " " + remvver.at(i);
-                                       if( pkg && remvver.at(i) != pkg->version() ) {
-                                               qDebug() << "Version mismatch, database version is" << pkg->version() << "but removing" << remvver.at(i);
-                                               mismatch = true;
-                                               pkglist += " <font color=\"red\">***TRYING TO REMOVE " + pkg->version() + "***</font> ";
-                                       }
-                               }
-                               if( pkg && pkg->installedSize()>0 )
-                                       pkglist += QString(" (%L1 kB)").arg(pkg->installedSize());
-                               pkglist += "<br>";
-                       }
-               }
-               pkglist += "</font>";
-
-               bool installing_blacklisted = false;
-               if( inst.count()>0 ) {
-                       pkglist += "<br><b><u>INSTALL/UPGRADE:</u></b><br><font size=\"-1\">";
-                       for( int i=0; i<inst.count(); i++ ) {
-                               pkglist += "<b>" + inst.at(i) + "</b>";
-                               Package* pkg = iAptInterface->packagesAvailable()->value(inst.at(i),0);
-                               if( !pkg ) {
-                                       qDebug() << "Warning: unknown package" << inst.at(i);
-                                       pkglist += "<font color=\"red\">***NEW/UNKNOWN***</font>";
-                                       mismatch = true;
-                               }
-                               if( pkg && pkg->isBlacklisted() ) {
-                                       qDebug() << "Warning: installing blacklisted package" << inst.at(i);
-                                       pkglist += "<font color=\"red\">***BLACKLISTED***</font>";
-                                       installing_blacklisted = true;
-                               }
+                if( remvver.count()>i ) {
+                    pkglist += " " + remvver.at(i);
+                    if( pkg && remvver.at(i) != pkg->version() ) {
+                        qDebug() << "Version mismatch, database version is" << pkg->version() << "but removing" << remvver.at(i);
+                        mismatch = true;
+                        pkglist += " <font color=\"red\">***TRYING TO REMOVE " + pkg->version() + "***</font> ";
+                    }
+                }
+                if( pkg && pkg->installedSize()>0 )
+                    pkglist += QString(" (%L1 kB)").arg(pkg->installedSize());
+                pkglist += "<br>";
+            }
+        }
+        pkglist += "</font>";
+
+        bool installing_blacklisted = false;
+        if( inst.count()>0 ) {
+            pkglist += "<br><b><u>INSTALL/UPGRADE:</u></b><br><font size=\"-1\">";
+            for( int i=0; i<inst.count(); i++ ) {
+                pkglist += "<b>" + inst.at(i) + "</b>";
+                Package* pkg = iAptInterface->packagesAvailable()->value(inst.at(i),0);
+                if( !pkg ) {
+                    qDebug() << "Warning: unknown package" << inst.at(i);
+                    pkglist += "<font color=\"red\">***NEW/UNKNOWN***</font>";
+                    mismatch = true;
+                }
+                if( pkg && pkg->isBlacklisted() ) {
+                    qDebug() << "Warning: installing blacklisted package" << inst.at(i);
+                    pkglist += "<font color=\"red\">***BLACKLISTED***</font>";
+                    installing_blacklisted = true;
+                }
 #ifdef Q_WS_MAEMO_5
-                               if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {       // unreliable?
-                                       warn_system_package_install = true;
-                               }
+                if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {      // unreliable?
+                    warn_system_package_install = true;
+                }
 #endif
-                               if( instver.count()>i ) {
-                                       pkglist += " " + instver.at(i);
-                                       if( pkg && instver.at(i) != pkg->version() ) {
-                                               qDebug() << "Version mismatch, database version is" << pkg->version() << "but installing" << instver.at(i);
-                                               mismatch = true;
-                                               pkglist += " <font color=\"red\">***TRYING TO INSTALL " + pkg->version() + "***</font> ";
-                                       }
-                               }
-                               if( pkg && pkg->size()>0 ) {
-                                       pkglist += QString(" (%L1 kB)").arg(pkg->size()/1024);
-                               }
-                               pkglist += "<br>";
-                       }
-               }
-               pkglist += "</font>";
-
-               if( mismatch ) {
-                       ConfirmDialog m(false, dialogParent);
-                       m.setText("Warning", "There is a version mismatch between your original package selections and some of the packages being installed " \
-                                         "from the repositories. This could be due to your application catalogs being out of date.");
-                       m.exec();
-               }
-               if( installing_blacklisted ) {
-                       ConfirmDialog b(false, dialogParent);
-                       b.setText("Warning","Blacklisted package(s) will be installed");
-                       b.exec();
-               }
-               if( warn_system_package_remove ) {
-                       ConfirmDialog s(false, dialogParent);
-                       s.setText("Warning","You are about to remove a critical system package.");
-                       s.exec();
-               }
-               if( warn_system_package_install ) {
-                       ConfirmDialog s(false, dialogParent);
-                       s.setText("Warning","You are trying to perform an install/upgrade operation on a critical system package. Doing a system upgrade with " \
-                                         "Faster Application Manager has not been tested and it could result in a horrible failure. You have been warned.");
-                       s.exec();
-               }
-
-               busyDialog(false);
-               ConfirmDialog d(true, dialogParent);
-               if( inst.count()==0 && remv.count()==0 )
-               {
-                       pkglist = "None of the packages can be installed";
-                       d.disableButton();
-               }
-               d.setText("Confirmation",pkglist);
-               if( d.exec() ) {
-                       iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetInstall);
-
-                       if( iSettings->qsettings()->value("enable_autoclean",true).toBool() && inst.count()>0 )
-                               iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetClean);
-
-                       QString busytext;
-                       if( remv.count() > 0 )
-                               busytext += QString("Remove %1 package(s)<br>").arg(remv.count());
-                       if( inst.count() > 0 )
-                               busytext += QString("Install %1 package(s)<br>").arg(inst.count());
-                       busytext += "Preparing...";
-                       busyDialog(true, "Operation in progress", busytext);
-
-                       // "run" really does nothing here since the previous item should still be running
-                       if( iWinPackageView->isVisible() ) {
-                               iAptInterface->run(iWinPackageView->mydimmer());
-                       } else {
-                               iAptInterface->run(iDimmer);
-                       }
-               }
-               iNextOperation = OpNone;
-               return;
-       } else {
-               busyDialog(false);
-               iNextOperation = OpNone;
-
-               if( iSettings->qsettings()->value("sound_notify",false).toBool() )
-               {
-                       qDebug() << "playing sound";
-                       iMediaObject->setCurrentSource( Phonon::MediaSource(iSettings->qsettings()->value("sound_file","/usr/share/sounds/ui-operation_ready.wav").toString()) );
-                       iMediaObject->play();
-               }
-
-               QString text = "<br><b><u>Faster Application Manager</u></b><br>"
-                                          "<b>"+title+"</b><br>" + msgs.join("<br>") + "<br>";
-
-               QRect r = QApplication::desktop()->rect();
-               if(r.width() < r.height()) {
-                       ConfirmDialog d(false, dialogParent);
-                       d.setText(title,msgs.join("<br>"));
-                       d.exec();
-               } else {
+                if( instver.count()>i ) {
+                    pkglist += " " + instver.at(i);
+                    if( pkg && instver.at(i) != pkg->version() ) {
+                        qDebug() << "Version mismatch, database version is" << pkg->version() << "but installing" << instver.at(i);
+                        mismatch = true;
+                        pkglist += " <font color=\"red\">***TRYING TO INSTALL " + pkg->version() + "***</font> ";
+                    }
+                }
+                if( pkg && pkg->size()>0 ) {
+                    pkglist += QString(" (%L1 kB)").arg(pkg->size()/1024);
+                }
+                pkglist += "<br>";
+            }
+        }
+        pkglist += "</font>";
+
+        if( mismatch ) {
+            ConfirmDialog m(false, dialogParent);
+            m.setText("Warning", "There is a version mismatch between your original package selections and some of the packages being installed " \
+                      "from the repositories. This could be due to your application catalogs being out of date.");
+            m.exec();
+        }
+        if( installing_blacklisted ) {
+            ConfirmDialog b(false, dialogParent);
+            b.setText("Warning","Blacklisted package(s) will be installed");
+            b.exec();
+        }
+        if( warn_system_package_remove ) {
+            ConfirmDialog s(false, dialogParent);
+            s.setText("Warning","You are about to remove a critical system package.");
+            s.exec();
+        }
+        if( warn_system_package_install ) {
+            ConfirmDialog s(false, dialogParent);
+            s.setText("Warning","You are trying to perform an install/upgrade operation on a critical system package. Doing a system upgrade with " \
+                      "Faster Application Manager has not been tested and it could result in a horrible failure. You have been warned.");
+            s.exec();
+        }
+
+        busyDialog(false);
+        ConfirmDialog d(true, dialogParent);
+        if( inst.count()==0 && remv.count()==0 )
+        {
+            pkglist = "None of the packages can be installed";
+            d.disableButton();
+        }
+        d.setText("Confirmation",pkglist);
+        if( d.exec() ) {
+            iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetInstall);
+
+            if( iSettings->qsettings()->value("enable_autoclean",true).toBool() && inst.count()>0 )
+                iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetClean);
+
+            QString busytext;
+            if( remv.count() > 0 )
+                busytext += QString("Remove %1 package(s)<br>").arg(remv.count());
+            if( inst.count() > 0 )
+                busytext += QString("Install %1 package(s)<br>").arg(inst.count());
+            busytext += "Preparing...";
+            busyDialog(true, "Operation in progress", busytext);
+
+            // "run" really does nothing here since the previous item should still be running
+            if( iWinPackageView->isVisible() ) {
+                iAptInterface->run(iWinPackageView->mydimmer());
+            } else {
+                iAptInterface->run(iDimmer);
+            }
+        }
+        iNextOperation = OpNone;
+        return;
+    } else {
+        busyDialog(false);
+        iNextOperation = OpNone;
+
+        if( iSettings->qsettings()->value("sound_notify",false).toBool() )
+        {
+            qDebug() << "playing sound";
+            iMediaObject->setCurrentSource( Phonon::MediaSource(iSettings->qsettings()->value("sound_file","/usr/share/sounds/ui-operation_ready.wav").toString()) );
+            iMediaObject->play();
+        }
+
+        QString text = "<br><b><u>Faster Application Manager</u></b><br>"
+                       "<b>"+title+"</b><br>" + msgs.join("<br>") + "<br>";
+
+        QRect r = QApplication::desktop()->rect();
+        if(r.width() < r.height()) {
+            ConfirmDialog d(false, dialogParent);
+            d.setText(title,msgs.join("<br>"));
+            d.exec();
+        } else {
 #ifdef Q_WS_MAEMO_5
-                       QMaemo5InformationBox::information(0, text, QMaemo5InformationBox::NoTimeout);
+            QMaemo5InformationBox::information(0, text, QMaemo5InformationBox::NoTimeout);
 #else
-                       ConfirmDialog d(false, dialogParent);
-                       d.setText(title,msgs.join("<br>"));
-                       d.exec();
+            ConfirmDialog d(false, dialogParent);
+            d.setText(title,msgs.join("<br>"));
+            d.exec();
 #endif
-               }
+        }
 
-               showFreeSpace();
-       }
+        showFreeSpace();
+    }
 
 }
 
 void MainWindow::busyDialog(bool show_, QString title, QString text)
 {
-       if( show_ ) {
-               iDimmer->setProgress(-1);
-               ui->menuMenu->setEnabled(false);
-               ui->centralWidget->setEnabled(false);
-               iWinPackageView->disableMenu();
-               iDimmer->resizeEvent(0);
-               iDimmer->dim(title, text);
-               iWinPackageView->mydimmer()->resizeEvent(0);
-               iWinPackageView->mydimmer()->dim(title, text);
-       } else {
-               iDimmer->undim();
-               iWinPackageView->mydimmer()->undim();
-               ui->menuMenu->setEnabled(true);
-               ui->centralWidget->setEnabled(true);
-               iWinPackageView->enableMenu();
-       }
+    if( show_ ) {
+        iDimmer->setProgress(-1);
+        ui->menuMenu->setEnabled(false);
+        ui->centralWidget->setEnabled(false);
+        iWinPackageView->disableMenu();
+        iDimmer->resizeEvent(0);
+        iDimmer->dim(title, text);
+        iWinPackageView->mydimmer()->resizeEvent(0);
+        iWinPackageView->mydimmer()->dim(title, text);
+    } else {
+        iDimmer->undim();
+        iWinPackageView->mydimmer()->undim();
+        ui->menuMenu->setEnabled(true);
+        ui->centralWidget->setEnabled(true);
+        iWinPackageView->enableMenu();
+    }
 }
 
 void MainWindow::on_actionAbout_triggered()
 {
-       ConfirmDialog d(false, this);
-       d.setText("About","Faster Application Manager<br>"
-                         "<font size=\"-1\">Version " + PROGRAM_VERSION + "</font><br><br>"
-                         "(C) Heikki Holstila 2010<br>Donate using "
-                         "<a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=6ZKRY5QFHL42A&lc=FI&item_name=Faster%20Application%20Manager"
-                         "%20for%20Maemo5&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted\">PayPal</a>");
-       d.exec();
+    ConfirmDialog d(false, this);
+    d.setText("About","Faster Application Manager<br>"
+              "<font size=\"-1\">Version " + PROGRAM_VERSION + "</font><br><br>"
+              "(C) Heikki Holstila 2010<br>Donate using "
+              "<a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=6ZKRY5QFHL42A&lc=FI&item_name=Faster%20Application%20Manager"
+              "%20for%20Maemo5&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted\">PayPal</a>");
+    d.exec();
 }
 
 void MainWindow::on_actionClean_triggered()
 {
-       //if( iOperation != OpNone ) return;
-       //iOperation = OpClean;
-       iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetClean);
-       iAptInterface->run(iDimmer);
+    //if( iOperation != OpNone ) return;
+    //iOperation = OpClean;
+    iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetClean);
+    iAptInterface->run(iDimmer);
 }
 
 void MainWindow::closeEvent(QCloseEvent *event)
 {
-       if( iDimmer->busy() ) {
-               iAptInterface->cancel();
-               event->ignore();
-       } else {
-               event->accept();
-       }
+    if( iDimmer->busy() ) {
+        iAptInterface->cancel();
+        event->ignore();
+    } else {
+        event->accept();
+    }
 }
 
 void MainWindow::on_actionView_log_triggered()
 {
-       QByteArray log = iAptInterface->readLogFile();
-       LogView l(log, this);
-       l.exec();
+    QByteArray log = iAptInterface->readLogFile();
+    LogView l(log, this);
+    l.exec();
 }
 
 void MainWindow::on_actionOptions_triggered()
 {
-       iSettings->openWin();
+    iSettings->openWin();
 }
 
 void MainWindow::notifyDialog(QString title, QString msg)
 {
-       QWidget* dialogParent = this;
-       if( iWinPackageView->isVisible() )
-               dialogParent = iWinPackageView;
+    QWidget* dialogParent = this;
+    if( iWinPackageView->isVisible() )
+        dialogParent = iWinPackageView;
 
-       ConfirmDialog d(false, dialogParent);
-       d.setText(title, msg);
-       d.exec();
+    ConfirmDialog d(false, dialogParent);
+    d.setText(title, msg);
+    d.exec();
 }
 
 bool MainWindow::confirmDialog(QString title, QString msg)
 {
-       QWidget* dialogParent = this;
-       if( iWinPackageView->isVisible() )
-               dialogParent = iWinPackageView;
+    QWidget* dialogParent = this;
+    if( iWinPackageView->isVisible() )
+        dialogParent = iWinPackageView;
 
-       ConfirmDialog d(true, dialogParent);
-       d.setText(title, msg);
-       return d.exec();
+    ConfirmDialog d(true, dialogParent);
+    d.setText(title, msg);
+    return d.exec();
 }
 
 void MainWindow::GdkEventIconThemeReload()
 {
-       // DOES NOT EVEN WORK (at least not reliably) - disabled from the project file
+    // DOES NOT EVEN WORK (at least not reliably) - disabled from the project file
 
 #ifdef MYDEF_GTK_EXISTS
-       qDebug() << "Sending GDK icon theme reload event";
+    qDebug() << "Sending GDK icon theme reload event";
 
-       gdk_init((int*)QApplication::argc(),(gchar***)QApplication::argv());
+    gdk_init((int*)QApplication::argc(),(gchar***)QApplication::argv());
 
-       // taken from hildon application manager
-       GdkEventClient ev;
-       ev.type = GDK_CLIENT_EVENT;
-       ev.window = NULL;
-       ev.send_event = TRUE;
-       ev.message_type = gdk_atom_intern_static_string("_GTK_LOAD_ICONTHEMES");
-       ev.data_format = 32;
-       gdk_event_send_clientmessage_toall((GdkEvent*)&ev);
+    // taken from hildon application manager
+    GdkEventClient ev;
+    ev.type = GDK_CLIENT_EVENT;
+    ev.window = NULL;
+    ev.send_event = TRUE;
+    ev.message_type = gdk_atom_intern_static_string("_GTK_LOAD_ICONTHEMES");
+    ev.data_format = 32;
+    gdk_event_send_clientmessage_toall((GdkEvent*)&ev);
 
-       while(gdk_events_pending()) {
-               g_main_context_iteration(NULL, true);
-       }
+    while(gdk_events_pending()) {
+        g_main_context_iteration(NULL, true);
+    }
 
 #endif
 }
 
 void MainWindow::on_actionLoad_file_triggered()
 {
-       QStringList files = QFileDialog::getOpenFileNames(this, "Open files", "/", "Files (*.deb *.install)");
-       if( files.count() > 0 ) {
-               QStringList debs = files.filter(QRegExp(".*\\.deb$"));
-               QStringList installs = files.filter(QRegExp(".*\\.install$"));
-               if( debs.count()>0 && installs.count()>0 ) {
-                       ConfirmDialog d(false, this);
-                       d.setText("Error", "You can't mix different file types in your selection");
-                       d.exec();
-                       return;
-               }
-               if( debs.count()>0 )
-                       iDpkgInterface->loadDebFiles(debs);
-               else if( installs.count()>0 )
-                       iAptInterface->loadInstallFiles(installs);
-       }
+    /*
+    QStringList files = QFileDialog::getOpenFileNames(this, "Open files", "/", "Files (*.deb *.install)");
+    QStringList debs;
+    QStringList installs;
+    if( files.count() > 0 ) {
+        debs = files.filter(QRegExp(".*\\.deb$"));
+        installs = files.filter(QRegExp(".*\\.install$"));
+        if( debs.count()>0 && installs.count()>0 ) {
+            ConfirmDialog d(false, this);
+            d.setText("Error", "You can't mix different file types in your selection");
+            d.exec();
+            return;
+        } else if( installs.count() != 1 ) {
+            ConfirmDialog d(false, this);
+            d.setText("Error","Select only one install file");
+            d.exec();
+            return;
+        }
+        if( debs.count()>0 )
+            iDpkgInterface->loadDebFiles(debs);
+        else if( installs.count()==1 )
+            InstallFile instf(installs.at(0));
+    }
+    */
+
+    QString file = QFileDialog::getOpenFileName(this, "Open file", "/", "Install files (*.install)");
+    if( !file.isEmpty() ) {
+        InstallFile instf( file );
+        bool reposchanged = false;
+        if( instf.isValid() ) {
+            qDebug() << "SUCCESS";
+            for(int i=0; i<instf.repositories().count(); i++) {
+                qDebug() << instf.repositories().at(i)->toString();
+                bool found=false;
+                for(int j=0; j<iAptInterface->repositories()->count(); j++) {
+                    if( instf.repositories().at(i) && iAptInterface->repositories()->at(j) &&
+                        instf.repositories().at(i)->toString(true) == iAptInterface->repositories()->at(j)->toString(true) )
+                    {
+                        found = true;
+                        qDebug() << "found";
+                        if( !iAptInterface->repositories()->at(j)->enabled() ) {
+                            iAptInterface->repositories()->at(j)->setEnabled(true);
+                            reposchanged = true;
+                            qDebug() << "not enabled, enabling";
+                        }
+                    }
+                }
+                if( !found ) {
+                    qDebug() << "repo not found, adding";
+                    Repository* r = new Repository();
+                    r->setFromString( instf.repositories().at(i)->toString(true) );
+                    iAptInterface->repositories()->append(r);
+                    reposchanged = true;
+                }
+            }
+
+
+            if( reposchanged ) {
+                iAptInterface->writeRepositories();
+            }
+            iAptInterface->setNeedRefresh(1,1,-1,1);
+            this->on_btnUpdate_clicked();
+
+        } else {
+            qDebug() << "FAIL";
+            ConfirmDialog d(false, this);
+            d.setText("Error",instf.errorString());
+            d.exec();
+        }
+    }
 }
 
 void MainWindow::resizeEvent(QResizeEvent* event)
 {
-       rescaleMenuView();
+    rescaleMenuView();
 
-       if( iDimmer ) {
-               iDimmer->resize( this->size() );
-       }
+    if( iDimmer ) {
+        iDimmer->resize( this->size() );
+    }
 
-       QMainWindow::resizeEvent(event);
+    QMainWindow::resizeEvent(event);
 }
 
 void MainWindow::rescaleMenuView()
 {
-       QRect sg = ui->listWidget->rect();
+    QRect sg = ui->listWidget->rect();
 
-       if( sg.width() > sg.height() ) {
-               ui->listWidget->setGridSize( QSize((sg.width()-12)/5, (sg.height()-12)/2) );
-       } else {
-               ui->listWidget->setGridSize( QSize((sg.width()-12)/3, (sg.height()-12)/3) );
-       }
+    if( sg.width() > sg.height() ) {
+        ui->listWidget->setGridSize( QSize((sg.width()-12)/5, (sg.height()-12)/2) );
+    } else {
+        ui->listWidget->setGridSize( QSize((sg.width()-12)/3, (sg.height()-12)/3) );
+    }
 }
 
 void MainWindow::orientationChanged()
@@ -702,68 +740,68 @@ void MainWindow::orientationChanged()
 
 void MainWindow::showFreeSpace()
 {
-       quint64 warn_limit_root = 5120;
-       quint64 warn_limit_opt = 51200;
-       struct statfs root_stat;
-       struct statfs opt_stat;
-       statfs("/",&root_stat);
-       statfs("/opt",&opt_stat);
-       quint64 free_root = static_cast<quint64>(root_stat.f_bavail) * static_cast<quint64>(root_stat.f_bsize) / 1024;
-       quint64 free_opt = static_cast<quint64>(opt_stat.f_bavail) * static_cast<quint64>(opt_stat.f_bsize) / 1024;
-       quint64 total_root = static_cast<quint64>(root_stat.f_blocks) * static_cast<quint64>(root_stat.f_bsize) / 1024;
-       quint64 total_opt = static_cast<quint64>(opt_stat.f_blocks) * static_cast<quint64>(opt_stat.f_bsize) / 1024;
-       qDebug() << "rootfs" << free_root << "/" << total_root << "kB free";
-       qDebug() << "opt fs" << free_opt << "/" << total_opt << "kB free";
-
-       QString rootstr = QString("rootfs: %L1 / %L2 MB free").arg(free_root/1024).arg(total_root/1024);
-       QString optstr = QString("opt: %L1 / %L2 MB free").arg(free_opt/1024).arg(total_opt/1024);
-
-       ui->label->setText("<font size=\"-1\">" + rootstr + "<br>" + optstr + "</font>");
-
-       /*
-       ui->progressBarRoot->setFormat(rootstr);
-       ui->progressBarRoot->setMaximum(total_root/1024);
-       ui->progressBarRoot->setValue(free_root/1024);
-       ui->progressBarOpt->setFormat(optstr);
-       ui->progressBarOpt->setMaximum(total_opt/1024);
-       ui->progressBarOpt->setValue(free_opt/1024);
-       */
-
-       if( free_root < warn_limit_root || free_opt < warn_limit_opt )
-       {
-               ConfirmDialog d(false, this);
-               QString t;
-               if( free_root < warn_limit_root )
-                       t += QString("Root filesystem has %L1 kB available<br>").arg(free_root);
-               if( free_opt < warn_limit_opt )
-                       t += QString("Opt (home) filesystem has %L1 kB available<br>").arg(free_opt);
-               t += "<br>You may proceed, but consider freeing up space to prevent problems in the future";
-               d.setText("Warning: Low disk space",t);
-               d.exec();
-       }
+    quint64 warn_limit_root = 5120;
+    quint64 warn_limit_opt = 51200;
+    struct statfs root_stat;
+    struct statfs opt_stat;
+    statfs("/",&root_stat);
+    statfs("/opt",&opt_stat);
+    quint64 free_root = static_cast<quint64>(root_stat.f_bavail) * static_cast<quint64>(root_stat.f_bsize) / 1024;
+    quint64 free_opt = static_cast<quint64>(opt_stat.f_bavail) * static_cast<quint64>(opt_stat.f_bsize) / 1024;
+    quint64 total_root = static_cast<quint64>(root_stat.f_blocks) * static_cast<quint64>(root_stat.f_bsize) / 1024;
+    quint64 total_opt = static_cast<quint64>(opt_stat.f_blocks) * static_cast<quint64>(opt_stat.f_bsize) / 1024;
+    qDebug() << "rootfs" << free_root << "/" << total_root << "kB free";
+    qDebug() << "opt fs" << free_opt << "/" << total_opt << "kB free";
+
+    QString rootstr = QString("rootfs: %L1 / %L2 MB free").arg(free_root/1024).arg(total_root/1024);
+    QString optstr = QString("opt: %L1 / %L2 MB free").arg(free_opt/1024).arg(total_opt/1024);
+
+    ui->label->setText("<font size=\"-1\">" + rootstr + "<br>" + optstr + "</font>");
+
+    /*
+    ui->progressBarRoot->setFormat(rootstr);
+    ui->progressBarRoot->setMaximum(total_root/1024);
+    ui->progressBarRoot->setValue(free_root/1024);
+    ui->progressBarOpt->setFormat(optstr);
+    ui->progressBarOpt->setMaximum(total_opt/1024);
+    ui->progressBarOpt->setValue(free_opt/1024);
+    */
+
+    if( free_root < warn_limit_root || free_opt < warn_limit_opt )
+    {
+        ConfirmDialog d(false, this);
+        QString t;
+        if( free_root < warn_limit_root )
+            t += QString("Root filesystem has %L1 kB available<br>").arg(free_root);
+        if( free_opt < warn_limit_opt )
+            t += QString("Opt (home) filesystem has %L1 kB available<br>").arg(free_opt);
+        t += "<br>You may proceed, but consider freeing up space to prevent problems in the future";
+        d.setText("Warning: Low disk space",t);
+        d.exec();
+    }
 }
 
 void MainWindow::on_listWidget_itemClicked(QListWidgetItem* item)
 {
-       qDebug() << "main menu:" << item->statusTip();
-
-       if( item->statusTip() == "manage_repos" ) {
-               on_btnRepos_clicked();
-       }
-       else if( item->statusTip() == "update_catalogs" ) {
-               on_btnUpdate_clicked();
-       }
-       else if( item->statusTip() == "install_apps" ) {
-               on_btnListInstallable_clicked();
-       }
-       else if( item->statusTip() == "remove_apps" ) {
-               on_btnListInstalled_clicked();
-       }
-       else if( item->statusTip() == "upgrade_apps" ) {
-               on_btnUpgrade_clicked();
-       }
-       else {
-               qDebug() << "Warning: Unhandled main menu item";
-       }
-       item->setSelected(false);
+    qDebug() << "main menu:" << item->statusTip();
+
+    if( item->statusTip() == "manage_repos" ) {
+        on_btnRepos_clicked();
+    }
+    else if( item->statusTip() == "update_catalogs" ) {
+        on_btnUpdate_clicked();
+    }
+    else if( item->statusTip() == "install_apps" ) {
+        on_btnListInstallable_clicked();
+    }
+    else if( item->statusTip() == "remove_apps" ) {
+        on_btnListInstalled_clicked();
+    }
+    else if( item->statusTip() == "upgrade_apps" ) {
+        on_btnUpgrade_clicked();
+    }
+    else {
+        qDebug() << "Warning: Unhandled main menu item";
+    }
+    item->setSelected(false);
 }
index 3c8ed0a..97e5418 100644 (file)
     <bool>false</bool>
    </property>
    <property name="text">
-    <string>Install local files</string>
+    <string>Load .install file</string>
    </property>
   </action>
  </widget>
index 41e2a0e..fbc5bcc 100644 (file)
@@ -71,6 +71,7 @@ PackageSelector::PackageSelector(Package* pkg, AAptInterface* apt, Settings* set
                ui->radioTabBasic->setText("Info");
                ui->radioTabChanges->setText("Chgs");
                ui->radioTabDepends->setText("Deps");
+        ui->scrollAreaWidgetContents->setMaximumWidth( QApplication::desktop()->width() - 15 );
        }
 
        Package* upg_pkg = iPkg->availablePackage();
@@ -223,7 +224,7 @@ void PackageSelector::updateInfo()
        if( iPkg->isInstalled() && !iPkg->isUpgradeable() )
        {
                ui->radioInstall->setEnabled(false);
-               ui->radioInstall->hide();
+        ui->radioInstall->hide();
        } else if( !iPkg->isInstalled() ) {
                ui->radioRemove->setEnabled(false);
                ui->radioRemove->hide();
index 17c7dcd..5961620 100644 (file)
@@ -31,7 +31,7 @@
         <x>0</x>
         <y>0</y>
         <width>694</width>
-        <height>670</height>
+        <height>669</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout_2">
          <property name="text">
           <string/>
          </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
         </widget>
        </item>
        <item>
index 3ff9002..f334694 100644 (file)
@@ -1,20 +1,20 @@
 /*
-       This file is part of Faster Application Manager.
+    This file is part of Faster Application Manager.
 
-       Faster Application Manager is free software: you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation, either version 3 of the License, or
-       (at your option) any later version.
+    Faster Application Manager is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
 
-       Faster Application Manager is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
+    Faster Application Manager is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
 
-       You should have received a copy of the GNU General Public License
-       along with Faster Application Manager.  If not, see <http://www.gnu.org/licenses/>.
+    You should have received a copy of the GNU General Public License
+    along with Faster Application Manager.  If not, see <http://www.gnu.org/licenses/>.
 
-       (C) Heikki Holstila 2010
+    (C) Heikki Holstila 2010
 */
 
 #include "packageview.h"
 
 PackageListWidgetItem::PackageListWidgetItem(Package* p_, QString name_) : QListWidgetItem(name_)
 {
-       iPackage = p_;
+    iPackage = p_;
 }
 
 
 void ListItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
 {
-       //QTime t;
-       //t.start();
-
-       QString name = index.data(UserRoleName).toString();
-       QString version = index.data(UserRoleVersion).toString();
-       QString desc = index.data(UserRoleDescShort).toString();
-       Package::operation marked = (Package::operation) index.data(UserRoleMarked).toInt();
-       bool installed = index.data(UserRoleInstalled).toBool();
-       bool upgradeable = index.data(UserRoleUpgradeable).toBool();
-       int statfilter = index.data(UserRoleCurrentStatFilter).toInt();
-       int catfilter = index.data(UserRoleCurrentCatFilter).toInt();
-       QString upg_version = index.data(UserRoleAvailVersion).toString();
-       BlacklistSelect::blackList blacklisted = static_cast<BlacklistSelect::blackList>( index.data(UserRoleBlacklisted).toInt() );
-
-       painter->save();
-       QRect r = option.rect;
-
-       QLinearGradient gradientBase(r.topLeft(), r.bottomLeft());
-       QColor base = option.palette.color(QPalette::Window);
-       QColor base2 = base;
-       int r1=base.red()+15;
-       int g1=base.green()+15;
-       int b1=base.blue()+15;
-       if( r1>255 ) r1=255;
-       if( g1>255 ) g1=255;
-       if( b1>255 ) b1=255;
-       int r2=base2.red()-20;
-       int g2=base2.green()-20;
-       int b2=base2.blue()-20;
-       if( r2<0 ) r2=0;
-       if( g2<0 ) g2=0;
-       if( b2<0 ) b2=0;
-       base.setRgb( r1, g1, b1 );
-       base2.setRgb( r2, g2, b2 );
-       gradientBase.setColorAt(0, base);
-       gradientBase.setColorAt(1, base2);
-
-       painter->fillRect(r, gradientBase);
-       painter->drawLine(QPoint(r.left(),r.bottom()), QPoint(r.right(),r.bottom()));
-
-       QPixmap icon = index.data(Qt::DecorationRole).value<QPixmap>();
-       if( icon.isNull() ) {
-               // use default icon
-               painter->drawPixmap( r.left(), r.top()+4, 48, 48, iDefaultIcon );
-       } else {
-               painter->drawPixmap( r.left(), r.top()+4, 48, 48, icon );
-       }
-
-       QPixmap statusicon;
-       if( marked == Package::PkgOpNone )
-       {
-               if( installed && upgradeable )
-                       statusicon = iIconPkgNoOpInstalledUpgradeable;
-               else if( installed )
-                       statusicon = iIconPkgNoOpInstalled;
-               else if( !installed )
-                       statusicon = iIconPkgNoOpNotInstalled;
-       } else if( marked == Package::PkgOpInstallUpgrade ) {
-               if( upgradeable )
-                       statusicon = iIconPkgUpgrade;
-               else
-                       statusicon = iIconPkgInstall;
-       } else if( marked == Package::PkgOpRemove ) {
-               statusicon = iIconPkgRemove;
-       }
-
-       QString showVer;
-       if( upgradeable && (statfilter==Package::PkgStatUpgradeable ||
-                                               (statfilter==Package::PkgStatUnknown && marked==Package::PkgOpInstallUpgrade) ||
-                                               (catfilter==PackageView::CatFilterAllMarked && marked==Package::PkgOpInstallUpgrade) ))
-       {
-               showVer = upg_version;
-       } else {
-               showVer = version;
-       }
-
-       int ver_w = 0;
-       if( QApplication::desktop()->width() > QApplication::desktop()->height() )
-       {
-               r = option.rect;
-               r.setRight( r.right()-statusicon.width()-4 );
-
-               if( catfilter != PackageView::CatFilterBlacklisted ) {
-                       painter->drawText(r, Qt::AlignTop|Qt::AlignRight, showVer, &r);
-                       ver_w = r.width();
-               } else if( blacklisted==BlacklistSelect::BlacklistThis ) {
-                       if( upgradeable && !upg_version.isEmpty() ) {
-                               showVer = upg_version;
-                       } else {
-                               showVer = version;
-                       }
-                       painter->drawText(r, Qt::AlignTop|Qt::AlignRight, showVer, &r);
-                       ver_w = r.width();
-               }
-       }
-
-       r = option.rect;
-       r.setRight( r.right()-statusicon.width()-4-ver_w );  //does not work as it should?
-       QFont f = painter->font();
-       f.setBold(true);
-       painter->setFont(f);
-       painter->drawText(r.left()+iDefaultIcon.width()+2, r.top(), r.width(), r.height(), Qt::AlignTop|Qt::AlignLeft, name, &r);
-       f.setBold(false);
-       painter->setFont(f);
-
-       f.setPointSize( f.pointSize()-4 );
-       painter->setFont(f);
-       r = option.rect;
-       painter->drawText(r.left()+iDefaultIcon.width()+2, r.top(), r.width(), r.height(), Qt::AlignBottom|Qt::AlignLeft, desc, &r);
-
-       r = option.rect;
-       painter->drawPixmap(r.right()-statusicon.width()-2, r.top()+4, 24, 24, statusicon);
-
-       painter->restore();
-
-       //if( t.elapsed()>=100 )
-       //qDebug() << name << t.elapsed();
+    //QTime t;
+    //t.start();
+
+    QString name = index.data(UserRoleName).toString();
+    QString version = index.data(UserRoleVersion).toString();
+    QString desc = index.data(UserRoleDescShort).toString();
+    Package::operation marked = (Package::operation) index.data(UserRoleMarked).toInt();
+    bool installed = index.data(UserRoleInstalled).toBool();
+    bool upgradeable = index.data(UserRoleUpgradeable).toBool();
+    int statfilter = index.data(UserRoleCurrentStatFilter).toInt();
+    int catfilter = index.data(UserRoleCurrentCatFilter).toInt();
+    QString upg_version = index.data(UserRoleAvailVersion).toString();
+    BlacklistSelect::blackList blacklisted = static_cast<BlacklistSelect::blackList>( index.data(UserRoleBlacklisted).toInt() );
+
+    painter->save();
+    QRect r = option.rect;
+
+    QPixmap icon = index.data(Qt::DecorationRole).value<QPixmap>();
+    if( icon.isNull() ) {
+        // use default icon
+        painter->drawPixmap( r.left()+6, r.top()+10, 48, 48, iDefaultIcon );
+    } else {
+        painter->drawPixmap( r.left()+6, r.top()+10, 48, 48, icon );
+    }
+
+    QPixmap statusicon;
+    if( marked == Package::PkgOpNone )
+    {
+        if( installed && upgradeable )
+            statusicon = iIconPkgNoOpInstalledUpgradeable;
+        else if( installed )
+            statusicon = iIconPkgNoOpInstalled;
+        else if( !installed )
+            statusicon = iIconPkgNoOpNotInstalled;
+    } else if( marked == Package::PkgOpInstallUpgrade ) {
+        if( upgradeable )
+            statusicon = iIconPkgUpgrade;
+        else
+            statusicon = iIconPkgInstall;
+    } else if( marked == Package::PkgOpRemove ) {
+        statusicon = iIconPkgRemove;
+    }
+
+    QString showVer;
+    if( upgradeable && (statfilter==Package::PkgStatUpgradeable ||
+                        (statfilter==Package::PkgStatUnknown && marked==Package::PkgOpInstallUpgrade) ||
+                        (catfilter==PackageView::CatFilterAllMarked && marked==Package::PkgOpInstallUpgrade) ))
+    {
+        showVer = upg_version;
+    } else {
+        showVer = version;
+    }
+
+    int ver_w = 0;
+    if( QApplication::desktop()->width() > QApplication::desktop()->height() )
+    {
+        r = option.rect;
+        r.setTop( r.top()+6 );
+        r.setRight( r.right()-statusicon.width()-6 );
+
+        if( catfilter != PackageView::CatFilterBlacklisted ) {
+            painter->drawText(r, Qt::AlignTop|Qt::AlignRight, showVer, &r);
+            ver_w = r.width();
+        } else if( blacklisted==BlacklistSelect::BlacklistThis ) {
+            if( upgradeable && !upg_version.isEmpty() ) {
+                showVer = upg_version;
+            } else {
+                showVer = version;
+            }
+            painter->drawText(r, Qt::AlignTop|Qt::AlignRight, showVer, &r);
+            ver_w = r.width();
+        }
+    }
+
+    r = option.rect;
+    r.setRight( r.right()-statusicon.width()-4-ver_w );  //does not work as it should?
+    QFont f = painter->font();
+    painter->setFont(f);
+    painter->drawText(r.left()+iDefaultIcon.width()+2, r.top()+5, r.width(), r.height(), Qt::AlignTop|Qt::AlignLeft, name, &r);
+
+    f.setPointSize( f.pointSize()-4 );
+    painter->setFont(f);
+    r = option.rect;
+    QColor gray;
+    gray = QColor(156, 154, 156);
+    painter->save();
+    f.setPointSize(13);
+    painter->setFont(f);
+    painter->setPen(gray);
+    r.setBottom(r.bottom()-10);
+    painter->drawText(r.left()+iDefaultIcon.width()+2, r.top(), r.width(), r.height(), Qt::AlignBottom|Qt::AlignLeft, desc, &r);
+    painter->restore();
+
+    r = option.rect;
+    painter->drawPixmap(r.right()-statusicon.width()-2, r.top()+10, 24, 24, statusicon);
+
+    painter->restore();
+
+    //if( t.elapsed()>=100 )
+    //qDebug() << name << t.elapsed();
 }
 
 void ListItemDelegate::loadIcons()
 {
-       iDefaultIcon = QPixmap(":/icons/icons/appdefault.png");
-       iIconPkgInstall = QPixmap(":/icons/icons/pkg_install.png");
-       iIconPkgUpgrade = QPixmap(":/icons/icons/pkg_upgrade.png");
-       iIconPkgRemove = QPixmap(":/icons/icons/pkg_remove.png");
-       iIconPkgNoOpInstalled = QPixmap(":/icons/icons/pkg_nop_installed.png");
-       iIconPkgNoOpNotInstalled = QPixmap(":/icons/icons/pkg_nop_notinstalled.png");
-       iIconPkgNoOpInstalledUpgradeable = QPixmap(":/icons/icons/pkg_nop_instupgr.png");
+#ifdef Q_WS_MAEMO_5
+    iDefaultIcon = QPixmap("/usr/share/icons/hicolor/64x64/hildon/tasklaunch_default_application.png");
+#else
+    iDefaultIcon = QPixmap(":/icons/icons/appdefault.png");
+#endif
+    iIconPkgInstall = QPixmap(":/icons/icons/pkg_install.png");
+    iIconPkgUpgrade = QPixmap(":/icons/icons/pkg_upgrade.png");
+    iIconPkgRemove = QPixmap(":/icons/icons/pkg_remove.png");
+    iIconPkgNoOpInstalled = QPixmap(":/icons/icons/pkg_nop_installed.png");
+    iIconPkgNoOpNotInstalled = QPixmap(":/icons/icons/pkg_nop_notinstalled.png");
+    iIconPkgNoOpInstalledUpgradeable = QPixmap(":/icons/icons/pkg_nop_instupgr.png");
 }
 
 
 QSize ListItemDelegate::sizeHint(const QStyleOptionViewItem&, const QModelIndex&) const
 {
-       return QSize(400, 58);
+    return QSize(400, 70);
 }
 
 
 PackageView::PackageView(QWidget *parent) : QMainWindow(parent), ui(new Ui::PackageView)
 {
-       iMainWindow = dynamic_cast<MainWindow*>(parent);
-       ui->setupUi(this);
+    iMainWindow = dynamic_cast<MainWindow*>(parent);
+    ui->setupUi(this);
 #ifdef Q_WS_MAEMO_5
-       this->setAttribute(Qt::WA_Maemo5StackedWindow);
-       this->setWindowFlags(Qt::Window);
-       this->setAttribute(Qt::WA_Maemo5AutoOrientation);
+    this->setAttribute(Qt::WA_Maemo5StackedWindow);
+    this->setWindowFlags(Qt::Window);
+    this->setAttribute(Qt::WA_Maemo5AutoOrientation);
 #endif
-       iSettings = 0;
-       iAptInterface = 0;
-
-       connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
-
-       iCatFilterLabels
-                       << tr("All marked packages")    // a special case
-                       << tr("All user categories")
-                       << tr("\tDesktop")
-                       << tr("\tEducation")
-                       << tr("\tGames")
-                       << tr("\tGraphics")
-                       << tr("\tInternet & Networking")
-                       << tr("\tLocation & Navigation")
-                       << tr("\tMultimedia")
-                       << tr("\tOffice")
-                       << tr("\tOther")
-                       << tr("\tProgramming")
-                       << tr("\tScience")
-                       << tr("\tSystem")
-                       << tr("\tUtilities")
-                       << tr("All packages (ADVANCED)")
-                       << tr("Blacklisted packages");  // a special case
-
-       iCatFilterStrings
-                       << ""
-                       << "user/"
-                       << "user/desktop"
-                       << "user/education"
-                       << "user/games"
-                       << "user/graphics"
-                       << "user/network"
-                       << "user/navigation"
-                       << "user/multimedia"
-                       << "user/office"
-                       << "user/other"
-                       << "user/development"
-                       << "user/science"
-                       << "user/system"
-                       << "user/utilities"
-                       << ""
-                       << "";
-
-       iDefaultCatFilter = CatFilterAllUser;
-       iSelectedCatFilter = iDefaultCatFilter;
-
-       iStatFilterLabels
-                       << tr("All")
-                       << tr("Not installed")
-                       << tr("Upgradeable")
-                       << tr("Installed");
-
-       iSelectedStatFilter = Package::PkgStatUnknown;
-       iSortOrder = SortAlpha;
-
-       iDimmer = new dimmer(this);
-
-       ui->searchBar->hide();
-
-       iListCoverLabel = new QLabel(ui->listWidget);
-       iListCoverLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
-       iListCoverLabel->setAlignment(Qt::AlignCenter);
-
-       iKeyFilter = new KeyEventGrabber(this);
-       ui->listWidget->installEventFilter(iKeyFilter);
-
-       iSortNoticeShown = false;
-
-       iSearchPkgName = true;
-       iSearchDisplayName = true;
-       iSearchDescShort = true;
-       iSearchDescLong = false;
-
-       // fine-tune kinetic scrolling parameters
+    iSettings = 0;
+    iAptInterface = 0;
+
+    connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(orientationChanged()));
+
+    iCatFilterLabels
+            << tr("All marked packages")       // a special case
+            << tr("All user categories")
+            << tr("\tDesktop")
+            << tr("\tEducation")
+            << tr("\tGames")
+            << tr("\tGraphics")
+            << tr("\tInternet & Networking")
+            << tr("\tLocation & Navigation")
+            << tr("\tMultimedia")
+            << tr("\tOffice")
+            << tr("\tOther")
+            << tr("\tProgramming")
+            << tr("\tScience")
+            << tr("\tSystem")
+            << tr("\tUtilities")
+            << tr("All packages (ADVANCED)")
+            << tr("Blacklisted packages");     // a special case
+
+    iCatFilterStrings
+            << ""
+            << "user/"
+            << "user/desktop"
+            << "user/education"
+            << "user/games"
+            << "user/graphics"
+            << "user/network"
+            << "user/navigation"
+            << "user/multimedia"
+            << "user/office"
+            << "user/other"
+            << "user/development"
+            << "user/science"
+            << "user/system"
+            << "user/utilities"
+            << ""
+            << "";
+
+    iDefaultCatFilter = CatFilterAllUser;
+    iSelectedCatFilter = iDefaultCatFilter;
+
+    iStatFilterLabels
+            << tr("All")
+            << tr("Not installed")
+            << tr("Upgradeable")
+            << tr("Installed");
+
+    iSelectedStatFilter = Package::PkgStatUnknown;
+    iSortOrder = SortAlpha;
+
+    iDimmer = new dimmer(this);
+
+    ui->searchBar->hide();
+
+    iListCoverLabel = new QLabel(ui->listWidget);
+    iListCoverLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+    iListCoverLabel->setAlignment(Qt::AlignCenter);
+
+    iKeyFilter = new KeyEventGrabber(this);
+    ui->listWidget->installEventFilter(iKeyFilter);
+
+    iSortNoticeShown = false;
+
+    iSearchPkgName = true;
+    iSearchDisplayName = true;
+    iSearchDescShort = true;
+    iSearchDescLong = false;
+
+    // fine-tune kinetic scrolling parameters
 #ifdef Q_WS_MAEMO_5
-       QAbstractKineticScroller* listscroller = ui->listWidget->property("kineticScroller").value<QAbstractKineticScroller*>();
-       if( listscroller )
-       {
-               //qDebug() << listscroller->dragInertia() << listscroller->decelerationFactor()
-               //              << listscroller->minimumVelocity() << listscroller->maximumVelocity();
-               listscroller->setDecelerationFactor(0.75); // default is 0.85
-               listscroller->setDragInertia(0.60);     // default is 0.85
-               listscroller->setMaximumVelocity(1800); // default is 3500
-
-               // not good because it alse sets horizontal overshoot:
-               //listscroller->setOvershootPolicy( QAbstractKineticScroller::OvershootAlwaysOn );
-       }
+    QAbstractKineticScroller* listscroller = ui->listWidget->property("kineticScroller").value<QAbstractKineticScroller*>();
+    if( listscroller )
+    {
+        //qDebug() << listscroller->dragInertia() << listscroller->decelerationFactor()
+        //             << listscroller->minimumVelocity() << listscroller->maximumVelocity();
+        listscroller->setDecelerationFactor(0.75); // default is 0.85
+        listscroller->setDragInertia(0.60);    // default is 0.85
+        listscroller->setMaximumVelocity(1800); // default is 3500
+
+        // not good because it alse sets horizontal overshoot:
+        //listscroller->setOvershootPolicy( QAbstractKineticScroller::OvershootAlwaysOn );
+    }
 #endif
 }
 
 PackageView::~PackageView()
 {
-       delete iListCoverLabel; iListCoverLabel=0;
-       delete iKeyFilter; iKeyFilter=0;
-       delete iDimmer; iDimmer=0;
-       delete ui; ui=0;
+    delete iListCoverLabel; iListCoverLabel=0;
+    delete iKeyFilter; iKeyFilter=0;
+    delete iDimmer; iDimmer=0;
+    delete ui; ui=0;
 }
 
 void PackageView::orientationChanged()
 {
-       ui->listWidget->scroll(1,1);    // this causes all items to be repainted
-       iListCoverLabel->setGeometry( ui->listWidget->rect() );
+    ui->listWidget->scroll(1,1);       // this causes all items to be repainted
+    iListCoverLabel->setGeometry( ui->listWidget->rect() );
 }
 
 void PackageView::resizeEvent(QResizeEvent* event)
 {
-       if( iDimmer ) {
-               iDimmer->resize( this->size() );
-       }
+    if( iDimmer ) {
+        iDimmer->resize( this->size() );
+    }
 
-       iListCoverLabel->setGeometry( ui->listWidget->rect() );
-       QWidget::resizeEvent(event);
+    iListCoverLabel->setGeometry( ui->listWidget->rect() );
+    QWidget::resizeEvent(event);
 }
 
 bool PackageView::doFilterCategory(Package* pkg)
 {
-       if( pkg->section()=="user/hidden" && iSelectedStatFilter!=Package::PkgStatInstalled && iSelectedStatFilter!=Package::PkgStatUnknown )
-               return false;
-       if( pkg->section()=="user/hidden" && !pkg->isInstalled() )
-               return false;
-
-       Package* upg_pkg = pkg->availablePackage();
-
-       if( iSelectedStatFilter==Package::PkgStatUpgradeable && iSelectedCatFilter!=CatFilterBlacklisted &&
-               pkg->isUpgradeable() && upg_pkg && upg_pkg->isBlacklisted() )
-               return false;
-
-       if( pkg->isBlacklisted() || (upg_pkg && upg_pkg->isBlacklisted()) )
-       {
-               if( iSelectedCatFilter == CatFilterBlacklisted )
-                       return true;
-               if( pkg->isInstalled() && (iSelectedStatFilter==Package::PkgStatInstalled || iSelectedStatFilter==Package::PkgStatUnknown) )
-                       return true;
-               if( pkg->isBlacklisted() && iSelectedCatFilter != CatFilterBlacklisted )
-                       return false;
-       } else if( !pkg->isBlacklisted() && iSelectedCatFilter == CatFilterBlacklisted )
-               return false;
-
-       if( iSelectedCatFilter==CatFilterAllMarked ) {
-               if( pkg->isMarkedForOperation() )
-                       return true;
-               else
-                       return false;
-       }
-       if( pkg->section().startsWith( iCatFilterStrings.at(iSelectedCatFilter) ) )
-               return true;
-
-       return false;
+    if( pkg->section()=="user/hidden" && iSelectedStatFilter!=Package::PkgStatInstalled && iSelectedStatFilter!=Package::PkgStatUnknown )
+        return false;
+    if( pkg->section()=="user/hidden" && !pkg->isInstalled() )
+        return false;
+
+    Package* upg_pkg = pkg->availablePackage();
+
+    if( iSelectedStatFilter==Package::PkgStatUpgradeable && iSelectedCatFilter!=CatFilterBlacklisted &&
+        pkg->isUpgradeable() && upg_pkg && upg_pkg->isBlacklisted() )
+        return false;
+
+    if( pkg->isBlacklisted() || (upg_pkg && upg_pkg->isBlacklisted()) )
+    {
+        if( iSelectedCatFilter == CatFilterBlacklisted )
+            return true;
+        if( pkg->isInstalled() && (iSelectedStatFilter==Package::PkgStatInstalled || iSelectedStatFilter==Package::PkgStatUnknown) )
+            return true;
+        if( pkg->isBlacklisted() && iSelectedCatFilter != CatFilterBlacklisted )
+            return false;
+    } else if( !pkg->isBlacklisted() && iSelectedCatFilter == CatFilterBlacklisted )
+        return false;
+
+    if( iSelectedCatFilter==CatFilterAllMarked ) {
+        if( pkg->isMarkedForOperation() )
+            return true;
+        else
+            return false;
+    }
+    if( pkg->section().startsWith( iCatFilterStrings.at(iSelectedCatFilter) ) )
+        return true;
+
+    return false;
 }
 
 QString PackageView::generateSortString(Package* pkg)
 {
-       QString sortstr;
-
-       if( iSortOrder==SortAlpha ) {
-               sortstr = pkg->displayName();
-       }
-       else if( iSortOrder==SortDateDesc ) {
-               Package* upg = 0;
-               if( pkg->isUpgradeable() )
-                       upg = pkg->availablePackage();
-
-               if( (!upg && pkg->date().isValid()) || iSelectedStatFilter==Package::PkgStatInstalled )
-                       sortstr = pkg->date().toString("yyyy-MM-dd hh:mm:ss");
-               else if( upg && upg->date().isValid() ) {
-                       sortstr = upg->date().toString("yyyy-MM-dd hh:mm:ss");
-               } else {
-                       sortstr = "";
-                       iPackagesEmptySort++;
-               }
-       }
-       else if( iSortOrder==SortSizeDesc ) {
-               if( pkg->isInstalled() )
-                       sortstr = QString("%1").arg(pkg->installedSize()*1024, 12 );
-               else
-                       sortstr = QString("%1").arg(pkg->size(), 12 );
-       }
-
-       //qDebug() << sortstr;
-
-       return sortstr;
+    QString sortstr;
+
+    if( iSortOrder==SortAlpha ) {
+        sortstr = pkg->displayName();
+    }
+    else if( iSortOrder==SortDateDesc ) {
+        Package* upg = 0;
+        if( pkg->isUpgradeable() )
+            upg = pkg->availablePackage();
+
+        if( (!upg && pkg->date().isValid()) || iSelectedStatFilter==Package::PkgStatInstalled )
+            sortstr = pkg->date().toString("yyyy-MM-dd hh:mm:ss");
+        else if( upg && upg->date().isValid() ) {
+            sortstr = upg->date().toString("yyyy-MM-dd hh:mm:ss");
+        } else {
+            sortstr = "";
+            iPackagesEmptySort++;
+        }
+    }
+    else if( iSortOrder==SortSizeDesc ) {
+        if( pkg->isInstalled() )
+            sortstr = QString("%1").arg(pkg->installedSize()*1024, 12 );
+        else
+            sortstr = QString("%1").arg(pkg->size(), 12 );
+    }
+
+    //qDebug() << sortstr;
+
+    return sortstr;
 }
 
 void PackageView::openWin()
 {
-       ui->listWidget->clear();
-       ui->listWidget->setSortingEnabled(true);
-       iPackagesEmptySort = 0;
-
-       if( !isVisible() ) {
-               iMainWindow->busyDialog(false);
-               iListCoverLabel->setText("Loading...");
-               iListCoverLabel->setAutoFillBackground(true);
-               iListCoverLabel->show();
-               show();
-               QApplication::processEvents();
-       }
-
-       if( iSortOrder==SortDateDesc || iSortOrder==SortSizeDesc )
-               ui->listWidget->sortItems(Qt::DescendingOrder);
-       else
-               ui->listWidget->sortItems(Qt::AscendingOrder);
-
-       delete ui->listWidget->itemDelegate();
-       ListItemDelegate* delegate = new ListItemDelegate(ui->listWidget);
-       delegate->loadIcons();
-       ui->listWidget->setItemDelegate( delegate );
-
-       if( !ui->searchBar->isVisible() )
-       {
-               if( iSelectedStatFilter == Package::PkgStatNotInstalled || iSelectedStatFilter == Package::PkgStatUnknown ||
-                       iSelectedCatFilter == CatFilterAllMarked || iSelectedCatFilter == CatFilterBlacklisted )
-               {
-                       QHashIterator<QString, Package*> i( *iAptInterface->packagesAvailable() );
-                       while (i.hasNext())
-                       {
-                               i.next();
-                               Package* inst = iAptInterface->packagesInstalled()->value(i.value()->name(),0);
-                               if( doFilterCategory(i.value()) && !inst )
-                                       addListItem(i.value(), generateSortString(i.value()));
-                       }
-               }
-               if( iSelectedStatFilter == Package::PkgStatInstalled || iSelectedStatFilter == Package::PkgStatUpgradeable ||
-                       iSelectedStatFilter == Package::PkgStatUnknown || iSelectedCatFilter == CatFilterAllMarked ||
-                       iSelectedCatFilter == CatFilterBlacklisted )
-               {
-                       QHashIterator<QString, Package*> i( *iAptInterface->packagesInstalled() );
-                       while (i.hasNext())
-                       {
-                               i.next();
-                               if( iSelectedStatFilter == Package::PkgStatUpgradeable && iSelectedCatFilter != CatFilterBlacklisted ) {
-                                       if( i.value()->isUpgradeable() && doFilterCategory(i.value()) )
-                                               addListItem(i.value(), generateSortString(i.value()));
-                               } else {
-                                       if( doFilterCategory(i.value()) )
-                                               addListItem(i.value(), generateSortString(i.value()));
-                               }
-                       }
-               }
-       } else {
-               for( int j=0; j<iSearchResults.count(); j++ )
-               {
-                       addListItem(iSearchResults.at(j), generateSortString( iSearchResults.at(j) ));
-               }
-       }
-
-       iListCoverLabel->hide();
-       iListCoverLabel->setAutoFillBackground(false);
-
-       updateLabel();
-
-       if( iSelectedStatFilter==Package::PkgStatUpgradeable && ui->listWidget->count()>0 &&
-               iSelectedCatFilter != CatFilterAllMarked && iSelectedCatFilter != CatFilterBlacklisted )
-       {
-               ui->actionUpgrade_all->setVisible(true);
-       } else {
-               ui->actionUpgrade_all->setVisible(false);
-       }
-
-       if( iSelectedCatFilter == CatFilterBlacklisted && ui->listWidget->count()>0 ) {
-               ui->actionRestore_all->setVisible(true);
-       } else {
-               ui->actionRestore_all->setVisible(false);
-       }
-
-       if( iSelectedStatFilter==Package::PkgStatInstalled ) {
-               ui->actionStore_list->setVisible(true);
-       } else {
-               ui->actionStore_list->setVisible(false);
-       }
-
-       show();
-
-       if( !ui->searchBar->isVisible() ) {
-               ui->listWidget->setFocusPolicy(Qt::StrongFocus);
-               ui->listWidget->setFocus();
-       } else {
-               ui->listWidget->setFocusPolicy(Qt::NoFocus);
-               ui->lineEdit->setFocus();
-       }
-
-       if( ui->listWidget->count() == 0 )
-       {
-               iListCoverLabel->setGeometry( ui->listWidget->rect() );
-               iListCoverLabel->setText("No packages");
-               iListCoverLabel->show();
-       }
-
-       if( ui->listWidget->count()>1 && iPackagesEmptySort == ui->listWidget->count() && !iSortNoticeShown ) {
-               ConfirmDialog d(false, this);
-               QString msg = "No shown packages currently have the required information for sorting by this criterion. The list is unsorted.";
-               if( iSortOrder == SortDateDesc && !iSettings->qsettings()->value("fetch_dates",false).toBool() )
-                       msg += " You can enable date fetching in the options menu.";
-               d.setText("Notice", msg);
-               d.exec();
-               iSortNoticeShown = true;
-       }
+    ui->listWidget->clear();
+    ui->listWidget->setSortingEnabled(true);
+    iPackagesEmptySort = 0;
+
+    if( !isVisible() ) {
+        iMainWindow->busyDialog(false);
+        iListCoverLabel->setText("Loading...");
+        iListCoverLabel->setAutoFillBackground(true);
+        iListCoverLabel->show();
+        show();
+        QApplication::processEvents();
+    }
+
+    if( iSortOrder==SortDateDesc || iSortOrder==SortSizeDesc )
+        ui->listWidget->sortItems(Qt::DescendingOrder);
+    else
+        ui->listWidget->sortItems(Qt::AscendingOrder);
+
+    delete ui->listWidget->itemDelegate();
+    ListItemDelegate* delegate = new ListItemDelegate(ui->listWidget);
+    delegate->loadIcons();
+    ui->listWidget->setItemDelegate( delegate );
+
+    if( !ui->searchBar->isVisible() )
+    {
+        if( iSelectedStatFilter == Package::PkgStatNotInstalled || iSelectedStatFilter == Package::PkgStatUnknown ||
+            iSelectedCatFilter == CatFilterAllMarked || iSelectedCatFilter == CatFilterBlacklisted )
+        {
+            QHashIterator<QString, Package*> i( *iAptInterface->packagesAvailable() );
+            while (i.hasNext())
+            {
+                i.next();
+                Package* inst = iAptInterface->packagesInstalled()->value(i.value()->name(),0);
+                if( doFilterCategory(i.value()) && !inst )
+                    addListItem(i.value(), generateSortString(i.value()));
+            }
+        }
+        if( iSelectedStatFilter == Package::PkgStatInstalled || iSelectedStatFilter == Package::PkgStatUpgradeable ||
+            iSelectedStatFilter == Package::PkgStatUnknown || iSelectedCatFilter == CatFilterAllMarked ||
+            iSelectedCatFilter == CatFilterBlacklisted )
+        {
+            QHashIterator<QString, Package*> i( *iAptInterface->packagesInstalled() );
+            while (i.hasNext())
+            {
+                i.next();
+                if( iSelectedStatFilter == Package::PkgStatUpgradeable && iSelectedCatFilter != CatFilterBlacklisted ) {
+                    if( i.value()->isUpgradeable() && doFilterCategory(i.value()) )
+                        addListItem(i.value(), generateSortString(i.value()));
+                } else {
+                    if( doFilterCategory(i.value()) )
+                        addListItem(i.value(), generateSortString(i.value()));
+                }
+            }
+        }
+    } else {
+        for( int j=0; j<iSearchResults.count(); j++ )
+        {
+            addListItem(iSearchResults.at(j), generateSortString( iSearchResults.at(j) ));
+        }
+    }
+
+    iListCoverLabel->hide();
+    iListCoverLabel->setAutoFillBackground(false);
+
+    updateLabel();
+
+    if( iSelectedStatFilter==Package::PkgStatUpgradeable && ui->listWidget->count()>0 &&
+        iSelectedCatFilter != CatFilterAllMarked && iSelectedCatFilter != CatFilterBlacklisted )
+    {
+        ui->actionUpgrade_all->setVisible(true);
+    } else {
+        ui->actionUpgrade_all->setVisible(false);
+    }
+
+    if( iSelectedCatFilter == CatFilterBlacklisted && ui->listWidget->count()>0 ) {
+        ui->actionRestore_all->setVisible(true);
+    } else {
+        ui->actionRestore_all->setVisible(false);
+    }
+
+    if( iSelectedStatFilter==Package::PkgStatInstalled ) {
+        ui->actionStore_list->setVisible(true);
+    } else {
+        ui->actionStore_list->setVisible(false);
+    }
+
+    show();
+
+    if( !ui->searchBar->isVisible() ) {
+        ui->listWidget->setFocusPolicy(Qt::StrongFocus);
+        ui->listWidget->setFocus();
+    } else {
+        ui->listWidget->setFocusPolicy(Qt::NoFocus);
+        ui->lineEdit->setFocus();
+    }
+
+    if( ui->listWidget->count() == 0 )
+    {
+        iListCoverLabel->setGeometry( ui->listWidget->rect() );
+        iListCoverLabel->setText("No packages");
+        iListCoverLabel->show();
+    }
+
+    if( ui->listWidget->count()>1 && iPackagesEmptySort == ui->listWidget->count() && !iSortNoticeShown ) {
+        ConfirmDialog d(false, this);
+        QString msg = "No shown packages currently have the required information for sorting by this criterion. The list is unsorted.";
+        if( iSortOrder == SortDateDesc && !iSettings->qsettings()->value("fetch_dates",false).toBool() )
+            msg += " You can enable date fetching in the options menu.";
+        d.setText("Notice", msg);
+        d.exec();
+        iSortNoticeShown = true;
+    }
 }
 
 void PackageView::enableMenu()
 {
-       ui->menuMenu->setEnabled(true);
+    ui->menuMenu->setEnabled(true);
 }
 
 void PackageView::disableMenu()
 {
-       ui->menuMenu->setEnabled(false);
+    ui->menuMenu->setEnabled(false);
 }
 
 void PackageView::addListItem(Package* pkg_, QString listname_)
 {
-       PackageListWidgetItem* p = new PackageListWidgetItem( pkg_, listname_ );
-
-       if( pkg_ != 0 )
-       {
-               QString name = pkg_->name();
-               if( !pkg_->maemoDisplayName().isEmpty() )
-                       name = pkg_->maemoDisplayName();
-               p->setData(UserRoleName, name);
-       } else {
-               p->setData(UserRoleName, listname_);
-       }
-
-       if( pkg_ != 0 )
-       {
-               p->setData(UserRoleDescShort, pkg_->descShort());
-               p->setData(UserRoleVersion, pkg_->version());
-               p->setData(UserRoleMarked, static_cast<int>(pkg_->markedOperation()) );
-               p->setData(UserRoleInstalled, pkg_->isInstalled());
-               p->setData(UserRoleUpgradeable, pkg_->isUpgradeable());
-               p->setData(UserRoleAvailVersion, pkg_->upgradeableVersion());
-               p->setData(UserRoleCurrentStatFilter, iSelectedStatFilter);
-               p->setData(UserRoleCurrentCatFilter, iSelectedCatFilter);
-
-               if( pkg_->availablePackage() )
-                       p->setData(UserRoleBlacklisted, static_cast<int>(pkg_->availablePackage()->blacklisted()) );
-               else
-                       p->setData(UserRoleBlacklisted, static_cast<int>(pkg_->blacklisted()) );
-
-               //qDebug() << pkg_->name();
-
-               pkg_->convertIcon();
-               p->setData(Qt::DecorationRole, *pkg_->icon());
-       }
-       ui->listWidget->addItem( p );
+    PackageListWidgetItem* p = new PackageListWidgetItem( pkg_, listname_ );
+
+    if( pkg_ != 0 )
+    {
+        QString name = pkg_->name();
+        if( !pkg_->maemoDisplayName().isEmpty() )
+            name = pkg_->maemoDisplayName();
+        p->setData(UserRoleName, name);
+    } else {
+        p->setData(UserRoleName, listname_);
+    }
+
+    if( pkg_ != 0 )
+    {
+        p->setData(UserRoleDescShort, pkg_->descShort());
+        p->setData(UserRoleVersion, pkg_->version());
+        p->setData(UserRoleMarked, static_cast<int>(pkg_->markedOperation()) );
+        p->setData(UserRoleInstalled, pkg_->isInstalled());
+        p->setData(UserRoleUpgradeable, pkg_->isUpgradeable());
+        p->setData(UserRoleAvailVersion, pkg_->upgradeableVersion());
+        p->setData(UserRoleCurrentStatFilter, iSelectedStatFilter);
+        p->setData(UserRoleCurrentCatFilter, iSelectedCatFilter);
+
+        if( pkg_->availablePackage() )
+            p->setData(UserRoleBlacklisted, static_cast<int>(pkg_->availablePackage()->blacklisted()) );
+        else
+            p->setData(UserRoleBlacklisted, static_cast<int>(pkg_->blacklisted()) );
+
+        //qDebug() << pkg_->name();
+
+        pkg_->convertIcon();
+        p->setData(Qt::DecorationRole, *pkg_->icon());
+    }
+    ui->listWidget->addItem( p );
 }
 
 void PackageView::closeEvent(QCloseEvent *event)
 {
-       if( !iAptInterface ) {
-               resetWindow();
-               event->accept();
-       }
-
-       if( iDimmer->busy() )
-       {
-               iAptInterface->cancel();
-               event->ignore();
-               return;
-       }
-
-       if( iAptInterface->numSelectedPackages() == 0 )
-       {               
-               resetWindow();
-               event->accept();
-       } else {
-               QString c;
-               c.setNum( iAptInterface->numSelectedPackages() );
-               ConfirmDialog d(true, this);
-               d.setText("Returning to main menu", QString("Clear %1 package selection(s) and lose all the pending changes?").arg(iAptInterface->numSelectedPackages()));
-               if( d.exec() ) {
-                       resetWindow();
-                       event->accept();
-               } else {
-                       event->ignore();
-               }
-       }
+    if( !iAptInterface ) {
+        resetWindow();
+        event->accept();
+    }
+
+    if( iDimmer->busy() )
+    {
+        iAptInterface->cancel();
+        event->ignore();
+        return;
+    }
+
+    if( iAptInterface->numSelectedPackages() == 0 )
+    {
+        resetWindow();
+        event->accept();
+    } else {
+        QString c;
+        c.setNum( iAptInterface->numSelectedPackages() );
+        ConfirmDialog d(true, this);
+        d.setText("Returning to main menu", QString("Clear %1 package selection(s) and lose all the pending changes?").arg(iAptInterface->numSelectedPackages()));
+        if( d.exec() ) {
+            resetWindow();
+            event->accept();
+        } else {
+            event->ignore();
+        }
+    }
 }
 
 void PackageView::changeEvent(QEvent *e)
@@ -579,341 +566,341 @@ void PackageView::changeEvent(QEvent *e)
 
 void PackageView::on_btn_Commit_clicked()
 {
-       QStringList pkgnames;
-
-       QHashIterator<QString, Package*> i( *iAptInterface->packagesAvailable() );
-       while (i.hasNext())
-       {
-               i.next();
-
-               if( i.value()->markedOperation() == Package::PkgOpInstallUpgrade )
-                       pkgnames << i.value()->name();
-               if( i.value()->markedOperation() == Package::PkgOpRemove ) {
-                       qDebug() << "warning: trying to add package marked from the wrong list";
-                       //pkgnames << i.value()->name() + "-";
-               }
-       }
-
-       QHashIterator<QString, Package*> r( *iAptInterface->packagesInstalled() );
-       while (r.hasNext())
-       {
-               r.next();
-
-               if( r.value()->markedOperation() == Package::PkgOpInstallUpgrade )
-                       pkgnames << r.value()->name();
-               if( r.value()->markedOperation() == Package::PkgOpRemove )
-                       pkgnames << r.value()->name() + "-";
-       }
-
-       iMainWindow->busyDialog(true, "Operation in progress", "Reading dependencies");
-
-       iAptInterface->setProcessPackages(pkgnames);
-       iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetSimulate);
-       iAptInterface->run(iDimmer);
+    QStringList pkgnames;
+
+    QHashIterator<QString, Package*> i( *iAptInterface->packagesAvailable() );
+    while (i.hasNext())
+    {
+        i.next();
+
+        if( i.value()->markedOperation() == Package::PkgOpInstallUpgrade )
+            pkgnames << i.value()->name();
+        if( i.value()->markedOperation() == Package::PkgOpRemove ) {
+            qDebug() << "warning: trying to add package marked from the wrong list";
+            //pkgnames << i.value()->name() + "-";
+        }
+    }
+
+    QHashIterator<QString, Package*> r( *iAptInterface->packagesInstalled() );
+    while (r.hasNext())
+    {
+        r.next();
+
+        if( r.value()->markedOperation() == Package::PkgOpInstallUpgrade )
+            pkgnames << r.value()->name();
+        if( r.value()->markedOperation() == Package::PkgOpRemove )
+            pkgnames << r.value()->name() + "-";
+    }
+
+    iMainWindow->busyDialog(true, "Operation in progress", "Reading dependencies");
+
+    iAptInterface->setProcessPackages(pkgnames);
+    iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetSimulate);
+    iAptInterface->run(iDimmer);
 }
 
 void PackageView::on_actionClear_selections_triggered()
 {
-       QString c;
-       c.setNum( iAptInterface->numSelectedPackages() );
-       ConfirmDialog d(true, this);
-       d.setText(tr("Confirmation"), tr("Clear ") + c + tr(" package selection(s) and lose all the pending changes?"));
-       if( d.exec() )
-       {
-               clearSelections();
-               openWin();
-       }
+    QString c;
+    c.setNum( iAptInterface->numSelectedPackages() );
+    ConfirmDialog d(true, this);
+    d.setText(tr("Confirmation"), tr("Clear ") + c + tr(" package selection(s) and lose all the pending changes?"));
+    if( d.exec() )
+    {
+        clearSelections();
+        openWin();
+    }
 }
 
 void PackageView::clearSelections()
 {
-       QHashIterator<QString, Package*> i( *iAptInterface->packagesInstalled() );
-       while (i.hasNext())
-       {
-               i.next();
-               i.value()->setMarkedForOperation(Package::PkgOpNone);
-       }
-       QHashIterator<QString, Package*> a( *iAptInterface->packagesAvailable() );
-       while (a.hasNext())
-       {
-               a.next();
-               a.value()->setMarkedForOperation(Package::PkgOpNone);
-       }
-       iAptInterface->setNumSelectedPackages(0);
+    QHashIterator<QString, Package*> i( *iAptInterface->packagesInstalled() );
+    while (i.hasNext())
+    {
+        i.next();
+        i.value()->setMarkedForOperation(Package::PkgOpNone);
+    }
+    QHashIterator<QString, Package*> a( *iAptInterface->packagesAvailable() );
+    while (a.hasNext())
+    {
+        a.next();
+        a.value()->setMarkedForOperation(Package::PkgOpNone);
+    }
+    iAptInterface->setNumSelectedPackages(0);
 }
 
 void PackageView::on_listWidget_itemClicked(QListWidgetItem* item)
 {
-       Package* pkg = dynamic_cast<PackageListWidgetItem*>(item)->package();
-       if( !pkg )
-               return;
-
-       bool bl = pkg->isBlacklisted();
-       bool bl_u = false;
-
-       Package* upg_pkg = pkg->availablePackage();
-       if( upg_pkg )
-               bl_u = upg_pkg->isBlacklisted();
-
-       PackageSelector s(pkg, iAptInterface, iSettings, iMainWindow, this);
-       s.exec();
-       Package::operation op = s.selectedOperation();
-
-       QStringList confl = pkg->checkConflicts_RichText();
-       if( confl.count() > 0 && op != Package::PkgOpNone ) {
-               ConfirmDialog d(true, this);
-               QString t = "Package " + pkg->name() + " conflicts with another installed or marked package. Mark anyway?";
-               t += "<font size=\"-1\"><br><br>Conflicts: ";
-               t += confl.join(", ");
-               t += "</font>";
-               d.setText("Conflicting packages", t);
-               if( !d.exec() )
-                       op = Package::PkgOpNone;
-       }
-
-       if( pkg->isPinned() && op != Package::PkgOpNone ) {
-               ConfirmDialog d(true, this);
-               d.setText("Warning","Package has been pinned in apt preferences. Operation might not go as expected. Mark anyway?");
-               if( !d.exec() )
-                       op = Package::PkgOpNone;
-       }
-
-       pkg->setMarkedForOperation( op );
-       item->setData( UserRoleMarked, (int)op );
-       updateLabel();
-
-       if( pkg->isBlacklisted() != bl ) {
-               openWin();
-       }
-       else if( upg_pkg && upg_pkg->isBlacklisted() != bl_u ) {
-               openWin();
-       }
+    Package* pkg = dynamic_cast<PackageListWidgetItem*>(item)->package();
+    if( !pkg )
+        return;
+
+    bool bl = pkg->isBlacklisted();
+    bool bl_u = false;
+
+    Package* upg_pkg = pkg->availablePackage();
+    if( upg_pkg )
+        bl_u = upg_pkg->isBlacklisted();
+
+    PackageSelector s(pkg, iAptInterface, iSettings, iMainWindow, this);
+    s.exec();
+    Package::operation op = s.selectedOperation();
+
+    QStringList confl = pkg->checkConflicts_RichText();
+    if( confl.count() > 0 && op != Package::PkgOpNone ) {
+        ConfirmDialog d(true, this);
+        QString t = "Package " + pkg->name() + " conflicts with another installed or marked package. Mark anyway?";
+        t += "<font size=\"-1\"><br><br>Conflicts: ";
+        t += confl.join(", ");
+        t += "</font>";
+        d.setText("Conflicting packages", t);
+        if( !d.exec() )
+            op = Package::PkgOpNone;
+    }
+
+    if( pkg->isPinned() && op != Package::PkgOpNone ) {
+        ConfirmDialog d(true, this);
+        d.setText("Warning","Package has been pinned in apt preferences. Operation might not go as expected. Mark anyway?");
+        if( !d.exec() )
+            op = Package::PkgOpNone;
+    }
+
+    pkg->setMarkedForOperation( op );
+    item->setData( UserRoleMarked, (int)op );
+    updateLabel();
+
+    if( pkg->isBlacklisted() != bl ) {
+        openWin();
+    }
+    else if( upg_pkg && upg_pkg->isBlacklisted() != bl_u ) {
+        openWin();
+    }
 }
 
 void PackageView::updateLabel()
 {
-       QString s;
-       s.setNum( iAptInterface->numSelectedPackages() );
-       QString s2;
-       s2.setNum( ui->listWidget->count() );
-       QString statlabel = iStatFilterLabels.at(iSelectedStatFilter);
-       if( iSelectedCatFilter == CatFilterAllMarked || iSelectedCatFilter == CatFilterBlacklisted )
-               statlabel = "All";
-       ui->label->setText("<font size=\"-2\"><b>" + s + "</b> package(s) marked<br>"
-                                          + "Showing: <b>" + statlabel + "</b><br>"
-                                          + "Filter: " + iCatFilterLabels.at(iSelectedCatFilter) + " - " + s2 + " package(s)</font>");
-
-       if( iAptInterface->numSelectedPackages()==0 ) {
-               ui->btn_Commit->setEnabled(false);
-               ui->actionClear_selections->setVisible(false);
-               ui->actionSave_selections->setVisible(false);
-       } else {
-               ui->btn_Commit->setEnabled(true);
-               ui->actionClear_selections->setVisible(true);
-               ui->actionSave_selections->setVisible(true);
-       }
+    QString s;
+    s.setNum( iAptInterface->numSelectedPackages() );
+    QString s2;
+    s2.setNum( ui->listWidget->count() );
+    QString statlabel = iStatFilterLabels.at(iSelectedStatFilter);
+    if( iSelectedCatFilter == CatFilterAllMarked || iSelectedCatFilter == CatFilterBlacklisted )
+        statlabel = "All";
+    ui->label->setText("<font size=\"-2\"><b>" + s + "</b> package(s) marked<br>"
+                       + "Showing: <b>" + statlabel + "</b><br>"
+                       + "Filter: " + iCatFilterLabels.at(iSelectedCatFilter) + " - " + s2 + " package(s)</font>");
+
+    if( iAptInterface->numSelectedPackages()==0 ) {
+        ui->btn_Commit->setEnabled(false);
+        ui->actionClear_selections->setVisible(false);
+        ui->actionSave_selections->setVisible(false);
+    } else {
+        ui->btn_Commit->setEnabled(true);
+        ui->actionClear_selections->setVisible(true);
+        ui->actionSave_selections->setVisible(true);
+    }
 }
 
 void PackageView::on_btn_CategoryFilter_clicked()
 {
-       FilterSelect f("Category filter", this);
-       f.setList( iCatFilterLabels, iSelectedCatFilter );
-
-       bool s = f.exec();
-
-       if( s )
-               iSelectedCatFilter = f.selection();
-
-       if( iSelectedCatFilter == CatFilterAllMarked || iSelectedCatFilter == CatFilterBlacklisted ) {
-               ui->btn_StatusFilter->setEnabled(false);
-       } else {
-               ui->btn_StatusFilter->setEnabled(true);
-       }
-
-       if( s ) {
-               iListCoverLabel->setText("Loading...");
-               iListCoverLabel->setAutoFillBackground(true);
-               iListCoverLabel->show();
-               QApplication::processEvents();
-               iSortNoticeShown = false;
-
-               openWin();
-
-               if( iSelectedCatFilter==CatFilterBlacklisted && iAptInterface->needListOrDateRefresh() )
-               {
-                       ConfirmDialog d(false, this);
-                       d.setText("Notice","Since you don't have all package lists currently loaded, not all blacklisted "
-                                         "packages are necessarily shown");
-                       d.exec();
-               }
-       }
+    FilterSelect f("Category filter", this);
+    f.setList( iCatFilterLabels, iSelectedCatFilter );
+
+    bool s = f.exec();
+
+    if( s )
+        iSelectedCatFilter = f.selection();
+
+    if( iSelectedCatFilter == CatFilterAllMarked || iSelectedCatFilter == CatFilterBlacklisted ) {
+        ui->btn_StatusFilter->setEnabled(false);
+    } else {
+        ui->btn_StatusFilter->setEnabled(true);
+    }
+
+    if( s ) {
+        iListCoverLabel->setText("Loading...");
+        iListCoverLabel->setAutoFillBackground(true);
+        iListCoverLabel->show();
+        QApplication::processEvents();
+        iSortNoticeShown = false;
+
+        openWin();
+
+        if( iSelectedCatFilter==CatFilterBlacklisted && iAptInterface->needListOrDateRefresh() )
+        {
+            ConfirmDialog d(false, this);
+            d.setText("Notice","Since you don't have all package lists currently loaded, not all blacklisted "
+                      "packages are necessarily shown");
+            d.exec();
+        }
+    }
 }
 
 void PackageView::setStatFilter(Package::packageStatus f_)
 {
-       iSelectedStatFilter = f_;
+    iSelectedStatFilter = f_;
 }
 
 void PackageView::on_btn_StatusFilter_clicked()
 {
-       FilterSelect f("Status filter", this);
-       f.setList( iStatFilterLabels, iSelectedStatFilter );
+    FilterSelect f("Status filter", this);
+    f.setList( iStatFilterLabels, iSelectedStatFilter );
 
-       int oldfilter = iSelectedStatFilter;
+    int oldfilter = iSelectedStatFilter;
 
-       bool s = f.exec();
+    bool s = f.exec();
 
-       if( s ) {
-               iSelectedStatFilter = (Package::packageStatus)f.selection();
+    if( s ) {
+        iSelectedStatFilter = (Package::packageStatus)f.selection();
 
-               iListCoverLabel->setText("Loading...");
-               iListCoverLabel->setAutoFillBackground(true);
-               iListCoverLabel->show();
-               QApplication::processEvents();
-               iSortNoticeShown = false;
+        iListCoverLabel->setText("Loading...");
+        iListCoverLabel->setAutoFillBackground(true);
+        iListCoverLabel->show();
+        QApplication::processEvents();
+        iSortNoticeShown = false;
 
-               openWin();
+        openWin();
 
-               if( oldfilter==Package::PkgStatInstalled && iSelectedStatFilter!=Package::PkgStatInstalled &&
-                       iAptInterface->needListOrDateRefresh() )
-               {
-                       iMainWindow->openNetworkConnection();
+        if( oldfilter==Package::PkgStatInstalled && iSelectedStatFilter!=Package::PkgStatInstalled &&
+            iAptInterface->needListOrDateRefresh() )
+        {
+            iMainWindow->openNetworkConnection();
 
-                       iMainWindow->setNextOperation(MainWindow::OpOpenPkgView);
-                       iMainWindow->busyDialog(true,"Operation in progress","Reading the rest of the package lists");
+            iMainWindow->setNextOperation(MainWindow::OpOpenPkgView);
+            iMainWindow->busyDialog(true,"Operation in progress","Reading the rest of the package lists");
 
-                       if( iAptInterface->needRepoRefresh() && !iSettings->qsettings()->value("no_catalogs_autoupdate",false).toBool() )
-                               iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
+            if( iAptInterface->needRepoRefresh() && !iSettings->qsettings()->value("no_catalogs_autoupdate",false).toBool() )
+                iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
 
-                       iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
-                       iAptInterface->addQueuedOperation(AAptInterface::ModeFetchDates);
-                       iAptInterface->run(iDimmer);
-               }
-       }
+            iAptInterface->addQueuedOperation(AAptInterface::ModeReadPackages);
+            iAptInterface->addQueuedOperation(AAptInterface::ModeFetchDates);
+            iAptInterface->run(iDimmer);
+        }
+    }
 }
 
 void PackageView::resetWindow()
 {
-       iAptInterface->writeBlacklist();
+    iAptInterface->writeBlacklist();
 
-       ui->btn_StatusFilter->setEnabled(true);
-       iSelectedCatFilter = iDefaultCatFilter;
-       //iSortOrder = SortAlpha;
-       iSortNoticeShown = false;
+    ui->btn_StatusFilter->setEnabled(true);
+    iSelectedCatFilter = iDefaultCatFilter;
+    //iSortOrder = SortAlpha;
+    iSortNoticeShown = false;
 
-       clearSelections();
-       clearSearch();
+    clearSelections();
+    clearSearch();
 }
 
 void PackageView::on_actionHelp_triggered()
 {
-       Help h(this);
-       h.exec();
+    Help h(this);
+    h.exec();
 }
 
 void PackageView::on_btn_searchClose_clicked()
 {
-       clearSearch();
+    clearSearch();
 
-       iListCoverLabel->setText("Loading...");
-       iListCoverLabel->setAutoFillBackground(true);
-       iListCoverLabel->show();
-       QApplication::processEvents();
+    iListCoverLabel->setText("Loading...");
+    iListCoverLabel->setAutoFillBackground(true);
+    iListCoverLabel->show();
+    QApplication::processEvents();
 
-       openWin();
+    openWin();
 }
 
 void PackageView::clearSearch()
 {
-       ui->lineEdit->clear();
-       ui->searchBar->hide();
-       ui->toolBar->show();
-       ui->listWidget->setFocusPolicy(Qt::StrongFocus);
+    ui->lineEdit->clear();
+    ui->searchBar->hide();
+    ui->toolBar->show();
+    ui->listWidget->setFocusPolicy(Qt::StrongFocus);
 
-       iSearchResults.clear();
+    iSearchResults.clear();
 }
 
 void PackageView::on_actionSearch_triggered()
 {
-       if( ui->searchBar->isVisible() )
-               return;
-
-       ui->listWidget->setFocusPolicy(Qt::NoFocus);
-       ui->searchLabel->setText( QString("%1 results").arg(ui->listWidget->count()) );
-       ui->toolBar->hide();
-       ui->searchBar->show();
-       ui->lineEdit->setFocus();
-       iPrevSearchText = "";
+    if( ui->searchBar->isVisible() )
+        return;
+
+    ui->listWidget->setFocusPolicy(Qt::NoFocus);
+    ui->searchLabel->setText( QString("%1 results").arg(ui->listWidget->count()) );
+    ui->toolBar->hide();
+    ui->searchBar->show();
+    ui->lineEdit->setFocus();
+    iPrevSearchText = "";
 }
 
 void PackageView::on_lineEdit_textEdited(QString text)
 {
-       if( !ui->searchBar->isVisible() )
-               return;
-
-       if( text.isEmpty() ) {
-               on_btn_searchClose_clicked();
-               return;
-       }
-
-       if( iPrevSearchText.length() > text.length() )
-       {
-               iListCoverLabel->setText("Loading...");
-               iListCoverLabel->setAutoFillBackground(true);
-               iListCoverLabel->show();
-               QApplication::processEvents();
-
-               ui->searchBar->hide();
-               openWin();
-               ui->searchBar->show();
-               ui->toolBar->hide(); // ensure it stays hidden
-               ui->lineEdit->setFocus();
-       }
-
-       iPrevSearchText = text;
-
-       QList<Package*> packages;
-       iSearchResults.clear();
-
-       for( int i=0; i<(ui->listWidget->count()); i++ ) {
-               packages.append( dynamic_cast<PackageListWidgetItem*>( ui->listWidget->item(i) )->package() );
-       }
-
-       if( text.startsWith(":") ) {
-               for( int i=0; i<packages.count(); i++ ) {
-                       if( packages.at(i) ) {
-                               if( (iSearchPkgName && packages.at(i)->name().startsWith(text.mid(1), Qt::CaseInsensitive)) ||
-                                       (iSearchDisplayName && packages.at(i)->displayName().startsWith(text.mid(1), Qt::CaseInsensitive)) ||
-                                       (iSearchDescShort && packages.at(i)->descShort().startsWith(text.mid(1), Qt::CaseInsensitive)) ||
-                                       (iSearchDescLong && packages.at(i)->descLong().startsWith(text.mid(1), Qt::CaseInsensitive)) )
-                               {
-                                       iSearchResults.append( packages.at(i) );
-                               }
-                       }
-               }
-       } else {
-               for( int i=0; i<packages.count(); i++ ) {
-                       if( packages.at(i) ) {
-                               if( (iSearchPkgName && packages.at(i)->name().contains(text, Qt::CaseInsensitive)) ||
-                                       (iSearchDisplayName && packages.at(i)->displayName().contains(text, Qt::CaseInsensitive)) ||
-                                       (iSearchDescShort && packages.at(i)->descShort().contains(text, Qt::CaseInsensitive)) ||
-                                       (iSearchDescLong && packages.at(i)->descLong().contains(text, Qt::CaseInsensitive)) )
-                               {
-                                       iSearchResults.append( packages.at(i) );
-                               }
-                       }
-               }
-       }
-
-       ui->searchLabel->setText( QString("%1 results").arg( iSearchResults.count()) );
-
-       openWin();
+    if( !ui->searchBar->isVisible() )
+        return;
+
+    if( text.isEmpty() ) {
+        on_btn_searchClose_clicked();
+        return;
+    }
+
+    if( iPrevSearchText.length() > text.length() )
+    {
+        iListCoverLabel->setText("Loading...");
+        iListCoverLabel->setAutoFillBackground(true);
+        iListCoverLabel->show();
+        QApplication::processEvents();
+
+        ui->searchBar->hide();
+        openWin();
+        ui->searchBar->show();
+        ui->toolBar->hide(); // ensure it stays hidden
+        ui->lineEdit->setFocus();
+    }
+
+    iPrevSearchText = text;
+
+    QList<Package*> packages;
+    iSearchResults.clear();
+
+    for( int i=0; i<(ui->listWidget->count()); i++ ) {
+        packages.append( dynamic_cast<PackageListWidgetItem*>( ui->listWidget->item(i) )->package() );
+    }
+
+    if( text.startsWith(":") ) {
+        for( int i=0; i<packages.count(); i++ ) {
+            if( packages.at(i) ) {
+                if( (iSearchPkgName && packages.at(i)->name().startsWith(text.mid(1), Qt::CaseInsensitive)) ||
+                    (iSearchDisplayName && packages.at(i)->displayName().startsWith(text.mid(1), Qt::CaseInsensitive)) ||
+                    (iSearchDescShort && packages.at(i)->descShort().startsWith(text.mid(1), Qt::CaseInsensitive)) ||
+                    (iSearchDescLong && packages.at(i)->descLong().startsWith(text.mid(1), Qt::CaseInsensitive)) )
+                {
+                    iSearchResults.append( packages.at(i) );
+                }
+            }
+        }
+    } else {
+        for( int i=0; i<packages.count(); i++ ) {
+            if( packages.at(i) ) {
+                if( (iSearchPkgName && packages.at(i)->name().contains(text, Qt::CaseInsensitive)) ||
+                    (iSearchDisplayName && packages.at(i)->displayName().contains(text, Qt::CaseInsensitive)) ||
+                    (iSearchDescShort && packages.at(i)->descShort().contains(text, Qt::CaseInsensitive)) ||
+                    (iSearchDescLong && packages.at(i)->descLong().contains(text, Qt::CaseInsensitive)) )
+                {
+                    iSearchResults.append( packages.at(i) );
+                }
+            }
+        }
+    }
+
+    ui->searchLabel->setText( QString("%1 results").arg( iSearchResults.count()) );
+
+    openWin();
 }
 
 void PackageView::setSearchText(QString text)
 {
-       ui->lineEdit->setText(text);
-       on_lineEdit_textEdited(text);
+    ui->lineEdit->setText(text);
+    on_lineEdit_textEdited(text);
 }
 
 KeyEventGrabber::KeyEventGrabber(QObject* parent) : QObject(parent)
@@ -922,354 +909,354 @@ KeyEventGrabber::KeyEventGrabber(QObject* parent) : QObject(parent)
 
 bool KeyEventGrabber::eventFilter(QObject *obj, QEvent *event)
 {
-       if( event->type() == QEvent::KeyPress ) {
-               QString text = dynamic_cast<QKeyEvent*>(event)->text();
-               int key = dynamic_cast<QKeyEvent*>(event)->key();
-               if( (text.trimmed() != "" || text==" ") && key!=Qt::Key_Backspace ) {
-                       dynamic_cast<PackageView*>(this->parent())->on_actionSearch_triggered();
-                       dynamic_cast<PackageView*>(this->parent())->setSearchText( text );
-                       return true;
-               }
-       }
-       return QObject::eventFilter(obj, event);
+    if( event->type() == QEvent::KeyPress ) {
+        QString text = dynamic_cast<QKeyEvent*>(event)->text();
+        int key = dynamic_cast<QKeyEvent*>(event)->key();
+        if( (text.trimmed() != "" || text==" ") && key!=Qt::Key_Backspace ) {
+            dynamic_cast<PackageView*>(this->parent())->on_actionSearch_triggered();
+            dynamic_cast<PackageView*>(this->parent())->setSearchText( text );
+            return true;
+        }
+    }
+    return QObject::eventFilter(obj, event);
 }
 
 void PackageView::on_pushButton_searchOptions_clicked()
 {
-       SearchOptions s(this);
-       s.setSelections(iSearchPkgName, iSearchDisplayName, iSearchDescShort, iSearchDescLong);
-       if( s.exec() )
-       {
-               iSearchPkgName = s.searchPkgName();
-               iSearchDisplayName = s.searchDisplayName();
-               iSearchDescShort = s.searchDescShort();
-               iSearchDescLong = s.searchDescLong();
-
-               iPrevSearchText += " ";
-               on_lineEdit_textEdited( ui->lineEdit->text() );
-       }
+    SearchOptions s(this);
+    s.setSelections(iSearchPkgName, iSearchDisplayName, iSearchDescShort, iSearchDescLong);
+    if( s.exec() )
+    {
+        iSearchPkgName = s.searchPkgName();
+        iSearchDisplayName = s.searchDisplayName();
+        iSearchDescShort = s.searchDescShort();
+        iSearchDescLong = s.searchDescLong();
+
+        iPrevSearchText += " ";
+        on_lineEdit_textEdited( ui->lineEdit->text() );
+    }
 }
 
 void PackageView::setSearchOptions(bool pkgname, bool dispname, bool dshort, bool dlong)
 {
-       iSearchPkgName = pkgname;
-       iSearchDisplayName = dispname;
-       iSearchDescShort = dshort;
-       iSearchDescLong = dlong;
+    iSearchPkgName = pkgname;
+    iSearchDisplayName = dispname;
+    iSearchDescShort = dshort;
+    iSearchDescLong = dlong;
 }
 
 void PackageView::on_actionUpgrade_all_triggered()
 {
-       for( int i=0; i<ui->listWidget->count(); i++ )
-       {
-               Package* pkg = dynamic_cast<PackageListWidgetItem*>(ui->listWidget->item(i))->package();
-               if( pkg && pkg->isUpgradeable() ) {
-                       pkg->setMarkedForOperation( Package::PkgOpInstallUpgrade );
-                       ui->listWidget->item(i)->setData(UserRoleMarked, (int)Package::PkgOpInstallUpgrade);
-               }
-       }
-       updateLabel();
+    for( int i=0; i<ui->listWidget->count(); i++ )
+    {
+        Package* pkg = dynamic_cast<PackageListWidgetItem*>(ui->listWidget->item(i))->package();
+        if( pkg && pkg->isUpgradeable() ) {
+            pkg->setMarkedForOperation( Package::PkgOpInstallUpgrade );
+            ui->listWidget->item(i)->setData(UserRoleMarked, (int)Package::PkgOpInstallUpgrade);
+        }
+    }
+    updateLabel();
 }
 
 void PackageView::on_actionView_log_triggered()
 {
-       QByteArray log = iAptInterface->readLogFile();
-       LogView l(log, this);
-       l.exec();
+    QByteArray log = iAptInterface->readLogFile();
+    LogView l(log, this);
+    l.exec();
 }
 
 void PackageView::on_btn_Sort_clicked()
 {
-       SortSelector s(iSortOrder, this);
-       if( s.exec() ) {
-               iSortOrder = s.selectedOperation();
-               iSortNoticeShown = false;
-               openWin();
-       }
+    SortSelector s(iSortOrder, this);
+    if( s.exec() ) {
+        iSortOrder = s.selectedOperation();
+        iSortNoticeShown = false;
+        openWin();
+    }
 }
 
 void PackageView::on_actionLoad_selections_triggered()
 {
-       if( iAptInterface->numSelectedPackages() > 0 ) {
-               ConfirmDialog d(true, this);
-               d.setText("Confirmation", "Proceed loading selections? All current selections will be cleared.");
-               if( !d.exec() )
-                       return;
-       }
-
-       QString filename = QFileDialog::getOpenFileName(this, "Open selections list", KDefaultUserOpenSaveDir, "Selection lists (*.slist)");
-       if( filename.isNull() || filename.isEmpty() )
-               return;
-
-       clearSelections();
-
-       QStringList unknownList;
-       QStringList wrongverList;
-       QStringList wrongstatusList;
-       int success=0;
-       int errors=0;
-
-       QFile f( filename );
-       if( f.open(QIODevice::ReadOnly | QIODevice::Text ) )
-       {
-               while(!f.atEnd()) {
-                       QString line = f.readLine().trimmed();
-                       QStringList parts = line.split(' ');
-                       if( parts.count()==3 ) {
-                               Package* pkgAv = iAptInterface->packagesAvailable()->value(parts.at(0),0);
-                               Package* pkgIn = iAptInterface->packagesInstalled()->value(parts.at(0),0);
-                               if( parts.at(2)=="install" ) {
-                                       if( !pkgAv && !pkgIn ) {
-                                               unknownList << parts.at(0);
-                                       }
-                                       else if( pkgIn ) {
-                                               wrongstatusList << parts.at(0);
-                                       }
-                                       else if( pkgAv ) {
-                                               if( !pkgAv->isInstalled() )
-                                               {
-                                                       pkgAv->setMarkedForOperation(Package::PkgOpInstallUpgrade);
-                                                       success++;
-                                                       if( pkgAv->version() != parts.at(1) ) {
-                                                               wrongverList << parts.at(0);
-                                                       }
-                                               } else {
-                                                       wrongstatusList << parts.at(0);
-                                               }
-                                       }
-
-                               } else if( parts.at(2)=="upgrade" ) {
-                                       if( !pkgAv && !pkgIn ) {
-                                               unknownList << parts.at(0);
-                                       }
-                                       else if( (pkgAv && !pkgIn) || (pkgIn && !pkgAv) ) {
-                                               wrongstatusList << parts.at(0);
-                                       }
-                                       else if( pkgIn && pkgAv ) {
-                                               if( pkgIn->isInstalled() && pkgIn->isUpgradeable() )
-                                               {
-                                                       pkgIn->setMarkedForOperation(Package::PkgOpInstallUpgrade);
-                                                       success++;
-                                                       if( pkgIn->version() != parts.at(1) ) {
-                                                               wrongverList << parts.at(0);
-                                                       }
-                                               } else {
-                                                       wrongstatusList << parts.at(0);
-                                               }
-                                       }
-
-                               } else if( parts.at(2)=="remove" ) {
-                                       if( !pkgAv && !pkgIn ) {
-                                               unknownList << parts.at(0);
-                                       }
-                                       else if( pkgAv && !pkgIn ) {
-                                               wrongstatusList << parts.at(0);
-                                       }
-                                       else if( pkgIn ) {
-                                               if( pkgIn->isInstalled() )
-                                               {
-                                                       pkgIn->setMarkedForOperation(Package::PkgOpRemove);
-                                                       success++;
-                                                       if( pkgIn->version() != parts.at(1) ) {
-                                                               wrongverList << parts.at(0);
-                                                       }
-                                               } else {
-                                                       wrongstatusList << parts.at(0);
-                                               }
-                                       }
-                               } else {
-                                       errors++;
-                               }
-                       } else if( !line.isEmpty() ){
-                               errors++;
-                       }
-               }
-               f.close();
-       }
-
-       ConfirmDialog d(false, this);
-       QString msg;
-       msg += QString("<b>%1 successful</b><br>").arg(success);
-
-       if( wrongverList.count() > 0 ) {
-               msg += QString("%1 version mismatches (selected anyway):<br>").arg(wrongverList.count());
-               msg += "<font size=\"-1\">";
-               for( int i=0; i<wrongverList.count(); i++ ) {
-                       msg += wrongverList.at(i) + " ";
-               }
-               msg += "</font><br>";
-       }
-
-       if( wrongstatusList.count() > 0 ) {
-               msg += QString("%1 status mismatches (packages ignored):<br>").arg(wrongstatusList.count());
-               msg += "<font size=\"-1\">";
-               for( int i=0; i<wrongstatusList.count(); i++ ) {
-                       msg += wrongstatusList.at(i) + " ";
-               }
-               msg += "</font><br>";
-       }
-
-       if( unknownList.count() > 0 ) {
-               msg += QString("%1 unknown packages:<br>").arg(unknownList.count());
-               msg += "<font size=\"-1\">";
-               for( int i=0; i<unknownList.count(); i++ ) {
-                       msg += unknownList.at(i) + " ";
-               }
-               msg += "</font><br>";
-       }
-
-       if( errors>0 || (wrongstatusList.count()==0 && unknownList.count()==0) ) {
-               msg += QString("%1 errors<br>").arg(errors);
-       }
-       if( success==0 && wrongstatusList.count()==0 && unknownList.count()==0 )
-               msg = "No stored selections";
-       QString title;
-       if( success > 0 )
-               title = "Selections loaded";
-       else
-               title = "No selections loaded";
-       d.setText(title, msg);
-       d.exec();
-
-       if( unknownList.count()>0 && iAptInterface->needListOrDateRefresh() )
-       {
-               ConfirmDialog f(false, this);
-               f.setText("About Unknown packages","You encountered unknown packages. You might want to try "
-                                 "loading the selections again after loading the full package lists (by selecting install or upgrade view)");
-               f.exec();
-       }
-
-       if( success > 0 ) {
-               ui->btn_StatusFilter->setEnabled(false);
-               iSelectedCatFilter = CatFilterAllMarked;
-       }
-       openWin();
+    if( iAptInterface->numSelectedPackages() > 0 ) {
+        ConfirmDialog d(true, this);
+        d.setText("Confirmation", "Proceed loading selections? All current selections will be cleared.");
+        if( !d.exec() )
+            return;
+    }
+
+    QString filename = QFileDialog::getOpenFileName(this, "Open selections list", KDefaultUserOpenSaveDir, "Selection lists (*.slist)");
+    if( filename.isNull() || filename.isEmpty() )
+        return;
+
+    clearSelections();
+
+    QStringList unknownList;
+    QStringList wrongverList;
+    QStringList wrongstatusList;
+    int success=0;
+    int errors=0;
+
+    QFile f( filename );
+    if( f.open(QIODevice::ReadOnly | QIODevice::Text ) )
+    {
+        while(!f.atEnd()) {
+            QString line = f.readLine().trimmed();
+            QStringList parts = line.split(' ');
+            if( parts.count()==3 ) {
+                Package* pkgAv = iAptInterface->packagesAvailable()->value(parts.at(0),0);
+                Package* pkgIn = iAptInterface->packagesInstalled()->value(parts.at(0),0);
+                if( parts.at(2)=="install" ) {
+                    if( !pkgAv && !pkgIn ) {
+                        unknownList << parts.at(0);
+                    }
+                    else if( pkgIn ) {
+                        wrongstatusList << parts.at(0);
+                    }
+                    else if( pkgAv ) {
+                        if( !pkgAv->isInstalled() )
+                        {
+                            pkgAv->setMarkedForOperation(Package::PkgOpInstallUpgrade);
+                            success++;
+                            if( pkgAv->version() != parts.at(1) ) {
+                                wrongverList << parts.at(0);
+                            }
+                        } else {
+                            wrongstatusList << parts.at(0);
+                        }
+                    }
+
+                } else if( parts.at(2)=="upgrade" ) {
+                    if( !pkgAv && !pkgIn ) {
+                        unknownList << parts.at(0);
+                    }
+                    else if( (pkgAv && !pkgIn) || (pkgIn && !pkgAv) ) {
+                        wrongstatusList << parts.at(0);
+                    }
+                    else if( pkgIn && pkgAv ) {
+                        if( pkgIn->isInstalled() && pkgIn->isUpgradeable() )
+                        {
+                            pkgIn->setMarkedForOperation(Package::PkgOpInstallUpgrade);
+                            success++;
+                            if( pkgIn->version() != parts.at(1) ) {
+                                wrongverList << parts.at(0);
+                            }
+                        } else {
+                            wrongstatusList << parts.at(0);
+                        }
+                    }
+
+                } else if( parts.at(2)=="remove" ) {
+                    if( !pkgAv && !pkgIn ) {
+                        unknownList << parts.at(0);
+                    }
+                    else if( pkgAv && !pkgIn ) {
+                        wrongstatusList << parts.at(0);
+                    }
+                    else if( pkgIn ) {
+                        if( pkgIn->isInstalled() )
+                        {
+                            pkgIn->setMarkedForOperation(Package::PkgOpRemove);
+                            success++;
+                            if( pkgIn->version() != parts.at(1) ) {
+                                wrongverList << parts.at(0);
+                            }
+                        } else {
+                            wrongstatusList << parts.at(0);
+                        }
+                    }
+                } else {
+                    errors++;
+                }
+            } else if( !line.isEmpty() ){
+                errors++;
+            }
+        }
+        f.close();
+    }
+
+    ConfirmDialog d(false, this);
+    QString msg;
+    msg += QString("<b>%1 successful</b><br>").arg(success);
+
+    if( wrongverList.count() > 0 ) {
+        msg += QString("%1 version mismatches (selected anyway):<br>").arg(wrongverList.count());
+        msg += "<font size=\"-1\">";
+        for( int i=0; i<wrongverList.count(); i++ ) {
+            msg += wrongverList.at(i) + " ";
+        }
+        msg += "</font><br>";
+    }
+
+    if( wrongstatusList.count() > 0 ) {
+        msg += QString("%1 status mismatches (packages ignored):<br>").arg(wrongstatusList.count());
+        msg += "<font size=\"-1\">";
+        for( int i=0; i<wrongstatusList.count(); i++ ) {
+            msg += wrongstatusList.at(i) + " ";
+        }
+        msg += "</font><br>";
+    }
+
+    if( unknownList.count() > 0 ) {
+        msg += QString("%1 unknown packages:<br>").arg(unknownList.count());
+        msg += "<font size=\"-1\">";
+        for( int i=0; i<unknownList.count(); i++ ) {
+            msg += unknownList.at(i) + " ";
+        }
+        msg += "</font><br>";
+    }
+
+    if( errors>0 || (wrongstatusList.count()==0 && unknownList.count()==0) ) {
+        msg += QString("%1 errors<br>").arg(errors);
+    }
+    if( success==0 && wrongstatusList.count()==0 && unknownList.count()==0 )
+        msg = "No stored selections";
+    QString title;
+    if( success > 0 )
+        title = "Selections loaded";
+    else
+        title = "No selections loaded";
+    d.setText(title, msg);
+    d.exec();
+
+    if( unknownList.count()>0 && iAptInterface->needListOrDateRefresh() )
+    {
+        ConfirmDialog f(false, this);
+        f.setText("About Unknown packages","You encountered unknown packages. You might want to try "
+                  "loading the selections again after loading the full package lists (by selecting install or upgrade view)");
+        f.exec();
+    }
+
+    if( success > 0 ) {
+        ui->btn_StatusFilter->setEnabled(false);
+        iSelectedCatFilter = CatFilterAllMarked;
+    }
+    openWin();
 }
 
 void PackageView::on_actionSave_selections_triggered()
 {
-       if( iAptInterface->numSelectedPackages() == 0 )
-               return;
-
-       QString filename = QFileDialog::getSaveFileName(this, "Save selections to...", KDefaultUserOpenSaveDir, "Selection lists (*.slist)");
-       if( filename.isNull() || filename.isEmpty() )
-               return;
-
-       if( !filename.endsWith(".slist") )
-               filename.append(".slist");
-
-       QFile f( filename );
-       bool fail = false;
-       int count = 0;
-       if( f.open(QIODevice::WriteOnly | QIODevice::Text) )
-       {
-               QTextStream out(&f);
-
-               QHashIterator<QString, Package*> i( *iAptInterface->packagesAvailable() );
-               while (i.hasNext())
-               {
-                       i.next();
-
-                       if( i.value()->markedOperation() == Package::PkgOpInstallUpgrade ) {
-                               out << i.value()->name() << " " << i.value()->version() << " install\n";
-                               count++;
-                       }
-                       if( i.value()->markedOperation() == Package::PkgOpRemove )
-                               qDebug() << "Warning: package is marked for removal in the wrong list";
-               }
-
-               QHashIterator<QString, Package*> r( *iAptInterface->packagesInstalled() );
-               while (r.hasNext())
-               {
-                       r.next();
-
-                       if( r.value()->markedOperation() == Package::PkgOpInstallUpgrade ) {
-                               out << r.value()->name() << " " << r.value()->version() << " upgrade\n";
-                               count++;
-                       }
-                       if( r.value()->markedOperation() == Package::PkgOpRemove ) {
-                               out << r.value()->name() << " " << r.value()->version() << " remove\n";
-                               count++;
-                       }
-               }
-
-               f.close();
-       } else {
-               fail = true;
-       }
-
-       ConfirmDialog d(false, this);
-       if( fail )
-               d.setText( "Error", "Failed to write package selections" );
-       else
-               d.setText( "Selections stored", QString("Stored %1 selections").arg(count) );
-       d.exec();
+    if( iAptInterface->numSelectedPackages() == 0 )
+        return;
+
+    QString filename = QFileDialog::getSaveFileName(this, "Save selections to...", KDefaultUserOpenSaveDir, "Selection lists (*.slist)");
+    if( filename.isNull() || filename.isEmpty() )
+        return;
+
+    if( !filename.endsWith(".slist") )
+        filename.append(".slist");
+
+    QFile f( filename );
+    bool fail = false;
+    int count = 0;
+    if( f.open(QIODevice::WriteOnly | QIODevice::Text) )
+    {
+        QTextStream out(&f);
+
+        QHashIterator<QString, Package*> i( *iAptInterface->packagesAvailable() );
+        while (i.hasNext())
+        {
+            i.next();
+
+            if( i.value()->markedOperation() == Package::PkgOpInstallUpgrade ) {
+                out << i.value()->name() << " " << i.value()->version() << " install\n";
+                count++;
+            }
+            if( i.value()->markedOperation() == Package::PkgOpRemove )
+                qDebug() << "Warning: package is marked for removal in the wrong list";
+        }
+
+        QHashIterator<QString, Package*> r( *iAptInterface->packagesInstalled() );
+        while (r.hasNext())
+        {
+            r.next();
+
+            if( r.value()->markedOperation() == Package::PkgOpInstallUpgrade ) {
+                out << r.value()->name() << " " << r.value()->version() << " upgrade\n";
+                count++;
+            }
+            if( r.value()->markedOperation() == Package::PkgOpRemove ) {
+                out << r.value()->name() << " " << r.value()->version() << " remove\n";
+                count++;
+            }
+        }
+
+        f.close();
+    } else {
+        fail = true;
+    }
+
+    ConfirmDialog d(false, this);
+    if( fail )
+        d.setText( "Error", "Failed to write package selections" );
+    else
+        d.setText( "Selections stored", QString("Stored %1 selections").arg(count) );
+    d.exec();
 }
 
 void PackageView::on_actionRestore_all_triggered()
 {
-       ConfirmDialog d(true, this);
-       d.setText("Confirmation","Restore all shown blacklisted packages?");
-       if( !d.exec() )
-               return;
-
-       for( int i=0; i<ui->listWidget->count(); i++ )
-       {
-               Package* pkg = dynamic_cast<PackageListWidgetItem*>(ui->listWidget->item(i))->package();
-               Package* p1 = iAptInterface->packagesInstalled()->value(pkg->name(),0);
-               Package* p2 = iAptInterface->packagesAvailable()->value(pkg->name(),0);
-               if( p1 && p1->isBlacklisted() ) {
-                       BlacklistSelect::blackList old = p1->blacklisted();
-                       p1->setBlacklisted(BlacklistSelect::BlacklistNone);
-                       iAptInterface->removeFromBlacklist(p1, old);
-               }
-               if( p2 && p2->isBlacklisted() ) {
-                       BlacklistSelect::blackList old = p2->blacklisted();
-                       p2->setBlacklisted(BlacklistSelect::BlacklistNone);
-                       iAptInterface->removeFromBlacklist(p2, old);
-               }
-       }
-       iAptInterface->writeBlacklist();
-       openWin();
+    ConfirmDialog d(true, this);
+    d.setText("Confirmation","Restore all shown blacklisted packages?");
+    if( !d.exec() )
+        return;
+
+    for( int i=0; i<ui->listWidget->count(); i++ )
+    {
+        Package* pkg = dynamic_cast<PackageListWidgetItem*>(ui->listWidget->item(i))->package();
+        Package* p1 = iAptInterface->packagesInstalled()->value(pkg->name(),0);
+        Package* p2 = iAptInterface->packagesAvailable()->value(pkg->name(),0);
+        if( p1 && p1->isBlacklisted() ) {
+            BlacklistSelect::blackList old = p1->blacklisted();
+            p1->setBlacklisted(BlacklistSelect::BlacklistNone);
+            iAptInterface->removeFromBlacklist(p1, old);
+        }
+        if( p2 && p2->isBlacklisted() ) {
+            BlacklistSelect::blackList old = p2->blacklisted();
+            p2->setBlacklisted(BlacklistSelect::BlacklistNone);
+            iAptInterface->removeFromBlacklist(p2, old);
+        }
+    }
+    iAptInterface->writeBlacklist();
+    openWin();
 }
 
 void PackageView::on_actionStore_list_triggered()
 {
-       QString filename = QFileDialog::getSaveFileName(this, "Save application list to...", KDefaultUserOpenSaveDir, "Selection lists (*.slist)");
-       if( filename.isNull() || filename.isEmpty() )
-               return;
-
-       if( !filename.endsWith(".slist") )
-               filename.append(".slist");
-
-       QFile f( filename );
-       bool fail = false;
-       int count = 0;
-       if( f.open(QIODevice::WriteOnly | QIODevice::Text) )
-       {
-               QTextStream out(&f);
-
-               QHashIterator<QString, Package*> r( *iAptInterface->packagesInstalled() );
-               while (r.hasNext())
-               {
-                       r.next();
-
-                       if( r.value()->isInstalled() && r.value()->section().startsWith("user/") ) {
-                               out << r.value()->name() << " " << r.value()->version() << " install\n";
-                               count++;
-                       }
-               }
-
-               f.close();
-       } else {
-               fail = true;
-       }
-
-       ConfirmDialog d(false, this);
-       if( fail )
-               d.setText( "Error", "Failed to write application list" );
-       else
-               d.setText( "List stored", QString("Stored %1 selections.").arg(count) + "<br>"
-                                  "The list can be used to restore removed applications later." );
-       d.exec();
+    QString filename = QFileDialog::getSaveFileName(this, "Save application list to...", KDefaultUserOpenSaveDir, "Selection lists (*.slist)");
+    if( filename.isNull() || filename.isEmpty() )
+        return;
+
+    if( !filename.endsWith(".slist") )
+        filename.append(".slist");
+
+    QFile f( filename );
+    bool fail = false;
+    int count = 0;
+    if( f.open(QIODevice::WriteOnly | QIODevice::Text) )
+    {
+        QTextStream out(&f);
+
+        QHashIterator<QString, Package*> r( *iAptInterface->packagesInstalled() );
+        while (r.hasNext())
+        {
+            r.next();
+
+            if( r.value()->isInstalled() && r.value()->section().startsWith("user/") ) {
+                out << r.value()->name() << " " << r.value()->version() << " install\n";
+                count++;
+            }
+        }
+
+        f.close();
+    } else {
+        fail = true;
+    }
+
+    ConfirmDialog d(false, this);
+    if( fail )
+        d.setText( "Error", "Failed to write application list" );
+    else
+        d.setText( "List stored", QString("Stored %1 selections.").arg(count) + "<br>"
+                   "The list can be used to restore removed applications later." );
+    d.exec();
 }
index ceee151..88131dd 100644 (file)
@@ -1,20 +1,20 @@
 /*
-       This file is part of Faster Application Manager.
+    This file is part of Faster Application Manager.
 
-       Faster Application Manager is free software: you can redistribute it and/or modify
-       it under the terms of the GNU General Public License as published by
-       the Free Software Foundation, either version 3 of the License, or
-       (at your option) any later version.
+    Faster Application Manager is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
 
-       Faster Application Manager is distributed in the hope that it will be useful,
-       but WITHOUT ANY WARRANTY; without even the implied warranty of
-       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-       GNU General Public License for more details.
+    Faster Application Manager is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
 
-       You should have received a copy of the GNU General Public License
-       along with Faster Application Manager.  If not, see <http://www.gnu.org/licenses/>.
+    You should have received a copy of the GNU General Public License
+    along with Faster Application Manager.  If not, see <http://www.gnu.org/licenses/>.
 
-       (C) Heikki Holstila 2010
+    (C) Heikki Holstila 2010
 */
 
 #ifndef PACKAGEVIEW_H
@@ -37,43 +37,43 @@ class KeyEventGrabber;
 class Settings;
 
 enum UserRoles { UserRoleName=Qt::UserRole, UserRoleVersion, UserRoleDescShort,
-                                UserRoleMarked, UserRoleInstalled, UserRoleUpgradeable, UserRoleAvailVersion,
-                                UserRoleCurrentStatFilter, UserRoleCurrentCatFilter, UserRoleBlacklisted };
+                 UserRoleMarked, UserRoleInstalled, UserRoleUpgradeable, UserRoleAvailVersion,
+                 UserRoleCurrentStatFilter, UserRoleCurrentCatFilter, UserRoleBlacklisted };
 
 
 class PackageListWidgetItem : public QListWidgetItem
 {
 public:
-       PackageListWidgetItem(Package* p_, QString name_);
+    PackageListWidgetItem(Package* p_, QString name_);
 
-       Package* package() { return iPackage; }
+    Package* package() { return iPackage; }
 
 private:
-       Package* iPackage;
+    Package* iPackage;
 };
 
 
 class ListItemDelegate : public QStyledItemDelegate
 {
 public:
-       explicit ListItemDelegate(QObject *parent=0) : QStyledItemDelegate(parent) {}
-       virtual ~ListItemDelegate() {}
+    explicit ListItemDelegate(QObject *parent=0) : QStyledItemDelegate(parent) {}
+    virtual ~ListItemDelegate() {}
 
-       void paint (QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
-       QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
-       void loadIcons();
+    void paint (QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+    QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
+    void loadIcons();
 
 private:
-       ListItemDelegate(const ListItemDelegate& old);
-       ListItemDelegate operator= (const ListItemDelegate& old);
-
-       QPixmap iDefaultIcon;
-       QPixmap iIconPkgInstall;
-       QPixmap iIconPkgUpgrade;
-       QPixmap iIconPkgRemove;
-       QPixmap iIconPkgNoOpInstalled;
-       QPixmap iIconPkgNoOpNotInstalled;
-       QPixmap iIconPkgNoOpInstalledUpgradeable;
+    ListItemDelegate(const ListItemDelegate& old);
+    ListItemDelegate operator= (const ListItemDelegate& old);
+
+    QPixmap iDefaultIcon;
+    QPixmap iIconPkgInstall;
+    QPixmap iIconPkgUpgrade;
+    QPixmap iIconPkgRemove;
+    QPixmap iIconPkgNoOpInstalled;
+    QPixmap iIconPkgNoOpNotInstalled;
+    QPixmap iIconPkgNoOpInstalledUpgradeable;
 };
 
 
@@ -83,120 +83,120 @@ class PackageView : public QMainWindow
 
 public:
 
-       enum sortOrder { SortAlpha, SortDateDesc, SortSizeDesc };
-
-       explicit PackageView(QWidget *parent);
-       virtual ~PackageView();
-
-       void openWin();
-       void resizeEvent(QResizeEvent* event);
-       void setAptInterface(AAptInterface* a_) { iAptInterface=a_; }
-       void setSettings(Settings* s_) { iSettings=s_; }
-       dimmer* mydimmer() { return iDimmer; }
-       void disableMenu();
-       void enableMenu();
-       void setStatFilter(Package::packageStatus f_);
-       void setSortOrder(sortOrder s_) { iSortOrder = s_; }
-       void clearSelections();
-       void setSearchText(QString text);
-       void setSearchOptions(bool pkgname, bool dispname, bool dshort, bool dlong);
-
-       void show() {
-               if( !isVisible() ) {
+    enum sortOrder { SortAlpha, SortDateDesc, SortSizeDesc };
+
+    explicit PackageView(QWidget *parent);
+    virtual ~PackageView();
+
+    void openWin();
+    void resizeEvent(QResizeEvent* event);
+    void setAptInterface(AAptInterface* a_) { iAptInterface=a_; }
+    void setSettings(Settings* s_) { iSettings=s_; }
+    dimmer* mydimmer() { return iDimmer; }
+    void disableMenu();
+    void enableMenu();
+    void setStatFilter(Package::packageStatus f_);
+    void setSortOrder(sortOrder s_) { iSortOrder = s_; }
+    void clearSelections();
+    void setSearchText(QString text);
+    void setSearchOptions(bool pkgname, bool dispname, bool dshort, bool dlong);
+
+    void show() {
+        if( !isVisible() ) {
 #ifdef Q_WS_MAEMO_5
             if(        dynamic_cast<QMainWindow*>(this->parent())->testAttribute( Qt::WA_Maemo5AutoOrientation ) ) {
                 this->setAttribute( Qt::WA_Maemo5AutoOrientation );
             } else {
                 this->setAttribute( Qt::WA_Maemo5LandscapeOrientation );
             }
-                       this->setAttribute(Qt::WA_Maemo5StackedWindow);
-                       this->setWindowFlags( Qt::Window );
+            this->setAttribute(Qt::WA_Maemo5StackedWindow);
+            this->setWindowFlags( Qt::Window );
 #endif
-               }
-               QMainWindow::show();
-       }
+        }
+        QMainWindow::show();
+    }
 
-       static const int CatFilterAllMarked = 0;
-       static const int CatFilterAllUser = 1;
-       static const int CatFilterBlacklisted = 16;
+    static const int CatFilterAllMarked = 0;
+    static const int CatFilterAllUser = 1;
+    static const int CatFilterBlacklisted = 16;
 
 public slots:
-       void orientationChanged();
-       void on_actionSearch_triggered();
+    void orientationChanged();
+    void on_actionSearch_triggered();
 
 protected:
     void changeEvent(QEvent *e);
-       AAptInterface* iAptInterface;
-       //MainWindow::operation iOperation;
-       void closeEvent(QCloseEvent *event);
+    AAptInterface* iAptInterface;
+    //MainWindow::operation iOperation;
+    void closeEvent(QCloseEvent *event);
 
 private:
-       PackageView(const PackageView& old);
-       PackageView operator= (const PackageView& old);
+    PackageView(const PackageView& old);
+    PackageView operator= (const PackageView& old);
 
-       bool doFilterCategory(Package* pkg);
-       QString generateSortString(Package* pkg);
-       void addListItem(Package* pkg_, QString listname_);
-       void updateLabel(void);
-       void resetWindow();
-       void clearSearch();
+    bool doFilterCategory(Package* pkg);
+    QString generateSortString(Package* pkg);
+    void addListItem(Package* pkg_, QString listname_);
+    void updateLabel(void);
+    void resetWindow();
+    void clearSearch();
 
     Ui::PackageView *ui;
-       MainWindow* iMainWindow;
-       QBoxLayout* iPkgLayout;
-       dimmer* iDimmer;
-       QLabel* iListCoverLabel;
-       Settings* iSettings;
+    MainWindow* iMainWindow;
+    QBoxLayout* iPkgLayout;
+    dimmer* iDimmer;
+    QLabel* iListCoverLabel;
+    Settings* iSettings;
 
-       QStringList iCatFilterLabels;
-       QStringList iCatFilterStrings;
-       int iSelectedCatFilter;
-       int iDefaultCatFilter;
+    QStringList iCatFilterLabels;
+    QStringList iCatFilterStrings;
+    int iSelectedCatFilter;
+    int iDefaultCatFilter;
 
-       QStringList iStatFilterLabels;
-       int iSelectedStatFilter;
-       sortOrder iSortOrder;
-       bool iSortNoticeShown;
+    QStringList iStatFilterLabels;
+    int iSelectedStatFilter;
+    sortOrder iSortOrder;
+    bool iSortNoticeShown;
 
-       QList<Package*> iSearchResults;
-       QString iPrevSearchText;
-       KeyEventGrabber* iKeyFilter;
+    QList<Package*> iSearchResults;
+    QString iPrevSearchText;
+    KeyEventGrabber* iKeyFilter;
 
-       bool iSearchPkgName;
-       bool iSearchDisplayName;
-       bool iSearchDescShort;
-       bool iSearchDescLong;
+    bool iSearchPkgName;
+    bool iSearchDisplayName;
+    bool iSearchDescShort;
+    bool iSearchDescLong;
 
-       int iPackagesEmptySort;
+    int iPackagesEmptySort;
 
 private slots:
-       void on_actionStore_list_triggered();
+    void on_actionStore_list_triggered();
  void on_pushButton_searchOptions_clicked();
  void on_actionRestore_all_triggered();
  void on_actionSave_selections_triggered();
-       void on_actionLoad_selections_triggered();
-       void on_btn_Sort_clicked();
-       void on_actionView_log_triggered();
-       void on_actionUpgrade_all_triggered();
-       void on_lineEdit_textEdited(QString );
-       void on_btn_searchClose_clicked();
-       void on_actionHelp_triggered();
-       void on_btn_StatusFilter_clicked();
-       void on_btn_CategoryFilter_clicked();
-       void on_listWidget_itemClicked(QListWidgetItem* item);
-       void on_actionClear_selections_triggered();
-       void on_btn_Commit_clicked();
+    void on_actionLoad_selections_triggered();
+    void on_btn_Sort_clicked();
+    void on_actionView_log_triggered();
+    void on_actionUpgrade_all_triggered();
+    void on_lineEdit_textEdited(QString );
+    void on_btn_searchClose_clicked();
+    void on_actionHelp_triggered();
+    void on_btn_StatusFilter_clicked();
+    void on_btn_CategoryFilter_clicked();
+    void on_listWidget_itemClicked(QListWidgetItem* item);
+    void on_actionClear_selections_triggered();
+    void on_btn_Commit_clicked();
 };
 
 
 class KeyEventGrabber : public QObject
 {
-       Q_OBJECT
+    Q_OBJECT
 public:
-       KeyEventGrabber(QObject* parent = 0);
+    KeyEventGrabber(QObject* parent = 0);
 
 protected:
-       bool eventFilter(QObject *obj, QEvent *event);
+    bool eventFilter(QObject *obj, QEvent *event);
 
 };
 
index 96a3b91..0b143d4 100644 (file)
@@ -30,10 +30,10 @@ Repository::~Repository()
 {
 }
 
-QString Repository::toString() const
+QString Repository::toString(bool noDisable) const
 {
        QString str;
-       if( iEnabled )
+    if( iEnabled || noDisable )
                str = "deb ";
        else
                str = "#deb ";
@@ -135,6 +135,26 @@ bool Repository::setFromString(QString repo)
        return true;
 }
 
+void Repository::setUrlDir(QString url_dir)
+{
+    QString url;
+    QString dir;
+
+    if( url_dir.indexOf("://") == -1 )
+        return;
+    int d = url_dir.indexOf('/', url_dir.indexOf("://")+3 );
+    if( d==-1 ) {
+        url = url_dir;
+        dir = "";
+    } else {
+        url = url_dir.left(d+1);
+        dir = url_dir.right( url_dir.length()-d-1 );
+    }
+
+    iUrl = url;
+    iDir = dir;
+}
+
 void Repository::set(QString name, QString url_dir, QString dist, QString components, bool enabled)
 {
        QString url;
index e67c968..82c280c 100644 (file)
@@ -32,6 +32,11 @@ public:
 
        void setName(QString n_) { iName=n_; }
        void setEnabled(bool e_) { iEnabled=e_; }
+    void setUrl(QString url_) { iUrl = url_; }
+    void setDir(QString dir_) { iDir = dir_; }
+    void setComponents(QString cmp_) { iComponents = cmp_; }
+    void setDist(QString d_) { iDist = d_; }
+    void setUrlDir(QString url_dir);
 
        QString name() const { return iName; }
        QString url() const { return iUrl; }
@@ -39,7 +44,7 @@ public:
        QString dist() const { return iDist; }
        QString components() const { return iComponents; }
        bool enabled() const { return iEnabled; }
-       QString toString() const;
+    QString toString(bool noDisable=false) const;
        QStringList toListFileNames() const;
        bool setFromString(QString repo);
        void set(QString name, QString url, QString dir_dist, QString components, bool enabled);