X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=packageselector.cpp;h=fbc5bcc3ab719161c992baa64b7da754006ab3ec;hb=585376e7269329f57cb8beef668f7c55ebea24e4;hp=392189a5518987a259ca00521bb57ae40491ef75;hpb=27420ae2e72651166b87bb62c7aae0df67e11a16;p=fapman diff --git a/packageselector.cpp b/packageselector.cpp index 392189a..fbc5bcc 100644 --- a/packageselector.cpp +++ b/packageselector.cpp @@ -17,7 +17,7 @@ (C) Heikki Holstila 2010 */ -#include +#include #include #include @@ -29,29 +29,29 @@ #include "blacklistselect.h" #include "aaptinterface.h" #include "settings.h" +#include "mainwindow.h" -PackageSelector::PackageSelector(Package* pkg, AAptInterface* apt, Settings* set, QWidget *parent) : +PackageSelector::PackageSelector(Package* pkg, AAptInterface* apt, Settings* set, MainWindow* mw, QWidget *parent) : QDialog(parent), - ui(new Ui::PackageSelector) + ui(new Ui::PackageSelector), iNetworkAccessManager(0), iChangelogFetched(false), iFetchInProgress(false) { - ui->setupUi(this); + ui->setupUi(this); iPkg = pkg; iAptInterface = apt; iSettings = set; - iNetworkAccessManager = 0; - iChangelogFetched = false; - iFetchInProgress = false; + iMainWindow = mw; iChangelog = ""; ui->pushButton_website->setIcon(QPixmap("/usr/share/icons/hicolor/48x48/hildon/general_web.png")); - if( getMaemoOrgUrl(pkg)=="" && getMaemoOrgUrl(pkg->availablePackage())=="" ) { + if( getMaemoOrgUrl(pkg).isEmpty() && getMaemoOrgUrl(pkg->availablePackage()).isEmpty() ) { ui->pushButton_website->setEnabled(false); } if( pkg->isMarkedForOperation() ) ui->pushButton_blacklist->setEnabled(false); if( pkg->icon() && !pkg->icon()->isNull() ) { - ui->label_appicon->setPixmap( *pkg->icon() ); + QPixmap aicon( *pkg->icon() ); + ui->label_appicon->setPixmap( aicon.scaled(48,48) ); } else { ui->label_appicon->setPixmap( QPixmap(":/icons/icons/appdefault.png") ); } @@ -71,12 +71,13 @@ 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(); if( !upg_pkg ) upg_pkg = iPkg; - if( (!pkg->isUpgradeable() || (upg_pkg && upg_pkg->upgradeDescription()=="")) && (getMaemoOrgUrl(upg_pkg)=="") ) + if( (!pkg->isUpgradeable() || (upg_pkg && upg_pkg->upgradeDescription().isEmpty())) && (getMaemoOrgUrl(upg_pkg).isEmpty()) ) ui->radioTabChanges->hide(); if( pkg->isUpgradeable() ) @@ -105,7 +106,7 @@ PackageSelector::PackageSelector(Package* pkg, AAptInterface* apt, Settings* set ui->radioRemove->setChecked(true); } - if( getMaemoOrgUrl(upg_pkg)!="" && !iChangelogFetched && !iFetchInProgress && + if( !getMaemoOrgUrl(upg_pkg).isEmpty() && !iChangelogFetched && !iFetchInProgress && iSettings->qsettings()->value("always_fetch_changes",false).toBool() ) { queryChangelog(); @@ -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(); @@ -385,6 +386,10 @@ void PackageSelector::on_radioTabBasic_clicked() } } + if( !iPkg->maintainerRichText().isEmpty() ) { + longtext +="Maintainer: " + iPkg->maintainerRichText() + "
"; + } + longtext += "
" + iPkg->descShort(); QString descLong = iPkg->descLong(); if( descLong.length()>0 ) { @@ -406,7 +411,7 @@ void PackageSelector::on_radioTabChanges_clicked() if( !upg_pkg ) upg_pkg = iPkg; - if( iPkg->isUpgradeable() && upg_pkg && upg_pkg->upgradeDescription()!="" ) + if( iPkg->isUpgradeable() && upg_pkg && !upg_pkg->upgradeDescription().isEmpty() ) { text += "Upgrade description:"; text += "
"; @@ -416,7 +421,7 @@ void PackageSelector::on_radioTabChanges_clicked() } QString changelog; - if( getMaemoOrgUrl(upg_pkg)!="" && !iChangelogFetched && !iFetchInProgress ) { + if( !getMaemoOrgUrl(upg_pkg).isEmpty() && !iChangelogFetched && !iFetchInProgress ) { queryChangelog(); changelog = "Fetching changelog..."; } else { @@ -521,6 +526,9 @@ void PackageSelector::queryChangelog() if( iChangelogFetched || iFetchInProgress ) return; + if( iMainWindow ) + iMainWindow->openNetworkConnection(); + iChangelogFetched = false; iFetchInProgress = true; iChangelog = ""; @@ -536,9 +544,9 @@ void PackageSelector::queryChangelog() if( !iNetworkAccessManager ) { iNetworkAccessManager = new QNetworkAccessManager(this); - connect(iNetworkAccessManager,SIGNAL(finished(QNetworkReply*)),this,SLOT(changelogFetchNetworkReply(QNetworkReply*))); + connect(iNetworkAccessManager,SIGNAL(finished(QNetworkReply*)),this,SLOT(changelogFetchNetworkReply(QNetworkReply*))); - if( iSettings->qsettings()->value("use_proxies").toBool() && iSettings->qsettings()->value("http_proxy").toString()!="" ) + if( iSettings->qsettings()->value("use_proxies").toBool() && !iSettings->qsettings()->value("http_proxy").toString().isEmpty() ) { QNetworkProxy proxy = Settings::createProxyFromString( iSettings->qsettings()->value("http_proxy").toString() ); iNetworkAccessManager->setProxy(proxy); @@ -569,7 +577,7 @@ void PackageSelector::changelogFetchNetworkReply(QNetworkReply* reply) qDebug() << "changelog fetched"; } else { - iChangelog = "Not available (Network error)"; + iChangelog = "Not available ( error)"; qDebug() << "changelog fetch error:" << reply->error() << reply->errorString(); }