+ 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;
+ }
+#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;
+ }
+#ifdef Q_WS_MAEMO_5
+ 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 {