summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg/mainwin.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp176
1 files changed, 90 insertions, 86 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index dbe694e..6f5c712 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1,5 +1,5 @@
/*
                This file is part of the OPIE Project
-
+
=. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk>
             .=l. Dan Williams <drw@handhelds.org>
@@ -28,14 +28,25 @@
*/
-#include <linux/limits.h>
-#include <unistd.h>
+#include "categoryfilterimpl.h"
+#include "datamgr.h"
+#include "global.h"
+#include "inputdlg.h"
+#include "ipkg.h"
+#include "installdlgimpl.h"
+#include "letterpushbutton.h"
+#include "mainwin.h"
+#include "packagewin.h"
+#include "settingsimpl.h"
+#include "utils.h"
+/* OPIE */
#include <qpe/qcopenvelope_qws.h>
-#include <qmenubar.h>
#include <qpe/qpeapplication.h>
-#include <qtoolbar.h>
#include <qpe/config.h>
#include <qpe/resource.h>
+/* QT */
+#include <qmenubar.h>
+#include <qtoolbar.h>
#include <qaction.h>
#include <qcombobox.h>
@@ -53,20 +64,12 @@
#include <qwidgetstack.h>
-#include "categoryfilterimpl.h"
-#include "datamgr.h"
-#include "global.h"
-#include "inputdlg.h"
-#include "ipkg.h"
-#include "installdlgimpl.h"
-#include "letterpushbutton.h"
-#include "mainwin.h"
-#include "packagewin.h"
-#include "settingsimpl.h"
-#include "utils.h"
+/* STD */
+#include <linux/limits.h>
+#include <unistd.h>
extern int compareVersions( const char *v1, const char *v2 );
MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
- : QMainWindow( parent, name, fl || WStyle_ContextHelp )
+ : QMainWindow( parent, name, fl || WStyle_ContextHelp )
{
// Disable suspend mode
@@ -240,5 +243,5 @@ MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl )
MainWindow :: ~MainWindow()
{
- delete mgr;
+ delete mgr;
// Reenable suspend mode
@@ -297,5 +300,5 @@ void MainWindow :: init()
cfg.setGroup( "settings" );
currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
-// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
+ // showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
#endif
@@ -338,6 +341,6 @@ void MainWindow :: setDocument( const QString &doc )
// Now set the check box of the selected package
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().startsWith( package ) )
@@ -355,5 +358,5 @@ void MainWindow :: displaySettings()
{
stack->raiseWidget( progressWindow );
- updateData();
+ updateData();
stack->raiseWidget( networkPkgWindow );
}
@@ -583,10 +586,10 @@ void MainWindow :: updateData()
serversList->insertItem( serverName );
if ( serverName == currentlySelectedServer )
- activeItem = i;
- }
+ activeItem = i;
+ }
- // set selected server to be active server
- if ( activeItem != -1 )
- serversList->setCurrentItem( activeItem );
+ // set selected server to be active server
+ if ( activeItem != -1 )
+ serversList->setCurrentItem( activeItem );
serverSelected( 0, FALSE );
}
@@ -626,8 +629,8 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
#ifdef QWS
- // read download directory from config file
- Config cfg( "aqpkg" );
- cfg.setGroup( "settings" );
- cfg.writeEntry( "selectedServer", currentlySelectedServer );
+ // read download directory from config file
+ Config cfg( "aqpkg" );
+ cfg.setGroup( "settings" );
+ cfg.writeEntry( "selectedServer", currentlySelectedServer );
#endif
@@ -679,5 +682,5 @@ void MainWindow :: serverSelected( int, bool raiseProgress )
QCheckListItem *item = new QCheckListItem( packagesList, package->getPackageName(),
- QCheckListItem::CheckBox );
+ QCheckListItem::CheckBox );
if ( package->isInstalled() )
@@ -739,5 +742,5 @@ void MainWindow :: searchForPackage( const QString &text )
for ( QCheckListItem *item = start; item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->text().lower().find( text ) != -1 )
@@ -767,11 +770,11 @@ void MainWindow :: updateServer()
InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
- tr( "Update lists" ) );
+ tr( "Update lists" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = FALSE;
+ reloadDocuments = FALSE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
-// delete progDlg;
+ // delete progDlg;
}
@@ -783,7 +786,7 @@ void MainWindow :: upgradePackages()
QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
- QMessageBox::Yes,
- QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
- 0, this );
+ QMessageBox::Yes,
+ QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
+ 0, this );
warn.adjustSize();
@@ -798,7 +801,7 @@ void MainWindow :: upgradePackages()
InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
- tr ( "Upgrade" ) );
+ tr ( "Upgrade" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = TRUE;
+ reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
@@ -816,6 +819,6 @@ void MainWindow :: downloadPackage()
{
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 && !found;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 && !found;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
@@ -837,6 +840,6 @@ void MainWindow :: downloadPackage()
doUpdate = false;
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
@@ -856,5 +859,5 @@ void MainWindow :: downloadPackage()
msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() );
if ( QMessageBox::information( this, tr( "Are you sure?" ),
- msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
+ msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
{
doUpdate = true;
@@ -909,6 +912,6 @@ void MainWindow :: downloadSelectedPackages()
ipkg.setRuntimeDirectory( dir );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
@@ -927,10 +930,10 @@ void MainWindow :: downloadRemotePackage()
if ( !ok || package.isEmpty() )
return;
-// DownloadRemoteDlgImpl dlg( this, "Install", true );
-// if ( dlg.exec() == QDialog::Rejected )
-// return;
+ // DownloadRemoteDlgImpl dlg( this, "Install", true );
+ // if ( dlg.exec() == QDialog::Rejected )
+ // return;
// grab details from dialog
-// QString package = dlg.getPackageLocation();
+ // QString package = dlg.getPackageLocation();
InstallData *item = new InstallData();
@@ -943,5 +946,5 @@ void MainWindow :: downloadRemotePackage()
InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = TRUE;
+ reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
@@ -962,6 +965,6 @@ void MainWindow :: applyChanges()
workingPackages.setAutoDelete( TRUE );
for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
- item != 0 ;
- item = (QCheckListItem *)item->nextSibling() )
+ item != 0 ;
+ item = (QCheckListItem *)item->nextSibling() )
{
if ( item->isOn() )
@@ -972,5 +975,5 @@ void MainWindow :: applyChanges()
else
return;
- }
+ }
}
@@ -979,5 +982,5 @@ void MainWindow :: applyChanges()
// Nothing to do
QMessageBox::information( this, tr( "Nothing to do" ),
- tr( "No packages selected" ), tr( "OK" ) );
+ tr( "No packages selected" ), tr( "OK" ) );
return;
@@ -987,5 +990,5 @@ void MainWindow :: applyChanges()
InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
- reloadDocuments = TRUE;
+ reloadDocuments = TRUE;
stack->addWidget( dlg, 3 );
stack->raiseWidget( dlg );
@@ -1025,5 +1028,5 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
if ( p->isPackageStoredLocally() )
name = item->text();
-
+
if ( !p->isPackageStoredLocally() )
newitem->packageName = p->getInstalledPackageName();
@@ -1091,22 +1094,22 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
switch( dlg.exec() )
{
- case 0: // Cancel
- delete newitem;
- return 0x0;
- break;
- case 1: // Remove
- newitem->option = "D";
- // If local file, remove using package name, not filename
- if ( p->isPackageStoredLocally() )
- name = item->text();
- break;
- case 2: // Reinstall or Upgrade
- newitem->option = secondOption;
- break;
+ case 0: // Cancel
+ delete newitem;
+ return 0x0;
+ break;
+ case 1: // Remove
+ newitem->option = "D";
+ // If local file, remove using package name, not filename
+ if ( p->isPackageStoredLocally() )
+ name = item->text();
+ break;
+ case 2: // Reinstall or Upgrade
+ newitem->option = secondOption;
+ break;
}
}
else
{
-// newitem->option = stickyOption;
+ // newitem->option = stickyOption;
}
}
@@ -1115,7 +1118,7 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
// Check if we are reinstalling the same version
if ( newitem->option != "R" )
- newitem->recreateLinks = true;
+ newitem->recreateLinks = true;
else
- newitem->recreateLinks = false;
+ newitem->recreateLinks = false;
// User hit cancel (on dlg - assume remove)
@@ -1139,12 +1142,12 @@ void MainWindow :: reloadData( InstallDlgImpl *dlg )
#ifdef QWS
if ( reloadDocuments )
- {
- m_status->setText( tr( "Updating Launcher..." ) );
-
- // Finally let the main system update itself
- QCopEnvelope e("QPE/System", "linkChanged(QString)");
- QString lf = QString::null;
- e << lf;
- }
+ {
+ m_status->setText( tr( "Updating Launcher..." ) );
+
+ // Finally let the main system update itself
+ QCopEnvelope e("QPE/System", "linkChanged(QString)");
+ QString lf = QString::null;
+ e << lf;
+ }
#endif
@@ -1182,5 +1185,6 @@ void MainWindow :: letterPushed( QString t )
if ( !item )
item = (QCheckListItem *)packagesList->firstChild();
- } while ( item != start);
+ }
+ while ( item != start);
}
@@ -1189,9 +1193,9 @@ void MainWindow :: slotDisplayPackage( QListViewItem *item )
QString itemstr( ((QCheckListItem*)item)->text() );
PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) );
- p->showMaximized();
+ QPEApplication::showWidget( p );
}
QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn )
- : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog )
+ : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog )
{
setCaption( caption );