author | tille <tille> | 2002-05-01 14:00:09 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-01 14:00:09 (UTC) |
commit | e729a9bdd9f37f4bd610d10122f002a0540c93ed (patch) (unidiff) | |
tree | a23696d8742a36b57256281dc7e2f7848407be61 /noncore/unsupported/oipkg/mainwindow.cpp | |
parent | 7e5615473c1d103db66f42ae60bf9ed57d52566c (diff) | |
download | opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.zip opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.gz opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.bz2 |
added ipkgfind remote query
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 109 |
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 | |||
@@ -24,4 +24,5 @@ | |||
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 | ||
@@ -43,5 +44,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
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(); |
@@ -55,4 +58,12 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
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 | } |
@@ -98,12 +109,4 @@ void MainWindow::makeMenu() | |||
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 | ||
@@ -127,4 +130,5 @@ void MainWindow::makeMenu() | |||
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 ); |
@@ -140,8 +144,6 @@ void MainWindow::makeMenu() | |||
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) ) ); |
@@ -149,6 +151,7 @@ void MainWindow::makeMenu() | |||
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() ); |
@@ -158,5 +161,4 @@ void MainWindow::makeMenu() | |||
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() ) ); |
@@ -165,9 +167,34 @@ void MainWindow::makeMenu() | |||
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 ); |
@@ -178,6 +205,6 @@ void MainWindow::makeMenu() | |||
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() ); |
@@ -185,6 +212,6 @@ void MainWindow::makeMenu() | |||
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) ) ); |
@@ -201,4 +228,5 @@ void MainWindow::makeMenu() | |||
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 ) ); |
@@ -210,4 +238,5 @@ MainWindow::~MainWindow() | |||
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() ); |
@@ -218,4 +247,5 @@ void 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 |
@@ -255,10 +285,19 @@ void MainWindow::displayList() | |||
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 | ||
@@ -346,4 +385,17 @@ void MainWindow::findClose() | |||
346 | } | 385 | } |
347 | 386 | ||
387 | void MainWindow::searchShow(bool b) | ||
388 | { | ||
389 | if (b) searchBar->show(); | ||
390 | else searchBar->hide(); | ||
391 | searchAction->setOn( b ); | ||
392 | } | ||
393 | |||
394 | void MainWindow::searchClose() | ||
395 | { | ||
396 | searchAction->setOn( false ); | ||
397 | } | ||
398 | |||
399 | |||
348 | void MainWindow::destShow(bool b) | 400 | void MainWindow::destShow(bool b) |
349 | { | 401 | { |
@@ -421,2 +473,21 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg) | |||
421 | } | 473 | } |
422 | } | 474 | } |
475 | |||
476 | |||
477 | void MainWindow::createLinks() | ||
478 | { | ||
479 | pvDebug(2,"creating links..."); | ||
480 | ipkg->createLinks( settings->destinationurl->text() ); | ||
481 | } | ||
482 | |||
483 | void MainWindow::removeLinks() | ||
484 | { | ||
485 | pvDebug(2,"removing links..."); | ||
486 | ipkg->removeLinks( settings->destinationurl->text() ); | ||
487 | } | ||
488 | |||
489 | void MainWindow::remotePackageQuery() | ||
490 | { | ||
491 | packageListSearch.query( searchEdit->text() ); | ||
492 | displayList(); | ||
493 | } | ||