summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/.cvsignore4
-rw-r--r--noncore/settings/aqpkg/aqpkg.pro1
-rw-r--r--noncore/settings/aqpkg/install.ui147
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp132
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h38
-rw-r--r--noncore/settings/aqpkg/mainwin.cpp86
-rw-r--r--noncore/settings/aqpkg/mainwin.h3
7 files changed, 164 insertions, 247 deletions
diff --git a/noncore/settings/aqpkg/.cvsignore b/noncore/settings/aqpkg/.cvsignore
index ef0e27f..751040e 100644
--- a/noncore/settings/aqpkg/.cvsignore
+++ b/noncore/settings/aqpkg/.cvsignore
@@ -1,10 +1,8 @@
1Makefile* 1Makefile*
2install.cpp
3install.h
4instoptions.cpp 2instoptions.cpp
5instoptions.h 3instoptions.h
6moc* 4moc*
7settings.cpp 5settings.cpp
8settings.h 6settings.h
9categoryfilter.cpp 7categoryfilter.cpp
10categoryfilter.h \ No newline at end of file 8categoryfilter.h
diff --git a/noncore/settings/aqpkg/aqpkg.pro b/noncore/settings/aqpkg/aqpkg.pro
index d8eee6a..d3f898b 100644
--- a/noncore/settings/aqpkg/aqpkg.pro
+++ b/noncore/settings/aqpkg/aqpkg.pro
@@ -20,33 +20,32 @@ SOURCES = mainwin.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= settings.ui \
36 install.ui \
37 instoptions.ui \ 36 instoptions.ui \
38 categoryfilter.ui 37 categoryfilter.ui
39 TARGET = aqpkg 38 TARGET = aqpkg
40INCLUDEPATH += $(OPIEDIR)/include 39INCLUDEPATH += $(OPIEDIR)/include
41DEPENDPATH += $(OPIEDIR)/include 40DEPENDPATH += $(OPIEDIR)/include
42LIBS += -lqpe -lopie -lstdc++ 41LIBS += -lqpe -lopie -lstdc++
43DESTDIR = $(OPIEDIR)/bin 42DESTDIR = $(OPIEDIR)/bin
44 43
45TRANSLATIONS = ../../../i18n/de/aqpkg.ts \ 44TRANSLATIONS = ../../../i18n/de/aqpkg.ts \
46 ../../../i18n/xx/aqpkg.ts \ 45 ../../../i18n/xx/aqpkg.ts \
47 ../../../i18n/en/aqpkg.ts \ 46 ../../../i18n/en/aqpkg.ts \
48 ../../../i18n/es/aqpkg.ts \ 47 ../../../i18n/es/aqpkg.ts \
49 ../../../i18n/fr/aqpkg.ts \ 48 ../../../i18n/fr/aqpkg.ts \
50 ../../../i18n/hu/aqpkg.ts \ 49 ../../../i18n/hu/aqpkg.ts \
51 ../../../i18n/ja/aqpkg.ts \ 50 ../../../i18n/ja/aqpkg.ts \
52 ../../../i18n/ko/aqpkg.ts \ 51 ../../../i18n/ko/aqpkg.ts \
diff --git a/noncore/settings/aqpkg/install.ui b/noncore/settings/aqpkg/install.ui
deleted file mode 100644
index 53622dd..0000000
--- a/noncore/settings/aqpkg/install.ui
+++ b/dev/null
@@ -1,147 +0,0 @@
1<!DOCTYPE UI><UI>
2<class>InstallDlg</class>
3<widget>
4 <class>QDialog</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>InstallDlg</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>196</width>
15 <height>278</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Install</string>
21 </property>
22 <grid>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget row="0" column="1" >
32 <class>QComboBox</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>destination</cstring>
36 </property>
37 </widget>
38 <widget row="3" column="0" >
39 <class>QPushButton</class>
40 <property stdset="1">
41 <name>name</name>
42 <cstring>btnInstall</cstring>
43 </property>
44 <property stdset="1">
45 <name>text</name>
46 <string>Start</string>
47 </property>
48 </widget>
49 <widget row="3" column="1" >
50 <class>QPushButton</class>
51 <property stdset="1">
52 <name>name</name>
53 <cstring>btnOptions</cstring>
54 </property>
55 <property stdset="1">
56 <name>text</name>
57 <string>Options</string>
58 </property>
59 </widget>
60 <widget row="2" column="0" rowspan="1" colspan="2" >
61 <class>QGroupBox</class>
62 <property stdset="1">
63 <name>name</name>
64 <cstring>GroupBox2</cstring>
65 </property>
66 <property stdset="1">
67 <name>title</name>
68 <string>Output</string>
69 </property>
70 <grid>
71 <property stdset="1">
72 <name>margin</name>
73 <number>11</number>
74 </property>
75 <property stdset="1">
76 <name>spacing</name>
77 <number>6</number>
78 </property>
79 <widget row="0" column="0" >
80 <class>QMultiLineEdit</class>
81 <property stdset="1">
82 <name>name</name>
83 <cstring>output</cstring>
84 </property>
85 </widget>
86 </grid>
87 </widget>
88 <widget row="0" column="0" >
89 <class>QLabel</class>
90 <property stdset="1">
91 <name>name</name>
92 <cstring>TextLabel1</cstring>
93 </property>
94 <property stdset="1">
95 <name>text</name>
96 <string>Destination</string>
97 </property>
98 </widget>
99 <widget row="1" column="0" >
100 <class>QLabel</class>
101 <property stdset="1">
102 <name>name</name>
103 <cstring>TextLabel3</cstring>
104 </property>
105 <property stdset="1">
106 <name>text</name>
107 <string>Space Avail</string>
108 </property>
109 </widget>
110 <widget row="1" column="1" >
111 <class>QLabel</class>
112 <property stdset="1">
113 <name>name</name>
114 <cstring>txtAvailableSpace</cstring>
115 </property>
116 <property stdset="1">
117 <name>text</name>
118 <string></string>
119 </property>
120 </widget>
121 </grid>
122</widget>
123<connections>
124 <connection>
125 <sender>btnOptions</sender>
126 <signal>clicked()</signal>
127 <receiver>InstallDlg</receiver>
128 <slot>optionsSelected()</slot>
129 </connection>
130 <connection>
131 <sender>btnInstall</sender>
132 <signal>clicked()</signal>
133 <receiver>InstallDlg</receiver>
134 <slot>installSelected()</slot>
135 </connection>
136 <connection>
137 <sender>destination</sender>
138 <signal>highlighted(const QString&amp;)</signal>
139 <receiver>InstallDlg</receiver>
140 <slot>displayAvailableSpace( const QString&amp; )</slot>
141 </connection>
142 <slot access="public">displayAvailableSpace( const QString&amp; )</slot>
143 <slot access="public">installSelected()</slot>
144 <slot access="public">displayText( const QString &amp; )</slot>
145 <slot access="public">optionsSelected()</slot>
146</connections>
147</UI>
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index 75ce1a1..65aaa32 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -2,190 +2,240 @@
2 installdlgimpl.cpp - description 2 installdlgimpl.cpp - description
3 ------------------- 3 -------------------
4 begin : Mon Aug 26 2002 4 begin : Mon Aug 26 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 <stdio.h>
19
18#ifdef QWS 20#ifdef QWS
19#include <qpe/config.h> 21#include <qpe/config.h>
20#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23#include <qpe/resource.h>
21#include <qpe/storage.h> 24#include <qpe/storage.h>
22#endif 25#endif
23 26
24#include <qmultilineedit.h>
25#include <qdialog.h>
26#include <qcombobox.h>
27#include <qcheckbox.h> 27#include <qcheckbox.h>
28#include <qpushbutton.h> 28#include <qcombobox.h>
29#include <qdialog.h>
30#include <qgroupbox.h>
31#include <qmultilineedit.h>
29#include <qlabel.h> 32#include <qlabel.h>
30 33#include <qlayout.h>
34#include <qpushbutton.h>
31 35
32#include "datamgr.h" 36#include "datamgr.h"
33#include "instoptionsimpl.h"
34#include "destination.h" 37#include "destination.h"
38#include "instoptionsimpl.h"
35#include "installdlgimpl.h" 39#include "installdlgimpl.h"
40#include "ipkg.h"
36#include "utils.h" 41#include "utils.h"
37#include "global.h" 42#include "global.h"
38 43
39InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent, const char* name, bool modal, WFlags fl ) 44InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 )
40 : InstallDlg( parent, name, modal, fl ) 45 : QWidget( 0, 0, 0 )
41{ 46{
47 setCaption( title );
48 init( TRUE );
49
42 pIpkg = 0; 50 pIpkg = 0;
43 upgradePackages = false; 51 upgradePackages = false;
44 dataMgr = dataManager; 52 dataMgr = dataManager;
45 vector<Destination>::iterator dit; 53 vector<Destination>::iterator dit;
46 54
47 QString defaultDest = "root"; 55 QString defaultDest = "root";
48#ifdef QWS 56#ifdef QWS
49 Config cfg( "aqpkg" ); 57 Config cfg( "aqpkg" );
50 cfg.setGroup( "settings" ); 58 cfg.setGroup( "settings" );
51 defaultDest = cfg.readEntry( "dest", "root" ); 59 defaultDest = cfg.readEntry( "dest", "root" );
52 60
53 // Grab flags - Turn MAKE_LINKS on by default (if no flags found) 61 // Grab flags - Turn MAKE_LINKS on by default (if no flags found)
54 flags = cfg.readNumEntry( "installFlags", 0 ); 62 flags = cfg.readNumEntry( "installFlags", 0 );
55#else 63#else
56 flags = 0; 64 flags = 0;
57#endif 65#endif
58 66
59 // Output text is read only 67 // Output text is read only
60 output->setReadOnly( true ); 68 output->setReadOnly( true );
61 QFont f( "helvetica" ); 69 //QFont f( "helvetica" );
62 f.setPointSize( 10 ); 70 //f.setPointSize( 10 );
63 output->setFont( f ); 71 //output->setFont( f );
64 72
65 73
66 // setup destination data 74 // setup destination data
67 int defIndex = 0; 75 int defIndex = 0;
68 int i; 76 int i;
69 for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i ) 77 for ( i = 0 , dit = dataMgr->getDestinationList().begin() ; dit != dataMgr->getDestinationList().end() ; ++dit, ++i )
70 { 78 {
71 destination->insertItem( dit->getDestinationName() ); 79 destination->insertItem( dit->getDestinationName() );
72 if ( dit->getDestinationName() == defaultDest ) 80 if ( dit->getDestinationName() == defaultDest )
73 defIndex = i; 81 defIndex = i;
74 } 82 }
75 83
76 destination->setCurrentItem( defIndex ); 84 destination->setCurrentItem( defIndex );
77 85
78 vector<InstallData>::iterator it; 86 vector<InstallData>::iterator it;
79 // setup package data 87 // setup package data
80 QString remove = "Remove\n"; 88 QString remove = tr( "Remove\n" );
81 QString install = "\nInstall\n"; 89 QString install = tr( "Install\n" );
82 QString upgrade = "\nUpgrade\n"; 90 QString upgrade = tr( "Upgrade\n" );
83 for ( it = packageList.begin() ; it != packageList.end() ; ++it ) 91 for ( it = packageList.begin() ; it != packageList.end() ; ++it )
84 { 92 {
85 InstallData item = *it; 93 InstallData item = *it;
86 if ( item.option == "I" ) 94 if ( item.option == "I" )
87 { 95 {
88 installList.push_back( item ); 96 installList.push_back( item );
89 install += " " + item.packageName + "\n"; 97 install.append( QString( " %1\n" ).arg( item.packageName ) );
90 } 98 }
91 else if ( item.option == "D" ) 99 else if ( item.option == "D" )
92 { 100 {
93 removeList.push_back( item ); 101 removeList.push_back( item );
94 remove += " " + item.packageName + "\n"; 102 remove.append( QString( " %1\n" ).arg( item.packageName ) );
95 } 103 }
96 else if ( item.option == "U" || item.option == "R" ) 104 else if ( item.option == "U" || item.option == "R" )
97 { 105 {
98 updateList.push_back( item ); 106 updateList.push_back( item );
99 QString type = " (Upgrade)"; 107 QString type;
100 if ( item.option == "R" ) 108 if ( item.option == "R" )
101 type = " (ReInstall)"; 109 type = tr( "(ReInstall)" );
102 upgrade += " " + item.packageName + type + "\n"; 110 else
103 } 111 type = tr( "(Upgrade)" );
112 upgrade.append( QString( " %1 %2\n" ).arg( item.packageName ).arg( type ) );
113 }
104 } 114 }
105 115
106 output->setText( remove + install + upgrade ); 116 output->setText( QString( "%1\n%2\n%3\n" ).arg( remove ).arg( install ).arg( upgrade ) );
107 117
108 displayAvailableSpace( destination->currentText() ); 118 displayAvailableSpace( destination->currentText() );
109} 119}
110 120
111InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) 121InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 )
112 : InstallDlg( parent, name, modal, fl ) 122 : QWidget( 0, 0, 0 )
113{ 123{
124 setCaption( title );
125 init( FALSE );
114 pIpkg = ipkg; 126 pIpkg = ipkg;
115 output->setText( initialText ); 127 output->setText( initialText );
116} 128}
117 129
118 130
119InstallDlgImpl::~InstallDlgImpl() 131InstallDlgImpl::~InstallDlgImpl()
120{ 132{
133 if ( pIpkg )
134 delete pIpkg;
121} 135}
122 136
123bool InstallDlgImpl :: showDlg() 137void InstallDlgImpl :: init( bool displayextrainfo )
124{ 138{
125 showMaximized(); 139 QGridLayout *layout = new QGridLayout( this );
126 bool ret = exec(); 140 layout->setSpacing( 4 );
141 layout->setMargin( 4 );
127 142
128 return ret; 143 if ( displayextrainfo )
144 {
145 QLabel *label = new QLabel( tr( "Destination" ), this );
146 layout->addWidget( label, 0, 0 );
147 destination = new QComboBox( FALSE, this );
148 layout->addWidget( destination, 0, 1 );
149 connect( destination, SIGNAL( highlighted( const QString & ) ),
150 this, SLOT( displayAvailableSpace( const QString & ) ) );
151
152 QLabel *label2 = new QLabel( tr( "Space Avail" ), this );
153 layout->addWidget( label2, 1, 0 );
154 txtAvailableSpace = new QLabel( "", this );
155 layout->addWidget( txtAvailableSpace, 1, 1 );
156 }
157 else
158 {
159 destination = 0x0;
160 txtAvailableSpace = 0x0;
161 }
162
163 QGroupBox *GroupBox2 = new QGroupBox( 0, Qt::Vertical, tr( "Output" ), this );
164 GroupBox2->layout()->setSpacing( 0 );
165 GroupBox2->layout()->setMargin( 4 );
166
167 QVBoxLayout *GroupBox2Layout = new QVBoxLayout( GroupBox2->layout() );
168 output = new QMultiLineEdit( GroupBox2 );
169 GroupBox2Layout->addWidget( output );
170 layout->addMultiCellWidget( GroupBox2, 2, 2, 0, 1 );
171
172 btnInstall = new QPushButton( Resource::loadPixmap( "aqpkg/apply" ), tr( "Start" ), this );
173 layout->addWidget( btnInstall, 3, 0 );
174 connect( btnInstall, SIGNAL( clicked() ), this, SLOT( installSelected() ) );
175
176 btnOptions = new QPushButton( Resource::loadPixmap( "aqpkg/config" ), tr( "Options" ), this );
177 layout->addWidget( btnOptions, 3, 1 );
178 connect( btnOptions, SIGNAL( clicked() ), this, SLOT( optionsSelected() ) );
129} 179}
130 180
131void InstallDlgImpl :: optionsSelected() 181void InstallDlgImpl :: optionsSelected()
132{ 182{
133 InstallOptionsDlgImpl opt( flags, this, "Option", true ); 183 InstallOptionsDlgImpl opt( flags, this, "Option", true );
134 opt.exec(); 184 opt.exec();
135 185
136 // set options selected from dialog 186 // set options selected from dialog
137 flags = opt.getFlags(); 187 flags = opt.getFlags();
138 188
139#ifdef QWS 189#ifdef QWS
140 Config cfg( "aqpkg" ); 190 Config cfg( "aqpkg" );
141 cfg.setGroup( "settings" ); 191 cfg.setGroup( "settings" );
142 cfg.writeEntry( "installFlags", flags ); 192 cfg.writeEntry( "installFlags", flags );
143#endif 193#endif
144} 194}
145 195
146void InstallDlgImpl :: installSelected() 196void InstallDlgImpl :: installSelected()
147{ 197{
148 if ( btnInstall->text() == "Abort" ) 198 if ( btnInstall->text() == tr( "Abort" ) )
149 { 199 {
150 if ( pIpkg ) 200 if ( pIpkg )
151 { 201 {
152 displayText( "\n**** User Clicked ABORT ***" ); 202 displayText( tr( "\n**** User Clicked ABORT ***" ) );
153 pIpkg->abort(); 203 pIpkg->abort();
154 displayText( "**** Process Aborted ****" ); 204 displayText( tr( "**** Process Aborted ****" ) );
155 } 205 }
156 206
157 btnInstall->setText( tr( "Close" ) ); 207 btnInstall->setText( tr( "Close" ) );
208 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
158 return; 209 return;
159 } 210 }
160 else if ( btnInstall->text() == tr( "Close" ) ) 211 else if ( btnInstall->text() == tr( "Close" ) )
161 { 212 {
162 done( 1 ); 213 emit reloadData( this );
163 return; 214 return;
164 } 215 }
165 216
166 // Disable buttons 217 // Disable buttons
167 btnOptions->setEnabled( false ); 218 btnOptions->setEnabled( false );
168// btnInstall->setEnabled( false ); 219// btnInstall->setEnabled( false );
169 220
170 btnInstall->setText( "Abort" ); 221 btnInstall->setText( tr( "Abort" ) );
171 222 btnInstall->setIconSet( Resource::loadPixmap( "close" ) );
172 if ( pIpkg ) 223 if ( pIpkg )
173 { 224 {
174 output->setText( "" ); 225 output->setText( "" );
175
176 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &))); 226 connect( pIpkg, SIGNAL(outputText(const QString &)), this, SLOT(displayText(const QString &)));
177 pIpkg->runIpkg(); 227 pIpkg->runIpkg();
178 } 228 }
179 else 229 else
180 { 230 {
181 output->setText( "" ); 231 output->setText( "" );
182 vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() ); 232 vector<Destination>::iterator d = dataMgr->getDestination( destination->currentText() );
183 QString dest = d->getDestinationName(); 233 QString dest = d->getDestinationName();
184 QString destDir = d->getDestinationPath(); 234 QString destDir = d->getDestinationPath();
185 int instFlags = flags; 235 int instFlags = flags;
186 if ( d->linkToRoot() ) 236 if ( d->linkToRoot() )
187 instFlags |= MAKE_LINKS; 237 instFlags |= MAKE_LINKS;
188 238
189#ifdef QWS 239#ifdef QWS
190 // Save settings 240 // Save settings
191 Config cfg( "aqpkg" ); 241 Config cfg( "aqpkg" );
@@ -229,63 +279,67 @@ void InstallDlgImpl :: installSelected()
229 if ( it->option == "R" ) 279 if ( it->option == "R" )
230 pIpkg->setOption( "reinstall" ); 280 pIpkg->setOption( "reinstall" );
231 else 281 else
232 pIpkg->setOption( "upgrade" ); 282 pIpkg->setOption( "upgrade" );
233 pIpkg->setDestination( it->destination->getDestinationName() ); 283 pIpkg->setDestination( it->destination->getDestinationName() );
234 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 284 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
235 pIpkg->setPackage( it->packageName ); 285 pIpkg->setPackage( it->packageName );
236 286
237 int tmpFlags = flags; 287 int tmpFlags = flags;
238 if ( it->destination->linkToRoot() && it->recreateLinks ) 288 if ( it->destination->linkToRoot() && it->recreateLinks )
239 tmpFlags |= MAKE_LINKS; 289 tmpFlags |= MAKE_LINKS;
240 pIpkg->setFlags( tmpFlags ); 290 pIpkg->setFlags( tmpFlags );
241 pIpkg->runIpkg(); 291 pIpkg->runIpkg();
242 } 292 }
243 293
244 delete pIpkg; 294 delete pIpkg;
295 pIpkg = 0;
245 } 296 }
246 297
247 btnOptions->setEnabled( true ); 298 btnOptions->setEnabled( true );
248// btnInstall->setEnabled( true ); 299// btnInstall->setEnabled( true );
249 btnInstall->setText( tr( "Close" ) ); 300 btnInstall->setText( tr( "Close" ) );
301 btnInstall->setIconSet( Resource::loadPixmap( "enter" ) );
250 302
251 if ( destination->currentText() != 0 && destination->currentText() != "" ) 303 if ( destination && destination->currentText() != 0 && destination->currentText() != "" )
252 displayAvailableSpace( destination->currentText() ); 304 displayAvailableSpace( destination->currentText() );
253} 305}
254 306
255 307
256void InstallDlgImpl :: displayText(const QString &text ) 308void InstallDlgImpl :: displayText(const QString &text )
257{ 309{
258 QString t = output->text() + "\n" + text; 310 //output->setText( QString( "%1\n%2" ).arg( output->text() ).arg( text ) );
259 output->setText( t ); 311 QString newtext = QString( "%1\n%2" ).arg( output->text() ).arg( text );
312 output->setText( newtext );
260 output->setCursorPosition( output->numLines(), 0 ); 313 output->setCursorPosition( output->numLines(), 0 );
261} 314}
262 315
263 316
264void InstallDlgImpl :: displayAvailableSpace( const QString &text ) 317void InstallDlgImpl :: displayAvailableSpace( const QString &text )
265{ 318{
266 vector<Destination>::iterator d = dataMgr->getDestination( text ); 319 vector<Destination>::iterator d = dataMgr->getDestination( text );
267 QString destDir = d->getDestinationPath(); 320 QString destDir = d->getDestinationPath();
268 321
269 long blockSize = 0; 322 long blockSize = 0;
270 long totalBlocks = 0; 323 long totalBlocks = 0;
271 long availBlocks = 0; 324 long availBlocks = 0;
272 QString space; 325 QString space;
273 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) ) 326 if ( Utils::getStorageSpace( (const char *)destDir, &blockSize, &totalBlocks, &availBlocks ) )
274 { 327 {
275 long mult = blockSize / 1024; 328 long mult = blockSize / 1024;
276 long div = 1024 / blockSize; 329 long div = 1024 / blockSize;
277 330
278 if ( !mult ) mult = 1; 331 if ( !mult ) mult = 1;
279 if ( !div ) div = 1; 332 if ( !div ) div = 1;
280// long total = totalBlocks * mult / div; 333// long total = totalBlocks * mult / div;
281 long avail = availBlocks * mult / div; 334 long avail = availBlocks * mult / div;
282// long used = total - avail; 335// long used = total - avail;
283 336
284 space.sprintf( "%ld Kb", avail ); 337 space.sprintf( "%ld Kb", avail );
285 } 338 }
286 else 339 else
287 space = "Unknown"; 340 space = tr( "Unknown" );
288 341
289 txtAvailableSpace->setText( space ); 342 if ( txtAvailableSpace )
343 txtAvailableSpace->setText( space );
290} 344}
291 345
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 2f80f08..4c9f087 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -7,61 +7,79 @@
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#ifndef INSTALLDLGIMPL_H 17#ifndef INSTALLDLGIMPL_H
18#define INSTALLDLGIMPL_H 18#define INSTALLDLGIMPL_H
19 19
20#include <vector> 20#include <vector>
21using namespace std; 21using namespace std;
22 22
23#include <qwidget.h>
23#include <qstring.h> 24#include <qstring.h>
24 25
25#include "ipkg.h" 26class QComboBox;
26#include "install.h" 27class QLabel;
28class QMultiLineEdit;
29class QPushButton;
30
31class DataManager;
32class Destination;
33class Ipkg;
27 34
28class InstallData 35class InstallData
29{ 36{
30public: 37public:
31 QString option; // I - install, D - delete, R- reinstall U - upgrade 38 QString option; // I - install, D - delete, R- reinstall U - upgrade
32 QString packageName; 39 QString packageName;
33 Destination *destination; 40 Destination *destination;
34 bool recreateLinks; 41 bool recreateLinks;
35}; 42};
36 43
37class InstallDlgImpl : public InstallDlg 44class InstallDlgImpl : public QWidget
38{ 45{
46 Q_OBJECT
39public: 47public:
40 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 48 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, const char *title = 0 );
41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 49 InstallDlgImpl( Ipkg *ipkg, QString initialText, const char *title = 0 );
42 ~InstallDlgImpl(); 50 ~InstallDlgImpl();
43 51
44 bool showDlg();
45 bool upgradeServer( QString &server ); 52 bool upgradeServer( QString &server );
46 53
47
48protected: 54protected:
49 55
50private: 56private:
51 DataManager *dataMgr; 57 DataManager *dataMgr;
52 vector<InstallData> installList; 58 vector<InstallData> installList;
53 vector<InstallData> removeList; 59 vector<InstallData> removeList;
54 vector<InstallData> updateList; 60 vector<InstallData> updateList;
55 int flags; 61 int flags;
56 Ipkg *pIpkg; 62 Ipkg *pIpkg;
57 bool upgradePackages; 63 bool upgradePackages;
64
65 QComboBox *destination;
66 QPushButton *btnInstall;
67 QPushButton *btnOptions;
68 QMultiLineEdit *output;
69 QLabel *txtAvailableSpace;
58 70
59 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags ); 71 void init( bool );
72
73 bool runIpkg( QString &option, const QString& package, const QString& dest, int flags );
60 74
61 void optionsSelected(); 75signals:
62 void installSelected(); 76 void reloadData( InstallDlgImpl * );
77
78public slots:
79 void optionsSelected();
80 void installSelected();
63 void displayText(const QString &text ); 81 void displayText(const QString &text );
64 void displayAvailableSpace( const QString &text); 82 void displayAvailableSpace( const QString &text);
65}; 83};
66 84
67#endif 85#endif
diff --git a/noncore/settings/aqpkg/mainwin.cpp b/noncore/settings/aqpkg/mainwin.cpp
index a25f5a7..947aace 100644
--- a/noncore/settings/aqpkg/mainwin.cpp
+++ b/noncore/settings/aqpkg/mainwin.cpp
@@ -32,32 +32,33 @@
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 "installdlgimpl.h" 49#include "installdlgimpl.h"
49#include "letterpushbutton.h" 50#include "letterpushbutton.h"
50#include "mainwin.h" 51#include "mainwin.h"
51#include "settingsimpl.h" 52#include "settingsimpl.h"
52#include "utils.h" 53#include "utils.h"
53 54
54extern int compareVersions( const char *v1, const char *v2 ); 55extern int compareVersions( const char *v1, const char *v2 );
55 56
56MainWindow :: MainWindow() 57MainWindow :: MainWindow()
57 :QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) 58 :QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
58{ 59{
59 setCaption( tr( "AQPkg - Package Manager" ) ); 60 setCaption( tr( "AQPkg - Package Manager" ) );
60 61
61 // Create UI widgets 62 // Create UI widgets
62 initMainWidget(); 63 initMainWidget();
63 initProgressWidget(); 64 initProgressWidget();
@@ -75,50 +76,41 @@ MainWindow :: MainWindow()
75 findBar = new QPEToolBar( this ); 76 findBar = new QPEToolBar( this );
76 addToolBar( findBar, QMainWindow::Top, true ); 77 addToolBar( findBar, QMainWindow::Top, true );
77 findBar->setHorizontalStretchable( true ); 78 findBar->setHorizontalStretchable( true );
78 findEdit = new QLineEdit( findBar ); 79 findEdit = new QLineEdit( findBar );
79 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) ); 80 QWhatsThis::add( findEdit, tr( "Type the text to search for here." ) );
80 findBar->setStretchableWidget( findEdit ); 81 findBar->setStretchableWidget( findEdit );
81 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) ); 82 connect( findEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( findPackage( const QString & ) ) );
82 83
83 // Quick jump toolbar 84 // Quick jump toolbar
84 jumpBar = new QPEToolBar( this ); 85 jumpBar = new QPEToolBar( this );
85 addToolBar( jumpBar, QMainWindow::Top, true ); 86 addToolBar( jumpBar, QMainWindow::Top, true );
86 jumpBar->setHorizontalStretchable( true ); 87 jumpBar->setHorizontalStretchable( true );
87 QWidget *w = new QWidget( jumpBar ); 88 QWidget *w = new QWidget( jumpBar );
88 jumpBar->setStretchableWidget( w ); 89 jumpBar->setStretchableWidget( w );
89 90
90 QGridLayout *layout = new QGridLayout( w ); 91 QGridLayout *layout = new QGridLayout( w );
91 //QVBoxLayout *vbox = new QVBoxLayout( w, 0, -1 );
92 //QHBoxLayout *hbox3 = new QHBoxLayout( vbox, -1 );
93 //QHBoxLayout *hbox4 = new QHBoxLayout( vbox, -1 );
94 92
95 char text[2]; 93 char text[2];
96 text[1] = '\0'; 94 text[1] = '\0';
97 for ( int i = 0 ; i < 26 ; ++i ) 95 for ( int i = 0 ; i < 26 ; ++i )
98 { 96 {
99 text[0] = 'A' + i; 97 text[0] = 'A' + i;
100 LetterPushButton *b = new LetterPushButton( text, w ); 98 LetterPushButton *b = new LetterPushButton( text, w );
101 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) ); 99 connect( b, SIGNAL( released( QString ) ), this, SLOT( letterPushed( QString ) ) );
102 layout->addWidget( b, i / 13, i % 13); 100 layout->addWidget( b, i / 13, i % 13);
103/*
104 if ( i < 13 )
105 hbox3->addWidget( b );
106 else
107 hbox4->addWidget( b );
108*/
109 } 101 }
110 102
111 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 );
112 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) ); 104 a->setWhatsThis( tr( "Click here to hide the Quick Jump toolbar." ) );
113 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) ); 105 connect( a, SIGNAL( activated() ), this, SLOT( hideJumpBar() ) );
114 a->addTo( jumpBar ); 106 a->addTo( jumpBar );
115 jumpBar->hide(); 107 jumpBar->hide();
116 108
117 // Packages menu 109 // Packages menu
118 QPopupMenu *popup = new QPopupMenu( this ); 110 QPopupMenu *popup = new QPopupMenu( this );
119 111
120 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 );
121 a->setWhatsThis( tr( "Click here to update package lists from servers." ) ); 113 a->setWhatsThis( tr( "Click here to update package lists from servers." ) );
122 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) ); 114 connect( a, SIGNAL( activated() ), this, SLOT( updateServer() ) );
123 a->addTo( popup ); 115 a->addTo( popup );
124 a->addTo( bar ); 116 a->addTo( bar );
@@ -785,71 +777,72 @@ void MainWindow :: searchForPackage( const QString &text )
785 } 777 }
786 } 778 }
787} 779}
788 780
789void MainWindow :: updateServer() 781void MainWindow :: updateServer()
790{ 782{
791 QString serverName = serversList->currentText(); 783 QString serverName = serversList->currentText();
792 784
793 // Update the current server 785 // Update the current server
794 // Display dialog 786 // Display dialog
795 787
796 // Disable buttons to stop silly people clicking lots on them :) 788 // Disable buttons to stop silly people clicking lots on them :)
797 789
798 // 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
799 mgr->writeOutIpkgConf(); 791 mgr->writeOutIpkgConf();
800 792
801 Ipkg ipkg; 793 Ipkg *ipkg = new Ipkg;
802 ipkg.setOption( "update" ); 794 ipkg->setOption( "update" );
803
804 InstallDlgImpl dlg( &ipkg, tr( "Refreshing server package lists" ), this, tr( "Upgrade" ), true );
805 dlg.showDlg();
806 795
807 reloadData(); 796 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Refreshing server package lists" ),
797 tr( "Update lists" ) );
798 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
799 dlg->showMaximized();
808 800
809// delete progDlg; 801// delete progDlg;
810} 802}
811 803
812void MainWindow :: upgradePackages() 804void MainWindow :: upgradePackages()
813{ 805{
814 // We're gonna do an upgrade of all packages 806 // We're gonna do an upgrade of all packages
815 // First warn user that this isn't recommended 807 // First warn user that this isn't recommended
816 // TODO - ODevice???? 808 // TODO - ODevice????
817 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" );
818 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning, 810 QMessageBox warn( tr( "Warning" ), text, QMessageBox::Warning,
819 QMessageBox::Yes, 811 QMessageBox::Yes,
820 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default , 812 QMessageBox::No | QMessageBox::Escape | QMessageBox::Default ,
821 0, this ); 813 0, this );
822 warn.adjustSize(); 814 warn.adjustSize();
823 815
824 if ( warn.exec() == QMessageBox::Yes ) 816 if ( warn.exec() == QMessageBox::Yes )
825 { 817 {
826 // 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
827 mgr->writeOutIpkgConf(); 819 mgr->writeOutIpkgConf();
828 820
829 // Now run upgrade 821 // Now run upgrade
830 Ipkg ipkg; 822 Ipkg *ipkg = new Ipkg;
831 ipkg.setOption( "upgrade" ); 823 ipkg->setOption( "upgrade" );
832
833 InstallDlgImpl dlg( &ipkg, tr( "Upgrading installed packages" ), this, tr( "Upgrade" ), true );
834 dlg.showDlg();
835 824
836 reloadData(); 825 InstallDlgImpl *dlg = new InstallDlgImpl( ipkg, tr( "Upgrading installed packages" ),
826 tr ( "Upgrade" ) );
827 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
828 dlg->showMaximized();
837 } 829 }
838} 830}
839 void MainWindow :: downloadPackage() 831
832void MainWindow :: downloadPackage()
840{ 833{
841 bool doUpdate = true; 834 bool doUpdate = true;
842 if ( downloadEnabled ) 835 if ( downloadEnabled )
843 { 836 {
844 // See if any packages are selected 837 // See if any packages are selected
845 bool found = false; 838 bool found = false;
846 if ( serversList->currentText() != LOCAL_SERVER ) 839 if ( serversList->currentText() != LOCAL_SERVER )
847 { 840 {
848 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 841 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
849 item != 0 && !found; 842 item != 0 && !found;
850 item = (QCheckListItem *)item->nextSibling() ) 843 item = (QCheckListItem *)item->nextSibling() )
851 { 844 {
852 if ( item->isOn() ) 845 if ( item->isOn() )
853 found = true; 846 found = true;
854 } 847 }
855 } 848 }
@@ -885,33 +878,33 @@ void MainWindow :: upgradePackages()
885 878
886 QString msgtext; 879 QString msgtext;
887 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() );
888 if ( QMessageBox::information( this, tr( "Are you sure?" ), 881 if ( QMessageBox::information( this, tr( "Are you sure?" ),
889 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 ) 882 msgtext, tr( "No" ), tr( "Yes" ) ) == 1 )
890 { 883 {
891 doUpdate = true; 884 doUpdate = true;
892 QFile f( p->getFilename() ); 885 QFile f( p->getFilename() );
893 f.remove(); 886 f.remove();
894 } 887 }
895 } 888 }
896 } 889 }
897 } 890 }
898 891
899 if ( doUpdate ) 892 if ( doUpdate )
900 { 893 {
901 reloadData(); 894 reloadData( 0x0 );
902 } 895 }
903} 896}
904 897
905void MainWindow :: downloadSelectedPackages() 898void MainWindow :: downloadSelectedPackages()
906{ 899{
907 // 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
908 mgr->writeOutIpkgConf(); 901 mgr->writeOutIpkgConf();
909 902
910 // Display dialog to user asking where to download the files to 903 // Display dialog to user asking where to download the files to
911 bool ok = FALSE; 904 bool ok = FALSE;
912 QString dir = ""; 905 QString dir = "";
913#ifdef QWS 906#ifdef QWS
914 // read download directory from config file 907 // read download directory from config file
915 Config cfg( "aqpkg" ); 908 Config cfg( "aqpkg" );
916 cfg.setGroup( "settings" ); 909 cfg.setGroup( "settings" );
917 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" ); 910 dir = cfg.readEntry( "downloadDir", "/home/root/Documents/application/ipkg" );
@@ -957,43 +950,35 @@ void MainWindow :: downloadRemotePackage()
957 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 );
958 if ( !ok || package.isEmpty() ) 951 if ( !ok || package.isEmpty() )
959 return; 952 return;
960// DownloadRemoteDlgImpl dlg( this, "Install", true ); 953// DownloadRemoteDlgImpl dlg( this, "Install", true );
961// if ( dlg.exec() == QDialog::Rejected ) 954// if ( dlg.exec() == QDialog::Rejected )
962// return; 955// return;
963 956
964 // grab details from dialog 957 // grab details from dialog
965// QString package = dlg.getPackageLocation(); 958// QString package = dlg.getPackageLocation();
966 959
967 InstallData item; 960 InstallData item;
968 item.option = "I"; 961 item.option = "I";
969 item.packageName = package; 962 item.packageName = package;
970 vector<InstallData> workingPackages; 963 vector<InstallData> workingPackages;
971 workingPackages.push_back( item ); 964 workingPackages.push_back( item );
972 965
973 InstallDlgImpl dlg2( workingPackages, mgr, this, "Install", true ); 966 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Download" ) );
974 dlg2.showDlg(); 967 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
975 968 dlg->showMaximized();
976 reloadData();
977
978#ifdef QWS
979 // Finally let the main system update itself
980 QCopEnvelope e("QPE/System", "linkChanged(QString)");
981 QString lf = QString::null;
982 e << lf;
983#endif
984} 969}
985 970
986 971
987void MainWindow :: applyChanges() 972void MainWindow :: applyChanges()
988{ 973{
989 stickyOption = ""; 974 stickyOption = "";
990 975
991 // 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
992 mgr->writeOutIpkgConf(); 977 mgr->writeOutIpkgConf();
993 978
994 // Now for each selected item 979 // Now for each selected item
995 // deal with it 980 // deal with it
996 981
997 vector<InstallData> workingPackages; 982 vector<InstallData> workingPackages;
998 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild(); 983 for ( QCheckListItem *item = (QCheckListItem *)packagesList->firstChild();
999 item != 0 ; 984 item != 0 ;
@@ -1003,43 +988,35 @@ void MainWindow :: applyChanges()
1003 { 988 {
1004 InstallData data = dealWithItem( item ); 989 InstallData data = dealWithItem( item );
1005 workingPackages.push_back( data ); 990 workingPackages.push_back( data );
1006 } 991 }
1007 } 992 }
1008 993
1009 if ( workingPackages.size() == 0 ) 994 if ( workingPackages.size() == 0 )
1010 { 995 {
1011 // Nothing to do 996 // Nothing to do
1012 QMessageBox::information( this, tr( "Nothing to do" ), 997 QMessageBox::information( this, tr( "Nothing to do" ),
1013 tr( "No packages selected" ), tr( "OK" ) ); 998 tr( "No packages selected" ), tr( "OK" ) );
1014 999
1015 return; 1000 return;
1016 } 1001 }
1017 1002
1018 // do the stuff 1003 // do the stuff
1019 InstallDlgImpl dlg( workingPackages, mgr, this, "Install", true ); 1004 InstallDlgImpl *dlg = new InstallDlgImpl( workingPackages, mgr, tr( "Apply changes" ) );
1020 dlg.showDlg(); 1005 connect( dlg, SIGNAL( reloadData( InstallDlgImpl * ) ), this, SLOT( reloadData( InstallDlgImpl * ) ) );
1021 1006 dlg->showMaximized();
1022 reloadData();
1023
1024#ifdef QWS
1025 // Finally let the main system update itself
1026 QCopEnvelope e("QPE/System", "linkChanged(QString)");
1027 QString lf = QString::null;
1028 e << lf;
1029#endif
1030} 1007}
1031 1008
1032// decide what to do - either remove, upgrade or install 1009// decide what to do - either remove, upgrade or install
1033// Current rules: 1010// Current rules:
1034// If not installed - install 1011// If not installed - install
1035// If installed and different version available - upgrade 1012// If installed and different version available - upgrade
1036// If installed and version up to date - remove 1013// If installed and version up to date - remove
1037InstallData MainWindow :: dealWithItem( QCheckListItem *item ) 1014InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1038{ 1015{
1039 QString name = item->text(); 1016 QString name = item->text();
1040 1017
1041 // Get package 1018 // Get package
1042 vector<Server>::iterator s = mgr->getServer( serversList->currentText() ); 1019 vector<Server>::iterator s = mgr->getServer( serversList->currentText() );
1043 Package *p = s->getPackage( name ); 1020 Package *p = s->getPackage( name );
1044 1021
1045 // 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
@@ -1137,37 +1114,54 @@ InstallData MainWindow :: dealWithItem( QCheckListItem *item )
1137// item.option = stickyOption; 1114// item.option = stickyOption;
1138 } 1115 }
1139 } 1116 }
1140 1117
1141 1118
1142 // Check if we are reinstalling the same version 1119 // Check if we are reinstalling the same version
1143 if ( item.option != "R" ) 1120 if ( item.option != "R" )
1144 item.recreateLinks = true; 1121 item.recreateLinks = true;
1145 else 1122 else
1146 item.recreateLinks = false; 1123 item.recreateLinks = false;
1147 1124
1148 // User hit cancel (on dlg - assume remove) 1125 // User hit cancel (on dlg - assume remove)
1149 return item; 1126 return item;
1150 } 1127 }
1151} 1128}
1152 1129
1153void MainWindow :: reloadData() 1130void MainWindow :: reloadData( InstallDlgImpl *dlg )
1154{ 1131{
1155 stack->raiseWidget( progressWindow ); 1132 stack->raiseWidget( progressWindow );
1133
1134 if ( dlg )
1135 {
1136 dlg->close();
1137 delete dlg;
1138 }
1139
1156 mgr->reloadServerData(); 1140 mgr->reloadServerData();
1157 serverSelected( -1, FALSE ); 1141 serverSelected( -1, FALSE );
1142
1143#ifdef QWS
1144 m_status->setText( tr( "Updating Launcher..." ) );
1145
1146 // Finally let the main system update itself
1147 QCopEnvelope e("QPE/System", "linkChanged(QString)");
1148 QString lf = QString::null;
1149 e << lf;
1150#endif
1151
1158 stack->raiseWidget( networkPkgWindow ); 1152 stack->raiseWidget( networkPkgWindow );
1159} 1153}
1160 1154
1161void MainWindow :: letterPushed( QString t ) 1155void MainWindow :: letterPushed( QString t )
1162{ 1156{
1163 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); 1157 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
1164 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 1158 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();
1165 if ( packagesList->firstChild() == 0 ) 1159 if ( packagesList->firstChild() == 0 )
1166 return; 1160 return;
1167 1161
1168 QCheckListItem *item; 1162 QCheckListItem *item;
1169 if ( start == 0 ) 1163 if ( start == 0 )
1170 { 1164 {
1171 item = (QCheckListItem *)packagesList->firstChild(); 1165 item = (QCheckListItem *)packagesList->firstChild();
1172 start = top; 1166 start = top;
1173 } 1167 }
diff --git a/noncore/settings/aqpkg/mainwin.h b/noncore/settings/aqpkg/mainwin.h
index b49c819..d0777fb 100644
--- a/noncore/settings/aqpkg/mainwin.h
+++ b/noncore/settings/aqpkg/mainwin.h
@@ -10,32 +10,33 @@
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#ifndef MAINWIN_H 18#ifndef MAINWIN_H
19#define MAINWIN_H 19#define MAINWIN_H
20 20
21#include <qmainwindow.h> 21#include <qmainwindow.h>
22#include <qpixmap.h> 22#include <qpixmap.h>
23 23
24class DataManager; 24class DataManager;
25class InstallData; 25class InstallData;
26class InstallDlgImpl;
26 27
27class QAction; 28class QAction;
28class QCheckListItem; 29class QCheckListItem;
29class QComboBox; 30class QComboBox;
30class QLabel; 31class QLabel;
31class QLineEdit; 32class QLineEdit;
32class QListView; 33class QListView;
33class QPEToolBar; 34class QPEToolBar;
34class QProgressBar; 35class QProgressBar;
35class QWidgetStack; 36class QWidgetStack;
36 37
37class MainWindow :public QMainWindow 38class MainWindow :public QMainWindow
38{ 39{
39 Q_OBJECT 40 Q_OBJECT
40public: 41public:
41 42
@@ -79,59 +80,59 @@ private:
79 80
80 bool categoryFilterEnabled; 81 bool categoryFilterEnabled;
81 bool showJumpTo; 82 bool showJumpTo;
82 bool showUninstalledPkgs; 83 bool showUninstalledPkgs;
83 bool showInstalledPkgs; 84 bool showInstalledPkgs;
84 bool showUpgradedPkgs; 85 bool showUpgradedPkgs;
85 bool downloadEnabled; 86 bool downloadEnabled;
86 87
87 void initMainWidget(); 88 void initMainWidget();
88 void updateData(); 89 void updateData();
89 void serverSelected( int index, bool showProgress ); 90 void serverSelected( int index, bool showProgress );
90 void searchForPackage( const QString & ); 91 void searchForPackage( const QString & );
91 bool filterByCategory( bool val ); 92 bool filterByCategory( bool val );
92 void downloadSelectedPackages(); 93 void downloadSelectedPackages();
93 void downloadRemotePackage(); 94 void downloadRemotePackage();
94 InstallData dealWithItem( QCheckListItem *item ); 95 InstallData dealWithItem( QCheckListItem *item );
95 void reloadData();
96 96
97 // Progress widget 97 // Progress widget
98 QWidget *progressWindow; 98 QWidget *progressWindow;
99 QLabel *m_status; 99 QLabel *m_status;
100 QProgressBar *m_progress; 100 QProgressBar *m_progress;
101 101
102 void initProgressWidget(); 102 void initProgressWidget();
103 103
104public slots: 104public slots:
105// void setDocument( const QString &doc ); 105// void setDocument( const QString &doc );
106 void displayHelp(); 106 void displayHelp();
107 void displayFindBar(); 107 void displayFindBar();
108 void displayJumpBar(); 108 void displayJumpBar();
109 void repeatFind(); 109 void repeatFind();
110 void findPackage( const QString & ); 110 void findPackage( const QString & );
111 void hideFindBar(); 111 void hideFindBar();
112 void hideJumpBar(); 112 void hideJumpBar();
113 void displayAbout(); 113 void displayAbout();
114 void displaySettings(); 114 void displaySettings();
115 void filterUninstalledPackages(); 115 void filterUninstalledPackages();
116 void filterInstalledPackages(); 116 void filterInstalledPackages();
117 void filterUpgradedPackages(); 117 void filterUpgradedPackages();
118 void filterCategory(); 118 void filterCategory();
119 bool setFilterCategory(); 119 bool setFilterCategory();
120 void raiseMainWidget(); 120 void raiseMainWidget();
121 void raiseProgressWidget(); 121 void raiseProgressWidget();
122 void enableUpgrade( bool ); 122 void enableUpgrade( bool );
123 void enableDownload( bool ); 123 void enableDownload( bool );
124 void reloadData( InstallDlgImpl * );
124 125
125private slots: 126private slots:
126 void init(); 127 void init();
127 void setProgressSteps( int ); 128 void setProgressSteps( int );
128 void setProgressMessage( const QString & ); 129 void setProgressMessage( const QString & );
129 void updateProgress( int ); 130 void updateProgress( int );
130 void serverSelected( int index ); 131 void serverSelected( int index );
131 void updateServer(); 132 void updateServer();
132 void upgradePackages(); 133 void upgradePackages();
133 void downloadPackage(); 134 void downloadPackage();
134 void applyChanges(); 135 void applyChanges();
135 void letterPushed( QString t ); 136 void letterPushed( QString t );
136}; 137};
137#endif 138#endif