summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp109
1 files changed, 90 insertions, 19 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index ca1e5e8..06828e0 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -23,6 +23,7 @@
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 <qlayout.h> 27#include <qlayout.h>
27 28
28#include "pksettingsbase.h" 29#include "pksettingsbase.h"
@@ -42,7 +43,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
42 //wait = new QMessageBox(this); 43 //wait = new QMessageBox(this);
43 // wait->setText(tr("Please wait")); 44 // wait->setText(tr("Please wait"));
44 ipkg = new PmIpkg( settings, this ); 45 ipkg = new PmIpkg( settings, this );
46// settings->setIpkg( ipkg );
45 packageList.setSettings( settings ); 47 packageList.setSettings( settings );
48 packageListSearch.setSettings( settings );
46 packageList.update(); 49 packageList.update();
47 makeMenu(); 50 makeMenu();
48 makeChannel(); 51 makeChannel();
@@ -54,6 +57,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
54 57
55 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 58 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
56 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 59 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
60
61 connect( settings->removeLinksButton, SIGNAL( clicked()),
62 SLOT(removeLinks()) );
63 connect( settings->createLinksButton, SIGNAL( clicked()),
64 SLOT(createLinks()) );
65
66 //rootLocal = new QCheckListItem(listViewPackages,tr("local"));
67 //rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
57 displayList(); 68 displayList();
58} 69}
59 70
@@ -97,14 +108,6 @@ void MainWindow::makeMenu()
97 updateAction->addTo( toolBar ); 108 updateAction->addTo( toolBar );
98 updateAction->addTo( srvMenu ); 109 updateAction->addTo( srvMenu );
99 110
100// could we use for find
101// detailsAction = new QAction( tr( "Find" ),
102 // Resource::loadIconSet( "find" ),
103 // QString::null, 0, this, 0 );
104// connect( detailsAction, SIGNAL( activated() ),
105// this , SLOT( showFind() ) );
106// detailsAction->addTo( toolBar );
107
108 QAction *cfgact; 111 QAction *cfgact;
109 112
110 cfgact = new QAction( tr( "Setups" ), 113 cfgact = new QAction( tr( "Setups" ),
@@ -126,6 +129,7 @@ void MainWindow::makeMenu()
126 129
127 QAction *a; 130 QAction *a;
128 131
132 // SECTIONS
129 sectionBar = new QPEToolBar( this ); 133 sectionBar = new QPEToolBar( this );
130 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); 134 addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
131 sectionBar->setHorizontalStretchable( true ); 135 sectionBar->setHorizontalStretchable( true );
@@ -139,17 +143,16 @@ void MainWindow::makeMenu()
139 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 143 a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
140 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); 144 connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
141 a->addTo( sectionBar ); 145 a->addTo( sectionBar );
142
143 setSections(); 146 setSections();
144 setSubSections(); 147 setSubSections();
145
146 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); 148 sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
147 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); 149 connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
148 sectionAction->setToggleAction( true ); 150 sectionAction->setToggleAction( true );
149 sectionAction->addTo( viewMenu ); 151 sectionAction->addTo( viewMenu );
150 152
153 //FIND
151 findBar = new QPEToolBar(this); 154 findBar = new QPEToolBar(this);
152 addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); 155 addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
153 label = new QLabel( tr("Filter: "), findBar ); 156 label = new QLabel( tr("Filter: "), findBar );
154 label->setBackgroundColor( findBar->backgroundColor() ); 157 label->setBackgroundColor( findBar->backgroundColor() );
155 findBar->setHorizontalStretchable( TRUE ); 158 findBar->setHorizontalStretchable( TRUE );
@@ -157,18 +160,42 @@ void MainWindow::makeMenu()
157 findBar->setStretchableWidget( findEdit ); 160 findBar->setStretchableWidget( findEdit );
158 connect( findEdit, SIGNAL( textChanged( const QString & ) ), 161 connect( findEdit, SIGNAL( textChanged( const QString & ) ),
159 this, SLOT( displayList() ) ); 162 this, SLOT( displayList() ) );
160
161 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); 163 a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
162 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); 164 connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) );
163 a->addTo( findBar ); 165 a->addTo( findBar );
164 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 166 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
165 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); 167 connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
166 a->addTo( findBar ); 168 a->addTo( findBar );
167 findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); 169 findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
168 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); 170 connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
169 findAction->setToggleAction( true ); 171 findAction->setToggleAction( true );
170 findAction->addTo( viewMenu ); 172 findAction->addTo( viewMenu );
171 173
174 //SEARCH
175 searchBar = new QPEToolBar(this);
176 addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
177 label = new QLabel( tr("ipkgfind: "), searchBar );
178 label->setBackgroundColor( searchBar->backgroundColor() );
179 searchBar->setHorizontalStretchable( TRUE );
180 searchEdit = new QLineEdit( searchBar, "seachEdit" );
181 searchBar->setStretchableWidget( searchEdit );
182// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
183// this, SLOT( displayList() ) );
184 a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
185 connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) );
186 a->addTo( searchBar );
187 searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 );
188 connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) );
189 searchCommit->addTo( searchBar );
190 a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
191 connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) );
192 a->addTo( searchBar );
193 searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 );
194 connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) );
195 searchAction->setToggleAction( true );
196 searchAction->addTo( viewMenu );
197
198 //DEST
172 destBar = new QPEToolBar(this); 199 destBar = new QPEToolBar(this);
173 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); 200 addToolBar( destBar, "Destination", QMainWindow::Top, TRUE );
174 label = new QLabel( tr("Destination: "), destBar ); 201 label = new QLabel( tr("Destination: "), destBar );
@@ -177,15 +204,15 @@ void MainWindow::makeMenu()
177 destination = new QComboBox( false, destBar ); 204 destination = new QComboBox( false, destBar );
178 destination->insertStringList( settings->getDestinationNames() ); 205 destination->insertStringList( settings->getDestinationNames() );
179 setComboName(destination,settings->getDestinationName()); 206 setComboName(destination,settings->getDestinationName());
180// connect( destination, SIGNAL(activated(int)), 207 connect( destination, SIGNAL(activated(int)),
181 // SLOT(activeDestinationChange(int)) ); 208 settings, SLOT(activeDestinationChange(int)) );
182 spacer = new QLabel( " ", destBar ); 209 spacer = new QLabel( " ", destBar );
183 spacer->setBackgroundColor( destBar->backgroundColor() ); 210 spacer->setBackgroundColor( destBar->backgroundColor() );
184 CheckBoxLink = new QCheckBox( tr("Link"), destBar); 211 CheckBoxLink = new QCheckBox( tr("Link"), destBar);
185 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); 212 CheckBoxLink->setBackgroundColor( destBar->backgroundColor() );
186 CheckBoxLink->setChecked( settings->createLinks() ); 213 CheckBoxLink->setChecked( settings->createLinks() );
187// connect( CheckBoxLink, SIGNAL(toggled(bool)), 214 connect( CheckBoxLink, SIGNAL(toggled(bool)),
188 // settings, SLOT(linkEnabled(bool)) ); 215 settings, SLOT(linkEnabled(bool)) );
189 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); 216 destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
190 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); 217 connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) );
191 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); 218 a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
@@ -200,6 +227,7 @@ void MainWindow::makeMenu()
200 cfg.setGroup( "gui" ); 227 cfg.setGroup( "gui" );
201 228
202 findShow( cfg.readBoolEntry( "findBar", true ) ); 229 findShow( cfg.readBoolEntry( "findBar", true ) );
230 searchShow( cfg.readBoolEntry( "searchBar", true ) );
203 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 231 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
204 destShow( cfg.readBoolEntry( "destBar", false ) ); 232 destShow( cfg.readBoolEntry( "destBar", false ) );
205} 233}
@@ -209,6 +237,7 @@ MainWindow::~MainWindow()
209 Config cfg( "oipkg", Config::User ); 237 Config cfg( "oipkg", Config::User );
210 cfg.setGroup( "gui" ); 238 cfg.setGroup( "gui" );
211 cfg.writeEntry( "findBar", !findBar->isHidden() ); 239 cfg.writeEntry( "findBar", !findBar->isHidden() );
240 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
212 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 241 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
213 cfg.writeEntry( "destBar", !destBar->isHidden() ); 242 cfg.writeEntry( "destBar", !destBar->isHidden() );
214 243
@@ -217,6 +246,7 @@ MainWindow::~MainWindow()
217void MainWindow::runIpkg() 246void MainWindow::runIpkg()
218{ 247{
219 packageList.allPackages(); 248 packageList.allPackages();
249 ipkg->loadList( packageListSearch );
220 ipkg->commit( packageList ); 250 ipkg->commit( packageList );
221 // ##### If we looked in the list of files, we could send out accurate 251 // ##### If we looked in the list of files, we could send out accurate
222 // ##### messages. But we don't bother yet, and just do an "all". 252 // ##### messages. But we don't bother yet, and just do an "all".
@@ -254,12 +284,21 @@ void MainWindow::displayList()
254 filterList(); 284 filterList();
255 listViewPackages->clear(); 285 listViewPackages->clear();
256 Package *pack = packageList.first(); 286 Package *pack = packageList.first();
287 PackageListItem *item;
288
289 QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
290 QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
257 while( pack ) 291 while( pack )
258 { 292 {
259 if ( pack && (pack->name() != "") ) 293 item = new PackageListItem( rootLocal, pack, settings );
260 listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) );
261 pack = packageList.next(); 294 pack = packageList.next();
262 } 295 }
296 pack = packageListSearch.first();
297 while( pack )
298 {
299 item = new PackageListItem( rootSearch, pack, settings );
300 pack = packageListSearch.next();
301 }
263} 302}
264 303
265void MainWindow::sectionChanged() 304void MainWindow::sectionChanged()
@@ -345,6 +384,19 @@ void MainWindow::findClose()
345 findAction->setOn( false ); 384 findAction->setOn( false );
346} 385}
347 386
387void MainWindow::searchShow(bool b)
388{
389 if (b) searchBar->show();
390 else searchBar->hide();
391 searchAction->setOn( b );
392}
393
394void MainWindow::searchClose()
395{
396 searchAction->setOn( false );
397}
398
399
348void MainWindow::destShow(bool b) 400void MainWindow::destShow(bool b)
349{ 401{
350 if (b) destBar->show(); 402 if (b) destBar->show();
@@ -420,3 +472,22 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg)
420 pvDebug(2,"Huh what do ya want") 472 pvDebug(2,"Huh what do ya want")
421 } 473 }
422} 474}
475
476
477void MainWindow::createLinks()
478{
479 pvDebug(2,"creating links...");
480 ipkg->createLinks( settings->destinationurl->text() );
481}
482
483void MainWindow::removeLinks()
484{
485 pvDebug(2,"removing links...");
486 ipkg->removeLinks( settings->destinationurl->text() );
487}
488
489void MainWindow::remotePackageQuery()
490{
491 packageListSearch.query( searchEdit->text() );
492 displayList();
493}