warn about system upgrade, minor fixes, code cleanup
authorHeikki Holstila <heikki.holstila@gmail.com>
Fri, 20 Aug 2010 11:41:53 +0000 (14:41 +0300)
committerHeikki Holstila <heikki.holstila@gmail.com>
Fri, 20 Aug 2010 11:41:53 +0000 (14:41 +0300)
14 files changed:
Makefile
TODO.txt
aaptinterface.cpp
aaptinterface.h
debian/changelog
fapman
main.cpp
mainwindow.cpp
package.cpp
package.h
packageview.cpp
searchoptions.cpp
searchoptions.h
version.h

index b97e55e..3b36b70 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: fapman
-# Generated by qmake (2.01a) (Qt 4.6.2) on: Wed Aug 18 17:34:07 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Fri Aug 20 14:06:45 2010
 # Project:  fapman.pro
 # Template: app
 # Command: /opt/NokiaQtSDK/Maemo/4.6.2/targets/fremantle-1030/bin/qmake -spec /opt/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-1030-slim/usr/share/qt4/mkspecs/linux-g++-maemo5 -unix -o Makefile fapman.pro
index 6e9eb7f..5b46a83 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -6,7 +6,8 @@
 
 
 0.6.5
-- a bugfix release (if needed)
+- ignore upgrades for pinned packages
+- warn when trying to do a system upgrade
 - promote to extras-testing
 
 
index 3d63feb..f900f1c 100644 (file)
@@ -45,6 +45,8 @@ AAptInterface::AAptInterface(QObject* parent = 0) : QObject(parent)
        iLastListUpdate.setTime_t(0);
        iLastDpkgUpdate.setTime_t(0);
 
+       iDataReadBuffer = new char[KDataReadBufferSize];
+
        iProcAptGetUpdate = new QProcess(this);
        iProcAptGetSimulate = new QProcess(this);
        iProcAptGetInstall = new QProcess(this);
@@ -103,6 +105,8 @@ AAptInterface::~AAptInterface()
                iProcAptGetInstall->kill();
        if( iProcAptGetClean->state() != QProcess::NotRunning )
                iProcAptGetClean->kill();
+
+       delete iDataReadBuffer;
 }
 
 void AAptInterface::addQueuedOperation(interfaceMode mode_)
@@ -1314,17 +1318,15 @@ Package* AAptInterface::ReadNextPackage(QFile& f, quint64& currentreaddata)
        bool pkgready = false;
 
        // this is faster than directly reading to QByteArray...
-       char* data = new char[25000];
        QByteArray line;
        while( !pkgready && !f.atEnd() ) {
-               f.readLine(data,25000);
-               line = data;
+               f.readLine(iDataReadBuffer,KDataReadBufferSize);
+               line = iDataReadBuffer;
                currentreaddata += line.size();
                if( processPackageDataLine(pkg,line) ) {
                        pkgready = true;
                }
        }
-       delete data;
 
        if( !pkg->name().isEmpty() && pkg->isInstalled() ) {
                QFileInfo f( KDpkgInfoDir + "/" + pkg->name() + ".list" );
index c7f1eeb..5fce974 100644 (file)
@@ -38,12 +38,15 @@ const QString KDateCacheFile = "/opt/fapman-cache/dates.cache";
 const QString KAptSourceList = "/opt/fapman-cache/sources.list";
 const QString KAptListDir = "/opt/fapman-cache/lists";
 const QString KAptArchivePartialDir = "/var/cache/apt/archives/partial";
+const QString KAptPreferencesFile = "/etc/apt/preferences";
 
 const QString KDpkgStatusFile = "/var/lib/dpkg/status";
 const QString KDpkgInfoDir = "/var/lib/dpkg/info";
 
 const int KListExpireTime = 3600;
 
+const int KDataReadBufferSize = 100000;
+
 class MainWindow;
 class FileReadThread;
 class DateFetchThread;
@@ -199,6 +202,7 @@ private:
        QStringList iBlacklist;
 
        multiLine iMultiLine;
+       char* iDataReadBuffer;
 
        int iDateRequestsWaiting;
        int iDateRequestsSent;
index 4f6e58d..d89f893 100644 (file)
@@ -1,17 +1,23 @@
+fapman (0.6.5-1) unstable; urgency=low
+
+  *
+
+ -- Heikki Holstila <heikki.holstila@gmail.com>  Fri, 20 Aug 2010 14:09:25 +0300
+
 fapman (0.6.4-1) unstable; urgency=low
 
   * show user/hidden category apps in the list of installed apps (remove only)
   * show "recommends" and "suggests" in package dependencies if there are any
   * check rootfs and opt free space on startup and warn if low
   * option to disable automatic catalog updates
-  * option to start fetching changelogs immediately when package view is opened
+  * option to start fetching changelogs immediately when package dialog is opened
   * warn about immediate conflicts when selecting a package for operation
   * don't use hildon banner in portrait mode
   * use the proxy settings for fetching package date information and changelogs
   * package list read speed optimizations
   * switched to garage bugtracker
 
- -- Heikki Holstila <heikki.holstila@gmail.com>  Thu, 19 Aug 2010 12:57:31 +0300
+ -- Heikki Holstila <heikki.holstila@gmail.com>  Thu, 19 Aug 2010 13:17:26 +0300
 
 fapman (0.6.3-1) unstable; urgency=low
 
diff --git a/fapman b/fapman
index 699d3b9..bfc7ef2 100755 (executable)
Binary files a/fapman and b/fapman differ
index e81f3ab..424313d 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -56,7 +56,6 @@ int main(int argc, char *argv[])
     w.show();
 #endif
 
-#ifdef Q_WS_MAEMO_5
        uid_t userUID = getuid();
        if( userUID != 0 ) {
                ConfirmDialog d(false, &w);
@@ -87,6 +86,7 @@ int main(int argc, char *argv[])
                d.exec();
        }
 
+#ifdef Q_WS_MAEMO_5
        // *** from patch by qwerty12 ***
        if (!QDBusConnection::sessionBus().isConnected()) {
                qWarning("Cannot connect to the D-Bus session bus.");
@@ -100,7 +100,6 @@ int main(int argc, char *argv[])
                qWarning("%s", qPrintable(QDBusConnection::sessionBus().lastError().message()));
        }
        // ***
-
 #endif
 
     return a.exec();
index 5e01956..036d6ee 100644 (file)
@@ -351,6 +351,7 @@ void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> last
                if( inst.count()>0 )
                        pkglist += QString("Total download size: %L1 kB<br>").arg(total_dl_size);
                bool mismatch = false;
+               bool warn_system_package = false;
 
                if( remv.count()>0 ) {
                        pkglist += "<br><b><u>REMOVE:</u></b><br><font size=\"-1\">";
@@ -362,6 +363,11 @@ void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> last
                                        pkglist += "<font color=\"red\">***UNKNOWN***</font>";
                                        mismatch = true;
                                }
+#ifdef Q_WS_MAEMO_5
+                               if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {
+                                       warn_system_package = true;
+                               }
+#endif
                                if( remvver.count()>i ) {
                                        pkglist += " " + remvver.at(i);
                                        if( pkg && remvver.at(i) != pkg->version() ) {
@@ -393,6 +399,11 @@ void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> last
                                        pkglist += "<font color=\"red\">***BLACKLISTED***</font>";
                                        installing_blacklisted = true;
                                }
+#ifdef Q_WS_MAEMO_5
+                               if( pkg && pkg->maemoDisplayName()=="Maemo 5" ) {
+                                       warn_system_package = true;
+                               }
+#endif
                                if( instver.count()>i ) {
                                        pkglist += " " + instver.at(i);
                                        if( pkg && instver.at(i) != pkg->version() ) {
@@ -420,6 +431,12 @@ void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> last
                        b.setText("Warning","Blacklisted package(s) will be installed");
                        b.exec();
                }
+               if( warn_system_package ) {
+                       ConfirmDialog s(false, this);
+                       s.setText("Warning","You are trying to perform an operation on a critical system package. This is an operation which has not been tested and " \
+                                         "it is unknown whether it will succeed or result in a horrible failure. You have been warned.");
+                       s.exec();
+               }
 
                busyDialog(false);
                ConfirmDialog d(true, this);
@@ -469,6 +486,10 @@ void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> last
                } else {
 #ifdef Q_WS_MAEMO_5
                        QMaemo5InformationBox::information(0, text, QMaemo5InformationBox::NoTimeout);
+#else
+                       ConfirmDialog d(false, this);
+                       d.setText(title,msgs.join("<br>"));
+                       d.exec();
 #endif
                }
 
index 9a4924a..1204101 100644 (file)
@@ -27,7 +27,7 @@
 Package::Package(QByteArray name_, AAptInterface *apt_):
                iAptInterface(apt_), iName(name_), iIsInstalled(false), iMarkedForOperation(false),
                iPkgStatus(PkgStatUnknown), iSize(0), iInstalledSize(0), iMarkedOperation(PkgOpNone),
-               iBlacklist(BlacklistSelect::BlacklistNone), iIcon(0)
+               iBlacklist(BlacklistSelect::BlacklistNone), iIcon(0), iPinned(false)
 {
 }
 
index fa0eafb..097c78d 100644 (file)
--- a/package.h
+++ b/package.h
@@ -61,6 +61,7 @@ public:
        inline void appendRecommends(QByteArray line_) { iRecommends << line_.split(','); }
        inline void appendSuggests(QByteArray line_) { iSuggests << line_.split(','); }
        inline void appendUpgradeDescription(QByteArray d_) { iUpgradeDescription.append(d_); }
+       inline void setPinned(bool p_) { iPinned=p_; }
 
        void convertIcon();
 
@@ -97,6 +98,7 @@ public:
        inline QList<QByteArray> breaks() { return iBreaks; }
        inline QList<QByteArray> recommends() { return iRecommends; }
        inline QList<QByteArray> suggests() { return iSuggests; }
+       inline bool isPinned() { return iPinned; }
 
        QStringList checkConflicts_RichText();
 
@@ -138,6 +140,8 @@ private:
        QList<QByteArray> iBreaks;
        QList<QByteArray> iRecommends;
        QList<QByteArray> iSuggests;
+
+       bool iPinned;
 };
 
 #endif // PACKAGE_H
index 1f2e514..27ac149 100644 (file)
@@ -535,7 +535,6 @@ void PackageView::closeEvent(QCloseEvent *event)
                return;
        }
 
-#ifdef Q_WS_MAEMO_5
        if( iAptInterface->numSelectedPackages() == 0 )
        {               
                resetWindow();
@@ -552,10 +551,6 @@ void PackageView::closeEvent(QCloseEvent *event)
                        event->ignore();
                }
        }
-#else  // for simulator
-       resetWindow();
-       event->accept();
-#endif
 }
 
 void PackageView::changeEvent(QEvent *e)
index f906245..3ae2a99 100644 (file)
@@ -1,3 +1,22 @@
+/*
+       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
+*/
+
 #include "searchoptions.h"
 #include "ui_searchoptions.h"
 
index 99ea6ed..5f3f0d3 100644 (file)
@@ -1,3 +1,22 @@
+/*
+       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
+*/
+
 #ifndef SEARCHOPTIONS_H
 #define SEARCHOPTIONS_H
 
index 40de00c..c3d2295 100644 (file)
--- a/version.h
+++ b/version.h
@@ -1 +1 @@
-const QString PROGRAM_VERSION="0.6.4";
+const QString PROGRAM_VERSION="0.6.5";