summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp51
1 files changed, 20 insertions, 31 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 0422d65..b668660 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -17,58 +17,61 @@
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qfile.h> 18#include <qfile.h>
19#include <qlistview.h> 19#include <qlistview.h>
20#include <qtextview.h> 20#include <qtextview.h>
21#include <qcheckbox.h> 21#include <qcheckbox.h>
22#include <qlineedit.h> 22#include <qlineedit.h>
23#include <qtabwidget.h> 23#include <qtabwidget.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qlayout.h> 27#include <qlayout.h>
28 28
29#include "pksettingsbase.h" 29#include "pksettingsbase.h"
30#include "utils.h" 30#include "utils.h"
31#include "packagelistitem.h" 31#include "packagelistitem.h"
32 32
33 33
34MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 34MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
35 QMainWindow( parent, name, f ) 35 QMainWindow( parent, name, f )
36 { 36 {
37 setCaption( tr("Package Manager") ); 37 setCaption( tr("Package Manager") );
38 settings = new PackageManagerSettings(this,0,TRUE); 38 settings = new PackageManagerSettings(this,0,TRUE);
39 listViewPackages = new PackageListView( this,"listViewPackages",settings ); 39 listViewPackages = new PackageListView( this,"listViewPackages",settings );
40 setCentralWidget( listViewPackages ); 40 setCentralWidget( listViewPackages );
41 listViewPackages->addList( tr("local"), &packageList ); 41 listViewPackages->addList( tr("feeds"), &packageListServers );
42 listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); 42 listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
43 listViewPackages->addList( tr("documents"), &packageListDocLnk );
43 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); 44 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
44 //wait = new QMessageBox(this); 45 //wait = new QMessageBox(this);
45 // wait->setText(tr("Please wait")); 46 // wait->setText(tr("Please wait"));
46 ipkg = new PmIpkg( settings, this ); 47 ipkg = new PmIpkg( settings, this );
47// settings->setIpkg( ipkg ); 48// settings->setIpkg( ipkg );
48 packageList.setSettings( settings ); 49 packageListServers.setSettings( settings );
49 packageListSearch.setSettings( settings ); 50 packageListSearch.setSettings( settings );
50 packageList.update(); 51 packageListDocLnk.setSettings( settings );
52 packageListServers.update();
53 packageListDocLnk.update();
51 makeMenu(); 54 makeMenu();
52 makeChannel(); 55 makeChannel();
53 //opie is hardcoded default ;) 56 //opie is hardcoded default ;)
54 for (int i=0;i<section->count();i++) 57 for (int i=0;i<section->count();i++)
55 if (section->text(i)=="opie") 58 if (section->text(i)=="opie")
56 section->setCurrentItem(i); 59 section->setCurrentItem(i);
57 sectionChanged(); 60 sectionChanged();
58 61
59 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 62 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
60 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 63 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
61 64
62 connect( settings->removeLinksButton, SIGNAL( clicked()), 65 connect( settings->removeLinksButton, SIGNAL( clicked()),
63 SLOT(removeLinks()) ); 66 SLOT(removeLinks()) );
64 connect( settings->createLinksButton, SIGNAL( clicked()), 67 connect( settings->createLinksButton, SIGNAL( clicked()),
65 SLOT(createLinks()) ); 68 SLOT(createLinks()) );
66 69
67 displayList(); 70 displayList();
68} 71}
69 72
70void MainWindow::makeMenu() 73void MainWindow::makeMenu()
71{ 74{
72 75
73 QPEToolBar *toolBar = new QPEToolBar( this ); 76 QPEToolBar *toolBar = new QPEToolBar( this );
74 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 77 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
@@ -223,147 +226,133 @@ void MainWindow::makeMenu()
223 226
224 // configure the menus 227 // configure the menus
225 Config cfg( "oipkg", Config::User ); 228 Config cfg( "oipkg", Config::User );
226 cfg.setGroup( "gui" ); 229 cfg.setGroup( "gui" );
227 230
228 findShow( cfg.readBoolEntry( "findBar", true ) ); 231 findShow( cfg.readBoolEntry( "findBar", true ) );
229 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 232 searchShow( cfg.readBoolEntry( "searchBar", true ) );
230 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 233 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
231 destShow( cfg.readBoolEntry( "destBar", false ) ); 234 destShow( cfg.readBoolEntry( "destBar", false ) );
232} 235}
233 236
234MainWindow::~MainWindow() 237MainWindow::~MainWindow()
235{ 238{
236 Config cfg( "oipkg", Config::User ); 239 Config cfg( "oipkg", Config::User );
237 cfg.setGroup( "gui" ); 240 cfg.setGroup( "gui" );
238 cfg.writeEntry( "findBar", !findBar->isHidden() ); 241 cfg.writeEntry( "findBar", !findBar->isHidden() );
239 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 242 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
240 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 243 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
241 cfg.writeEntry( "destBar", !destBar->isHidden() ); 244 cfg.writeEntry( "destBar", !destBar->isHidden() );
242 245
243} 246}
244 247
245void MainWindow::runIpkg() 248void MainWindow::runIpkg()
246{ 249{
247 packageList.allPackages(); 250 packageListServers.allPackages();
248 ipkg->loadList( packageListSearch ); 251 ipkg->loadList( packageListSearch );
249 ipkg->commit( packageList ); 252 ipkg->loadList( packageListDocLnk );
253 ipkg->commit( packageListServers );
250 // ##### If we looked in the list of files, we could send out accurate 254 // ##### If we looked in the list of files, we could send out accurate
251 // ##### messages. But we don't bother yet, and just do an "all". 255 // ##### messages. But we don't bother yet, and just do an "all".
252 QCopEnvelope e("QPE/System", "linkChanged(QString)"); 256 QCopEnvelope e("QPE/System", "linkChanged(QString)");
253 QString lf = QString::null; 257 QString lf = QString::null;
254 e << lf; 258 e << lf;
255 displayList(); 259 displayList();
256} 260}
257 261
258void MainWindow::updateList() 262void MainWindow::updateList()
259{ 263{
260 //wait->show(); 264 //wait->show();
261 QTimer *t = new QTimer( this ); 265 QTimer *t = new QTimer( this );
262 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); 266 connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
263 t->start( 0, false ); 267 t->start( 0, false );
264 packageList.clear(); 268 packageListServers.clear();
269 packageListSearch.clear();
270 packageListDocLnk.clear();
265 ipkg->update(); 271 ipkg->update();
266 packageList.update(); 272 packageListServers.update();
273 packageListSearch.update();
274 packageListDocLnk.update();
267 t->stop(); 275 t->stop();
268 // wait->hide(); 276 // wait->hide();
269} 277}
270 278
271void MainWindow::filterList() 279void MainWindow::filterList()
272{ 280{
273 //wait->show(); 281 //wait->show();
274 QString f = ""; 282 QString f = "";
275 if ( findAction->isOn() ) f = findEdit->text(); 283 if ( findAction->isOn() ) f = findEdit->text();
276 packageList.filterPackages( f ); 284 packageListServers.filterPackages( f );
277 //wait->hide(); 285 //wait->hide();
278} 286}
279 287
280void MainWindow::displayList() 288void MainWindow::displayList()
281{ 289{
282 //wait->hide(); 290 //wait->hide();
283 filterList(); 291 filterList();
284 listViewPackages->display(); 292 listViewPackages->display();
285//// if (!rootLocal)
286//// {
287 //QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
288 //QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
289//// }
290// listViewPackages->clear();
291// Package *pack = packageList.first();
292// PackageListItem *item;
293// while( pack )
294// {
295 // item = new PackageListItem( rootLocal, pack, settings );
296// pack = packageList.next();
297 // }
298// pack = packageListSearch.first();
299// while( pack )
300// {
301 // item = new PackageListItem( rootSearch, pack, settings );
302// pack = packageListSearch.next();
303 // }
304} 293}
305 294
306void MainWindow::sectionChanged() 295void MainWindow::sectionChanged()
307{ 296{
308 disconnect( section, SIGNAL( activated(int) ), 297 disconnect( section, SIGNAL( activated(int) ),
309 this, SLOT( sectionChanged() ) ); 298 this, SLOT( sectionChanged() ) );
310 disconnect( subsection, SIGNAL(activated(int) ), 299 disconnect( subsection, SIGNAL(activated(int) ),
311 this, SLOT( subSectionChanged() ) ); 300 this, SLOT( subSectionChanged() ) );
312 subsection->clear(); 301 subsection->clear();
313 packageList.setSection( section->currentText() ); 302 packageListServers.setSection( section->currentText() );
314 setSubSections(); 303 setSubSections();
315 connect( section, SIGNAL( activated(int) ), 304 connect( section, SIGNAL( activated(int) ),
316 this, SLOT( sectionChanged() ) ); 305 this, SLOT( sectionChanged() ) );
317 connect( subsection, SIGNAL(activated(int) ), 306 connect( subsection, SIGNAL(activated(int) ),
318 this, SLOT( subSectionChanged() ) ); 307 this, SLOT( subSectionChanged() ) );
319 displayList(); 308 displayList();
320} 309}
321 310
322void MainWindow::subSectionChanged() 311void MainWindow::subSectionChanged()
323{ 312{
324 disconnect( section, SIGNAL( activated(int) ), 313 disconnect( section, SIGNAL( activated(int) ),
325 this, SLOT( sectionChanged() ) ); 314 this, SLOT( sectionChanged() ) );
326 disconnect( subsection, SIGNAL(activated(int) ), 315 disconnect( subsection, SIGNAL(activated(int) ),
327 this, SLOT( subSectionChanged() ) ); 316 this, SLOT( subSectionChanged() ) );
328 packageList.setSubSection( subsection->currentText() ); 317 packageListServers.setSubSection( subsection->currentText() );
329 connect( section, SIGNAL( activated(int) ), 318 connect( section, SIGNAL( activated(int) ),
330 this, SLOT( sectionChanged() ) ); 319 this, SLOT( sectionChanged() ) );
331 connect( subsection, SIGNAL(activated(int) ), 320 connect( subsection, SIGNAL(activated(int) ),
332 this, SLOT( subSectionChanged() ) ); 321 this, SLOT( subSectionChanged() ) );
333 displayList(); 322 displayList();
334} 323}
335 324
336void MainWindow::setSections() 325void MainWindow::setSections()
337{ 326{
338 section->clear(); 327 section->clear();
339 section->insertStringList( packageList.getSections() ); 328 section->insertStringList( packageListServers.getSections() );
340} 329}
341 330
342void MainWindow::setSubSections() 331void MainWindow::setSubSections()
343{ 332{
344 subsection->clear(); 333 subsection->clear();
345 subsection->insertStringList( packageList.getSubSections() ); 334 subsection->insertStringList( packageListServers.getSubSections() );
346} 335}
347 336
348 337
349void MainWindow::showSettings() 338void MainWindow::showSettings()
350{ 339{
351 if ( settings->showDialog( 0 ) ) 340 if ( settings->showDialog( 0 ) )
352 updateList(); 341 updateList();
353} 342}
354void MainWindow::showSettingsSrv() 343void MainWindow::showSettingsSrv()
355{ 344{
356 if ( settings->showDialog( 1 ) ) 345 if ( settings->showDialog( 1 ) )
357 updateList(); 346 updateList();
358} 347}
359void MainWindow::showSettingsDst() 348void MainWindow::showSettingsDst()
360{ 349{
361 if ( settings->showDialog( 2 ) ) 350 if ( settings->showDialog( 2 ) )
362 updateList(); 351 updateList();
363} 352}
364 353
365void MainWindow::sectionShow(bool b) 354void MainWindow::sectionShow(bool b)
366{ 355{
367 if (b) sectionBar->show(); 356 if (b) sectionBar->show();
368 else sectionBar->hide(); 357 else sectionBar->hide();
369 sectionAction->setOn( b ); 358 sectionAction->setOn( b );