summaryrefslogtreecommitdiff
authortille <tille>2002-04-28 01:35:36 (UTC)
committer tille <tille>2002-04-28 01:35:36 (UTC)
commit61cc74e0e4602d0df07b250f2786f0f0e96da28f (patch) (unidiff)
tree7fab7d278163082856f0561ec9e451922f6066e3
parenta64cc0ad0574ae1e15c4965d2557c3e06cc3fd65 (diff)
downloadopie-61cc74e0e4602d0df07b250f2786f0f0e96da28f.zip
opie-61cc74e0e4602d0df07b250f2786f0f0e96da28f.tar.gz
opie-61cc74e0e4602d0df07b250f2786f0f0e96da28f.tar.bz2
gui fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp16
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h2
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp4
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp24
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h1
5 files changed, 33 insertions, 14 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 6bf9a7a..c95f482 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -11,39 +11,45 @@
11#include <qaction.h> 11#include <qaction.h>
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qpopupmenu.h> 13#include <qpopupmenu.h>
14#include <qtoolbutton.h> 14#include <qtoolbutton.h>
15#include <qstring.h> 15#include <qstring.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qfile.h> 17#include <qfile.h>
18#include <qlistview.h> 18#include <qlistview.h>
19#include <qtextview.h> 19#include <qtextview.h>
20#include <qlineedit.h> 20#include <qlineedit.h>
21#include <qtabwidget.h> 21#include <qtabwidget.h>
22#include <qcombobox.h> 22#include <qcombobox.h>
23#include <qmessagebox.h>
23#include <qlayout.h> 24#include <qlayout.h>
24 25
25#include "pksettingsbase.h" 26#include "pksettingsbase.h"
26#include "packagelistitem.h" 27#include "packagelistitem.h"
27 28
29
28MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 30MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
29 QMainWindow( parent, name, f ) 31 QMainWindow( parent, name, f )
30 { 32 {
31 settings = new PackageManagerSettings(this,0,TRUE); 33 settings = new PackageManagerSettings(this,0,TRUE);
32 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 34 listViewPackages = new PackageListView( this,"listViewPackages",settings );
33 ipkg = new PmIpkg( settings, this ); 35 ipkg = new PmIpkg( settings, this );
34 36
35 setCentralWidget( listViewPackages ); 37 setCentralWidget( listViewPackages );
36 setCaption( tr("Package Manager") ); 38 setCaption( tr("Package Manager") );
37 39
40 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
41 wait = new QMessageBox(this);
42 wait->setText(tr("Please wait"));
43
38 channel = new QCopChannel( "QPE/Application/oipkg", this ); 44 channel = new QCopChannel( "QPE/Application/oipkg", this );
39 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 45 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
40 this, SLOT(receive(const QCString&, const QByteArray&)) ); 46 this, SLOT(receive(const QCString&, const QByteArray&)) );
41 47
42 makeMenu(); 48 makeMenu();
43 49
44 connect( section, SIGNAL( activated(int) ), 50 connect( section, SIGNAL( activated(int) ),
45 this, SLOT( sectionChanged() ) ); 51 this, SLOT( sectionChanged() ) );
46 connect( subsection, SIGNAL(activated(int) ), 52 connect( subsection, SIGNAL(activated(int) ),
47 this, SLOT( subSectionChanged() ) ); 53 this, SLOT( subSectionChanged() ) );
48 54
49 ipkg = new PmIpkg( settings, this ); 55 ipkg = new PmIpkg( settings, this );
@@ -185,48 +191,56 @@ void MainWindow::runIpkg()
185{ 191{
186 ipkg->commit( packageList ); 192 ipkg->commit( packageList );
187 // ##### If we looked in the list of files, we could send out accurate 193 // ##### If we looked in the list of files, we could send out accurate
188 // ##### messages. But we don't bother yet, and just do an "all". 194 // ##### messages. But we don't bother yet, and just do an "all".
189 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 195 QCopEnvelope e("QPE/System", "linkChanged(QString)");
190 QString lf = QString::null; 196 QString lf = QString::null;
191 e << lf; 197 e << lf;
192 displayList(); 198 displayList();
193} 199}
194 200
195void MainWindow::updateList() 201void MainWindow::updateList()
196{ 202{
203 wait->show();
197 QTimer *t = new QTimer( this ); 204 QTimer *t = new QTimer( this );
198 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); 205 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
199 t->start( 0, false ); 206 t->start( 0, false );
200 packageList.clear(); 207 packageList.clear();
201 ipkg->update(); 208 ipkg->update();
202 getList(); 209 getList();
203 t->stop(); 210 t->stop();
211 wait->hide();
212
204} 213}
205 214
206void MainWindow::getList() 215void MainWindow::getList()
207{ 216{
217 wait->show();
208 packageList.update(); 218 packageList.update();
209 displayList(); 219 displayList();
220 wait->hide();
210} 221}
211 222
212void MainWindow::filterList() 223void MainWindow::filterList()
213{ 224{
225 wait->show();
214 QString f = ""; 226 QString f = "";
215 if ( findAction->isOn() ) f = findEdit->text(); 227 if ( findAction->isOn() ) f = findEdit->text();
216 packageList.filterPackages( f ); 228 packageList.filterPackages( f );
229 wait->hide();
217} 230}
218 231
219void MainWindow::displayList() 232void MainWindow::displayList()
220{ 233{
234 wait->hide();
221 filterList(); 235 filterList();
222 listViewPackages->clear(); 236 listViewPackages->clear();
223 Package *pack = packageList.first(); 237 Package *pack = packageList.first();
224 while( pack ) 238 while( pack )
225 { 239 {
226 if ( pack && (pack->name() != "") ) 240 if ( pack && (pack->name() != "") )
227 listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); 241 listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) );
228 pack = packageList.next(); 242 pack = packageList.next();
229 } 243 }
230} 244}
231 245
232void MainWindow::sectionChanged() 246void MainWindow::sectionChanged()
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index bcb0cc9..a713d00 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -7,24 +7,25 @@
7#include <qpopupmenu.h> 7#include <qpopupmenu.h>
8 8
9#include "packagelist.h" 9#include "packagelist.h"
10#include "pmipkg.h" 10#include "pmipkg.h"
11#include "pksettings.h" 11#include "pksettings.h"
12#include "packagelistview.h" 12#include "packagelistview.h"
13 13
14class QComboBox; 14class QComboBox;
15class QPEToolBar; 15class QPEToolBar;
16class QLineEdit; 16class QLineEdit;
17class PackageListItem; 17class PackageListItem;
18class QCopChannel; 18class QCopChannel;
19class QMessageBox;
19 20
20class MainWindow : public QMainWindow 21class MainWindow : public QMainWindow
21{ 22{
22 Q_OBJECT 23 Q_OBJECT
23 24
24 25
25public: 26public:
26 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 27 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
27 ~MainWindow(); 28 ~MainWindow();
28 29
29 QCopChannel *channel; 30 QCopChannel *channel;
30 31
@@ -60,17 +61,18 @@ private:
60 PackageList packageList; 61 PackageList packageList;
61 QAction *runAction; 62 QAction *runAction;
62 QAction *detailsAction; 63 QAction *detailsAction;
63 QAction *updateAction; 64 QAction *updateAction;
64 QAction *findAction; 65 QAction *findAction;
65 QAction *sectionAction; 66 QAction *sectionAction;
66 PackageListView *listViewPackages; 67 PackageListView *listViewPackages;
67 QPEToolBar *findBar; 68 QPEToolBar *findBar;
68 QLineEdit *findEdit; 69 QLineEdit *findEdit;
69 QPEToolBar *sectionBar; 70 QPEToolBar *sectionBar;
70 QComboBox *section; 71 QComboBox *section;
71 QComboBox *subsection; 72 QComboBox *subsection;
73 QMessageBox *wait;
72private slots: 74private slots:
73 void rotateUpdateIcon(); 75 void rotateUpdateIcon();
74}; 76};
75 77
76#endif 78#endif
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp
index f84a9c4..be01837 100644
--- a/noncore/unsupported/oipkg/pksettings.cpp
+++ b/noncore/unsupported/oipkg/pksettings.cpp
@@ -285,27 +285,27 @@ void PackageManagerSettings::readInstallationSetting(int setting)
285 if ( setting < 0 ) return; 285 if ( setting < 0 ) return;
286 Config cfg( "oipkg", Config::User ); 286 Config cfg( "oipkg", Config::User );
287 cfg.setGroup( "Setting_" + QString::number( setting ) ); 287 cfg.setGroup( "Setting_" + QString::number( setting ) );
288 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); 288 CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) );
289 QString dest = cfg.readEntry( "dest" ); 289 QString dest = cfg.readEntry( "dest" );
290 QString linkdest = cfg.readEntry( "linkdest" ); 290 QString linkdest = cfg.readEntry( "linkdest" );
291 pvDebug(3, "dest="+dest); 291 pvDebug(3, "dest="+dest);
292 pvDebug(3, "linkdest="+linkdest); 292 pvDebug(3, "linkdest="+linkdest);
293 293
294 for ( int i = 0; i < activeDestination->count(); i++) 294 for ( int i = 0; i < activeDestination->count(); i++)
295 { 295 {
296 if ( activeDestination->text( i ) == dest ) 296 if ( activeDestination->text( i ) == dest )
297 activeDestination->setCurrentItem( i ); 297 activeDestination->setCurrentItem( i );
298 if ( activeLinkDestination->text( i ) == linkdest ) 298 if ( activeLinkDestination->text( i ) == linkdest )
299 activeLinkDestination->setCurrentItem( i ); 299 activeLinkDestination->setCurrentItem( i );
300 } 300 }
301} 301}
302 302
303void PackageManagerSettings::writeCurrentInstallationSetting() 303void PackageManagerSettings::writeCurrentInstallationSetting()
304{ 304{
305 Config cfg( "oipkg", Config::User ); 305 Config cfg( "oipkg", Config::User );
306 changed = false; 306 changed = false;
307 cfg.setGroup( "Setting_" + QString::number(currentSetting) ); 307 cfg.setGroup( "Setting_" + QString::number(currentSetting) );
308 cfg.writeEntry( "link", CheckBoxLink->isChecked() ); 308 cfg.writeEntry( "link", CheckBoxLink->isChecked() );
309 cfg.writeEntry( "dest", getDestinationName() ); 309 cfg.writeEntry( "dest", getDestinationName() );
310 cfg.writeEntry( "linkdest" , getLinkDestinationName() ); 310 cfg.writeEntry( "linkdest" , getLinkDestinationName() );
311 QStringList sers = getActiveServers(); 311 QStringList sers = getActiveServers();
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index f0992f5..ecc97b2 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -193,122 +193,124 @@ void PmIpkg::commit( PackageList pl )
193 sizecount += 1; 193 sizecount += 1;
194 rem += pack->name()+"<br>"; 194 rem += pack->name()+"<br>";
195 } 195 }
196 } 196 }
197 } 197 }
198 198
199 startDialog(); 199 startDialog();
200 200
201} 201}
202 202
203void PmIpkg::startDialog() 203void PmIpkg::startDialog()
204{ 204{
205 QDialog *d = new QDialog(); 205 installDialog = new QDialog(0,0,true);
206 QGridLayout *RunWindowLayout = new QGridLayout( d ); 206 QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
207 RunWindowLayout->setSpacing( 2 ); 207 RunWindowLayout->setSpacing( 2 );
208 RunWindowLayout->setMargin( 2 ); 208 RunWindowLayout->setMargin( 2 );
209 209
210 QHBoxLayout *buttons = new QHBoxLayout; 210 QHBoxLayout *buttons = new QHBoxLayout;
211 buttons->setSpacing( 6 ); 211 buttons->setSpacing( 6 );
212 buttons->setMargin( 0 ); 212 buttons->setMargin( 0 );
213 213
214 PackageListView *plv = new PackageListView(d, "install",settings); 214 PackageListView *plv = new PackageListView(installDialog, "install",settings);
215 RunWindowLayout->addWidget( plv, 1, 0 ); 215 RunWindowLayout->addWidget( plv, 1, 0 );
216 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 216 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
217 { 217 {
218 plv->insertItem( new PackageListItem(plv, it,settings) ); 218 plv->insertItem( new PackageListItem(plv, it,settings) );
219 } 219 }
220 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 220 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
221 { 221 {
222 plv->insertItem( new PackageListItem(plv, it,settings) ); 222 plv->insertItem( new PackageListItem(plv, it,settings) );
223 } 223 }
224 QPushButton *doItButton = new QPushButton( d, "doItButton" ); 224 QPushButton *doItButton = new QPushButton( installDialog, "doItButton" );
225 doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); 225 doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) );
226 QFont doItButton_font( doItButton->font() ); 226 QFont doItButton_font( doItButton->font() );
227 doItButton_font.setPointSize( 8 ); 227 doItButton_font.setPointSize( 8 );
228 doItButton->setFont( doItButton_font ); 228 doItButton->setFont( doItButton_font );
229 doItButton->setText( tr( "Do all " ) ); 229 doItButton->setText( tr( "Do all " ) );
230 doItButton->setAutoResize( FALSE ); 230 doItButton->setAutoResize( FALSE );
231 buttons->addWidget( doItButton ); 231 buttons->addWidget( doItButton );
232 232
233 QPushButton *installButton = new QPushButton( d, "installButton" ); 233 QPushButton *installButton = new QPushButton( installDialog, "installButton" );
234 QFont installButton_font( installButton->font() ); 234 QFont installButton_font( installButton->font() );
235 installButton_font.setPointSize( 8 ); 235 installButton_font.setPointSize( 8 );
236 installButton->setFont( installButton_font ); 236 installButton->setFont( installButton_font );
237 installButton->setText( tr( "Install" ) ); 237 installButton->setText( tr( "Install" ) );
238 installButton->setAutoResize( TRUE ); 238 installButton->setAutoResize( TRUE );
239 buttons->addWidget( installButton ); 239 buttons->addWidget( installButton );
240 240
241 QPushButton *removeButton = new QPushButton( d, "removeButton" ); 241 QPushButton *removeButton = new QPushButton( installDialog, "removeButton" );
242 QFont removeButton_font( removeButton->font() ); 242 QFont removeButton_font( removeButton->font() );
243 removeButton_font.setPointSize( 7 ); 243 removeButton_font.setPointSize( 7 );
244 removeButton->setFont( removeButton_font ); 244 removeButton->setFont( removeButton_font );
245 removeButton->setText( tr( "Remove" ) ); 245 removeButton->setText( tr( "Remove" ) );
246 removeButton->setAutoResize( TRUE ); 246 removeButton->setAutoResize( TRUE );
247 buttons->addWidget( removeButton ); 247 buttons->addWidget( removeButton );
248 248
249 QPushButton *cancelButton = new QPushButton( d, "cancelButton" ); 249 QPushButton *cancelButton = new QPushButton( installDialog, "cancelButton" );
250 QFont cancelButton_font( cancelButton->font() ); 250 QFont cancelButton_font( cancelButton->font() );
251 cancelButton_font.setPointSize( 8 ); 251 cancelButton_font.setPointSize( 8 );
252 cancelButton->setFont( cancelButton_font ); 252 cancelButton->setFont( cancelButton_font );
253 cancelButton->setText( tr( "Cancel" ) ); 253 cancelButton->setText( tr( "Cancel" ) );
254 cancelButton->setAutoResize( TRUE ); 254 cancelButton->setAutoResize( TRUE );
255 buttons->addWidget( cancelButton ); 255 buttons->addWidget( cancelButton );
256 256
257 RunWindowLayout->addLayout( buttons, 3, 0 ); 257 RunWindowLayout->addLayout( buttons, 3, 0 );
258 258
259 connect( doItButton, SIGNAL( clicked() ), 259 connect( doItButton, SIGNAL( clicked() ),
260 this, SLOT( doIt() ) ); 260 this, SLOT( doIt() ) );
261 connect( installButton, SIGNAL( clicked() ), 261 connect( installButton, SIGNAL( clicked() ),
262 this, SLOT( install() ) ); 262 this, SLOT( install() ) );
263 connect( removeButton, SIGNAL( clicked() ), 263 connect( removeButton, SIGNAL( clicked() ),
264 this, SLOT( remove() ) ); 264 this, SLOT( remove() ) );
265 connect( cancelButton, SIGNAL( clicked() ), 265 connect( cancelButton, SIGNAL( clicked() ),
266 d, SLOT( close() ) ); 266 installDialog, SLOT( close() ) );
267 d->showMaximized(); 267 installDialog->showMaximized();
268 d->exec(); 268 if ( installDialog->exec() ) doIt();
269 // d->close(); 269 installDialog->close();
270} 270}
271 271
272void PmIpkg::doIt() 272void PmIpkg::doIt()
273{ 273{
274 remove(); 274 remove();
275 install(); 275 install();
276} 276}
277 277
278 278
279void PmIpkg::remove() 279void PmIpkg::remove()
280{ 280{
281 if ( to_remove.count() == 0 ) return; 281 if ( to_remove.count() == 0 ) return;
282 installDialog->close();
282 show( true ); 283 show( true );
283 284
284 out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); 285 out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>");
285 286
286 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) 287 for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
287 { 288 {
288 if ( runIpkg("remove " + it->name()) == 0) 289 if ( runIpkg("remove " + it->name()) == 0)
289 { 290 {
290 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 291 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
291 it->processed(); 292 it->processed();
292 runwindow->progress->setProgress( 1 ); 293 runwindow->progress->setProgress( 1 );
293 }else{ 294 }else{
294 out("<b>"+tr("Error while removing")+"</b>"+it->name()); 295 out("<b>"+tr("Error while removing")+"</b>"+it->name());
295 } 296 }
296 } 297 }
297} 298}
298 299
299 300
300void PmIpkg::install() 301void PmIpkg::install()
301{ 302{
302 if ( to_install.count() == 0 ) return; 303 if ( to_install.count() == 0 ) return;
304 installDialog->close();
303 show( true ); 305 show( true );
304 out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 306 out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
305 for (Package *it=to_install.first(); it != 0; it=to_install.next() ) 307 for (Package *it=to_install.first(); it != 0; it=to_install.next() )
306 { 308 {
307 309
308 if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) 310 if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 )
309 { 311 {
310 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); 312 runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress());
311 if ( it->link() ) 313 if ( it->link() )
312 makeLinks( it ); 314 makeLinks( it );
313 it->processed(); 315 it->processed();
314 }else{ 316 }else{
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index f70283e..c5e6255 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -19,24 +19,25 @@ public:
19 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); 19 PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 );
20 ~PmIpkg(); 20 ~PmIpkg();
21 21
22 void commit( PackageList ); 22 void commit( PackageList );
23 void update(); 23 void update();
24 PackageList* getPackageList(); 24 PackageList* getPackageList();
25 void showButtons(bool b=true); 25 void showButtons(bool b=true);
26 void show( bool buttons=true ); 26 void show( bool buttons=true );
27 27
28private: 28private:
29 PackageManagerSettings* settings; 29 PackageManagerSettings* settings;
30 RunWindow *runwindow; 30 RunWindow *runwindow;
31 QDialog *installDialog;
31 QList<Package> to_remove; 32 QList<Package> to_remove;
32 QList<Package> to_install; 33 QList<Package> to_install;
33 bool runwindowopen; 34 bool runwindowopen;
34 QString fileNameToInstall; 35 QString fileNameToInstall;
35 36
36 void startDialog(); 37 void startDialog();
37 void makeLinks(Package*); 38 void makeLinks(Package*);
38 void linkPackage( QString, QString ); 39 void linkPackage( QString, QString );
39 void processLinkDir( QString, QString ); 40 void processLinkDir( QString, QString );
40 int runIpkg(const QString& args, const QString& dest="" ); 41 int runIpkg(const QString& args, const QString& dest="" );
41 void out( QString ); 42 void out( QString );
42 43