summaryrefslogtreecommitdiff
path: root/noncore/settings/aqpkg
Unidiff
Diffstat (limited to 'noncore/settings/aqpkg') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/.cvsignore1
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro26
-rw-r--r--noncore/settings/aqpkg/main.cpp44
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp31
-rw-r--r--noncore/settings/aqpkg/mainwin.h5
5 files changed, 27 insertions, 80 deletions
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore
index 2888d4a..4183697 100644
--- a/noncore/settings/aqpkg/.cvsignore
+++ b/noncore/settings/aqpkg/.cvsignore
@@ -1,2 +1,3 @@
1Makefile* 1Makefile*
2moc* 2moc*
3.moc*
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index d241d1b..882cfd4 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,14 +1,13 @@
1 TEMPLATE= app 1 CONFIG = qt warn_on release quick-app
2 CONFIG = qt warn_on release
3 HEADERS = global.h \ 2 HEADERS = global.h \
4 mainwin.h \ 3 mainwin.h \
5 datamgr.h \ 4 datamgr.h \
6 settingsimpl.h \ 5 settingsimpl.h \
7 ipkg.h \ 6 ipkg.h \
8 packagewin.h \ 7 packagewin.h \
9 package.h \ 8 package.h \
10 installdlgimpl.h \ 9 installdlgimpl.h \
11 instoptionsimpl.h \ 10 instoptionsimpl.h \
12 destination.h \ 11 destination.h \
13 utils.h \ 12 utils.h \
14 server.h \ 13 server.h \
@@ -23,40 +22,19 @@ SOURCES = mainwin.cpp \
23 main.cpp \ 22 main.cpp \
24 packagewin.cpp \ 23 packagewin.cpp \
25 package.cpp \ 24 package.cpp \
26 installdlgimpl.cpp \ 25 installdlgimpl.cpp \
27 instoptionsimpl.cpp \ 26 instoptionsimpl.cpp \
28 destination.cpp \ 27 destination.cpp \
29 utils.cpp \ 28 utils.cpp \
30 server.cpp \ 29 server.cpp \
31 letterpushbutton.cpp \ 30 letterpushbutton.cpp \
32 inputdlg.cpp \ 31 inputdlg.cpp \
33 version.cpp \ 32 version.cpp \
34 categoryfilterimpl.cpp 33 categoryfilterimpl.cpp
35 INTERFACES=
36 TARGET = aqpkg 34 TARGET = aqpkg
37INCLUDEPATH += $(OPIEDIR)/include 35INCLUDEPATH += $(OPIEDIR)/include
38DEPENDPATH += $(OPIEDIR)/include 36DEPENDPATH += $(OPIEDIR)/include
39LIBS += -lqpe -lopie -lstdc++ 37LIBS += -lqpe -lopie -lstdc++
40DESTDIR = $(OPIEDIR)/bin
41
42TRANSLATIONS = ../../../i18n/de/aqpkg.ts \
43 ../../../i18n/nl/aqpkg.ts \
44 ../../../i18n/xx/aqpkg.ts \
45 ../../../i18n/en/aqpkg.ts \
46 ../../../i18n/es/aqpkg.ts \
47 ../../../i18n/fr/aqpkg.ts \
48 ../../../i18n/hu/aqpkg.ts \
49 ../../../i18n/ja/aqpkg.ts \
50 ../../../i18n/ko/aqpkg.ts \
51 ../../../i18n/no/aqpkg.ts \
52 ../../../i18n/pl/aqpkg.ts \
53 ../../../i18n/pt/aqpkg.ts \
54 ../../../i18n/pt_BR/aqpkg.ts \
55 ../../../i18n/sl/aqpkg.ts \
56 ../../../i18n/zh_CN/aqpkg.ts \
57 ../../../i18n/zh_TW/aqpkg.ts \
58 ../../../i18n/it/aqpkg.ts \
59 ../../../i18n/da/aqpkg.ts
60
61 38
62include ( $(OPIEDIR)/include.pro ) 39include ( $(OPIEDIR)/include.pro )
40
diff --git a/noncore/settings/aqpkg/main.cpp b/noncore/settings/aqpkg/main.cpp
index b7f8b7b..179f8b7 100644
--- a/noncore/settings/aqpkg/main.cpp
+++ b/noncore/settings/aqpkg/main.cpp
@@ -18,61 +18,21 @@
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
19..}^=.=       =       ; Public License for more details. 19..}^=.=       =       ; Public License for more details.
20++=   -.     .`     .: 20++=   -.     .`     .:
21 :     =  ...= . :.=- You should have received a copy of the GNU 21 :     =  ...= . :.=- You should have received a copy of the GNU
22 -.   .:....=;==+<; General Public License along with this file; 22 -.   .:....=;==+<; General Public License along with this file;
23  -_. . .   )=.  = see the file COPYING. If not, write to the 23  -_. . .   )=.  = see the file COPYING. If not, write to the
24    --        :-=` Free Software Foundation, Inc., 24    --        :-=` Free Software Foundation, Inc.,
25 59 Temple Place - Suite 330, 25 59 Temple Place - Suite 330,
26 Boston, MA 02111-1307, USA. 26 Boston, MA 02111-1307, USA.
27 27
28*/ 28*/
29 29
30#ifdef QWS
31#include <qpe/qpeapplication.h>
32#include <qpe/qcopenvelope_qws.h>
33#else
34#include <qapplication.h>
35#endif
36
37#include <qobjectdefs.h>
38
39#include "mainwin.h" 30#include "mainwin.h"
40#include "server.h"
41
42#include "global.h"
43 31
32#include <opie/oapplicationfactory.h>
44 33
45/* be less intrusive for translation -zecke */ 34/* be less intrusive for translation -zecke */
46extern QString LOCAL_SERVER; 35extern QString LOCAL_SERVER;
47extern QString LOCAL_IPKGS; 36extern QString LOCAL_IPKGS;
48 37
49int main(int argc, char *argv[]) 38OPIE_EXPORT_APP( OApplicationFactory<MainWindow> )
50{
51#ifdef QWS
52 QPEApplication a( argc, argv );
53#else
54 QApplication a( argc, argv );
55#endif
56
57#ifdef QWS
58 // Disable suspend mode
59 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::DisableSuspend;
60#endif
61
62 LOCAL_SERVER = QObject::tr( "Installed packages" );
63 LOCAL_IPKGS = QObject::tr( "Local packages" );
64
65 MainWindow *win = new MainWindow();
66 a.setMainWidget(win);
67 win->showMaximized();
68
69 a.exec();
70
71#ifdef QWS
72 // Reenable suspend mode
73 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
74#endif
75 #ifdef _DEBUG
76 DumpUnfreed();
77 #endif
78}
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,15 +1,15 @@
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
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This file is distributed in the hope that 14    .i_,=:_.      -<s. This file is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
@@ -57,27 +57,33 @@
57#include "global.h" 57#include "global.h"
58#include "inputdlg.h" 58#include "inputdlg.h"
59#include "ipkg.h" 59#include "ipkg.h"
60#include "installdlgimpl.h" 60#include "installdlgimpl.h"
61#include "letterpushbutton.h" 61#include "letterpushbutton.h"
62#include "mainwin.h" 62#include "mainwin.h"
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
67extern int compareVersions( const char *v1, const char *v2 ); 67extern int compareVersions( const char *v1, const char *v2 );
68 68
69MainWindow :: MainWindow() 69MainWindow :: 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
78 // Build menu and tool bars 84 // Build menu and tool bars
79 setToolBarsMovable( FALSE ); 85 setToolBarsMovable( FALSE );
80 86
81 QToolBar *bar = new QToolBar( this ); 87 QToolBar *bar = new QToolBar( this );
82 bar->setHorizontalStretchable( TRUE ); 88 bar->setHorizontalStretchable( TRUE );
83 QMenuBar *mb = new QMenuBar( bar ); 89 QMenuBar *mb = new QMenuBar( bar );
@@ -225,24 +231,27 @@ MainWindow :: MainWindow()
225 stack->addWidget( progressWindow, 2 ); 231 stack->addWidget( progressWindow, 2 );
226 stack->addWidget( networkPkgWindow, 1 ); 232 stack->addWidget( networkPkgWindow, 1 );
227 setCentralWidget( stack ); 233 setCentralWidget( stack );
228 stack->raiseWidget( progressWindow ); 234 stack->raiseWidget( progressWindow );
229 235
230 // Delayed call to finish initialization 236 // Delayed call to finish initialization
231 QTimer::singleShot( 100, this, SLOT( init() ) ); 237 QTimer::singleShot( 100, this, SLOT( init() ) );
232} 238}
233 239
234MainWindow :: ~MainWindow() 240MainWindow :: ~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
239void MainWindow :: initMainWidget() 248void MainWindow :: initMainWidget()
240{ 249{
241 networkPkgWindow = new QWidget( this ); 250 networkPkgWindow = new QWidget( this );
242 251
243 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); 252 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
244 253
245 serversList = new QComboBox( networkPkgWindow ); 254 serversList = new QComboBox( networkPkgWindow );
246 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) ); 255 connect( serversList, SIGNAL(activated(int)), this, SLOT(serverSelected(int)) );
247 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); 256 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
248 257
@@ -1003,25 +1012,24 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
1003 QString dest = "root"; 1012 QString dest = "root";
1004 if ( !p->isInstalled() ) 1013 if ( !p->isInstalled() )
1005 { 1014 {
1006 InstallData *newitem = new InstallData(); 1015 InstallData *newitem = new InstallData();
1007 newitem->option = "I"; 1016 newitem->option = "I";
1008 newitem->packageName = name; 1017 newitem->packageName = name;
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();
1022 else 1030 else
1023 newitem->packageName = name; 1031 newitem->packageName = name;
1024 1032
1025 if ( p->getInstalledTo() ) 1033 if ( p->getInstalledTo() )
1026 { 1034 {
1027 newitem->destination = p->getInstalledTo(); 1035 newitem->destination = p->getInstalledTo();
@@ -1037,25 +1045,24 @@ InstallData *MainWindow :: dealWithItem( QCheckListItem *item )
1037 // If the version requested is older and user selected a local ipk file, then reinstall the file 1045 // If the version requested is older and user selected a local ipk file, then reinstall the file
1038 if ( p->isPackageStoredLocally() && val == -1 ) 1046 if ( p->isPackageStoredLocally() && val == -1 )
1039 val = 0; 1047 val = 0;
1040 1048
1041 if ( val == -2 ) 1049 if ( val == -2 )
1042 { 1050 {
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 {
1056 QString caption; 1063 QString caption;
1057 QString text; 1064 QString text;
1058 QString secondButton; 1065 QString secondButton;
1059 QString secondOption; 1066 QString secondOption;
1060 if ( val == 0 ) 1067 if ( val == 0 )
1061 { 1068 {
@@ -1180,54 +1187,54 @@ void MainWindow :: letterPushed( QString t )
1180void MainWindow :: slotDisplayPackage( QListViewItem *item ) 1187void MainWindow :: slotDisplayPackage( QListViewItem *item )
1181{ 1188{
1182 QString itemstr( ((QCheckListItem*)item)->text() ); 1189 QString itemstr( ((QCheckListItem*)item)->text() );
1183 PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) ); 1190 PackageWindow *p = new PackageWindow( mgr->getServer( serversList->currentText() )->getPackage( itemstr ) );
1184 p->showMaximized(); 1191 p->showMaximized();
1185} 1192}
1186 1193
1187QuestionDlg::QuestionDlg( const QString &caption, const QString &text, const QString &secondbtn ) 1194QuestionDlg::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
1210int QuestionDlg::exec() 1217int 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
1223void QuestionDlg::slotButtonPressed() 1230void 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}
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index 615ff8b..b8e1c98 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -42,29 +42,30 @@ class QCheckListItem;
42class QComboBox; 42class QComboBox;
43class QLabel; 43class QLabel;
44class QLineEdit; 44class QLineEdit;
45class QListView; 45class QListView;
46class QListViewItem; 46class QListViewItem;
47class QToolBar; 47class QToolBar;
48class QProgressBar; 48class QProgressBar;
49class QPushButton; 49class QPushButton;
50class QWidgetStack; 50class QWidgetStack;
51 51
52class MainWindow :public QMainWindow 52class MainWindow :public QMainWindow
53{ 53{
54 Q_OBJECT 54 Q_OBJECT
55public: 55public:
56 56
57 MainWindow(); 57 MainWindow( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
58 ~MainWindow(); 58 ~MainWindow();
59 static QString appName() { return QString::fromLatin1( "aqpkg" ); };
59 60
60protected: 61protected:
61 void closeEvent( QCloseEvent* e ); 62 void closeEvent( QCloseEvent* e );
62 63
63private: 64private:
64 DataManager *mgr; 65 DataManager *mgr;
65 66
66 QWidgetStack *stack; 67 QWidgetStack *stack;
67 68
68 QToolBar *findBar; 69 QToolBar *findBar;
69 QToolBar *jumpBar; 70 QToolBar *jumpBar;
70 QLineEdit *findEdit; 71 QLineEdit *findEdit;