Diffstat (limited to 'noncore/settings/aqpkg/mainwin.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/mainwin.cpp | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp index 42093cf..dbe694e 100644 --- a/noncore/settings/aqpkg/mainwin.cpp +++ b/noncore/settings/aqpkg/mainwin.cpp | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
@@ -63,15 +63,21 @@ | |||
63 | #include "packagewin.h" | 63 | #include "packagewin.h" |
64 | #include "settingsimpl.h" | 64 | #include "settingsimpl.h" |
65 | #include "utils.h" | 65 | #include "utils.h" |
66 | 66 | ||
67 | extern int compareVersions( const char *v1, const char *v2 ); | 67 | extern int compareVersions( const char *v1, const char *v2 ); |
68 | 68 | ||
69 | MainWindow :: MainWindow() | 69 | MainWindow :: MainWindow( QWidget* parent, const char* name, WFlags fl ) |
70 | :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) | 70 | :QMainWindow( parent, name, fl || WStyle_ContextHelp ) |
71 | { | 71 | { |
72 | // Disable suspend mode | ||
73 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend; | ||
74 | |||
75 | LOCAL_SERVER = QObject::tr( "Installed packages" ); | ||
76 | LOCAL_IPKGS = QObject::tr( "Local packages" ); | ||
77 | |||
72 | setCaption( tr( "AQPkg - Package Manager" ) ); | 78 | setCaption( tr( "AQPkg - Package Manager" ) ); |
73 | 79 | ||
74 | // Create UI widgets | 80 | // Create UI widgets |
75 | initMainWidget(); | 81 | initMainWidget(); |
76 | initProgressWidget(); | 82 | initProgressWidget(); |
77 | 83 | ||
@@ -231,12 +237,15 @@ MainWindow :: MainWindow() | |||
231 | QTimer::singleShot( 100, this, SLOT( init() ) ); | 237 | QTimer::singleShot( 100, this, SLOT( init() ) ); |
232 | } | 238 | } |
233 | 239 | ||
234 | MainWindow :: ~MainWindow() | 240 | MainWindow :: ~MainWindow() |
235 | { | 241 | { |
236 | delete mgr; | 242 | delete mgr; |
243 | |||
244 | // Reenable suspend mode | ||
245 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | ||
237 | } | 246 | } |
238 | 247 | ||
239 | void MainWindow :: initMainWidget() | 248 | void MainWindow :: initMainWidget() |
240 | { | 249 | { |
241 | networkPkgWindow = new QWidget( this ); | 250 | networkPkgWindow = new QWidget( this ); |
242 | 251 | ||
@@ -1009,13 +1018,12 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1009 | return newitem; | 1018 | return newitem; |
1010 | } | 1019 | } |
1011 | else | 1020 | else |
1012 | { | 1021 | { |
1013 | InstallData *newitem = new InstallData(); | 1022 | InstallData *newitem = new InstallData(); |
1014 | newitem->option = "D"; | 1023 | newitem->option = "D"; |
1015 | |||
1016 | // If local file, remove using package name, not filename | 1024 | // If local file, remove using package name, not filename |
1017 | if ( p->isPackageStoredLocally() ) | 1025 | if ( p->isPackageStoredLocally() ) |
1018 | name = item->text(); | 1026 | name = item->text(); |
1019 | 1027 | ||
1020 | if ( !p->isPackageStoredLocally() ) | 1028 | if ( !p->isPackageStoredLocally() ) |
1021 | newitem->packageName = p->getInstalledPackageName(); | 1029 | newitem->packageName = p->getInstalledPackageName(); |
@@ -1043,13 +1051,12 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item ) | |||
1043 | // Error - should handle | 1051 | // Error - should handle |
1044 | } | 1052 | } |
1045 | else if ( val == -1 ) | 1053 | else if ( val == -1 ) |
1046 | { | 1054 | { |
1047 | // Version available is older - remove only | 1055 | // Version available is older - remove only |
1048 | newitem->option = "D"; | 1056 | newitem->option = "D"; |
1049 | |||
1050 | // If local file, remove using package name, not filename | 1057 | // If local file, remove using package name, not filename |
1051 | if ( p->isPackageStoredLocally() ) | 1058 | if ( p->isPackageStoredLocally() ) |
1052 | name = item->text(); | 1059 | name = item->text(); |
1053 | } | 1060 | } |
1054 | else | 1061 | else |
1055 | { | 1062 | { |
@@ -1186,48 +1193,48 @@ void MainWindow :: slotDisplayPackage( QListViewItem *item ) | |||
1186 | 1193 | ||
1187 | QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) | 1194 | QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) |
1188 | : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog ) | 1195 | : QWidget( 0x0, 0x0, WType_Modal | WType_TopLevel | WStyle_Dialog ) |
1189 | { | 1196 | { |
1190 | setCaption( caption ); | 1197 | setCaption( caption ); |
1191 | resize( 175, 100 ); | 1198 | resize( 175, 100 ); |
1192 | 1199 | ||
1193 | QGridLayout *layout = new QGridLayout( this ); | 1200 | QGridLayout *layout = new QGridLayout( this ); |
1194 | 1201 | ||
1195 | QLabel *l = new QLabel( text, this ); | 1202 | QLabel *l = new QLabel( text, this ); |
1196 | l->setAlignment( AlignCenter | WordBreak ); | 1203 | l->setAlignment( AlignCenter | WordBreak ); |
1197 | layout->addMultiCellWidget( l, 0, 0, 0, 1 ); | 1204 | layout->addMultiCellWidget( l, 0, 0, 0, 1 ); |
1198 | 1205 | ||
1199 | btn1 = new QPushButton( tr( "Remove" ), this ); | 1206 | btn1 = new QPushButton( tr( "Remove" ), this ); |
1200 | connect( btn1, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); | 1207 | connect( btn1, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); |
1201 | layout->addWidget( btn1, 1, 0 ); | 1208 | layout->addWidget( btn1, 1, 0 ); |
1202 | 1209 | ||
1203 | btn2 = new QPushButton( secondbtn, this ); | 1210 | btn2 = new QPushButton( secondbtn, this ); |
1204 | connect( btn2, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); | 1211 | connect( btn2, SIGNAL(clicked()), this, SLOT(slotButtonPressed()) ); |
1205 | layout->addWidget( btn2, 1, 1 ); | 1212 | layout->addWidget( btn2, 1, 1 ); |
1206 | 1213 | ||
1207 | executing = FALSE; | 1214 | executing = FALSE; |
1208 | } | 1215 | } |
1209 | 1216 | ||
1210 | int QuestionDlg::exec() | 1217 | int QuestionDlg::exec() |
1211 | { | 1218 | { |
1212 | show(); | 1219 | show(); |
1213 | 1220 | ||
1214 | if ( !executing ) | 1221 | if ( !executing ) |
1215 | { | 1222 | { |
1216 | executing = TRUE; | 1223 | executing = TRUE; |
1217 | qApp->enter_loop(); | 1224 | qApp->enter_loop(); |
1218 | } | 1225 | } |
1219 | 1226 | ||
1220 | return buttonpressed; | 1227 | return buttonpressed; |
1221 | } | 1228 | } |
1222 | 1229 | ||
1223 | void QuestionDlg::slotButtonPressed() | 1230 | void QuestionDlg::slotButtonPressed() |
1224 | { | 1231 | { |
1225 | if ( sender() == btn1 ) | 1232 | if ( sender() == btn1 ) |
1226 | buttonpressed = 1; | 1233 | buttonpressed = 1; |
1227 | else if ( sender() == btn2 ) | 1234 | else if ( sender() == btn2 ) |
1228 | buttonpressed = 2; | 1235 | buttonpressed = 2; |
1229 | else | 1236 | else |
1230 | buttonpressed = 0; | 1237 | buttonpressed = 0; |
1231 | 1238 | ||
1232 | qApp->exit_loop(); | 1239 | qApp->exit_loop(); |
1233 | } | 1240 | } |