Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index b485a03..cb2b4cd 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -42,39 +42,46 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
42 | 42 | ||
43 | connect( table->section, SIGNAL( activated(int) ), | 43 | connect( table->section, SIGNAL( activated(int) ), |
44 | this, SLOT( sectionChanged() ) ); | 44 | this, SLOT( sectionChanged() ) ); |
45 | connect( table->subsection, SIGNAL(activated(int) ), | 45 | connect( table->subsection, SIGNAL(activated(int) ), |
46 | this, SLOT( subSectionChanged() ) ); | 46 | this, SLOT( subSectionChanged() ) ); |
47 | connect( table->ListViewPackages, SIGNAL( clicked( QListViewItem* ) ), | 47 | connect( table->ListViewPackages, SIGNAL( clicked( QListViewItem* ) ), |
48 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 48 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
49 | 49 | ||
50 | settings = new PackageManagerSettings(this,0,TRUE); | 50 | settings = new PackageManagerSettings(this,0,TRUE); |
51 | 51 | ||
52 | ipkg = new PmIpkg( settings, this ); | 52 | ipkg = new PmIpkg( settings, this ); |
53 | packageList.setSettings( settings ); | 53 | packageList.setSettings( settings ); |
54 | newList(); | 54 | getList(); |
55 | setSections(); | 55 | setSections(); |
56 | setSubSections(); | 56 | setSubSections(); |
57 | displayList(); | 57 | displayList(); |
58 | } | 58 | } |
59 | 59 | ||
60 | void MainWindow::makeMenu() | 60 | void MainWindow::makeMenu() |
61 | { | 61 | { |
62 | 62 | ||
63 | QPEToolBar *toolBar = new QPEToolBar( this ); | 63 | QPEToolBar *toolBar = new QPEToolBar( this ); |
64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
66 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 66 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
67 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 67 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
68 | 68 | ||
69 | //#define TOOLBAR | ||
70 | #ifdef TOOLBAR | ||
71 | QPEToolBar *secBar = new QPEToolBar( this ); | ||
72 | QComboBox *sections = new QComboBox( false, this ); | ||
73 | secBar->addTo( sections ); | ||
74 | #endif | ||
75 | |||
69 | contextMenu = new QPopupMenu( this ); | 76 | contextMenu = new QPopupMenu( this ); |
70 | 77 | ||
71 | setToolBarsMovable( false ); | 78 | setToolBarsMovable( false ); |
72 | toolBar->setHorizontalStretchable( true ); | 79 | toolBar->setHorizontalStretchable( true ); |
73 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 80 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
74 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 81 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
75 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 82 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
76 | 83 | ||
77 | toolBar->setStretchableWidget (srvMenu); | 84 | toolBar->setStretchableWidget (srvMenu); |
78 | 85 | ||
79 | 86 | ||
80 | runAction = new QAction( tr( "Run" ), | 87 | runAction = new QAction( tr( "Run" ), |
@@ -125,37 +132,38 @@ void MainWindow::makeMenu() | |||
125 | SLOT( showSettingsDst() ) ); | 132 | SLOT( showSettingsDst() ) ); |
126 | cfgact->addTo( cfgMenu ); | 133 | cfgact->addTo( cfgMenu ); |
127 | 134 | ||
128 | } | 135 | } |
129 | 136 | ||
130 | MainWindow::~MainWindow() | 137 | MainWindow::~MainWindow() |
131 | { | 138 | { |
132 | } | 139 | } |
133 | 140 | ||
134 | void MainWindow::runIpkg() | 141 | void MainWindow::runIpkg() |
135 | { | 142 | { |
136 | ipkg->commit( packageList ); | 143 | ipkg->commit( packageList ); |
137 | ipkg->runIpkg("update"); | 144 | updateList(); |
138 | packageList.update(); | ||
139 | } | 145 | } |
140 | 146 | ||
141 | void MainWindow::updateList() | 147 | void MainWindow::updateList() |
142 | { | 148 | { |
143 | ipkg->runIpkg("update"); | 149 | // todo: packageList.clear(); |
144 | packageList.update(); | 150 | ipkg->update(); |
151 | getList(); | ||
145 | } | 152 | } |
146 | 153 | ||
147 | void MainWindow::newList() | 154 | void MainWindow::getList() |
148 | { | 155 | { |
149 | packageList.update(); | 156 | packageList.update(); |
157 | displayList(); | ||
150 | } | 158 | } |
151 | 159 | ||
152 | void MainWindow::filterList() | 160 | void MainWindow::filterList() |
153 | { | 161 | { |
154 | packageList.filterPackages(); | 162 | packageList.filterPackages(); |
155 | } | 163 | } |
156 | 164 | ||
157 | void MainWindow::displayList() | 165 | void MainWindow::displayList() |
158 | { | 166 | { |
159 | table->ListViewPackages->clear(); | 167 | table->ListViewPackages->clear(); |
160 | Package *pack = packageList.first(); | 168 | Package *pack = packageList.first(); |
161 | while( pack ) | 169 | while( pack ) |
@@ -208,35 +216,35 @@ void MainWindow::setSections() | |||
208 | } | 216 | } |
209 | 217 | ||
210 | void MainWindow::setSubSections() | 218 | void MainWindow::setSubSections() |
211 | { | 219 | { |
212 | table->subsection->clear(); | 220 | table->subsection->clear(); |
213 | table->subsection->insertStringList( packageList.getSubSections() ); | 221 | table->subsection->insertStringList( packageList.getSubSections() ); |
214 | } | 222 | } |
215 | 223 | ||
216 | 224 | ||
217 | void MainWindow::showSettings() | 225 | void MainWindow::showSettings() |
218 | { | 226 | { |
219 | if ( settings->showDialog( 0 ) ) | 227 | if ( settings->showDialog( 0 ) ) |
220 | newList(); | 228 | getList(); |
221 | } | 229 | } |
222 | void MainWindow::showSettingsSrv() | 230 | void MainWindow::showSettingsSrv() |
223 | { | 231 | { |
224 | if ( settings->showDialog( 1 ) ) | 232 | if ( settings->showDialog( 1 ) ) |
225 | newList(); | 233 | getList(); |
226 | } | 234 | } |
227 | void MainWindow::showSettingsDst() | 235 | void MainWindow::showSettingsDst() |
228 | { | 236 | { |
229 | if ( settings->showDialog( 2 ) ) | 237 | if ( settings->showDialog( 2 ) ) |
230 | newList(); | 238 | getList(); |
231 | } | 239 | } |
232 | 240 | ||
233 | 241 | ||
234 | void MainWindow::showDetails() | 242 | void MainWindow::showDetails() |
235 | { | 243 | { |
236 | if ( activePackage ) return; | 244 | if ( activePackage ) return; |
237 | if ( details ) | 245 | if ( details ) |
238 | { | 246 | { |
239 | details = new PackageDetails( this ); | 247 | details = new PackageDetails( this ); |
240 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 248 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
241 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 249 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
242 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); | 250 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); |