summaryrefslogtreecommitdiff
authordrw <drw>2003-02-04 17:52:14 (UTC)
committer drw <drw>2003-02-04 17:52:14 (UTC)
commit294f0a9b5e5678a6eba1fb77943201fac804049f (patch) (unidiff)
treeb37638264f6bd22bb0894025ea70037294f15c9d
parent328aeec813c953b260a992afc53a5c9d812e1bcf (diff)
downloadopie-294f0a9b5e5678a6eba1fb77943201fac804049f.zip
opie-294f0a9b5e5678a6eba1fb77943201fac804049f.tar.gz
opie-294f0a9b5e5678a6eba1fb77943201fac804049f.tar.bz2
Updates to configure dialog
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/.cvsignore2
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro3
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp2
-rw-r--r--noncore/settings/aqpkg/settings.ui872
-rw-r--r--noncore/settings/aqpkg/settingsimpl.cpp237
-rw-r--r--noncore/settings/aqpkg/settingsimpl.h45
6 files changed, 239 insertions, 922 deletions
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore
index 751040e..12658fc 100644
--- a/noncore/settings/aqpkg/.cvsignore
+++ b/noncore/settings/aqpkg/.cvsignore
@@ -1,8 +1,6 @@
1Makefile* 1Makefile*
2instoptions.cpp 2instoptions.cpp
3instoptions.h 3instoptions.h
4moc* 4moc*
5settings.cpp
6settings.h
7categoryfilter.cpp 5categoryfilter.cpp
8categoryfilter.h 6categoryfilter.h
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index d3f898b..f66fd95 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -1,63 +1,62 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on release 2 CONFIG = qt warn_on release
3 HEADERS = global.h \ 3 HEADERS = global.h \
4 mainwin.h \ 4 mainwin.h \
5 datamgr.h \ 5 datamgr.h \
6 settingsimpl.h \ 6 settingsimpl.h \
7 ipkg.h \ 7 ipkg.h \
8 package.h \ 8 package.h \
9 installdlgimpl.h \ 9 installdlgimpl.h \
10 instoptionsimpl.h \ 10 instoptionsimpl.h \
11 destination.h \ 11 destination.h \
12 utils.h \ 12 utils.h \
13 server.h \ 13 server.h \
14 helpwindow.h \ 14 helpwindow.h \
15 letterpushbutton.h \ 15 letterpushbutton.h \
16 inputdlg.h \ 16 inputdlg.h \
17 categoryfilterimpl.h 17 categoryfilterimpl.h
18 SOURCES = mainwin.cpp \ 18 SOURCES = mainwin.cpp \
19 datamgr.cpp \ 19 datamgr.cpp \
20 mem.cpp \ 20 mem.cpp \
21 settingsimpl.cpp \ 21 settingsimpl.cpp \
22 ipkg.cpp \ 22 ipkg.cpp \
23 main.cpp \ 23 main.cpp \
24 package.cpp \ 24 package.cpp \
25 installdlgimpl.cpp \ 25 installdlgimpl.cpp \
26 instoptionsimpl.cpp \ 26 instoptionsimpl.cpp \
27 destination.cpp \ 27 destination.cpp \
28 utils.cpp \ 28 utils.cpp \
29 server.cpp \ 29 server.cpp \
30 helpwindow.cpp \ 30 helpwindow.cpp \
31 letterpushbutton.cpp \ 31 letterpushbutton.cpp \
32 inputdlg.cpp \ 32 inputdlg.cpp \
33 version.cpp \ 33 version.cpp \
34 categoryfilterimpl.cpp 34 categoryfilterimpl.cpp
35 INTERFACES= settings.ui \ 35 INTERFACES= instoptions.ui \
36 instoptions.ui \
37 categoryfilter.ui 36 categoryfilter.ui
38 TARGET = aqpkg 37 TARGET = aqpkg
39INCLUDEPATH += $(OPIEDIR)/include 38INCLUDEPATH += $(OPIEDIR)/include
40DEPENDPATH += $(OPIEDIR)/include 39DEPENDPATH += $(OPIEDIR)/include
41LIBS += -lqpe -lopie -lstdc++ 40LIBS += -lqpe -lopie -lstdc++
42DESTDIR = $(OPIEDIR)/bin 41DESTDIR = $(OPIEDIR)/bin
43 42
44TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ 43TRANSLATIONS = ../../../i18n/de/aqpkg.ts \
45 ../../../i18n/xx/aqpkg.ts \ 44 ../../../i18n/xx/aqpkg.ts \
46 ../../../i18n/en/aqpkg.ts \ 45 ../../../i18n/en/aqpkg.ts \
47 ../../../i18n/es/aqpkg.ts \ 46 ../../../i18n/es/aqpkg.ts \
48 ../../../i18n/fr/aqpkg.ts \ 47 ../../../i18n/fr/aqpkg.ts \
49 ../../../i18n/hu/aqpkg.ts \ 48 ../../../i18n/hu/aqpkg.ts \
50 ../../../i18n/ja/aqpkg.ts \ 49 ../../../i18n/ja/aqpkg.ts \
51 ../../../i18n/ko/aqpkg.ts \ 50 ../../../i18n/ko/aqpkg.ts \
52 ../../../i18n/no/aqpkg.ts \ 51 ../../../i18n/no/aqpkg.ts \
53 ../../../i18n/pl/aqpkg.ts \ 52 ../../../i18n/pl/aqpkg.ts \
54 ../../../i18n/pt/aqpkg.ts \ 53 ../../../i18n/pt/aqpkg.ts \
55 ../../../i18n/pt_BR/aqpkg.ts \ 54 ../../../i18n/pt_BR/aqpkg.ts \
56 ../../../i18n/sl/aqpkg.ts \ 55 ../../../i18n/sl/aqpkg.ts \
57 ../../../i18n/zh_CN/aqpkg.ts \ 56 ../../../i18n/zh_CN/aqpkg.ts \
58 ../../../i18n/zh_TW/aqpkg.ts \ 57 ../../../i18n/zh_TW/aqpkg.ts \
59 ../../../i18n/it/aqpkg.ts \ 58 ../../../i18n/it/aqpkg.ts \
60 ../../../i18n/da/aqpkg.ts 59 ../../../i18n/da/aqpkg.ts
61 60
62 61
63include ( $(OPIEDIR)/include.pro ) 62include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index 947aace..361946c 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -1,1186 +1,1186 @@
1/*************************************************************************** 1/***************************************************************************
2 mainwin.cpp - description 2 mainwin.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 13:32:30 BST 2002 4 begin : Mon Aug 26 13:32:30 BST 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <linux/limits.h> 18#include <linux/limits.h>
19#include <unistd.h> 19#include <unistd.h>
20 20
21#include <qpe/qcopenvelope_qws.h> 21#include <qpe/qcopenvelope_qws.h>
22#include <qpe/qpemenubar.h> 22#include <qpe/qpemenubar.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qpe/qpetoolbar.h> 24#include <qpe/qpetoolbar.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/resource.h> 26#include <qpe/resource.h>
27 27
28#include <qaction.h> 28#include <qaction.h>
29#include <qcombobox.h> 29#include <qcombobox.h>
30#include <qfile.h> 30#include <qfile.h>
31#include <qlabel.h> 31#include <qlabel.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qlineedit.h> 33#include <qlineedit.h>
34#include <qlistview.h> 34#include <qlistview.h>
35#include <qmenubar.h> 35#include <qmenubar.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpopupmenu.h> 37#include <qpopupmenu.h>
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39#include <qtimer.h> 39#include <qtimer.h>
40#include <qwhatsthis.h> 40#include <qwhatsthis.h>
41#include <qwidgetstack.h> 41#include <qwidgetstack.h>
42 42
43#include "categoryfilterimpl.h" 43#include "categoryfilterimpl.h"
44#include "datamgr.h" 44#include "datamgr.h"
45#include "global.h" 45#include "global.h"
46#include "helpwindow.h" 46#include "helpwindow.h"
47#include "inputdlg.h" 47#include "inputdlg.h"
48#include "ipkg.h" 48#include "ipkg.h"
49#include "installdlgimpl.h" 49#include "installdlgimpl.h"
50#include "letterpushbutton.h" 50#include "letterpushbutton.h"
51#include "mainwin.h" 51#include "mainwin.h"
52#include "settingsimpl.h" 52#include "settingsimpl.h"
53#include "utils.h" 53#include "utils.h"
54 54
55extern int compareVersions( const char *v1, const char *v2 ); 55extern int compareVersions( const char *v1, const char *v2 );
56 56
57MainWindow :: MainWindow() 57MainWindow :: MainWindow()
58 :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) 58 :QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
59{ 59{
60 setCaption( tr( "AQPkg - Package Manager" ) ); 60 setCaption( tr( "AQPkg - Package Manager" ) );
61 61
62 // Create UI widgets 62 // Create UI widgets
63 initMainWidget(); 63 initMainWidget();
64 initProgressWidget(); 64 initProgressWidget();
65 65
66 // Build menu and tool bars 66 // Build menu and tool bars
67 setToolBarsMovable( FALSE ); 67 setToolBarsMovable( FALSE );
68 68
69 QPEToolBar *bar = new QPEToolBar( this ); 69 QPEToolBar *bar = new QPEToolBar( this );
70 bar->setHorizontalStretchable( TRUE ); 70 bar->setHorizontalStretchable( TRUE );
71 QPEMenuBar *mb = new QPEMenuBar( bar ); 71 QPEMenuBar *mb = new QPEMenuBar( bar );
72 mb->setMargin( 0 ); 72 mb->setMargin( 0 );
73 bar = new QPEToolBar( this ); 73 bar = new QPEToolBar( this );
74 74
75 // Find toolbar 75 // Find toolbar
76 findBar = new QPEToolBar( this ); 76 findBar = new QPEToolBar( this );
77 addToolBar( findBar, QMainWindow::Top, true ); 77 addToolBar( findBar, QMainWindow::Top, true );
78 findBar->setHorizontalStretchable( true ); 78 findBar->setHorizontalStretchable( true );
79 findEdit = new QLineEdit( findBar ); 79 findEdit = new QLineEdit( findBar );
80 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); 80 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
81 findBar->setStretchableWidget( findEdit ); 81 findBar->setStretchableWidget( findEdit );
82 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); 82 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) );
83 83
84 // Quick jump toolbar 84 // Quick jump toolbar
85 jumpBar = new QPEToolBar( this ); 85 jumpBar = new QPEToolBar( this );
86 addToolBar( jumpBar, QMainWindow::Top, true ); 86 addToolBar( jumpBar, QMainWindow::Top, true );
87 jumpBar->setHorizontalStretchable( true ); 87 jumpBar->setHorizontalStretchable( true );
88 QWidget *w = new QWidget( jumpBar ); 88 QWidget *w = new QWidget( jumpBar );
89 jumpBar->setStretchableWidget( w ); 89 jumpBar->setStretchableWidget( w );
90 90
91 QGridLayout *layout = new QGridLayout( w ); 91 QGridLayout *layout = new QGridLayout( w );
92 92
93 char text[2]; 93 char text[2];
94 text[1] = '\0'; 94 text[1] = '\0';
95 for ( int i = 0 ; i < 26 ; ++i ) 95 for ( int i = 0 ; i < 26 ; ++i )
96 { 96 {
97 text[0] = 'A' + i; 97 text[0] = 'A' + i;
98 LetterPushButton *b = new LetterPushButton( text, w ); 98 LetterPushButton *b = new LetterPushButton( text, w );
99 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 99 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
100 layout->addWidget( b, i / 13, i % 13); 100 layout->addWidget( b, i / 13, i % 13);
101 } 101 }
102 102
103 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 ); 103 QAction *a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, w, 0 );
104 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); 104 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
105 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); 105 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
106 a->addTo( jumpBar ); 106 a->addTo( jumpBar );
107 jumpBar->hide(); 107 jumpBar->hide();
108 108
109 // Packages menu 109 // Packages menu
110 QPopupMenu *popup = new QPopupMenu( this ); 110 QPopupMenu *popup = new QPopupMenu( this );
111 111
112 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 ); 112 a = new QAction( tr( "Update lists" ), Resource::loadPixmap( "aqpkg/update" ), QString::null, 0, this, 0 );
113 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 113 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
114 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); 114 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
115 a->addTo( popup ); 115 a->addTo( popup );
116 a->addTo( bar ); 116 a->addTo( bar );
117 117
118 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 ); 118 actionUpgrade = new QAction( tr( "Upgrade" ), Resource::loadPixmap( "aqpkg/upgrade" ), QString::null, 0, this, 0 );
119 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) ); 119 actionUpgrade->setWhatsThis( tr( "Click here to upgrade all installed packages if a newer version is available." ) );
120 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) ); 120 connect( actionUpgrade, SIGNAL( activated() ), this, SLOT( upgradePackages() ) );
121 actionUpgrade->addTo( popup ); 121 actionUpgrade->addTo( popup );
122 actionUpgrade->addTo( bar ); 122 actionUpgrade->addTo( bar );
123 123
124 iconDownload = Resource::loadPixmap( "aqpkg/download" ); 124 iconDownload = Resource::loadPixmap( "aqpkg/download" );
125 iconRemove = Resource::loadPixmap( "aqpkg/remove" ); 125 iconRemove = Resource::loadPixmap( "aqpkg/remove" );
126 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 ); 126 actionDownload = new QAction( tr( "Download" ), iconDownload, QString::null, 0, this, 0 );
127 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 127 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
128 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) ); 128 connect( actionDownload, SIGNAL( activated() ), this, SLOT( downloadPackage() ) );
129 actionDownload->addTo( popup ); 129 actionDownload->addTo( popup );
130 actionDownload->addTo( bar ); 130 actionDownload->addTo( bar );
131 131
132 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 ); 132 a = new QAction( tr( "Apply changes" ), Resource::loadPixmap( "aqpkg/apply" ), QString::null, 0, this, 0 );
133 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) ); 133 a->setWhatsThis( tr( "Click here to install, remove or upgrade currently selected package(s)." ) );
134 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) ); 134 connect( a, SIGNAL( activated() ), this, SLOT( applyChanges() ) );
135 a->addTo( popup ); 135 a->addTo( popup );
136 a->addTo( bar ); 136 a->addTo( bar );
137 137
138 mb->insertItem( tr( "Actions" ), popup ); 138 mb->insertItem( tr( "Actions" ), popup );
139 139
140 // View menu 140 // View menu
141 popup = new QPopupMenu( this ); 141 popup = new QPopupMenu( this );
142 142
143 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 ); 143 actionUninstalled = new QAction( tr( "Show packages not installed" ), QString::null, 0, this, 0 );
144 actionUninstalled->setToggleAction( TRUE ); 144 actionUninstalled->setToggleAction( TRUE );
145 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) ); 145 actionUninstalled->setWhatsThis( tr( "Click here to show packages available which have not been installed." ) );
146 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) ); 146 connect( actionUninstalled, SIGNAL( activated() ), this, SLOT( filterUninstalledPackages() ) );
147 actionUninstalled->addTo( popup ); 147 actionUninstalled->addTo( popup );
148 148
149 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 ); 149 actionInstalled = new QAction( tr( "Show installed packages" ), QString::null, 0, this, 0 );
150 actionInstalled->setToggleAction( TRUE ); 150 actionInstalled->setToggleAction( TRUE );
151 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) ); 151 actionInstalled->setWhatsThis( tr( "Click here to show packages currently installed on this device." ) );
152 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) ); 152 connect( actionInstalled, SIGNAL( activated() ), this, SLOT( filterInstalledPackages() ) );
153 actionInstalled->addTo( popup ); 153 actionInstalled->addTo( popup );
154 154
155 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 ); 155 actionUpdated = new QAction( tr( "Show updated packages" ), QString::null, 0, this, 0 );
156 actionUpdated->setToggleAction( TRUE ); 156 actionUpdated->setToggleAction( TRUE );
157 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) ); 157 actionUpdated->setWhatsThis( tr( "Click here to show packages currently installed on this device which have a newer version available." ) );
158 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) ); 158 connect( actionUpdated, SIGNAL( activated() ), this, SLOT( filterUpgradedPackages() ) );
159 actionUpdated->addTo( popup ); 159 actionUpdated->addTo( popup );
160 160
161 popup->insertSeparator(); 161 popup->insertSeparator();
162 162
163 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 ); 163 actionFilter = new QAction( tr( "Filter by category" ), Resource::loadPixmap( "aqpkg/filter" ), QString::null, 0, this, 0 );
164 actionFilter->setToggleAction( TRUE ); 164 actionFilter->setToggleAction( TRUE );
165 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) ); 165 actionFilter->setWhatsThis( tr( "Click here to list packages belonging to one category." ) );
166 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) ); 166 connect( actionFilter, SIGNAL( activated() ), this, SLOT( filterCategory() ) );
167 actionFilter->addTo( popup ); 167 actionFilter->addTo( popup );
168 168
169 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 ); 169 a = new QAction( tr( "Set filter category" ), QString::null, 0, this, 0 );
170 a->setWhatsThis( tr( "Click here to change package category to used filter." ) ); 170 a->setWhatsThis( tr( "Click here to change package category to used filter." ) );
171 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) ); 171 connect( a, SIGNAL( activated() ), this, SLOT( setFilterCategory() ) );
172 a->addTo( popup ); 172 a->addTo( popup );
173 173
174 popup->insertSeparator(); 174 popup->insertSeparator();
175 175
176 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); 176 a = new QAction( tr( "Find" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
177 a->setWhatsThis( tr( "Click here to search for text in package names." ) ); 177 a->setWhatsThis( tr( "Click here to search for text in package names." ) );
178 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) ); 178 connect( a, SIGNAL( activated() ), this, SLOT( displayFindBar() ) );
179 a->addTo( popup ); 179 a->addTo( popup );
180 180
181 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 ); 181 actionFindNext = new QAction( tr( "Find next" ), Resource::loadIconSet( "next" ), QString::null, 0, this, 0 );
182 actionFindNext->setEnabled( FALSE ); 182 actionFindNext->setEnabled( FALSE );
183 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) ); 183 actionFindNext->setWhatsThis( tr( "Click here to find the next package name containing the text you are searching for." ) );
184 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) ); 184 connect( actionFindNext, SIGNAL( activated() ), this, SLOT( repeatFind() ) );
185 actionFindNext->addTo( popup ); 185 actionFindNext->addTo( popup );
186 actionFindNext->addTo( findBar ); 186 actionFindNext->addTo( findBar );
187 187
188 188
189 popup->insertSeparator(); 189 popup->insertSeparator();
190 190
191 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 ); 191 a = new QAction( tr( "Quick Jump keypad" ), Resource::loadPixmap( "aqpkg/keyboard" ), QString::null, 0, this, 0 );
192 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) ); 192 a->setWhatsThis( tr( "Click here to display/hide keypad to allow quick movement through the package list." ) );
193 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) ); 193 connect( a, SIGNAL( activated() ), this, SLOT( displayJumpBar() ) );
194 a->addTo( popup ); 194 a->addTo( popup );
195 195
196 mb->insertItem( tr( "View" ), popup ); 196 mb->insertItem( tr( "View" ), popup );
197 197
198 198
199 // Options menu 199 // Options menu
200 popup = new QPopupMenu( this ); 200 popup = new QPopupMenu( this );
201 201
202 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 ); 202 a = new QAction( tr( "Configure" ), Resource::loadPixmap( "aqpkg/config" ), QString::null, 0, this, 0 );
203 a->setWhatsThis( tr( "Click here to configure this application." ) ); 203 a->setWhatsThis( tr( "Click here to configure this application." ) );
204 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) ); 204 connect( a, SIGNAL( activated() ), this, SLOT( displaySettings() ) );
205 a->addTo( popup ); 205 a->addTo( popup );
206 206
207 popup->insertSeparator(); 207 popup->insertSeparator();
208 208
209 a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 ); 209 a = new QAction( tr( "Help" ), Resource::loadPixmap( "help_icon" ), QString::null, 0, this, 0 );
210 a->setWhatsThis( tr( "Click here for help." ) ); 210 a->setWhatsThis( tr( "Click here for help." ) );
211 connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) ); 211 connect( a, SIGNAL( activated() ), this, SLOT( displayHelp() ) );
212 a->addTo( popup ); 212 a->addTo( popup );
213 213
214 a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 ); 214 a = new QAction( tr( "About" ), Resource::loadPixmap( "UtilsIcon" ), QString::null, 0, this, 0 );
215 a->setWhatsThis( tr( "Click here for software version information." ) ); 215 a->setWhatsThis( tr( "Click here for software version information." ) );
216 connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) ); 216 connect( a, SIGNAL( activated() ), this, SLOT( displayAbout() ) );
217 a->addTo( popup ); 217 a->addTo( popup );
218 218
219 mb->insertItem( tr( "Options" ), popup ); 219 mb->insertItem( tr( "Options" ), popup );
220 220
221 // Finish find toolbar creation 221 // Finish find toolbar creation
222 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 222 a = new QAction( QString::null, Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
223 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) ); 223 a->setWhatsThis( tr( "Click here to hide the find toolbar." ) );
224 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) ); 224 connect( a, SIGNAL( activated() ), this, SLOT( hideFindBar() ) );
225 a->addTo( findBar ); 225 a->addTo( findBar );
226 findBar->hide(); 226 findBar->hide();
227 227
228 // Create widget stack and add UI widgets 228 // Create widget stack and add UI widgets
229 stack = new QWidgetStack( this ); 229 stack = new QWidgetStack( this );
230 stack->addWidget( progressWindow, 2 ); 230 stack->addWidget( progressWindow, 2 );
231 stack->addWidget( networkPkgWindow, 1 ); 231 stack->addWidget( networkPkgWindow, 1 );
232 setCentralWidget( stack ); 232 setCentralWidget( stack );
233 stack->raiseWidget( progressWindow ); 233 stack->raiseWidget( progressWindow );
234 234
235 // Delayed call to finish initialization 235 // Delayed call to finish initialization
236 QTimer::singleShot( 100, this, SLOT( init() ) ); 236 QTimer::singleShot( 100, this, SLOT( init() ) );
237} 237}
238 238
239MainWindow :: ~MainWindow() 239MainWindow :: ~MainWindow()
240{ 240{
241 delete mgr; 241 delete mgr;
242} 242}
243 243
244void MainWindow :: initMainWidget() 244void MainWindow :: initMainWidget()
245{ 245{
246 networkPkgWindow = new QWidget( this ); 246 networkPkgWindow = new QWidget( this );
247 247
248 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow ); 248 QLabel *l = new QLabel( tr( "Servers:" ), networkPkgWindow );
249 249
250 serversList = new QComboBox( networkPkgWindow ); 250 serversList = new QComboBox( networkPkgWindow );
251 connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) ); 251 connect( serversList, SIGNAL( activated( int ) ), this, SLOT( serverSelected( int ) ) );
252 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) ); 252 QWhatsThis::add( serversList, tr( "Click here to select a package feed." ) );
253 253
254 installedIcon = Resource::loadPixmap( "aqpkg/installed" ); 254 installedIcon = Resource::loadPixmap( "aqpkg/installed" );
255 updatedIcon = Resource::loadPixmap( "aqpkg/updated" ); 255 updatedIcon = Resource::loadPixmap( "aqpkg/updated" );
256 256
257 packagesList = new QListView( networkPkgWindow ); 257 packagesList = new QListView( networkPkgWindow );
258 packagesList->addColumn( tr( "Packages" ), 225 ); 258 packagesList->addColumn( tr( "Packages" ), 225 );
259 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) ); 259 QWhatsThis::add( packagesList, tr( "This is a listing of all packages for the server feed selected above.\n\nA blue dot next to the package name indicates that the package is currently installed.\n\nA blue dot with a star indicates that a newer version of the package is available from the server feed.\n\nClick inside the box at the left to select a package." ) );
260 260
261 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 ); 261 QVBoxLayout *vbox = new QVBoxLayout( networkPkgWindow, 0, -1 );
262 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 ); 262 QHBoxLayout *hbox1 = new QHBoxLayout( vbox, -1 );
263 hbox1->addWidget( l ); 263 hbox1->addWidget( l );
264 hbox1->addWidget( serversList ); 264 hbox1->addWidget( serversList );
265 265
266 vbox->addWidget( packagesList ); 266 vbox->addWidget( packagesList );
267 267
268 downloadEnabled = TRUE; 268 downloadEnabled = TRUE;
269} 269}
270 270
271void MainWindow :: initProgressWidget() 271void MainWindow :: initProgressWidget()
272{ 272{
273 progressWindow = new QWidget( this ); 273 progressWindow = new QWidget( this );
274 274
275 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 ); 275 QVBoxLayout *layout = new QVBoxLayout( progressWindow, 4, 4 );
276 276
277 m_status = new QLabel( progressWindow ); 277 m_status = new QLabel( progressWindow );
278 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); 278 m_status->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
279 layout->addWidget( m_status ); 279 layout->addWidget( m_status );
280 280
281 m_progress = new QProgressBar( progressWindow ); 281 m_progress = new QProgressBar( progressWindow );
282 layout->addWidget( m_progress ); 282 layout->addWidget( m_progress );
283} 283}
284 284
285void MainWindow :: init() 285void MainWindow :: init()
286{ 286{
287#ifdef QWS 287#ifdef QWS
288 // read download directory from config file 288 // read download directory from config file
289 Config cfg( "aqpkg" ); 289 Config cfg( "aqpkg" );
290 cfg.setGroup( "settings" ); 290 cfg.setGroup( "settings" );
291 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" ); 291 currentlySelectedServer = cfg.readEntry( "selectedServer", "local" );
292// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" ); 292// showJumpTo = cfg.readBoolEntry( "showJumpTo", "true" );
293 293
294#endif 294#endif
295 295
296 stack->raiseWidget( progressWindow ); 296 stack->raiseWidget( progressWindow );
297 297
298 mgr = new DataManager(); 298 mgr = new DataManager();
299 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) ); 299 connect( mgr, SIGNAL( progressSetSteps( int ) ), this, SLOT( setProgressSteps( int ) ) );
300 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ), 300 connect( mgr, SIGNAL( progressSetMessage( const QString & ) ),
301 this, SLOT( setProgressMessage( const QString & ) ) ); 301 this, SLOT( setProgressMessage( const QString & ) ) );
302 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) ); 302 connect( mgr, SIGNAL( progressUpdate( int ) ), this, SLOT( updateProgress( int ) ) );
303 mgr->loadServers(); 303 mgr->loadServers();
304 304
305 showUninstalledPkgs = false; 305 showUninstalledPkgs = false;
306 showInstalledPkgs = false; 306 showInstalledPkgs = false;
307 showUpgradedPkgs = false; 307 showUpgradedPkgs = false;
308 categoryFilterEnabled = false; 308 categoryFilterEnabled = false;
309 309
310 updateData(); 310 updateData();
311 311
312 stack->raiseWidget( networkPkgWindow ); 312 stack->raiseWidget( networkPkgWindow );
313} 313}
314/* 314/*
315void MainWindow :: setDocument( const QString &doc ) 315void MainWindow :: setDocument( const QString &doc )
316{ 316{
317 // Remove path from package 317 // Remove path from package
318 QString package = Utils::getPackageNameFromIpkFilename( doc ); 318 QString package = Utils::getPackageNameFromIpkFilename( doc );
319// std::cout << "Selecting package " << package << std::endl; 319// std::cout << "Selecting package " << package << std::endl;
320 320
321 // First select local server 321 // First select local server
322 for ( int i = 0 ; i < serversList->count() ; ++i ) 322 for ( int i = 0 ; i < serversList->count() ; ++i )
323 { 323 {
324 if ( serversList->text( i ) == LOCAL_IPKGS ) 324 if ( serversList->text( i ) == LOCAL_IPKGS )
325 { 325 {
326 serversList->setCurrentItem( i ); 326 serversList->setCurrentItem( i );
327 break; 327 break;
328 } 328 }
329 } 329 }
330 serverSelected( 0 ); 330 serverSelected( 0 );
331 331
332 // Now set the check box of the selected package 332 // Now set the check box of the selected package
333 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 333 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
334 item != 0 ; 334 item != 0 ;
335 item = (QCheckListItem *)item->nextSibling() ) 335 item = (QCheckListItem *)item->nextSibling() )
336 { 336 {
337 if ( item->text().startsWith( package ) ) 337 if ( item->text().startsWith( package ) )
338 { 338 {
339 item->setOn( true ); 339 item->setOn( true );
340 break; 340 break;
341 } 341 }
342 } 342 }
343} 343}
344*/ 344*/
345void MainWindow :: displaySettings() 345void MainWindow :: displaySettings()
346{ 346{
347 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true ); 347 SettingsImpl *dlg = new SettingsImpl( mgr, this, "Settings", true );
348 if ( dlg->showDlg( 0 ) ) 348 if ( dlg->showDlg() )
349 { 349 {
350 stack->raiseWidget( progressWindow ); 350 stack->raiseWidget( progressWindow );
351 updateData(); 351 updateData();
352 stack->raiseWidget( networkPkgWindow ); 352 stack->raiseWidget( networkPkgWindow );
353 } 353 }
354 delete dlg; 354 delete dlg;
355} 355}
356 356
357void MainWindow :: displayHelp() 357void MainWindow :: displayHelp()
358{ 358{
359 HelpWindow *dlg = new HelpWindow( this ); 359 HelpWindow *dlg = new HelpWindow( this );
360 dlg->exec(); 360 dlg->exec();
361 delete dlg; 361 delete dlg;
362} 362}
363 363
364void MainWindow :: displayFindBar() 364void MainWindow :: displayFindBar()
365{ 365{
366 findBar->show(); 366 findBar->show();
367 findEdit->setFocus(); 367 findEdit->setFocus();
368} 368}
369 369
370void MainWindow :: displayJumpBar() 370void MainWindow :: displayJumpBar()
371{ 371{
372 jumpBar->show(); 372 jumpBar->show();
373} 373}
374 374
375void MainWindow :: repeatFind() 375void MainWindow :: repeatFind()
376{ 376{
377 searchForPackage( findEdit->text() ); 377 searchForPackage( findEdit->text() );
378} 378}
379 379
380void MainWindow :: findPackage( const QString &text ) 380void MainWindow :: findPackage( const QString &text )
381{ 381{
382 actionFindNext->setEnabled( !text.isEmpty() ); 382 actionFindNext->setEnabled( !text.isEmpty() );
383 searchForPackage( text ); 383 searchForPackage( text );
384} 384}
385 385
386void MainWindow :: hideFindBar() 386void MainWindow :: hideFindBar()
387{ 387{
388 findBar->hide(); 388 findBar->hide();
389} 389}
390 390
391void MainWindow :: hideJumpBar() 391void MainWindow :: hideJumpBar()
392{ 392{
393 jumpBar->hide(); 393 jumpBar->hide();
394} 394}
395 395
396void MainWindow :: displayAbout() 396void MainWindow :: displayAbout()
397{ 397{
398 QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) ); 398 QMessageBox::about( this, tr( "About AQPkg" ), tr( VERSION_TEXT ) );
399} 399}
400 400
401void MainWindow :: filterUninstalledPackages() 401void MainWindow :: filterUninstalledPackages()
402{ 402{
403 showUninstalledPkgs = actionUninstalled->isOn(); 403 showUninstalledPkgs = actionUninstalled->isOn();
404 if ( showUninstalledPkgs ) 404 if ( showUninstalledPkgs )
405 { 405 {
406 showInstalledPkgs = FALSE; 406 showInstalledPkgs = FALSE;
407 showUpgradedPkgs = FALSE; 407 showUpgradedPkgs = FALSE;
408 } 408 }
409 serverSelected( -1 ); 409 serverSelected( -1 );
410 410
411 actionInstalled->setOn( FALSE ); 411 actionInstalled->setOn( FALSE );
412 actionUpdated->setOn( FALSE ); 412 actionUpdated->setOn( FALSE );
413} 413}
414 414
415void MainWindow :: filterInstalledPackages() 415void MainWindow :: filterInstalledPackages()
416{ 416{
417 showInstalledPkgs = actionInstalled->isOn(); 417 showInstalledPkgs = actionInstalled->isOn();
418 if ( showInstalledPkgs ) 418 if ( showInstalledPkgs )
419 { 419 {
420 showUninstalledPkgs = FALSE; 420 showUninstalledPkgs = FALSE;
421 showUpgradedPkgs = FALSE; 421 showUpgradedPkgs = FALSE;
422 } 422 }
423 serverSelected( -1 ); 423 serverSelected( -1 );
424 424
425 actionUninstalled->setOn( FALSE ); 425 actionUninstalled->setOn( FALSE );
426 actionUpdated->setOn( FALSE ); 426 actionUpdated->setOn( FALSE );
427} 427}
428 428
429void MainWindow :: filterUpgradedPackages() 429void MainWindow :: filterUpgradedPackages()
430{ 430{
431 showUpgradedPkgs = actionUpdated->isOn(); 431 showUpgradedPkgs = actionUpdated->isOn();
432 if ( showUpgradedPkgs ) 432 if ( showUpgradedPkgs )
433 { 433 {
434 showUninstalledPkgs = FALSE; 434 showUninstalledPkgs = FALSE;
435 showInstalledPkgs = FALSE; 435 showInstalledPkgs = FALSE;
436 } 436 }
437 serverSelected( -1 ); 437 serverSelected( -1 );
438 438
439 actionUninstalled->setOn( FALSE ); 439 actionUninstalled->setOn( FALSE );
440 actionInstalled->setOn( FALSE ); 440 actionInstalled->setOn( FALSE );
441} 441}
442 442
443bool MainWindow :: setFilterCategory() 443bool MainWindow :: setFilterCategory()
444{ 444{
445 // Get categories; 445 // Get categories;
446 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this ); 446 CategoryFilterImpl dlg( DataManager::getAvailableCategories(), categoryFilter, this );
447 if ( dlg.exec() == QDialog::Accepted ) 447 if ( dlg.exec() == QDialog::Accepted )
448 { 448 {
449 categoryFilter = dlg.getSelectedFilter(); 449 categoryFilter = dlg.getSelectedFilter();
450 450
451 if ( categoryFilter == "" ) 451 if ( categoryFilter == "" )
452 return false; 452 return false;
453 453
454 categoryFilterEnabled = true; 454 categoryFilterEnabled = true;
455 serverSelected( -1 ); 455 serverSelected( -1 );
456 actionFilter->setOn( TRUE ); 456 actionFilter->setOn( TRUE );
457 return true; 457 return true;
458 } 458 }
459 459
460 return false; 460 return false;
461} 461}
462 462
463void MainWindow :: filterCategory() 463void MainWindow :: filterCategory()
464{ 464{
465 if ( !actionFilter->isOn() ) 465 if ( !actionFilter->isOn() )
466 { 466 {
467 filterByCategory( FALSE ); 467 filterByCategory( FALSE );
468 } 468 }
469 else 469 else
470 { 470 {
471 actionFilter->setOn( filterByCategory( TRUE ) ); 471 actionFilter->setOn( filterByCategory( TRUE ) );
472 } 472 }
473} 473}
474 474
475bool MainWindow :: filterByCategory( bool val ) 475bool MainWindow :: filterByCategory( bool val )
476{ 476{
477 if ( val ) 477 if ( val )
478 { 478 {
479 if ( categoryFilter == "" ) 479 if ( categoryFilter == "" )
480 { 480 {
481 if ( !setFilterCategory() ) 481 if ( !setFilterCategory() )
482 return false; 482 return false;
483 } 483 }
484 484
485 categoryFilterEnabled = true; 485 categoryFilterEnabled = true;
486 serverSelected( -1 ); 486 serverSelected( -1 );
487 return true; 487 return true;
488 } 488 }
489 else 489 else
490 { 490 {
491 // Turn off filter 491 // Turn off filter
492 categoryFilterEnabled = false; 492 categoryFilterEnabled = false;
493 serverSelected( -1 ); 493 serverSelected( -1 );
494 return false; 494 return false;
495 } 495 }
496} 496}
497 497
498void MainWindow :: raiseMainWidget() 498void MainWindow :: raiseMainWidget()
499{ 499{
500 stack->raiseWidget( networkPkgWindow ); 500 stack->raiseWidget( networkPkgWindow );
501} 501}
502 502
503void MainWindow :: raiseProgressWidget() 503void MainWindow :: raiseProgressWidget()
504{ 504{
505 stack->raiseWidget( progressWindow ); 505 stack->raiseWidget( progressWindow );
506} 506}
507 507
508void MainWindow :: enableUpgrade( bool enabled ) 508void MainWindow :: enableUpgrade( bool enabled )
509{ 509{
510 actionUpgrade->setEnabled( enabled ); 510 actionUpgrade->setEnabled( enabled );
511} 511}
512 512
513void MainWindow :: enableDownload( bool enabled ) 513void MainWindow :: enableDownload( bool enabled )
514{ 514{
515 if ( enabled ) 515 if ( enabled )
516 { 516 {
517 actionDownload->setIconSet( iconDownload ); 517 actionDownload->setIconSet( iconDownload );
518 actionDownload->setText( tr( "Download" ) ); 518 actionDownload->setText( tr( "Download" ) );
519 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) ); 519 actionDownload->setWhatsThis( tr( "Click here to download the currently selected package(s)." ) );
520 } 520 }
521 else 521 else
522 { 522 {
523 actionDownload->setIconSet( iconRemove ); 523 actionDownload->setIconSet( iconRemove );
524 actionDownload->setText( tr( "Remove" ) ); 524 actionDownload->setText( tr( "Remove" ) );
525 actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) ); 525 actionDownload->setWhatsThis( tr( "Click here to uninstall the currently selected package(s)." ) );
526 } 526 }
527} 527}
528 528
529void MainWindow :: setProgressSteps( int numsteps ) 529void MainWindow :: setProgressSteps( int numsteps )
530{ 530{
531 m_progress->setTotalSteps( numsteps ); 531 m_progress->setTotalSteps( numsteps );
532} 532}
533 533
534void MainWindow :: setProgressMessage( const QString &msg ) 534void MainWindow :: setProgressMessage( const QString &msg )
535{ 535{
536 m_status->setText( msg ); 536 m_status->setText( msg );
537} 537}
538 538
539void MainWindow :: updateProgress( int progress ) 539void MainWindow :: updateProgress( int progress )
540{ 540{
541 m_progress->setProgress( progress ); 541 m_progress->setProgress( progress );
542} 542}
543 543
544void MainWindow :: updateData() 544void MainWindow :: updateData()
545{ 545{
546 m_progress->setTotalSteps( mgr->getServerList().size() ); 546 m_progress->setTotalSteps( mgr->getServerList().size() );
547 547
548 serversList->clear(); 548 serversList->clear();
549 packagesList->clear(); 549 packagesList->clear();
550 550
551 vector<Server>::iterator it; 551 vector<Server>::iterator it;
552 int activeItem = -1; 552 int activeItem = -1;
553 int i; 553 int i;
554 QString serverName; 554 QString serverName;
555 for ( i = 0, it = mgr->getServerList().begin() ; it != mgr->getServerList().end() ; ++it, ++i ) 555 for ( i = 0, it = mgr->getServerList().begin() ; it != mgr->getServerList().end() ; ++it, ++i )
556 { 556 {
557 serverName = it->getServerName(); 557 serverName = it->getServerName();
558 m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) ); 558 m_status->setText( tr( "Building server list:\n\t%1" ).arg( serverName ) );
559 m_progress->setProgress( i ); 559 m_progress->setProgress( i );
560 qApp->processEvents(); 560 qApp->processEvents();
561 561
562// cout << "Adding " << it->getServerName() << " to combobox" << endl; 562// cout << "Adding " << it->getServerName() << " to combobox" << endl;
563 if ( !it->isServerActive() ) 563 if ( !it->isServerActive() )
564 { 564 {
565// cout << serverName << " is not active" << endl; 565// cout << serverName << " is not active" << endl;
566 i--; 566 i--;
567 continue; 567 continue;
568 } 568 }
569 569
570 serversList->insertItem( serverName ); 570 serversList->insertItem( serverName );
571 if ( serverName == currentlySelectedServer ) 571 if ( serverName == currentlySelectedServer )
572 activeItem = i; 572 activeItem = i;
573 } 573 }
574 574
575 // set selected server to be active server 575 // set selected server to be active server
576 if ( activeItem != -1 ) 576 if ( activeItem != -1 )
577 serversList->setCurrentItem( activeItem ); 577 serversList->setCurrentItem( activeItem );
578 serverSelected( 0, FALSE ); 578 serverSelected( 0, FALSE );
579} 579}
580 580
581void MainWindow :: serverSelected( int index ) 581void MainWindow :: serverSelected( int index )
582{ 582{
583 serverSelected( index, TRUE ); 583 serverSelected( index, TRUE );
584} 584}
585 585
586void MainWindow :: serverSelected( int, bool raiseProgress ) 586void MainWindow :: serverSelected( int, bool raiseProgress )
587{ 587{
588 QPixmap nullIcon( installedIcon.size() ); 588 QPixmap nullIcon( installedIcon.size() );
589 nullIcon.fill( colorGroup().base() ); 589 nullIcon.fill( colorGroup().base() );
590 590
591 // display packages 591 // display packages
592 QString serverName = serversList->currentText(); 592 QString serverName = serversList->currentText();
593 currentlySelectedServer = serverName; 593 currentlySelectedServer = serverName;
594 594
595 vector<Server>::iterator s = mgr->getServer( serverName ); 595 vector<Server>::iterator s = mgr->getServer( serverName );
596 596
597 vector<Package> &list = s->getPackageList(); 597 vector<Package> &list = s->getPackageList();
598 vector<Package>::iterator it; 598 vector<Package>::iterator it;
599 599
600 // Display progress widget while loading list 600 // Display progress widget while loading list
601 bool doProgress = ( list.size() > 200 ); 601 bool doProgress = ( list.size() > 200 );
602 if ( doProgress ) 602 if ( doProgress )
603 { 603 {
604 if ( raiseProgress ) 604 if ( raiseProgress )
605 { 605 {
606 stack->raiseWidget( progressWindow ); 606 stack->raiseWidget( progressWindow );
607 } 607 }
608 m_progress->setTotalSteps( list.size() ); 608 m_progress->setTotalSteps( list.size() );
609 m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) ); 609 m_status->setText( tr( "Building package list for:\n\t%1" ).arg( serverName ) );
610 } 610 }
611 611
612 packagesList->clear(); 612 packagesList->clear();
613 613
614#ifdef QWS 614#ifdef QWS
615 // read download directory from config file 615 // read download directory from config file
616 Config cfg( "aqpkg" ); 616 Config cfg( "aqpkg" );
617 cfg.setGroup( "settings" ); 617 cfg.setGroup( "settings" );
618 cfg.writeEntry( "selectedServer", currentlySelectedServer ); 618 cfg.writeEntry( "selectedServer", currentlySelectedServer );
619#endif 619#endif
620 620
621 int i = 0; 621 int i = 0;
622 for ( it = list.begin() ; it != list.end() ; ++it ) 622 for ( it = list.begin() ; it != list.end() ; ++it )
623 { 623 {
624 // Update progress after every 100th package (arbitrary value, seems to give good balance) 624 // Update progress after every 100th package (arbitrary value, seems to give good balance)
625 i++; 625 i++;
626 if ( ( i % 100 ) == 0 ) 626 if ( ( i % 100 ) == 0 )
627 { 627 {
628 if ( doProgress ) 628 if ( doProgress )
629 { 629 {
630 m_progress->setProgress( i ); 630 m_progress->setProgress( i );
631 } 631 }
632 qApp->processEvents(); 632 qApp->processEvents();
633 } 633 }
634 634
635 QString text = ""; 635 QString text = "";
636 636
637 // Apply show only uninstalled packages filter 637 // Apply show only uninstalled packages filter
638 if ( showUninstalledPkgs && it->isInstalled() ) 638 if ( showUninstalledPkgs && it->isInstalled() )
639 continue; 639 continue;
640 640
641 // Apply show only installed packages filter 641 // Apply show only installed packages filter
642 if ( showInstalledPkgs && !it->isInstalled() ) 642 if ( showInstalledPkgs && !it->isInstalled() )
643 continue; 643 continue;
644 644
645 // Apply show only new installed packages filter 645 // Apply show only new installed packages filter
646 if ( showUpgradedPkgs ) 646 if ( showUpgradedPkgs )
647 { 647 {
648 if ( !it->isInstalled() || 648 if ( !it->isInstalled() ||
649 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 ) 649 compareVersions( it->getInstalledVersion(), it->getVersion() ) != 1 )
650 continue; 650 continue;
651 } 651 }
652 652
653 // Apply the section filter 653 // Apply the section filter
654 if ( categoryFilterEnabled && categoryFilter != "" ) 654 if ( categoryFilterEnabled && categoryFilter != "" )
655 { 655 {
656 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 ) 656 if ( it->getSection() == "" || categoryFilter.find( it->getSection().lower() ) == -1 )
657 continue; 657 continue;
658 } 658 }
659 659
660 // If the local server, only display installed packages 660 // If the local server, only display installed packages
661 if ( serverName == LOCAL_SERVER && !it->isInstalled() ) 661 if ( serverName == LOCAL_SERVER && !it->isInstalled() )
662 continue; 662 continue;
663 663
664 664
665 QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox ); 665 QCheckListItem *item = new QCheckListItem( packagesList, it->getPackageName(), QCheckListItem::CheckBox );
666 666
667 if ( it->isInstalled() ) 667 if ( it->isInstalled() )
668 { 668 {
669 // If a different version of package is available, show update available icon 669 // If a different version of package is available, show update available icon
670 // Otherwise, show installed icon 670 // Otherwise, show installed icon
671 if ( it->getVersion() != it->getInstalledVersion() && 671 if ( it->getVersion() != it->getInstalledVersion() &&
672 compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1) 672 compareVersions( it->getInstalledVersion(), it->getVersion() ) == 1)
673 { 673 {
674 674
675 item->setPixmap( 0, updatedIcon ); 675 item->setPixmap( 0, updatedIcon );
676 } 676 }
677 else 677 else
678 { 678 {
679 item->setPixmap( 0, installedIcon ); 679 item->setPixmap( 0, installedIcon );
680 } 680 }
681 681
682 QString destName = ""; 682 QString destName = "";
683 if ( it->getLocalPackage() ) 683 if ( it->getLocalPackage() )
684 { 684 {
685 if ( it->getLocalPackage()->getInstalledTo() ) 685 if ( it->getLocalPackage()->getInstalledTo() )
686 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName(); 686 destName = it->getLocalPackage()->getInstalledTo()->getDestinationName();
687 } 687 }
688 else 688 else
689 { 689 {
690 if ( it->getInstalledTo() ) 690 if ( it->getInstalledTo() )
691 destName = it->getInstalledTo()->getDestinationName(); 691 destName = it->getInstalledTo()->getDestinationName();
692 } 692 }
693 if ( destName != "" ) 693 if ( destName != "" )
694 new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) ); 694 new QCheckListItem( item, QString( tr( "Installed To - %1" ).arg( destName ) ) );
695 } 695 }
696 else 696 else
697 { 697 {
698 item->setPixmap( 0, nullIcon ); 698 item->setPixmap( 0, nullIcon );
699 } 699 }
700 700
701 if ( !it->isPackageStoredLocally() ) 701 if ( !it->isPackageStoredLocally() )
702 { 702 {
703 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) ); 703 new QCheckListItem( item, QString( tr( "Description - %1" ).arg( it->getDescription() ) ) );
704 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) ); 704 new QCheckListItem( item, QString( tr( "Size - %1" ).arg( it->getPackageSize() ) ) );
705 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) ); 705 new QCheckListItem( item, QString( tr( "Section - %1" ).arg( it->getSection() ) ) );
706 } 706 }
707 else 707 else
708 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) ); 708 new QCheckListItem( item, QString( tr( "Filename - %1" ).arg( it->getFilename() ) ) );
709 709
710 if ( serverName == LOCAL_SERVER ) 710 if ( serverName == LOCAL_SERVER )
711 { 711 {
712 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) ); 712 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getVersion() ) ) );
713 } 713 }
714 else 714 else
715 { 715 {
716 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) ); 716 new QCheckListItem( item, QString( tr( "V. Available - %1" ).arg( it->getVersion() ) ) );
717 if ( it->getLocalPackage() ) 717 if ( it->getLocalPackage() )
718 { 718 {
719 if ( it->isInstalled() ) 719 if ( it->isInstalled() )
720 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) ); 720 new QCheckListItem( item, QString( tr( "V. Installed - %1" ).arg( it->getInstalledVersion() ) ) );
721 } 721 }
722 } 722 }
723 723
724 packagesList->insertItem( item ); 724 packagesList->insertItem( item );
725 } 725 }
726 726
727 // If the local server or the local ipkgs server disable the download button 727 // If the local server or the local ipkgs server disable the download button
728 if ( serverName == LOCAL_SERVER ) 728 if ( serverName == LOCAL_SERVER )
729 { 729 {
730 downloadEnabled = TRUE; 730 downloadEnabled = TRUE;
731 actionUpgrade->setEnabled( FALSE ); 731 actionUpgrade->setEnabled( FALSE );
732 } 732 }
733 else if ( serverName == LOCAL_IPKGS ) 733 else if ( serverName == LOCAL_IPKGS )
734 { 734 {
735 downloadEnabled = FALSE; 735 downloadEnabled = FALSE;
736 actionUpgrade->setEnabled( FALSE ); 736 actionUpgrade->setEnabled( FALSE );
737 } 737 }
738 else 738 else
739 { 739 {
740 downloadEnabled = TRUE; 740 downloadEnabled = TRUE;
741 actionUpgrade->setEnabled( TRUE ); 741 actionUpgrade->setEnabled( TRUE );
742 } 742 }
743 enableDownload( downloadEnabled ); 743 enableDownload( downloadEnabled );
744 744
745 // Display this widget once everything is done 745 // Display this widget once everything is done
746 if ( doProgress && raiseProgress ) 746 if ( doProgress && raiseProgress )
747 { 747 {
748 stack->raiseWidget( networkPkgWindow ); 748 stack->raiseWidget( networkPkgWindow );
749 } 749 }
750} 750}
751 751
752void MainWindow :: searchForPackage( const QString &text ) 752void MainWindow :: searchForPackage( const QString &text )
753{ 753{
754 if ( !text.isEmpty() ) 754 if ( !text.isEmpty() )
755 { 755 {
756// cout << "searching for " << text << endl; 756// cout << "searching for " << text << endl;
757 // look through package list for text startng at current position 757 // look through package list for text startng at current position
758 vector<InstallData> workingPackages; 758 vector<InstallData> workingPackages;
759 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 759 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
760// if ( start != 0 ) 760// if ( start != 0 )
761// start = (QCheckListItem *)start->nextSibling(); 761// start = (QCheckListItem *)start->nextSibling();
762 762
763 if ( start == 0 ) 763 if ( start == 0 )
764 start = (QCheckListItem *)packagesList->firstChild(); 764 start = (QCheckListItem *)packagesList->firstChild();
765 765
766 for ( QCheckListItem *item = start; item != 0 ; 766 for ( QCheckListItem *item = start; item != 0 ;
767 item = (QCheckListItem *)item->nextSibling() ) 767 item = (QCheckListItem *)item->nextSibling() )
768 { 768 {
769// cout << "checking " << item->text().lower() << endl; 769// cout << "checking " << item->text().lower() << endl;
770 if ( item->text().lower().find( text ) != -1 ) 770 if ( item->text().lower().find( text ) != -1 )
771 { 771 {
772// cout << "matched " << item->text() << endl; 772// cout << "matched " << item->text() << endl;
773 packagesList->ensureItemVisible( item ); 773 packagesList->ensureItemVisible( item );
774 packagesList->setCurrentItem( item ); 774 packagesList->setCurrentItem( item );
775 break; 775 break;
776 } 776 }
777 } 777 }
778 } 778 }
779} 779}
780 780
781void MainWindow :: updateServer() 781void MainWindow :: updateServer()
782{ 782{
783 QString serverName = serversList->currentText(); 783 QString serverName = serversList->currentText();
784 784
785 // Update the current server 785 // Update the current server
786 // Display dialog 786 // Display dialog
787 787
788 // Disable buttons to stop silly people clicking lots on them :) 788 // Disable buttons to stop silly people clicking lots on them :)
789 789
790 // First, write out ipkg_conf file so that ipkg can use it 790 // First, write out ipkg_conf file so that ipkg can use it
791 mgr->writeOutIpkgConf(); 791 mgr->writeOutIpkgConf();
792 792
793 Ipkg *ipkg = new Ipkg; 793 Ipkg *ipkg = new Ipkg;
794 ipkg->setOption( "update" ); 794 ipkg->setOption( "update" );
795 795
796 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ), 796 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
797 tr( "Update lists" ) ); 797 tr( "Update lists" ) );
798 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 798 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
799 dlg->showMaximized(); 799 dlg->showMaximized();
800 800
801// delete progDlg; 801// delete progDlg;
802} 802}
803 803
804void MainWindow :: upgradePackages() 804void MainWindow :: upgradePackages()
805{ 805{
806 // We're gonna do an upgrade of all packages 806 // We're gonna do an upgrade of all packages
807 // First warn user that this isn't recommended 807 // First warn user that this isn't recommended
808 // TODO - ODevice???? 808 // TODO - ODevice????
809 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" ); 809 QString text = tr( "WARNING: Upgrading while\nOpie/Qtopia is running\nis NOT recommended!\n\nAre you sure?\n" );
810 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, 810 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
811 QMessageBox::Yes, 811 QMessageBox::Yes,
812 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 812 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
813 0, this ); 813 0, this );
814 warn.adjustSize(); 814 warn.adjustSize();
815 815
816 if ( warn.exec() == QMessageBox::Yes ) 816 if ( warn.exec() == QMessageBox::Yes )
817 { 817 {
818 // First, write out ipkg_conf file so that ipkg can use it 818 // First, write out ipkg_conf file so that ipkg can use it
819 mgr->writeOutIpkgConf(); 819 mgr->writeOutIpkgConf();
820 820
821 // Now run upgrade 821 // Now run upgrade
822 Ipkg *ipkg = new Ipkg; 822 Ipkg *ipkg = new Ipkg;
823 ipkg->setOption( "upgrade" ); 823 ipkg->setOption( "upgrade" );
824 824
825 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ), 825 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
826 tr ( "Upgrade" ) ); 826 tr ( "Upgrade" ) );
827 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 827 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
828 dlg->showMaximized(); 828 dlg->showMaximized();
829 } 829 }
830} 830}
831 831
832void MainWindow :: downloadPackage() 832void MainWindow :: downloadPackage()
833{ 833{
834 bool doUpdate = true; 834 bool doUpdate = true;
835 if ( downloadEnabled ) 835 if ( downloadEnabled )
836 { 836 {
837 // See if any packages are selected 837 // See if any packages are selected
838 bool found = false; 838 bool found = false;
839 if ( serversList->currentText() != LOCAL_SERVER ) 839 if ( serversList->currentText() != LOCAL_SERVER )
840 { 840 {
841 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 841 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
842 item != 0 && !found; 842 item != 0 && !found;
843 item = (QCheckListItem *)item->nextSibling() ) 843 item = (QCheckListItem *)item->nextSibling() )
844 { 844 {
845 if ( item->isOn() ) 845 if ( item->isOn() )
846 found = true; 846 found = true;
847 } 847 }
848 } 848 }
849 849
850 // If user selected some packages then download the and store the locally 850 // If user selected some packages then download the and store the locally
851 // otherwise, display dialog asking user what package to download from an http server 851 // otherwise, display dialog asking user what package to download from an http server
852 // and whether to install it 852 // and whether to install it
853 if ( found ) 853 if ( found )
854 downloadSelectedPackages(); 854 downloadSelectedPackages();
855 else 855 else
856 downloadRemotePackage(); 856 downloadRemotePackage();
857 857
858 } 858 }
859 else 859 else
860 { 860 {
861 doUpdate = false; 861 doUpdate = false;
862 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 862 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
863 item != 0 ; 863 item != 0 ;
864 item = (QCheckListItem *)item->nextSibling() ) 864 item = (QCheckListItem *)item->nextSibling() )
865 { 865 {
866 if ( item->isOn() ) 866 if ( item->isOn() )
867 { 867 {
868 QString name = item->text(); 868 QString name = item->text();
869 int pos = name.find( "*" ); 869 int pos = name.find( "*" );
870 name.truncate( pos ); 870 name.truncate( pos );
871 871
872 // if (there is a (installed), remove it 872 // if (there is a (installed), remove it
873 pos = name.find( "(installed)" ); 873 pos = name.find( "(installed)" );
874 if ( pos > 0 ) 874 if ( pos > 0 )
875 name.truncate( pos - 1 ); 875 name.truncate( pos - 1 );
876 876
877 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name ); 877 Package *p = mgr->getServer( serversList->currentText() )->getPackage( name );
878 878
879 QString msgtext; 879 QString msgtext;
880 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() ); 880 msgtext = tr( "Are you sure you wish to delete\n%1?" ).arg( (const char *)p->getPackageName() );
881 if ( QMessageBox::information( this, tr( "Are you sure?" ), 881 if ( QMessageBox::information( this, tr( "Are you sure?" ),
882 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) 882 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
883 { 883 {
884 doUpdate = true; 884 doUpdate = true;
885 QFile f( p->getFilename() ); 885 QFile f( p->getFilename() );
886 f.remove(); 886 f.remove();
887 } 887 }
888 } 888 }
889 } 889 }
890 } 890 }
891 891
892 if ( doUpdate ) 892 if ( doUpdate )
893 { 893 {
894 reloadData( 0x0 ); 894 reloadData( 0x0 );
895 } 895 }
896} 896}
897 897
898void MainWindow :: downloadSelectedPackages() 898void MainWindow :: downloadSelectedPackages()
899{ 899{
900 // First, write out ipkg_conf file so that ipkg can use it 900 // First, write out ipkg_conf file so that ipkg can use it
901 mgr->writeOutIpkgConf(); 901 mgr->writeOutIpkgConf();
902 902
903 // Display dialog to user asking where to download the files to 903 // Display dialog to user asking where to download the files to
904 bool ok = FALSE; 904 bool ok = FALSE;
905 QString dir = ""; 905 QString dir = "";
906#ifdef QWS 906#ifdef QWS
907 // read download directory from config file 907 // read download directory from config file
908 Config cfg( "aqpkg" ); 908 Config cfg( "aqpkg" );
909 cfg.setGroup( "settings" ); 909 cfg.setGroup( "settings" );
910 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 910 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
911#endif 911#endif
912 912
913 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this ); 913 QString text = InputDialog::getText( tr( "Download to where" ), tr( "Enter path to download to" ), dir, &ok, this );
914 if ( ok && !text.isEmpty() ) 914 if ( ok && !text.isEmpty() )
915 dir = text; // user entered something and pressed ok 915 dir = text; // user entered something and pressed ok
916 else 916 else
917 return; // user entered nothing or pressed cancel 917 return; // user entered nothing or pressed cancel
918 918
919#ifdef QWS 919#ifdef QWS
920 // Store download directory in config file 920 // Store download directory in config file
921 cfg.writeEntry( "downloadDir", dir ); 921 cfg.writeEntry( "downloadDir", dir );
922#endif 922#endif
923 923
924 // Get starting directory 924 // Get starting directory
925 char initDir[PATH_MAX]; 925 char initDir[PATH_MAX];
926 getcwd( initDir, PATH_MAX ); 926 getcwd( initDir, PATH_MAX );
927 927
928 // Download each package 928 // Download each package
929 Ipkg ipkg; 929 Ipkg ipkg;
930 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 930 connect( &ipkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
931 931
932 ipkg.setOption( "download" ); 932 ipkg.setOption( "download" );
933 ipkg.setRuntimeDirectory( dir ); 933 ipkg.setRuntimeDirectory( dir );
934 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 934 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
935 item != 0 ; 935 item != 0 ;
936 item = (QCheckListItem *)item->nextSibling() ) 936 item = (QCheckListItem *)item->nextSibling() )
937 { 937 {
938 if ( item->isOn() ) 938 if ( item->isOn() )
939 { 939 {
940 ipkg.setPackage( item->text() ); 940 ipkg.setPackage( item->text() );
941 ipkg.runIpkg( ); 941 ipkg.runIpkg( );
942 } 942 }
943 } 943 }
944} 944}
945 945
946void MainWindow :: downloadRemotePackage() 946void MainWindow :: downloadRemotePackage()
947{ 947{
948 // Display dialog 948 // Display dialog
949 bool ok; 949 bool ok;
950 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this ); 950 QString package = InputDialog::getText( tr( "Install Remote Package" ), tr( "Enter package location" ), "http://", &ok, this );
951 if ( !ok || package.isEmpty() ) 951 if ( !ok || package.isEmpty() )
952 return; 952 return;
953// DownloadRemoteDlgImpl dlg( this, "Install", true ); 953// DownloadRemoteDlgImpl dlg( this, "Install", true );
954// if ( dlg.exec() == QDialog::Rejected ) 954// if ( dlg.exec() == QDialog::Rejected )
955// return; 955// return;
956 956
957 // grab details from dialog 957 // grab details from dialog
958// QString package = dlg.getPackageLocation(); 958// QString package = dlg.getPackageLocation();
959 959
960 InstallData item; 960 InstallData item;
961 item.option = "I"; 961 item.option = "I";
962 item.packageName = package; 962 item.packageName = package;
963 vector<InstallData> workingPackages; 963 vector<InstallData> workingPackages;
964 workingPackages.push_back( item ); 964 workingPackages.push_back( item );
965 965
966 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) ); 966 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
967 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 967 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
968 dlg->showMaximized(); 968 dlg->showMaximized();
969} 969}
970 970
971 971
972void MainWindow :: applyChanges() 972void MainWindow :: applyChanges()
973{ 973{
974 stickyOption = ""; 974 stickyOption = "";
975 975
976 // First, write out ipkg_conf file so that ipkg can use it 976 // First, write out ipkg_conf file so that ipkg can use it
977 mgr->writeOutIpkgConf(); 977 mgr->writeOutIpkgConf();
978 978
979 // Now for each selected item 979 // Now for each selected item
980 // deal with it 980 // deal with it
981 981
982 vector<InstallData> workingPackages; 982 vector<InstallData> workingPackages;
983 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 983 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
984 item != 0 ; 984 item != 0 ;
985 item = (QCheckListItem *)item->nextSibling() ) 985 item = (QCheckListItem *)item->nextSibling() )
986 { 986 {
987 if ( item->isOn() ) 987 if ( item->isOn() )
988 { 988 {
989 InstallData data = dealWithItem( item ); 989 InstallData data = dealWithItem( item );
990 workingPackages.push_back( data ); 990 workingPackages.push_back( data );
991 } 991 }
992 } 992 }
993 993
994 if ( workingPackages.size() == 0 ) 994 if ( workingPackages.size() == 0 )
995 { 995 {
996 // Nothing to do 996 // Nothing to do
997 QMessageBox::information( this, tr( "Nothing to do" ), 997 QMessageBox::information( this, tr( "Nothing to do" ),
998 tr( "No packages selected" ), tr( "OK" ) ); 998 tr( "No packages selected" ), tr( "OK" ) );
999 999
1000 return; 1000 return;
1001 } 1001 }
1002 1002
1003 // do the stuff 1003 // do the stuff
1004 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) ); 1004 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
1005 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) ); 1005 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
1006 dlg->showMaximized(); 1006 dlg->showMaximized();
1007} 1007}
1008 1008
1009// decide what to do - either remove, upgrade or install 1009// decide what to do - either remove, upgrade or install
1010// Current rules: 1010// Current rules:
1011// If not installed - install 1011// If not installed - install
1012// If installed and different version available - upgrade 1012// If installed and different version available - upgrade
1013// If installed and version up to date - remove 1013// If installed and version up to date - remove
1014InstallData MainWindow :: dealWithItem( QCheckListItem *item ) 1014InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1015{ 1015{
1016 QString name = item->text(); 1016 QString name = item->text();
1017 1017
1018 // Get package 1018 // Get package
1019 vector<Server>::iterator s = mgr->getServer( serversList->currentText() ); 1019 vector<Server>::iterator s = mgr->getServer( serversList->currentText() );
1020 Package *p = s->getPackage( name ); 1020 Package *p = s->getPackage( name );
1021 1021
1022 // If the package has a filename then it is a local file 1022 // If the package has a filename then it is a local file
1023 if ( p->isPackageStoredLocally() ) 1023 if ( p->isPackageStoredLocally() )
1024 name = p->getFilename(); 1024 name = p->getFilename();
1025 1025
1026 QString option; 1026 QString option;
1027 QString dest = "root"; 1027 QString dest = "root";
1028 if ( !p->isInstalled() ) 1028 if ( !p->isInstalled() )
1029 { 1029 {
1030 InstallData item; 1030 InstallData item;
1031 item.option = "I"; 1031 item.option = "I";
1032 item.packageName = name; 1032 item.packageName = name;
1033 return item; 1033 return item;
1034 } 1034 }
1035 else 1035 else
1036 { 1036 {
1037 InstallData item; 1037 InstallData item;
1038 item.option = "D"; 1038 item.option = "D";
1039 if ( !p->isPackageStoredLocally() ) 1039 if ( !p->isPackageStoredLocally() )
1040 item.packageName = p->getInstalledPackageName(); 1040 item.packageName = p->getInstalledPackageName();
1041 else 1041 else
1042 item.packageName = name; 1042 item.packageName = name;
1043 1043
1044 if ( p->getInstalledTo() ) 1044 if ( p->getInstalledTo() )
1045 { 1045 {
1046 item.destination = p->getInstalledTo(); 1046 item.destination = p->getInstalledTo();
1047// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl; 1047// cout << "dest - " << p->getInstalledTo()->getDestinationName() << endl;
1048// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl; 1048// cout << "dest - " << p->getInstalledTo()->getDestinationPath() << endl;
1049 } 1049 }
1050 else 1050 else
1051 { 1051 {
1052 item.destination = p->getLocalPackage()->getInstalledTo(); 1052 item.destination = p->getLocalPackage()->getInstalledTo();
1053 } 1053 }
1054 1054
1055 // Now see if version is newer or not 1055 // Now see if version is newer or not
1056 int val = compareVersions( p->getInstalledVersion(), p->getVersion() ); 1056 int val = compareVersions( p->getInstalledVersion(), p->getVersion() );
1057 1057
1058 // If the version requested is older and user selected a local ipk file, then reinstall the file 1058 // If the version requested is older and user selected a local ipk file, then reinstall the file
1059 if ( p->isPackageStoredLocally() && val == -1 ) 1059 if ( p->isPackageStoredLocally() && val == -1 )
1060 val = 0; 1060 val = 0;
1061 1061
1062 if ( val == -2 ) 1062 if ( val == -2 )
1063 { 1063 {
1064 // Error - should handle 1064 // Error - should handle
1065 } 1065 }
1066 else if ( val == -1 ) 1066 else if ( val == -1 )
1067 { 1067 {
1068 // Version available is older - remove only 1068 // Version available is older - remove only
1069 item.option = "D"; 1069 item.option = "D";
1070 } 1070 }
1071 else 1071 else
1072 { 1072 {
1073 QString caption; 1073 QString caption;
1074 QString text; 1074 QString text;
1075 QString secondButton; 1075 QString secondButton;
1076 QString secondOption; 1076 QString secondOption;
1077 if ( val == 0 ) 1077 if ( val == 0 )
1078 { 1078 {
1079 // Version available is the same - option to remove or reinstall 1079 // Version available is the same - option to remove or reinstall
1080 caption = tr( "Do you wish to remove or reinstall\n%1?" ); 1080 caption = tr( "Do you wish to remove or reinstall\n%1?" );
1081 text = tr( "Remove or ReInstall" ); 1081 text = tr( "Remove or ReInstall" );
1082 secondButton = tr( "ReInstall" ); 1082 secondButton = tr( "ReInstall" );
1083 secondOption = tr( "R" ); 1083 secondOption = tr( "R" );
1084 } 1084 }
1085 else if ( val == 1 ) 1085 else if ( val == 1 )
1086 { 1086 {
1087 // Version available is newer - option to remove or upgrade 1087 // Version available is newer - option to remove or upgrade
1088 caption = tr( "Do you wish to remove or upgrade\n%1?" ); 1088 caption = tr( "Do you wish to remove or upgrade\n%1?" );
1089 text = tr( "Remove or Upgrade" ); 1089 text = tr( "Remove or Upgrade" );
1090 secondButton = tr( "Upgrade" ); 1090 secondButton = tr( "Upgrade" );
1091 secondOption = tr( "U" ); 1091 secondOption = tr( "U" );
1092 } 1092 }
1093 1093
1094 // Sticky option not implemented yet, but will eventually allow 1094 // Sticky option not implemented yet, but will eventually allow
1095 // the user to say something like 'remove all' 1095 // the user to say something like 'remove all'
1096 if ( stickyOption == "" ) 1096 if ( stickyOption == "" )
1097 { 1097 {
1098 QString msgtext; 1098 QString msgtext;
1099 msgtext = caption.arg( ( const char * )name ); 1099 msgtext = caption.arg( ( const char * )name );
1100 switch( QMessageBox::information( this, text, 1100 switch( QMessageBox::information( this, text,
1101 msgtext, tr( "Remove" ), secondButton ) ) 1101 msgtext, tr( "Remove" ), secondButton ) )
1102 { 1102 {
1103 case 0: // Try again or Enter 1103 case 0: // Try again or Enter
1104 // option 0 = Remove 1104 // option 0 = Remove
1105 item.option = "D"; 1105 item.option = "D";
1106 break; 1106 break;
1107 case 1: // Quit or Escape 1107 case 1: // Quit or Escape
1108 item.option = secondOption; 1108 item.option = secondOption;
1109 break; 1109 break;
1110 } 1110 }
1111 } 1111 }
1112 else 1112 else
1113 { 1113 {
1114// item.option = stickyOption; 1114// item.option = stickyOption;
1115 } 1115 }
1116 } 1116 }
1117 1117
1118 1118
1119 // Check if we are reinstalling the same version 1119 // Check if we are reinstalling the same version
1120 if ( item.option != "R" ) 1120 if ( item.option != "R" )
1121 item.recreateLinks = true; 1121 item.recreateLinks = true;
1122 else 1122 else
1123 item.recreateLinks = false; 1123 item.recreateLinks = false;
1124 1124
1125 // User hit cancel (on dlg - assume remove) 1125 // User hit cancel (on dlg - assume remove)
1126 return item; 1126 return item;
1127 } 1127 }
1128} 1128}
1129 1129
1130void MainWindow :: reloadData( InstallDlgImpl *dlg ) 1130void MainWindow :: reloadData( InstallDlgImpl *dlg )
1131{ 1131{
1132 stack->raiseWidget( progressWindow ); 1132 stack->raiseWidget( progressWindow );
1133 1133
1134 if ( dlg ) 1134 if ( dlg )
1135 { 1135 {
1136 dlg->close(); 1136 dlg->close();
1137 delete dlg; 1137 delete dlg;
1138 } 1138 }
1139 1139
1140 mgr->reloadServerData(); 1140 mgr->reloadServerData();
1141 serverSelected( -1, FALSE ); 1141 serverSelected( -1, FALSE );
1142 1142
1143#ifdef QWS 1143#ifdef QWS
1144 m_status->setText( tr( "Updating Launcher..." ) ); 1144 m_status->setText( tr( "Updating Launcher..." ) );
1145 1145
1146 // Finally let the main system update itself 1146 // Finally let the main system update itself
1147 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 1147 QCopEnvelope e("QPE/System", "linkChanged(QString)");
1148 QString lf = QString::null; 1148 QString lf = QString::null;
1149 e << lf; 1149 e << lf;
1150#endif 1150#endif
1151 1151
1152 stack->raiseWidget( networkPkgWindow ); 1152 stack->raiseWidget( networkPkgWindow );
1153} 1153}
1154 1154
1155void MainWindow :: letterPushed( QString t ) 1155void MainWindow :: letterPushed( QString t )
1156{ 1156{
1157 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); 1157 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
1158 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 1158 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
1159 if ( packagesList->firstChild() == 0 ) 1159 if ( packagesList->firstChild() == 0 )
1160 return; 1160 return;
1161 1161
1162 QCheckListItem *item; 1162 QCheckListItem *item;
1163 if ( start == 0 ) 1163 if ( start == 0 )
1164 { 1164 {
1165 item = (QCheckListItem *)packagesList->firstChild(); 1165 item = (QCheckListItem *)packagesList->firstChild();
1166 start = top; 1166 start = top;
1167 } 1167 }
1168 else 1168 else
1169 item = (QCheckListItem *)start->nextSibling(); 1169 item = (QCheckListItem *)start->nextSibling();
1170 1170
1171 if ( item == 0 ) 1171 if ( item == 0 )
1172 item = (QCheckListItem *)packagesList->firstChild(); 1172 item = (QCheckListItem *)packagesList->firstChild();
1173 do 1173 do
1174 { 1174 {
1175 if ( item->text().lower().startsWith( t.lower() ) ) 1175 if ( item->text().lower().startsWith( t.lower() ) )
1176 { 1176 {
1177 packagesList->setSelected( item, true ); 1177 packagesList->setSelected( item, true );
1178 packagesList->ensureItemVisible( item ); 1178 packagesList->ensureItemVisible( item );
1179 break; 1179 break;
1180 } 1180 }
1181 1181
1182 item = (QCheckListItem *)item->nextSibling(); 1182 item = (QCheckListItem *)item->nextSibling();
1183 if ( !item ) 1183 if ( !item )
1184 item = (QCheckListItem *)packagesList->firstChild(); 1184 item = (QCheckListItem *)packagesList->firstChild();
1185 } while ( item != start); 1185 } while ( item != start);
1186} 1186}
diff --git a/noncore/settings/aqpkg/settings.ui b/noncore/settings/aqpkg/settings.ui
deleted file mode 100644
index 2db0768..0000000
--- a/noncore/settings/aqpkg/settings.ui
+++ b/dev/null
@@ -1,872 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>SettingsBase</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Settings</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>238</width>
15 <height>353</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Configuration</string>
21 </property>
22 <property>
23 <name>layoutMargin</name>
24 </property>
25 <property>
26 <name>layoutSpacing</name>
27 </property>
28 <grid>
29 <property stdset="1">
30 <name>margin</name>
31 <number>11</number>
32 </property>
33 <property stdset="1">
34 <name>spacing</name>
35 <number>6</number>
36 </property>
37 <widget row="0" column="0" >
38 <class>QTabWidget</class>
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TabWidget</cstring>
42 </property>
43 <property stdset="1">
44 <name>enabled</name>
45 <bool>true</bool>
46 </property>
47 <property>
48 <name>layoutMargin</name>
49 </property>
50 <property>
51 <name>layoutSpacing</name>
52 </property>
53 <widget>
54 <class>QWidget</class>
55 <property stdset="1">
56 <name>name</name>
57 <cstring>tab</cstring>
58 </property>
59 <attribute>
60 <name>title</name>
61 <string>Servers</string>
62 </attribute>
63 <grid>
64 <property stdset="1">
65 <name>margin</name>
66 <number>11</number>
67 </property>
68 <property stdset="1">
69 <name>spacing</name>
70 <number>6</number>
71 </property>
72 <widget row="0" column="0" >
73 <class>QLayoutWidget</class>
74 <property stdset="1">
75 <name>name</name>
76 <cstring>Layout2</cstring>
77 </property>
78 <hbox>
79 <property stdset="1">
80 <name>margin</name>
81 <number>0</number>
82 </property>
83 <property stdset="1">
84 <name>spacing</name>
85 <number>6</number>
86 </property>
87 <widget>
88 <class>QLabel</class>
89 <property stdset="1">
90 <name>name</name>
91 <cstring>Servers</cstring>
92 </property>
93 <property stdset="1">
94 <name>text</name>
95 <string>Servers</string>
96 </property>
97 </widget>
98 <spacer>
99 <property>
100 <name>name</name>
101 <cstring>Spacer2</cstring>
102 </property>
103 <property stdset="1">
104 <name>orientation</name>
105 <enum>Horizontal</enum>
106 </property>
107 <property stdset="1">
108 <name>sizeType</name>
109 <enum>Expanding</enum>
110 </property>
111 <property>
112 <name>sizeHint</name>
113 <size>
114 <width>20</width>
115 <height>20</height>
116 </size>
117 </property>
118 </spacer>
119 </hbox>
120 </widget>
121 <widget row="1" column="0" >
122 <class>QLayoutWidget</class>
123 <property stdset="1">
124 <name>name</name>
125 <cstring>Layout8</cstring>
126 </property>
127 <grid>
128 <property stdset="1">
129 <name>margin</name>
130 <number>0</number>
131 </property>
132 <property stdset="1">
133 <name>spacing</name>
134 <number>6</number>
135 </property>
136 <widget row="0" column="0" rowspan="1" colspan="2" >
137 <class>QListBox</class>
138 <property stdset="1">
139 <name>name</name>
140 <cstring>servers</cstring>
141 </property>
142 <property stdset="1">
143 <name>selectionMode</name>
144 <enum>Extended</enum>
145 </property>
146 </widget>
147 <widget row="2" column="0" rowspan="1" colspan="2" >
148 <class>QLayoutWidget</class>
149 <property stdset="1">
150 <name>name</name>
151 <cstring>Layout6</cstring>
152 </property>
153 <grid>
154 <property stdset="1">
155 <name>margin</name>
156 <number>0</number>
157 </property>
158 <property stdset="1">
159 <name>spacing</name>
160 <number>6</number>
161 </property>
162 <widget row="2" column="1" >
163 <class>QCheckBox</class>
164 <property stdset="1">
165 <name>name</name>
166 <cstring>active</cstring>
167 </property>
168 <property stdset="1">
169 <name>text</name>
170 <string>Active Server</string>
171 </property>
172 </widget>
173 <widget row="0" column="0" >
174 <class>QLabel</class>
175 <property stdset="1">
176 <name>name</name>
177 <cstring>TextLabel1_3</cstring>
178 </property>
179 <property stdset="1">
180 <name>text</name>
181 <string>Name:</string>
182 </property>
183 </widget>
184 <widget row="1" column="0" >
185 <class>QLabel</class>
186 <property stdset="1">
187 <name>name</name>
188 <cstring>TextLabel2_3</cstring>
189 </property>
190 <property stdset="1">
191 <name>text</name>
192 <string>URL:</string>
193 </property>
194 </widget>
195 <widget row="0" column="1" >
196 <class>QLineEdit</class>
197 <property stdset="1">
198 <name>name</name>
199 <cstring>servername</cstring>
200 </property>
201 </widget>
202 <widget row="1" column="1" >
203 <class>QLineEdit</class>
204 <property stdset="1">
205 <name>name</name>
206 <cstring>serverurl</cstring>
207 </property>
208 </widget>
209 <widget row="3" column="1" >
210 <class>QPushButton</class>
211 <property stdset="1">
212 <name>name</name>
213 <cstring>btnChangeServer</cstring>
214 </property>
215 <property stdset="1">
216 <name>text</name>
217 <string>Change</string>
218 </property>
219 </widget>
220 </grid>
221 </widget>
222 <widget row="1" column="1" >
223 <class>QPushButton</class>
224 <property stdset="1">
225 <name>name</name>
226 <cstring>removeserver</cstring>
227 </property>
228 <property stdset="1">
229 <name>enabled</name>
230 <bool>true</bool>
231 </property>
232 <property stdset="1">
233 <name>text</name>
234 <string>Remove</string>
235 </property>
236 <property stdset="1">
237 <name>autoDefault</name>
238 <bool>false</bool>
239 </property>
240 </widget>
241 <widget row="1" column="0" >
242 <class>QPushButton</class>
243 <property stdset="1">
244 <name>name</name>
245 <cstring>newserver</cstring>
246 </property>
247 <property stdset="1">
248 <name>enabled</name>
249 <bool>true</bool>
250 </property>
251 <property stdset="1">
252 <name>text</name>
253 <string>New</string>
254 </property>
255 <property stdset="1">
256 <name>autoDefault</name>
257 <bool>false</bool>
258 </property>
259 </widget>
260 </grid>
261 </widget>
262 </grid>
263 </widget>
264 <widget>
265 <class>QWidget</class>
266 <property stdset="1">
267 <name>name</name>
268 <cstring>tab</cstring>
269 </property>
270 <attribute>
271 <name>title</name>
272 <string>Destinations</string>
273 </attribute>
274 <grid>
275 <property stdset="1">
276 <name>margin</name>
277 <number>11</number>
278 </property>
279 <property stdset="1">
280 <name>spacing</name>
281 <number>6</number>
282 </property>
283 <widget row="0" column="0" >
284 <class>QLayoutWidget</class>
285 <property stdset="1">
286 <name>name</name>
287 <cstring>Layout3</cstring>
288 </property>
289 <hbox>
290 <property stdset="1">
291 <name>margin</name>
292 <number>0</number>
293 </property>
294 <property stdset="1">
295 <name>spacing</name>
296 <number>6</number>
297 </property>
298 <widget>
299 <class>QLabel</class>
300 <property stdset="1">
301 <name>name</name>
302 <cstring>Destinations</cstring>
303 </property>
304 <property stdset="1">
305 <name>text</name>
306 <string>Destinations</string>
307 </property>
308 </widget>
309 <spacer>
310 <property>
311 <name>name</name>
312 <cstring>Spacer2_2</cstring>
313 </property>
314 <property stdset="1">
315 <name>orientation</name>
316 <enum>Horizontal</enum>
317 </property>
318 <property stdset="1">
319 <name>sizeType</name>
320 <enum>Expanding</enum>
321 </property>
322 <property>
323 <name>sizeHint</name>
324 <size>
325 <width>20</width>
326 <height>20</height>
327 </size>
328 </property>
329 </spacer>
330 </hbox>
331 </widget>
332 <widget row="2" column="0" >
333 <class>QLayoutWidget</class>
334 <property stdset="1">
335 <name>name</name>
336 <cstring>Layout5</cstring>
337 </property>
338 <hbox>
339 <property stdset="1">
340 <name>margin</name>
341 <number>0</number>
342 </property>
343 <property stdset="1">
344 <name>spacing</name>
345 <number>6</number>
346 </property>
347 <widget>
348 <class>QPushButton</class>
349 <property stdset="1">
350 <name>name</name>
351 <cstring>newdestination</cstring>
352 </property>
353 <property stdset="1">
354 <name>enabled</name>
355 <bool>true</bool>
356 </property>
357 <property stdset="1">
358 <name>text</name>
359 <string>New</string>
360 </property>
361 <property stdset="1">
362 <name>autoDefault</name>
363 <bool>false</bool>
364 </property>
365 </widget>
366 <widget>
367 <class>QPushButton</class>
368 <property stdset="1">
369 <name>name</name>
370 <cstring>removedestination</cstring>
371 </property>
372 <property stdset="1">
373 <name>enabled</name>
374 <bool>true</bool>
375 </property>
376 <property stdset="1">
377 <name>text</name>
378 <string>Remove</string>
379 </property>
380 <property stdset="1">
381 <name>autoDefault</name>
382 <bool>false</bool>
383 </property>
384 </widget>
385 </hbox>
386 </widget>
387 <spacer row="0" column="0" >
388 <property>
389 <name>name</name>
390 <cstring>Spacer3</cstring>
391 </property>
392 <property stdset="1">
393 <name>orientation</name>
394 <enum>Horizontal</enum>
395 </property>
396 <property stdset="1">
397 <name>sizeType</name>
398 <enum>Expanding</enum>
399 </property>
400 <property>
401 <name>sizeHint</name>
402 <size>
403 <width>20</width>
404 <height>20</height>
405 </size>
406 </property>
407 </spacer>
408 <widget row="1" column="0" >
409 <class>QListBox</class>
410 <property stdset="1">
411 <name>name</name>
412 <cstring>destinations</cstring>
413 </property>
414 <property stdset="1">
415 <name>selectionMode</name>
416 <enum>Single</enum>
417 </property>
418 </widget>
419 <widget row="3" column="0" >
420 <class>QLayoutWidget</class>
421 <property stdset="1">
422 <name>name</name>
423 <cstring>Layout13</cstring>
424 </property>
425 <grid>
426 <property stdset="1">
427 <name>margin</name>
428 <number>0</number>
429 </property>
430 <property stdset="1">
431 <name>spacing</name>
432 <number>6</number>
433 </property>
434 <widget row="1" column="0" >
435 <class>QLabel</class>
436 <property stdset="1">
437 <name>name</name>
438 <cstring>TextLabel1_3_2_2</cstring>
439 </property>
440 <property stdset="1">
441 <name>text</name>
442 <string>URL:</string>
443 </property>
444 </widget>
445 <widget row="3" column="1" >
446 <class>QPushButton</class>
447 <property stdset="1">
448 <name>name</name>
449 <cstring>btnChangeDest</cstring>
450 </property>
451 <property stdset="1">
452 <name>text</name>
453 <string>Change</string>
454 </property>
455 </widget>
456 <widget row="0" column="1" >
457 <class>QLineEdit</class>
458 <property stdset="1">
459 <name>name</name>
460 <cstring>destinationname</cstring>
461 </property>
462 </widget>
463 <widget row="0" column="0" >
464 <class>QLabel</class>
465 <property stdset="1">
466 <name>name</name>
467 <cstring>TextLabel1_3_2</cstring>
468 </property>
469 <property stdset="1">
470 <name>text</name>
471 <string>Name:</string>
472 </property>
473 </widget>
474 <widget row="2" column="1" >
475 <class>QCheckBox</class>
476 <property stdset="1">
477 <name>name</name>
478 <cstring>linkToRoot</cstring>
479 </property>
480 <property stdset="1">
481 <name>text</name>
482 <string>Link To Root</string>
483 </property>
484 <property stdset="1">
485 <name>checked</name>
486 <bool>true</bool>
487 </property>
488 </widget>
489 <widget row="1" column="1" >
490 <class>QLineEdit</class>
491 <property stdset="1">
492 <name>name</name>
493 <cstring>destinationurl</cstring>
494 </property>
495 </widget>
496 </grid>
497 </widget>
498 </grid>
499 </widget>
500 <widget>
501 <class>QWidget</class>
502 <property stdset="1">
503 <name>name</name>
504 <cstring>tab</cstring>
505 </property>
506 <attribute>
507 <name>title</name>
508 <string>Proxies</string>
509 </attribute>
510 <widget>
511 <class>QLabel</class>
512 <property stdset="1">
513 <name>name</name>
514 <cstring>TextLabel1_2</cstring>
515 </property>
516 <property stdset="1">
517 <name>geometry</name>
518 <rect>
519 <x>1</x>
520 <y>19</y>
521 <width>67</width>
522 <height>22</height>
523 </rect>
524 </property>
525 <property stdset="1">
526 <name>text</name>
527 <string>HTTP Proxy</string>
528 </property>
529 </widget>
530 <widget>
531 <class>QLineEdit</class>
532 <property stdset="1">
533 <name>name</name>
534 <cstring>txtFtpProxy</cstring>
535 </property>
536 <property stdset="1">
537 <name>geometry</name>
538 <rect>
539 <x>74</x>
540 <y>72</y>
541 <width>110</width>
542 <height>22</height>
543 </rect>
544 </property>
545 </widget>
546 <widget>
547 <class>QLineEdit</class>
548 <property stdset="1">
549 <name>name</name>
550 <cstring>txtHttpProxy</cstring>
551 </property>
552 <property stdset="1">
553 <name>geometry</name>
554 <rect>
555 <x>74</x>
556 <y>19</y>
557 <width>110</width>
558 <height>22</height>
559 </rect>
560 </property>
561 </widget>
562 <widget>
563 <class>QLabel</class>
564 <property stdset="1">
565 <name>name</name>
566 <cstring>TextLabel4</cstring>
567 </property>
568 <property stdset="1">
569 <name>geometry</name>
570 <rect>
571 <x>1</x>
572 <y>153</y>
573 <width>67</width>
574 <height>22</height>
575 </rect>
576 </property>
577 <property stdset="1">
578 <name>text</name>
579 <string>Password</string>
580 </property>
581 </widget>
582 <widget>
583 <class>QLineEdit</class>
584 <property stdset="1">
585 <name>name</name>
586 <cstring>txtUsername</cstring>
587 </property>
588 <property stdset="1">
589 <name>geometry</name>
590 <rect>
591 <x>74</x>
592 <y>125</y>
593 <width>110</width>
594 <height>22</height>
595 </rect>
596 </property>
597 </widget>
598 <widget>
599 <class>QLineEdit</class>
600 <property stdset="1">
601 <name>name</name>
602 <cstring>txtPassword</cstring>
603 </property>
604 <property stdset="1">
605 <name>geometry</name>
606 <rect>
607 <x>74</x>
608 <y>153</y>
609 <width>110</width>
610 <height>22</height>
611 </rect>
612 </property>
613 </widget>
614 <widget>
615 <class>QCheckBox</class>
616 <property stdset="1">
617 <name>name</name>
618 <cstring>chkFtpProxyEnabled</cstring>
619 </property>
620 <property stdset="1">
621 <name>geometry</name>
622 <rect>
623 <x>74</x>
624 <y>100</y>
625 <width>110</width>
626 <height>19</height>
627 </rect>
628 </property>
629 <property stdset="1">
630 <name>text</name>
631 <string>Enabled</string>
632 </property>
633 </widget>
634 <widget>
635 <class>QLabel</class>
636 <property stdset="1">
637 <name>name</name>
638 <cstring>TextLabel2</cstring>
639 </property>
640 <property stdset="1">
641 <name>geometry</name>
642 <rect>
643 <x>1</x>
644 <y>72</y>
645 <width>67</width>
646 <height>22</height>
647 </rect>
648 </property>
649 <property stdset="1">
650 <name>text</name>
651 <string>FTP Proxy</string>
652 </property>
653 </widget>
654 <widget>
655 <class>QLabel</class>
656 <property stdset="1">
657 <name>name</name>
658 <cstring>TextLabel3</cstring>
659 </property>
660 <property stdset="1">
661 <name>geometry</name>
662 <rect>
663 <x>1</x>
664 <y>125</y>
665 <width>67</width>
666 <height>22</height>
667 </rect>
668 </property>
669 <property stdset="1">
670 <name>text</name>
671 <string>Username</string>
672 </property>
673 </widget>
674 <widget>
675 <class>QCheckBox</class>
676 <property stdset="1">
677 <name>name</name>
678 <cstring>chkHttpProxyEnabled</cstring>
679 </property>
680 <property stdset="1">
681 <name>geometry</name>
682 <rect>
683 <x>74</x>
684 <y>47</y>
685 <width>110</width>
686 <height>19</height>
687 </rect>
688 </property>
689 <property stdset="1">
690 <name>text</name>
691 <string>Enabled</string>
692 </property>
693 </widget>
694 <widget>
695 <class>QPushButton</class>
696 <property stdset="1">
697 <name>name</name>
698 <cstring>btnProxyApply</cstring>
699 </property>
700 <property stdset="1">
701 <name>geometry</name>
702 <rect>
703 <x>74</x>
704 <y>181</y>
705 <width>110</width>
706 <height>28</height>
707 </rect>
708 </property>
709 <property stdset="1">
710 <name>text</name>
711 <string>&amp;Apply</string>
712 </property>
713 </widget>
714 </widget>
715 <widget>
716 <class>QWidget</class>
717 <property stdset="1">
718 <name>name</name>
719 <cstring>tab</cstring>
720 </property>
721 <attribute>
722 <name>title</name>
723 <string>General</string>
724 </attribute>
725 <widget>
726 <class>QLabel</class>
727 <property stdset="1">
728 <name>name</name>
729 <cstring>TextLabel1</cstring>
730 </property>
731 <property stdset="1">
732 <name>geometry</name>
733 <rect>
734 <x>20</x>
735 <y>30</y>
736 <width>150</width>
737 <height>20</height>
738 </rect>
739 </property>
740 <property stdset="1">
741 <name>text</name>
742 <string>(Will take effect on restart)</string>
743 </property>
744 </widget>
745 <widget>
746 <class>QCheckBox</class>
747 <property stdset="1">
748 <name>name</name>
749 <cstring>jumpTo</cstring>
750 </property>
751 <property stdset="1">
752 <name>geometry</name>
753 <rect>
754 <x>17</x>
755 <y>14</y>
756 <width>150</width>
757 <height>20</height>
758 </rect>
759 </property>
760 <property stdset="1">
761 <name>text</name>
762 <string>Show Jump To Letters</string>
763 </property>
764 </widget>
765 </widget>
766 </widget>
767 </grid>
768</widget>
769<connections>
770 <connection>
771 <sender>newserver</sender>
772 <signal>clicked()</signal>
773 <receiver>Settings</receiver>
774 <slot>newServer()</slot>
775 </connection>
776 <connection>
777 <sender>removeserver</sender>
778 <signal>clicked()</signal>
779 <receiver>Settings</receiver>
780 <slot>removeServer()</slot>
781 </connection>
782 <connection>
783 <sender>newdestination</sender>
784 <signal>clicked()</signal>
785 <receiver>Settings</receiver>
786 <slot>newDestination()</slot>
787 </connection>
788 <connection>
789 <sender>removedestination</sender>
790 <signal>clicked()</signal>
791 <receiver>Settings</receiver>
792 <slot>removeDestination()</slot>
793 </connection>
794 <connection>
795 <sender>servers</sender>
796 <signal>highlighted(int)</signal>
797 <receiver>Settings</receiver>
798 <slot>editServer(int)</slot>
799 </connection>
800 <connection>
801 <sender>destinations</sender>
802 <signal>highlighted(int)</signal>
803 <receiver>Settings</receiver>
804 <slot>editDestination(int)</slot>
805 </connection>
806 <connection>
807 <sender>btnChangeServer</sender>
808 <signal>clicked()</signal>
809 <receiver>Settings</receiver>
810 <slot>changeServerDetails()</slot>
811 </connection>
812 <connection>
813 <sender>btnChangeDest</sender>
814 <signal>clicked()</signal>
815 <receiver>Settings</receiver>
816 <slot>changeDestinationDetails()</slot>
817 </connection>
818 <connection>
819 <sender>jumpTo</sender>
820 <signal>toggled(bool)</signal>
821 <receiver>Settings</receiver>
822 <slot>toggleJumpTo(bool)</slot>
823 </connection>
824 <connection>
825 <sender>btnProxyApply</sender>
826 <signal>clicked()</signal>
827 <receiver>Settings</receiver>
828 <slot>proxyApplyChanges()</slot>
829 </connection>
830 <slot access="public">activeServerChanged()</slot>
831 <slot access="public">changeDestinationDetails()</slot>
832 <slot access="public">changeServerDetails()</slot>
833 <slot access="public">createLinksToDest()</slot>
834 <slot access="public">destNameChanged(const QString&amp;)</slot>
835 <slot access="public">destUrlChanged(const QString&amp;)</slot>
836 <slot access="public">editDestination(int)</slot>
837 <slot access="public">editServer(int)</slot>
838 <slot access="public">installationSettingChange(int)</slot>
839 <slot access="public">installationSettingSetName(const QString &amp;)</slot>
840 <slot access="public">linkEnabled(bool)</slot>
841 <slot access="public">newDestination()</slot>
842 <slot access="public">newInstallationSetting()</slot>
843 <slot access="public">newServer()</slot>
844 <slot access="public">proxyApplyChanges()</slot>
845 <slot access="public">removeDestination()</slot>
846 <slot access="public">removeInstallationSetting()</slot>
847 <slot access="public">removeLinksToDest()</slot>
848 <slot access="public">removeServer()</slot>
849 <slot access="public">renameInstallationSetting()</slot>
850 <slot access="public">serverNameChanged(const QString&amp;)</slot>
851 <slot access="public">serverUrlChanged(const QString&amp;)</slot>
852 <slot access="public">toggleJumpTo(bool)</slot>
853</connections>
854<tabstops>
855 <tabstop>servers</tabstop>
856 <tabstop>newserver</tabstop>
857 <tabstop>removeserver</tabstop>
858 <tabstop>servername</tabstop>
859 <tabstop>serverurl</tabstop>
860 <tabstop>active</tabstop>
861 <tabstop>btnChangeServer</tabstop>
862 <tabstop>TabWidget</tabstop>
863 <tabstop>destinations</tabstop>
864 <tabstop>newdestination</tabstop>
865 <tabstop>removedestination</tabstop>
866 <tabstop>destinationname</tabstop>
867 <tabstop>destinationurl</tabstop>
868 <tabstop>linkToRoot</tabstop>
869 <tabstop>btnChangeDest</tabstop>
870 <tabstop>jumpTo</tabstop>
871</tabstops>
872</UI>
diff --git a/noncore/settings/aqpkg/settingsimpl.cpp b/noncore/settings/aqpkg/settingsimpl.cpp
index 4bb928a..c5a55d2 100644
--- a/noncore/settings/aqpkg/settingsimpl.cpp
+++ b/noncore/settings/aqpkg/settingsimpl.cpp
@@ -1,267 +1,438 @@
1/*************************************************************************** 1/***************************************************************************
2 settingsimpl.cpp - description 2 settingsimpl.cpp - description
3 ------------------- 3 -------------------
4 begin : Thu Aug 29 2002 4 begin : Thu Aug 29 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include <fstream> 18#include <fstream>
19#include <algorithm> 19#include <algorithm>
20using namespace std; 20using namespace std;
21 21
22#include <qlistbox.h> 22#include <qcheckbox.h>
23#include <qgroupbox.h>
24#include <qlabel.h>
25#include <qlayout.h>
23#include <qlineedit.h> 26#include <qlineedit.h>
27#include <qlistbox.h>
24#include <qpushbutton.h> 28#include <qpushbutton.h>
25#include <qtabwidget.h> 29
26#include <qcheckbox.h> 30#include <opie/otabwidget.h>
27 31
28#ifdef QWS 32#ifdef QWS
29#include <qpe/config.h> 33#include <qpe/config.h>
34#include <qpe/resource.h>
30#endif 35#endif
31 36
32#include "settingsimpl.h" 37#include "settingsimpl.h"
33 38
34#include "global.h" 39#include "global.h"
35 40
36SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 41SettingsImpl :: SettingsImpl( DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl )
37 : SettingsBase( parent, name, modal, fl ) 42 : QDialog( parent, name, modal, fl )
38{ 43{
44 setCaption( tr( "Configuration" ) );
45
46 // Setup layout to make everything pretty
47 QVBoxLayout *layout = new QVBoxLayout( this );
48 layout->setMargin( 2 );
49 layout->setSpacing( 4 );
50
51 // Setup tabs for all info
52 OTabWidget *tabwidget = new OTabWidget( this );
53 layout->addWidget( tabwidget );
54
55 tabwidget->addTab( initServerTab(), "aqpkg/servertab", tr( "Servers" ) );
56 tabwidget->addTab( initDestinationTab(), "aqpkg/desttab", tr( "Destinations" ) );
57 tabwidget->addTab( initProxyTab(), "aqpkg/proxytab", tr( "Proxies" ) );
58 tabwidget->setCurrentTab( tr( "Servers" ) );
59
39 dataMgr = dataManager; 60 dataMgr = dataManager;
40
41 setupData(); 61 setupData();
42 changed = false; 62 changed = false;
43 newserver = false; 63 newserver = false;
44 newdestination = false; 64 newdestination = false;
45} 65}
46 66
47SettingsImpl :: ~SettingsImpl() 67SettingsImpl :: ~SettingsImpl()
48{ 68{
49 69
50} 70}
51 71
52bool SettingsImpl :: showDlg( int i ) 72bool SettingsImpl :: showDlg()
53{ 73{
54 TabWidget->setCurrentPage( i );
55 showMaximized(); 74 showMaximized();
56 exec(); 75 exec();
57 76
58 if ( changed ) 77 if ( changed )
59 dataMgr->writeOutIpkgConf(); 78 dataMgr->writeOutIpkgConf();
60 79
61 return changed; 80 return changed;
62} 81}
63 82
83QWidget *SettingsImpl :: initServerTab()
84{
85 QWidget *control = new QWidget( this );
86
87 QVBoxLayout *vb = new QVBoxLayout( control );
88
89 QScrollView *sv = new QScrollView( control );
90 vb->addWidget( sv, 0, 0 );
91 sv->setResizePolicy( QScrollView::AutoOneFit );
92 sv->setFrameStyle( QFrame::NoFrame );
93
94 QWidget *container = new QWidget( sv->viewport() );
95 sv->addChild( container );
96
97 QGridLayout *layout = new QGridLayout( container );
98 layout->setSpacing( 2 );
99 layout->setMargin( 4 );
100
101 servers = new QListBox( container );
102 servers->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
103 connect( servers, SIGNAL( highlighted( int ) ), this, SLOT( editServer( int ) ) );
104 layout->addMultiCellWidget( servers, 0, 0, 0, 1 );
105
106 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
107 connect( btn, SIGNAL( clicked() ), this, SLOT( newServer() ) );
108 layout->addWidget( btn, 1, 0 );
109
110 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
111 connect( btn, SIGNAL( clicked() ), this, SLOT( removeServer() ) );
112 layout->addWidget( btn, 1, 1 );
113
114 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Server" ), container );
115 grpbox->layout()->setSpacing( 2 );
116 grpbox->layout()->setMargin( 4 );
117 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
118
119 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
120
121 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
122 grplayout->addWidget( label, 0, 0 );
123 servername = new QLineEdit( grpbox );
124 grplayout->addWidget( servername, 0, 1 );
125
126 label = new QLabel( tr( "Address:" ), grpbox );
127 grplayout->addWidget( label, 1, 0 );
128 serverurl = new QLineEdit( grpbox );
129 grplayout->addWidget( serverurl, 1, 1 );
130
131 active = new QCheckBox( tr( "Active Server" ), grpbox );
132 grplayout->addMultiCellWidget( active, 2, 2, 0, 1 );
133
134 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
135 connect( btn, SIGNAL( clicked() ), this, SLOT( changeServerDetails() ) );
136 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
137
138 return control;
139}
140
141QWidget *SettingsImpl :: initDestinationTab()
142{
143 QWidget *control = new QWidget( this );
144
145 QVBoxLayout *vb = new QVBoxLayout( control );
146
147 QScrollView *sv = new QScrollView( control );
148 vb->addWidget( sv, 0, 0 );
149 sv->setResizePolicy( QScrollView::AutoOneFit );
150 sv->setFrameStyle( QFrame::NoFrame );
151
152 QWidget *container = new QWidget( sv->viewport() );
153 sv->addChild( container );
154
155 QGridLayout *layout = new QGridLayout( container );
156 layout->setSpacing( 2 );
157 layout->setMargin( 4 );
158
159 destinations = new QListBox( container );
160 destinations->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
161 connect( destinations, SIGNAL( highlighted( int ) ), this, SLOT( editDestination( int ) ) );
162 layout->addMultiCellWidget( destinations, 0, 0, 0, 1 );
163
164 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), container );
165 connect( btn, SIGNAL( clicked() ), this, SLOT( newDestination() ) );
166 layout->addWidget( btn, 1, 0 );
167
168 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), container );
169 connect( btn, SIGNAL( clicked() ), this, SLOT( removeDestination() ) );
170 layout->addWidget( btn, 1, 1 );
171
172 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "Destination" ), container );
173 grpbox->layout()->setSpacing( 2 );
174 grpbox->layout()->setMargin( 4 );
175 layout->addMultiCellWidget( grpbox, 2, 2, 0, 1 );
176
177 QGridLayout *grplayout = new QGridLayout( grpbox->layout() );
178
179 QLabel *label = new QLabel( tr( "Name:" ), grpbox );
180 grplayout->addWidget( label, 0, 0 );
181 destinationname = new QLineEdit( grpbox );
182 grplayout->addWidget( destinationname, 0, 1 );
183
184 label = new QLabel( tr( "Location:" ), grpbox );
185 grplayout->addWidget( label, 1, 0 );
186 destinationurl = new QLineEdit( grpbox );
187 grplayout->addWidget( destinationurl, 1, 1 );
188
189 linkToRoot = new QCheckBox( tr( "Link to root" ), grpbox );
190 grplayout->addMultiCellWidget( linkToRoot, 2, 2, 0, 1 );
191
192 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), grpbox );
193 connect( btn, SIGNAL( clicked() ), this, SLOT( changeDestinationDetails() ) );
194 grplayout->addMultiCellWidget( btn, 3, 3, 0, 1 );
195
196 return control;
197}
198
199QWidget *SettingsImpl :: initProxyTab()
200{
201 QWidget *control = new QWidget( this );
202
203 QVBoxLayout *vb = new QVBoxLayout( control );
204
205 QScrollView *sv = new QScrollView( control );
206 vb->addWidget( sv, 0, 0 );
207 sv->setResizePolicy( QScrollView::AutoOneFit );
208 sv->setFrameStyle( QFrame::NoFrame );
209
210 QWidget *container = new QWidget( sv->viewport() );
211 sv->addChild( container );
212
213 QGridLayout *layout = new QGridLayout( container );
214 layout->setSpacing( 2 );
215 layout->setMargin( 4 );
216
217 QGroupBox *grpbox = new QGroupBox( 0, Qt::Vertical, tr( "HTTP Proxy" ), container );
218 grpbox->layout()->setSpacing( 2 );
219 grpbox->layout()->setMargin( 4 );
220 layout->addMultiCellWidget( grpbox, 0, 0, 0, 1 );
221 QVBoxLayout *grplayout = new QVBoxLayout( grpbox->layout() );
222 txtHttpProxy = new QLineEdit( grpbox );
223 grplayout->addWidget( txtHttpProxy );
224 chkHttpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
225 grplayout->addWidget( chkHttpProxyEnabled );
226
227 grpbox = new QGroupBox( 0, Qt::Vertical, tr( "FTP Proxy" ), container );
228 grpbox->layout()->setSpacing( 2 );
229 grpbox->layout()->setMargin( 4 );
230 layout->addMultiCellWidget( grpbox, 1, 1, 0, 1 );
231 grplayout = new QVBoxLayout( grpbox->layout() );
232 txtFtpProxy = new QLineEdit( grpbox );
233 grplayout->addWidget( txtFtpProxy );
234 chkFtpProxyEnabled = new QCheckBox( tr( "Enabled" ), grpbox );
235 grplayout->addWidget( chkFtpProxyEnabled );
236
237 QLabel *label = new QLabel( tr( "Username:" ), container );
238 layout->addWidget( label, 2, 0 );
239 txtUsername = new QLineEdit( container );
240 layout->addWidget( txtUsername, 2, 1 );
241
242 label = new QLabel( tr( "Password:" ), container );
243 layout->addWidget( label, 3, 0 );
244 txtPassword = new QLineEdit( container );
245 layout->addWidget( txtPassword, 3, 1 );
246
247 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Update" ), container );
248 connect( btn, SIGNAL( clicked() ), this, SLOT( proxyApplyChanges() ) );
249 layout->addMultiCellWidget( btn, 4, 4, 0, 1 );
250
251 return control;
252}
253
64void SettingsImpl :: setupData() 254void SettingsImpl :: setupData()
65{ 255{
66 // add servers 256 // add servers
67 vector<Server>::iterator it; 257 vector<Server>::iterator it;
68 for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it ) 258 for ( it = dataMgr->getServerList().begin() ; it != dataMgr->getServerList().end() ; ++it )
69 { 259 {
70 if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS ) 260 if ( it->getServerName() == LOCAL_SERVER || it->getServerName() == LOCAL_IPKGS )
71 continue; 261 continue;
72 262
73 servers->insertItem( it->getServerName() ); 263 servers->insertItem( it->getServerName() );
74 } 264 }
75 265
266
76 // add destinations 267 // add destinations
77 vector<Destination>::iterator it2; 268 vector<Destination>::iterator it2;
78 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 ) 269 for ( it2 = dataMgr->getDestinationList().begin() ; it2 != dataMgr->getDestinationList().end() ; ++it2 )
79 destinations->insertItem( it2->getDestinationName() ); 270 destinations->insertItem( it2->getDestinationName() );
80 271
81 // setup general tab
82#ifdef QWS
83 Config cfg( "aqpkg" );
84 cfg.setGroup( "settings" );
85 jumpTo->setChecked( cfg.readBoolEntry( "showJumpTo", "true" ) );
86#else
87 jumpTo->setChecked( true );
88#endif
89
90 // setup proxy tab 272 // setup proxy tab
91 txtHttpProxy->setText( dataMgr->getHttpProxy() ); 273 txtHttpProxy->setText( dataMgr->getHttpProxy() );
92 txtFtpProxy->setText( dataMgr->getFtpProxy() ); 274 txtFtpProxy->setText( dataMgr->getFtpProxy() );
93 txtUsername->setText( dataMgr->getProxyUsername() ); 275 txtUsername->setText( dataMgr->getProxyUsername() );
94 txtPassword->setText( dataMgr->getProxyPassword() ); 276 txtPassword->setText( dataMgr->getProxyPassword() );
95 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() ); 277 chkHttpProxyEnabled->setChecked( dataMgr->getHttpProxyEnabled() );
96 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() ); 278 chkFtpProxyEnabled->setChecked( dataMgr->getFtpProxyEnabled() );
97} 279}
98 280
99//------------------ Servers tab ---------------------- 281//------------------ Servers tab ----------------------
100 282
101void SettingsImpl :: editServer( int sel ) 283void SettingsImpl :: editServer( int sel )
102{ 284{
103 currentSelectedServer = sel; 285 currentSelectedServer = sel;
104 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); 286 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
105 serverName = s->getServerName(); 287 serverName = s->getServerName();
106 servername->setText( s->getServerName() ); 288 servername->setText( s->getServerName() );
107 serverurl->setText( s->getServerUrl() ); 289 serverurl->setText( s->getServerUrl() );
108 active->setChecked( s->isServerActive() ); 290 active->setChecked( s->isServerActive() );
109} 291}
110 292
111void SettingsImpl :: newServer() 293void SettingsImpl :: newServer()
112{ 294{
113 newserver = true; 295 newserver = true;
114 servername->setText( "" ); 296 servername->setText( "" );
115 serverurl->setText( "" ); 297 serverurl->setText( "" );
116 servername->setFocus(); 298 servername->setFocus();
117 active->setChecked( true ); 299 active->setChecked( true );
118} 300}
119 301
120void SettingsImpl :: removeServer() 302void SettingsImpl :: removeServer()
121{ 303{
122 changed = true; 304 changed = true;
123 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); 305 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
124 dataMgr->getServerList().erase( s ); 306 dataMgr->getServerList().erase( s );
125 servers->removeItem( currentSelectedServer ); 307 servers->removeItem( currentSelectedServer );
126} 308}
127 309
128void SettingsImpl :: changeServerDetails() 310void SettingsImpl :: changeServerDetails()
129{ 311{
130 changed = true; 312 changed = true;
131 313
132 QString newName = servername->text(); 314 QString newName = servername->text();
133 if ( !newserver ) 315 if ( !newserver )
134 { 316 {
135 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() ); 317 vector<Server>::iterator s = dataMgr->getServer( servers->currentText() );
136 318
137 // Update url 319 // Update url
138 s->setServerUrl( serverurl->text() ); 320 s->setServerUrl( serverurl->text() );
139 s->setActive( active->isChecked() ); 321 s->setActive( active->isChecked() );
140 322
141 323
142 // Check if server name has changed, if it has then we need to replace the key in the map 324 // Check if server name has changed, if it has then we need to replace the key in the map
143 if ( serverName != newName ) 325 if ( serverName != newName )
144 { 326 {
145 // Update server name 327 // Update server name
146 s->setServerName( newName ); 328 s->setServerName( newName );
147 329
148 // See if this server is the active server 330 // See if this server is the active server
149 // if ( dataMgr->getActiveServer() == serverName ) 331 // if ( dataMgr->getActiveServer() == serverName )
150 // dataMgr->setActiveServer( newName ); 332 // dataMgr->setActiveServer( newName );
151 333
152 // Update list box 334 // Update list box
153 servers->changeItem( newName, currentSelectedServer ); 335 servers->changeItem( newName, currentSelectedServer );
154 } 336 }
155 } 337 }
156 else 338 else
157 { 339 {
158 Server s( newName, serverurl->text() ); 340 Server s( newName, serverurl->text() );
159 dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) ); 341 dataMgr->getServerList().push_back( Server( newName, serverurl->text() ) );
160 dataMgr->getServerList().end()->setActive( active->isChecked() ); 342 dataMgr->getServerList().end()->setActive( active->isChecked() );
161 servers->insertItem( newName ); 343 servers->insertItem( newName );
162 servers->setCurrentItem( servers->count() ); 344 servers->setCurrentItem( servers->count() );
163 newserver = false; 345 newserver = false;
164 } 346 }
165} 347}
166 348
167//------------------ Destinations tab ---------------------- 349//------------------ Destinations tab ----------------------
168 350
169void SettingsImpl :: editDestination( int sel ) 351void SettingsImpl :: editDestination( int sel )
170{ 352{
171 currentSelectedDestination = sel; 353 currentSelectedDestination = sel;
172 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); 354 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
173 destinationName = d->getDestinationName(); 355 destinationName = d->getDestinationName();
174 destinationname->setText( d->getDestinationName() ); 356 destinationname->setText( d->getDestinationName() );
175 destinationurl->setText( d->getDestinationPath() ); 357 destinationurl->setText( d->getDestinationPath() );
176 linkToRoot->setChecked( d->linkToRoot() ); 358 linkToRoot->setChecked( d->linkToRoot() );
177} 359}
178 360
179void SettingsImpl :: newDestination() 361void SettingsImpl :: newDestination()
180{ 362{
181 newdestination = true; 363 newdestination = true;
182 destinationname->setText( "" ); 364 destinationname->setText( "" );
183 destinationurl->setText( "" ); 365 destinationurl->setText( "" );
184 destinationname->setFocus(); 366 destinationname->setFocus();
185 linkToRoot->setChecked( true ); 367 linkToRoot->setChecked( true );
186} 368}
187 369
188void SettingsImpl :: removeDestination() 370void SettingsImpl :: removeDestination()
189{ 371{
190 changed = true; 372 changed = true;
191 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); 373 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
192 dataMgr->getDestinationList().erase( d ); 374 dataMgr->getDestinationList().erase( d );
193 destinations->removeItem( currentSelectedDestination ); 375 destinations->removeItem( currentSelectedDestination );
194} 376}
195 377
196void SettingsImpl :: changeDestinationDetails() 378void SettingsImpl :: changeDestinationDetails()
197{ 379{
198 changed = true; 380 changed = true;
199 381
200#ifdef QWS 382#ifdef QWS
201 Config cfg( "aqpkg" ); 383 Config cfg( "aqpkg" );
202 cfg.setGroup( "destinations" ); 384 cfg.setGroup( "destinations" );
203#endif 385#endif
204 386
205 QString newName = destinationname->text(); 387 QString newName = destinationname->text();
206 if ( !newdestination ) 388 if ( !newdestination )
207 { 389 {
208 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() ); 390 vector<Destination>::iterator d = dataMgr->getDestination( destinations->currentText() );
209 391
210 // Update url 392 // Update url
211 d->setDestinationPath( destinationurl->text() ); 393 d->setDestinationPath( destinationurl->text() );
212 d->linkToRoot( linkToRoot->isChecked() ); 394 d->linkToRoot( linkToRoot->isChecked() );
213 395
214 // Check if server name has changed, if it has then we need to replace the key in the map 396 // Check if server name has changed, if it has then we need to replace the key in the map
215 if ( destinationName != newName ) 397 if ( destinationName != newName )
216 { 398 {
217 // Update server name 399 // Update server name
218 d->setDestinationName( newName ); 400 d->setDestinationName( newName );
219 401
220 // Update list box 402 // Update list box
221 destinations->changeItem( newName, currentSelectedDestination ); 403 destinations->changeItem( newName, currentSelectedDestination );
222 } 404 }
223#ifdef QWS 405#ifdef QWS
224 QString key = newName; 406 QString key = newName;
225 key += "_linkToRoot"; 407 key += "_linkToRoot";
226 int val = d->linkToRoot(); 408 int val = d->linkToRoot();
227 cfg.writeEntry( key, val ); 409 cfg.writeEntry( key, val );
228#endif 410#endif
229 } 411 }
230 else 412 else
231 { 413 {
232 dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) ); 414 dataMgr->getDestinationList().push_back( Destination( newName, destinationurl->text() ) );
233 destinations->insertItem( newName ); 415 destinations->insertItem( newName );
234 destinations->setCurrentItem( destinations->count() ); 416 destinations->setCurrentItem( destinations->count() );
235 newdestination = false; 417 newdestination = false;
236 418
237#ifdef QWS 419#ifdef QWS
238 QString key = newName; 420 QString key = newName;
239 key += "_linkToRoot"; 421 key += "_linkToRoot";
240 cfg.writeEntry( key, true ); 422 cfg.writeEntry( key, true );
241#endif 423#endif
242 } 424 }
243} 425}
244 426
245//------------------ General tab ----------------------
246
247void SettingsImpl :: toggleJumpTo( bool val )
248{
249#ifdef QWS
250 Config cfg( "aqpkg" );
251 cfg.setGroup( "settings" );
252 cfg.writeEntry( "showJumpTo", val );
253#endif
254}
255
256//------------------ Proxy tab ---------------------- 427//------------------ Proxy tab ----------------------
257void SettingsImpl :: proxyApplyChanges() 428void SettingsImpl :: proxyApplyChanges()
258{ 429{
259 changed = true; 430 changed = true;
260 dataMgr->setHttpProxy( txtHttpProxy->text() ); 431 dataMgr->setHttpProxy( txtHttpProxy->text() );
261 dataMgr->setFtpProxy( txtFtpProxy->text() ); 432 dataMgr->setFtpProxy( txtFtpProxy->text() );
262 dataMgr->setProxyUsername( txtUsername->text() ); 433 dataMgr->setProxyUsername( txtUsername->text() );
263 dataMgr->setProxyPassword( txtPassword->text() ); 434 dataMgr->setProxyPassword( txtPassword->text() );
264 435
265 dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() ); 436 dataMgr->setHttpProxyEnabled( chkHttpProxyEnabled->isChecked() );
266 dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() ); 437 dataMgr->setFtpProxyEnabled( chkFtpProxyEnabled->isChecked() );
267} 438}
diff --git a/noncore/settings/aqpkg/settingsimpl.h b/noncore/settings/aqpkg/settingsimpl.h
index bb027dc..9ffc259 100644
--- a/noncore/settings/aqpkg/settingsimpl.h
+++ b/noncore/settings/aqpkg/settingsimpl.h
@@ -1,56 +1,77 @@
1/*************************************************************************** 1/***************************************************************************
2 settingsimpl.h - description 2 settingsimpl.h - description
3 ------------------- 3 -------------------
4 begin : Thu Aug 29 2002 4 begin : Thu Aug 29 2002
5 copyright : (C) 2002 by Andy Qua 5 copyright : (C) 2002 by Andy Qua
6 email : andy.qua@blueyonder.co.uk 6 email : andy.qua@blueyonder.co.uk
7 ***************************************************************************/ 7 ***************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. * 14 * (at your option) any later version. *
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17 17
18#include "settings.h"
19
20#include "datamgr.h" 18#include "datamgr.h"
21 19
22class SettingsImpl : public SettingsBase 20#include <qdialog.h>
21
22class QCheckBox;
23class QLineEdit;
24class QListBox;
25
26class SettingsImpl : public QDialog
23{ 27{
28 Q_OBJECT
24public: 29public:
25 SettingsImpl( DataManager *dataManager, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); 30 SettingsImpl( DataManager *dataManager, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
26 ~SettingsImpl(); 31 ~SettingsImpl();
27 32
28 bool showDlg( int i ); 33 bool showDlg();
29 34
30private: 35private:
36 QListBox *servers;
37 QLineEdit *servername;
38 QLineEdit *serverurl;
39 QCheckBox *active;
40 QListBox *destinations;
41 QLineEdit *destinationname;
42 QLineEdit *destinationurl;
43 QCheckBox *linkToRoot;
44 QLineEdit *txtHttpProxy;
45 QCheckBox *chkHttpProxyEnabled;
46 QLineEdit *txtFtpProxy;
47 QCheckBox *chkFtpProxyEnabled;
48 QLineEdit *txtUsername;
49 QLineEdit *txtPassword;
50
31 DataManager *dataMgr; 51 DataManager *dataMgr;
32 QString serverName; 52 QString serverName;
33 QString destinationName; 53 QString destinationName;
34 int currentSelectedServer; 54 int currentSelectedServer;
35 int currentSelectedDestination; 55 int currentSelectedDestination;
36 bool changed; 56 bool changed;
37 bool newserver; 57 bool newserver;
38 bool newdestination; 58 bool newdestination;
39 59
60 QWidget *initServerTab();
61 QWidget *initDestinationTab();
62 QWidget *initProxyTab();
63
40 void setupConnections(); 64 void setupConnections();
41 void setupData(); 65 void setupData();
42 66
67public slots:
43 void editServer( int s ); 68 void editServer( int s );
44 void changeServerDetails(); 69 void changeServerDetails();
45 void newServer(); 70 void newServer();
46 void removeServer(); 71 void removeServer();
47
48 void editDestination( int s ); 72 void editDestination( int s );
49 void changeDestinationDetails(); 73 void changeDestinationDetails();
50 void newDestination(); 74 void newDestination();
51 void removeDestination(); 75 void removeDestination();
52
53 void toggleJumpTo( bool val );
54
55 void proxyApplyChanges(); 76 void proxyApplyChanges();
56}; 77};