release 0.6.7 (see the debian changelog for a proper list of changes)
[fapman] / aaptinterface.cpp
index b00f257..fc4e616 100644 (file)
@@ -86,12 +86,6 @@ AAptInterface::AAptInterface(QObject* parent = 0) : QObject(parent)
        QFile logfile(KLogFile);
        logfile.remove();
 
-       // clear files left from old versions
-       QFile f1("/root/.fapman/dates.cache");
-       f1.remove();
-       QFile f2("/root/.fapman/lastupdate");
-       f2.remove();
-
        readRepositoryInfo();
 }
 
@@ -1025,8 +1019,10 @@ void AAptInterface::readRepositoryInfo()
                return;
        }
 
-       if( ownFound )
+       if( ownFound ) {
+               qDebug() << "own repo lists found";
                return;
+       }
 
        QFile ham( KHamRepoListFile );
        if( ham.open(QIODevice::ReadOnly | QIODevice::Text ) )
@@ -1037,21 +1033,26 @@ void AAptInterface::readRepositoryInfo()
                        Repository* r = new Repository();
                        if( r->setFromString(line) ) {
                                iRepositories.append(r);
+
+#ifdef Q_WS_MAEMO_5
+                               // disable the ovi repository by default
+                               if( line.contains("https://downloads.maemo.nokia.com/fremantle1.2/ovi/") ) {
+                                       r->setEnabled(false);
+                               }
+#endif
                        } else {
                                delete r;
                                r=0;
                        }
                }
                ham.close();
+               qDebug() << "system repo list loaded";
        }
+
 }
 
 bool AAptInterface::writeRepositories()
 {
-#ifndef Q_WS_MAEMO_5   // for simulator
-       return true;
-#endif
-
        iNeedListRefresh = true;
 
        QFile own( KOwnRepoFile );
@@ -1090,10 +1091,6 @@ bool AAptInterface::writeRepositories()
 
 bool AAptInterface::needRepoRefresh()
 {
-#ifndef Q_WS_MAEMO_5   // for simulator
-       return false;
-#endif
-
        if( iNeedRepoRefresh || iSettings->qsettings()->value("need_repo_refresh", false).toBool() ) {
                iNeedRepoRefresh = false;
                iSettings->qsettings()->setValue("need_repo_refresh", false);
@@ -1602,13 +1599,29 @@ void AAptInterface::removeFromBlacklist(Package *pkg, BlacklistSelect::blackList
                return;
        }
 
-       QStringList newlist;
+       //QStringList newlist;
        bool removed = false;
 
        for( int i=0; i<iBlacklist.count(); i++ )
        {
                if( oldstate == BlacklistSelect::BlacklistAll )
                {
+                       if( iBlacklist.at(i) == pkg->name() ) {
+                               iBlacklist.removeAt(i);
+                               i--;
+                               removed = true;
+                       }
+               } else if( oldstate == BlacklistSelect::BlacklistThis ) {
+                       if( iBlacklist.at(i) == (pkg->name()+" "+pkg->version()) ) {
+                               iBlacklist.removeAt(i);
+                               i--;
+                               removed = true;
+                       }
+               }
+
+               /*
+               if( oldstate == BlacklistSelect::BlacklistAll )
+               {
                        if( !(iBlacklist.at(i) == pkg->name()) ) {
                                newlist << iBlacklist.at(i);
                        } else removed = true;
@@ -1616,7 +1629,9 @@ void AAptInterface::removeFromBlacklist(Package *pkg, BlacklistSelect::blackList
                        if( !(iBlacklist.at(i) == (pkg->name()+" "+pkg->version())) ) {
                                newlist << iBlacklist.at(i);
                        } else removed = true;
-               }
+               } else {
+                       newlist << iBlacklist.at(i);
+               }*/
        }
 
        if( removed )
@@ -1624,7 +1639,7 @@ void AAptInterface::removeFromBlacklist(Package *pkg, BlacklistSelect::blackList
        else
                qDebug() << "blacklist:" << pkg->name() << "not in saved list";
 
-       iBlacklist = newlist;
+       //iBlacklist = newlist;
 }
 
 
@@ -1738,7 +1753,7 @@ void AAptInterface::startFetchDates()
                                                QApplication::processEvents(QEventLoop::WaitForMoreEvents);
                                        }
                                } else {
-                                       while( iDateRequestsWaiting>1 ) {
+                                       while( iDateRequestsWaiting>5 ) {
                                                QApplication::processEvents(QEventLoop::WaitForMoreEvents);
                                        }
                                }
@@ -1820,10 +1835,10 @@ void AAptInterface::dateFetchNetworkReply(QNetworkReply* reply)
 {
        iDateRequestsWaiting--;
        iDateRequestsReceived++;
-       //qDebug() << "reply" << reply->header(QNetworkRequest::LastModifiedHeader).toDateTime();
        iNetworkError = reply->error();
+       QDateTime dateModified = reply->header(QNetworkRequest::LastModifiedHeader).toDateTime();
 
-       if( reply->error() == QNetworkReply::NoError && reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().isValid() )
+       if( reply->error() == QNetworkReply::NoError && dateModified.isValid() )
        {
                QString pkgname = reply->url().fragment();
                //qDebug() << pkgname;
@@ -1833,7 +1848,7 @@ void AAptInterface::dateFetchNetworkReply(QNetworkReply* reply)
 
                Package* pkg = iPackagesAvailable.value(pkgname, 0);
                if( pkg ) {
-                       pkg->setDate( reply->header(QNetworkRequest::LastModifiedHeader).toDateTime() );
+                       pkg->setDate( dateModified );
                } else {
                        qDebug() << "warning: unknown packagename in reply:" << pkgname;
                }