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 | |||
@@ -14,55 +14,66 @@ | |||
14 | #include <qpopupmenu.h> | 14 | #include <qpopupmenu.h> |
15 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
16 | #include <qstring.h> | 16 | #include <qstring.h> |
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 <qlayout.h> | 27 | #include <qlayout.h> |
27 | 28 | ||
28 | #include "pksettingsbase.h" | 29 | #include "pksettingsbase.h" |
29 | #include "utils.h" | 30 | #include "utils.h" |
30 | #include "packagelistitem.h" | 31 | #include "packagelistitem.h" |
31 | 32 | ||
32 | 33 | ||
33 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
34 | QMainWindow( parent, name, f ) | 35 | QMainWindow( parent, name, f ) |
35 | { | 36 | { |
36 | setCaption( tr("Package Manager") ); | 37 | setCaption( tr("Package Manager") ); |
37 | settings = new PackageManagerSettings(this,0,TRUE); | 38 | settings = new PackageManagerSettings(this,0,TRUE); |
38 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 39 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
39 | setCentralWidget( listViewPackages ); | 40 | setCentralWidget( listViewPackages ); |
40 | 41 | ||
41 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | 42 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); |
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(); |
49 | //opie is hardcoded default ;) | 52 | //opie is hardcoded default ;) |
50 | for (int i=0;i<section->count();i++) | 53 | for (int i=0;i<section->count();i++) |
51 | if (section->text(i)=="opie") | 54 | if (section->text(i)=="opie") |
52 | section->setCurrentItem(i); | 55 | section->setCurrentItem(i); |
53 | sectionChanged(); | 56 | sectionChanged(); |
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 | ||
60 | void MainWindow::makeMenu() | 71 | void MainWindow::makeMenu() |
61 | { | 72 | { |
62 | 73 | ||
63 | QPEToolBar *toolBar = new QPEToolBar( this ); | 74 | QPEToolBar *toolBar = new QPEToolBar( this ); |
64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 75 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 76 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
66 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 77 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
67 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 78 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
68 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 79 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
@@ -88,144 +99,163 @@ void MainWindow::makeMenu() | |||
88 | runAction->addTo( srvMenu ); | 99 | runAction->addTo( srvMenu ); |
89 | 100 | ||
90 | srvMenu->insertSeparator (); | 101 | srvMenu->insertSeparator (); |
91 | 102 | ||
92 | updateAction = new QAction( tr( "Update" ), | 103 | updateAction = new QAction( tr( "Update" ), |
93 | Resource::loadIconSet( "oipkg/update" ), | 104 | Resource::loadIconSet( "oipkg/update" ), |
94 | QString::null, 0, this, 0 ); | 105 | QString::null, 0, this, 0 ); |
95 | connect( updateAction, SIGNAL( activated() ), | 106 | connect( updateAction, SIGNAL( activated() ), |
96 | this , SLOT( updateList() ) ); | 107 | this , SLOT( updateList() ) ); |
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" ), |
111 | QString::null, 0, this, 0 ); | 114 | QString::null, 0, this, 0 ); |
112 | connect( cfgact, SIGNAL( activated() ), | 115 | connect( cfgact, SIGNAL( activated() ), |
113 | SLOT( showSettings() ) ); | 116 | SLOT( showSettings() ) ); |
114 | cfgact->addTo( cfgMenu ); | 117 | cfgact->addTo( cfgMenu ); |
115 | 118 | ||
116 | cfgact = new QAction( tr( "Servers" ), | 119 | cfgact = new QAction( tr( "Servers" ), |
117 | QString::null, 0, this, 0 ); | 120 | QString::null, 0, this, 0 ); |
118 | connect( cfgact, SIGNAL( activated() ), | 121 | connect( cfgact, SIGNAL( activated() ), |
119 | SLOT( showSettingsSrv() ) ); | 122 | SLOT( showSettingsSrv() ) ); |
120 | cfgact->addTo( cfgMenu ); | 123 | cfgact->addTo( cfgMenu ); |
121 | cfgact = new QAction( tr( "Destinations" ), | 124 | cfgact = new QAction( tr( "Destinations" ), |
122 | QString::null, 0, this, 0 ); | 125 | QString::null, 0, this, 0 ); |
123 | connect( cfgact, SIGNAL( activated() ), | 126 | connect( cfgact, SIGNAL( activated() ), |
124 | SLOT( showSettingsDst() ) ); | 127 | SLOT( showSettingsDst() ) ); |
125 | cfgact->addTo( cfgMenu ); | 128 | cfgact->addTo( cfgMenu ); |
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 ); |
132 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 136 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
133 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 137 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
134 | sectionBar->setStretchableWidget( label ); | 138 | sectionBar->setStretchableWidget( label ); |
135 | section = new QComboBox( false, sectionBar ); | 139 | section = new QComboBox( false, sectionBar ); |
136 | label = new QLabel( " / ", sectionBar ); | 140 | label = new QLabel( " / ", sectionBar ); |
137 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 141 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
138 | subsection = new QComboBox( false, sectionBar ); | 142 | subsection = new QComboBox( false, sectionBar ); |
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 ); |
156 | findEdit = new QLineEdit( findBar, "findEdit" ); | 159 | findEdit = new QLineEdit( findBar, "findEdit" ); |
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 ); |
175 | label->setBackgroundColor( destBar->backgroundColor() ); | 202 | label->setBackgroundColor( destBar->backgroundColor() ); |
176 | destBar->setHorizontalStretchable( TRUE ); | 203 | destBar->setHorizontalStretchable( TRUE ); |
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 ); |
192 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 219 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
193 | a->addTo( destBar ); | 220 | a->addTo( destBar ); |
194 | destBar->setStretchableWidget( CheckBoxLink ); | 221 | destBar->setStretchableWidget( CheckBoxLink ); |
195 | destAction->setToggleAction( true ); | 222 | destAction->setToggleAction( true ); |
196 | // destAction->addTo( viewMenu ); | 223 | // destAction->addTo( viewMenu ); |
197 | 224 | ||
198 | // configure the menus | 225 | // configure the menus |
199 | Config cfg( "oipkg", Config::User ); | 226 | Config cfg( "oipkg", Config::User ); |
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 | } |
206 | 234 | ||
207 | MainWindow::~MainWindow() | 235 | MainWindow::~MainWindow() |
208 | { | 236 | { |
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 | ||
215 | } | 244 | } |
216 | 245 | ||
217 | void MainWindow::runIpkg() | 246 | 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 |
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". |
223 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 253 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
224 | QString lf = QString::null; | 254 | QString lf = QString::null; |
225 | e << lf; | 255 | e << lf; |
226 | displayList(); | 256 | displayList(); |
227 | } | 257 | } |
228 | 258 | ||
229 | void MainWindow::updateList() | 259 | void MainWindow::updateList() |
230 | { | 260 | { |
231 | //wait->show(); | 261 | //wait->show(); |
@@ -245,30 +275,39 @@ void MainWindow::filterList() | |||
245 | QString f = ""; | 275 | QString f = ""; |
246 | if ( findAction->isOn() ) f = findEdit->text(); | 276 | if ( findAction->isOn() ) f = findEdit->text(); |
247 | packageList.filterPackages( f ); | 277 | packageList.filterPackages( f ); |
248 | //wait->hide(); | 278 | //wait->hide(); |
249 | } | 279 | } |
250 | 280 | ||
251 | void MainWindow::displayList() | 281 | void MainWindow::displayList() |
252 | { | 282 | { |
253 | //wait->hide(); | 283 | //wait->hide(); |
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 | ||
265 | void MainWindow::sectionChanged() | 304 | void MainWindow::sectionChanged() |
266 | { | 305 | { |
267 | disconnect( section, SIGNAL( activated(int) ), | 306 | disconnect( section, SIGNAL( activated(int) ), |
268 | this, SLOT( sectionChanged() ) ); | 307 | this, SLOT( sectionChanged() ) ); |
269 | disconnect( subsection, SIGNAL(activated(int) ), | 308 | disconnect( subsection, SIGNAL(activated(int) ), |
270 | this, SLOT( subSectionChanged() ) ); | 309 | this, SLOT( subSectionChanged() ) ); |
271 | subsection->clear(); | 310 | subsection->clear(); |
272 | packageList.setSection( section->currentText() ); | 311 | packageList.setSection( section->currentText() ); |
273 | setSubSections(); | 312 | setSubSections(); |
274 | connect( section, SIGNAL( activated(int) ), | 313 | connect( section, SIGNAL( activated(int) ), |
@@ -336,24 +375,37 @@ void MainWindow::sectionClose() | |||
336 | void MainWindow::findShow(bool b) | 375 | void MainWindow::findShow(bool b) |
337 | { | 376 | { |
338 | if (b) findBar->show(); | 377 | if (b) findBar->show(); |
339 | else findBar->hide(); | 378 | else findBar->hide(); |
340 | findAction->setOn( b ); | 379 | findAction->setOn( b ); |
341 | } | 380 | } |
342 | 381 | ||
343 | void MainWindow::findClose() | 382 | void MainWindow::findClose() |
344 | { | 383 | { |
345 | findAction->setOn( false ); | 384 | findAction->setOn( false ); |
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 | { |
350 | if (b) destBar->show(); | 402 | if (b) destBar->show(); |
351 | else destBar->hide(); | 403 | else destBar->hide(); |
352 | destAction->setOn( b ); | 404 | destAction->setOn( b ); |
353 | } | 405 | } |
354 | 406 | ||
355 | void MainWindow::destClose() | 407 | void MainWindow::destClose() |
356 | { | 408 | { |
357 | destAction->setOn( false ); | 409 | destAction->setOn( false ); |
358 | } | 410 | } |
359 | 411 | ||
@@ -411,12 +463,31 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg) | |||
411 | { | 463 | { |
412 | ipkg->removeFile( QString(arg) ); | 464 | ipkg->removeFile( QString(arg) ); |
413 | }else if( msg == "createLinks(QString)" ) | 465 | }else if( msg == "createLinks(QString)" ) |
414 | { | 466 | { |
415 | ipkg->createLinks( QString(arg) ); | 467 | ipkg->createLinks( QString(arg) ); |
416 | }else if( msg == "removeLinks(QString)" ) | 468 | }else if( msg == "removeLinks(QString)" ) |
417 | { | 469 | { |
418 | ipkg->removeLinks( QString(arg) ); | 470 | ipkg->removeLinks( QString(arg) ); |
419 | }else{ | 471 | }else{ |
420 | pvDebug(2,"Huh what do ya want") | 472 | pvDebug(2,"Huh what do ya want") |
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 | } | ||