fixes
[fapman] / mainwindow.cpp
index 8fa98fd..5e01956 100644 (file)
@@ -142,8 +142,6 @@ MainWindow::MainWindow(QWidget *parent) :
        iMediaObject = new Phonon::MediaObject(this);
        Phonon::AudioOutput* aout = new Phonon::AudioOutput(Phonon::NotificationCategory, this);
        Phonon::createPath(iMediaObject, aout);
-
-       resetIdlingTime();
 }
 
 MainWindow::~MainWindow()
@@ -227,12 +225,17 @@ void MainWindow::on_btnListInstallable_clicked()
 {
        //install
 
-       if( iIdlingSince < QDateTime::currentDateTime().addSecs(-30*60) )
-               iAptInterface->setNeedRefresh(-1,1,1,1);
+       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 );
 
-       if( iAptInterface->needRepoRefresh() )
+       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"));
@@ -249,12 +252,17 @@ void MainWindow::on_btnUpgrade_clicked()
 {
        // upgrade
 
-       if( iIdlingSince < QDateTime::currentDateTime().addSecs(-30*60) )
-               iAptInterface->setNeedRefresh(-1,1,1,1);
+       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 );
 
-       if( iAptInterface->needRepoRefresh() )
+       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"));
@@ -274,8 +282,10 @@ void MainWindow::on_btnListInstalled_clicked()
        if( !iSettings->qsettings()->value("remove_readfull",false).toBool() )
                iAptInterface->setSkipListAndDates();
 
-       if( iIdlingSince < QDateTime::currentDateTime().addSecs(-30*60) )
-               iAptInterface->setNeedRefresh(-1,-1,1,-1);
+       int dpkgupd = -1;
+       if( iAptInterface->lastDpkgUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
+               dpkgupd = 1;
+       iAptInterface->setNeedRefresh(-1,-1,dpkgupd,-1);
 
        iWinPackageView->setStatFilter( Package::PkgStatInstalled );
 
@@ -449,11 +459,19 @@ void MainWindow::operationQueueFinished(QList<AAptInterface::interfaceMode> last
                }
 
                QString text = "<br><b><u>Faster Application Manager</u></b><br>"
-                               "<b>"+title+"</b><br>" + msgs.join("<br>") + "<br>";
+                                          "<b>"+title+"</b><br>" + msgs.join("<br>") + "<br>";
 
+               QRect r = QApplication::desktop()->rect();
+               if(r.width() < r.height()) {
+                       ConfirmDialog d(false, this);
+                       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);
 #endif
+               }
+
        }
 
 }