}
- /*
- // does not work
-
- QDBusConnection conn = QDBusConnection::connectToBus(QDBusConnection::SystemBus, "faster_application_manager");
-
- QString service = "com.nokia.icd";
- QString path = "/com/nokia/icd";
- QString method = "connect";
-
- QDBusInterface net(service, path, service, conn, this);
- net.call(method,"[ANY]",0);
- */
-
iMediaObject = new Phonon::MediaObject(this);
Phonon::AudioOutput* aout = new Phonon::AudioOutput(Phonon::NotificationCategory, this);
Phonon::createPath(iMediaObject, aout);
showFreeSpace();
+ iNetworkConfigurationManager = new QNetworkConfigurationManager(this);
+ iNetworkSession = new QNetworkSession(iNetworkConfigurationManager->defaultConfiguration(),this);
+
show();
- orientationChanged();
+ rescaleMenuView();
}
MainWindow::~MainWindow()
// save "need repo refresh" status
iSettings->qsettings()->setValue("need_repo_refresh", iAptInterface->needRepoRefresh());
+ if( iNetworkSession && iNetworkSession->isOpen() ) {
+ iNetworkSession->close();
+ }
+ // iNetworkSession automatically deleted by parent
+
delete iWinPackageView; iWinPackageView=0;
delete iWinRepoView; iWinRepoView=0;
delete iAptInterface; iAptInterface=0;
//iMediaObject and aout automatically deleted by their parent
}
+void MainWindow::openNetworkConnection()
+{
+ if( iNetworkSession->isOpen() )
+ return;
+
+ iNetworkSession->open();
+ if( !iNetworkSession->waitForOpened(20000) )
+ {
+ ConfirmDialog d(false, this);
+ d.setText("Network error","Unable to open a network connection");
+ d.exec();
+ }
+}
+
void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
{
// update catalogs
+ openNetworkConnection();
+
busyDialog(true, tr("Operation in progress"), tr("Updating catalogs"));
iAptInterface->addQueuedOperation(AAptInterface::ModeAptGetUpdate);
{
//install
+ openNetworkConnection();
+
int listupd = -1;
int dpkgupd = -1;
if( iAptInterface->lastListUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
{
// upgrade
+ openNetworkConnection();
+
int listupd = -1;
int dpkgupd = -1;
if( iAptInterface->lastListUpdate() < QDateTime::currentDateTime().addSecs(-KListExpireTime) )
void MainWindow::resizeEvent(QResizeEvent* event)
{
+ rescaleMenuView();
+
+ if( iDimmer ) {
+ iDimmer->resize( this->size() );
+ }
+
+ QMainWindow::resizeEvent(event);
+}
+
+void MainWindow::rescaleMenuView()
+{
QRect sg = ui->listWidget->rect();
if( sg.width() > sg.height() ) {
} else {
ui->listWidget->setGridSize( QSize((sg.width()-12)/3, (sg.height()-12)/3) );
}
-
- if( iDimmer ) {
- iDimmer->resize( this->size() );
- }
-
- QMainWindow::resizeEvent(event);
}
void MainWindow::orientationChanged()