author | tille <tille> | 2002-05-01 22:56:23 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-01 22:56:23 (UTC) |
commit | a3397118d3c384655bedb40210db96ca34adc0c9 (patch) (unidiff) | |
tree | 3b8d46e0e9d1203801783a7dbf92400a4ed8652a | |
parent | 89b16f3378b783be9058852528e066dcadea953d (diff) | |
download | opie-a3397118d3c384655bedb40210db96ca34adc0c9.zip opie-a3397118d3c384655bedb40210db96ca34adc0c9.tar.gz opie-a3397118d3c384655bedb40210db96ca34adc0c9.tar.bz2 |
fixed close of local & ipkgfind
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 41 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 36 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.h | 7 |
3 files changed, 64 insertions, 20 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 4865c39..0422d65 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,430 +1,431 @@ | |||
1 | // adadpted form qpe/qipkg | 1 | // adadpted form qpe/qipkg |
2 | 2 | ||
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | 5 | ||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | #include <qaction.h> | 12 | #include <qaction.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
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 <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 | ||
34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 34 | MainWindow::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 | 41 | listViewPackages->addList( tr("local"), &packageList ); | |
42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | ||
42 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | 43 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); |
43 | //wait = new QMessageBox(this); | 44 | //wait = new QMessageBox(this); |
44 | // wait->setText(tr("Please wait")); | 45 | // wait->setText(tr("Please wait")); |
45 | ipkg = new PmIpkg( settings, this ); | 46 | ipkg = new PmIpkg( settings, this ); |
46 | // settings->setIpkg( ipkg ); | 47 | // settings->setIpkg( ipkg ); |
47 | packageList.setSettings( settings ); | 48 | packageList.setSettings( settings ); |
48 | packageListSearch.setSettings( settings ); | 49 | packageListSearch.setSettings( settings ); |
49 | packageList.update(); | 50 | packageList.update(); |
50 | makeMenu(); | 51 | makeMenu(); |
51 | makeChannel(); | 52 | makeChannel(); |
52 | //opie is hardcoded default ;) | 53 | //opie is hardcoded default ;) |
53 | for (int i=0;i<section->count();i++) | 54 | for (int i=0;i<section->count();i++) |
54 | if (section->text(i)=="opie") | 55 | if (section->text(i)=="opie") |
55 | section->setCurrentItem(i); | 56 | section->setCurrentItem(i); |
56 | sectionChanged(); | 57 | sectionChanged(); |
57 | 58 | ||
58 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 59 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
59 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 60 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
60 | 61 | ||
61 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 62 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
62 | SLOT(removeLinks()) ); | 63 | SLOT(removeLinks()) ); |
63 | connect( settings->createLinksButton, SIGNAL( clicked()), | 64 | connect( settings->createLinksButton, SIGNAL( clicked()), |
64 | SLOT(createLinks()) ); | 65 | SLOT(createLinks()) ); |
65 | 66 | ||
66 | displayList(); | 67 | displayList(); |
67 | } | 68 | } |
68 | 69 | ||
69 | void MainWindow::makeMenu() | 70 | void MainWindow::makeMenu() |
70 | { | 71 | { |
71 | 72 | ||
72 | QPEToolBar *toolBar = new QPEToolBar( this ); | 73 | QPEToolBar *toolBar = new QPEToolBar( this ); |
73 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 74 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
74 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 75 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
75 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 76 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
76 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 77 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
77 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 78 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
78 | 79 | ||
79 | setToolBarsMovable( false ); | 80 | setToolBarsMovable( false ); |
80 | toolBar->setHorizontalStretchable( true ); | 81 | toolBar->setHorizontalStretchable( true ); |
81 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 82 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
82 | menuBar->insertItem( tr( "View" ), viewMenu ); | 83 | menuBar->insertItem( tr( "View" ), viewMenu ); |
83 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 84 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
84 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 85 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
85 | 86 | ||
86 | QLabel *spacer = new QLabel( "", toolBar ); | 87 | QLabel *spacer = new QLabel( "", toolBar ); |
87 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 88 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
88 | toolBar->setStretchableWidget( spacer ); | 89 | toolBar->setStretchableWidget( spacer ); |
89 | 90 | ||
90 | 91 | ||
91 | runAction = new QAction( tr( "Apply" ), | 92 | runAction = new QAction( tr( "Apply" ), |
92 | Resource::loadPixmap( "oipkg/install" ), | 93 | Resource::loadPixmap( "oipkg/install" ), |
93 | QString::null, 0, this, 0 ); | 94 | QString::null, 0, this, 0 ); |
94 | connect( runAction, SIGNAL( activated() ), | 95 | connect( runAction, SIGNAL( activated() ), |
95 | this, SLOT( runIpkg() ) ); | 96 | this, SLOT( runIpkg() ) ); |
96 | runAction->addTo( toolBar ); | 97 | runAction->addTo( toolBar ); |
97 | runAction->addTo( srvMenu ); | 98 | runAction->addTo( srvMenu ); |
98 | 99 | ||
99 | srvMenu->insertSeparator (); | 100 | srvMenu->insertSeparator (); |
100 | 101 | ||
101 | updateAction = new QAction( tr( "Update" ), | 102 | updateAction = new QAction( tr( "Update" ), |
102 | Resource::loadIconSet( "oipkg/update" ), | 103 | Resource::loadIconSet( "oipkg/update" ), |
103 | QString::null, 0, this, 0 ); | 104 | QString::null, 0, this, 0 ); |
104 | connect( updateAction, SIGNAL( activated() ), | 105 | connect( updateAction, SIGNAL( activated() ), |
105 | this , SLOT( updateList() ) ); | 106 | this , SLOT( updateList() ) ); |
106 | updateAction->addTo( toolBar ); | 107 | updateAction->addTo( toolBar ); |
107 | updateAction->addTo( srvMenu ); | 108 | updateAction->addTo( srvMenu ); |
108 | 109 | ||
109 | QAction *cfgact; | 110 | QAction *cfgact; |
110 | 111 | ||
111 | cfgact = new QAction( tr( "Setups" ), | 112 | cfgact = new QAction( tr( "Setups" ), |
112 | QString::null, 0, this, 0 ); | 113 | QString::null, 0, this, 0 ); |
113 | connect( cfgact, SIGNAL( activated() ), | 114 | connect( cfgact, SIGNAL( activated() ), |
114 | SLOT( showSettings() ) ); | 115 | SLOT( showSettings() ) ); |
115 | cfgact->addTo( cfgMenu ); | 116 | cfgact->addTo( cfgMenu ); |
116 | 117 | ||
117 | cfgact = new QAction( tr( "Servers" ), | 118 | cfgact = new QAction( tr( "Servers" ), |
118 | QString::null, 0, this, 0 ); | 119 | QString::null, 0, this, 0 ); |
119 | connect( cfgact, SIGNAL( activated() ), | 120 | connect( cfgact, SIGNAL( activated() ), |
120 | SLOT( showSettingsSrv() ) ); | 121 | SLOT( showSettingsSrv() ) ); |
121 | cfgact->addTo( cfgMenu ); | 122 | cfgact->addTo( cfgMenu ); |
122 | cfgact = new QAction( tr( "Destinations" ), | 123 | cfgact = new QAction( tr( "Destinations" ), |
123 | QString::null, 0, this, 0 ); | 124 | QString::null, 0, this, 0 ); |
124 | connect( cfgact, SIGNAL( activated() ), | 125 | connect( cfgact, SIGNAL( activated() ), |
125 | SLOT( showSettingsDst() ) ); | 126 | SLOT( showSettingsDst() ) ); |
126 | cfgact->addTo( cfgMenu ); | 127 | cfgact->addTo( cfgMenu ); |
127 | 128 | ||
128 | QAction *a; | 129 | QAction *a; |
129 | 130 | ||
130 | // SECTIONS | 131 | // SECTIONS |
131 | sectionBar = new QPEToolBar( this ); | 132 | sectionBar = new QPEToolBar( this ); |
132 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 133 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
133 | sectionBar->setHorizontalStretchable( true ); | 134 | sectionBar->setHorizontalStretchable( true ); |
134 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 135 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
135 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 136 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
136 | sectionBar->setStretchableWidget( label ); | 137 | sectionBar->setStretchableWidget( label ); |
137 | section = new QComboBox( false, sectionBar ); | 138 | section = new QComboBox( false, sectionBar ); |
138 | label = new QLabel( " / ", sectionBar ); | 139 | label = new QLabel( " / ", sectionBar ); |
139 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 140 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
140 | subsection = new QComboBox( false, sectionBar ); | 141 | subsection = new QComboBox( false, sectionBar ); |
141 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 142 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
142 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 143 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
143 | a->addTo( sectionBar ); | 144 | a->addTo( sectionBar ); |
144 | setSections(); | 145 | setSections(); |
145 | setSubSections(); | 146 | setSubSections(); |
146 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 147 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
147 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 148 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
148 | sectionAction->setToggleAction( true ); | 149 | sectionAction->setToggleAction( true ); |
149 | sectionAction->addTo( viewMenu ); | 150 | sectionAction->addTo( viewMenu ); |
150 | 151 | ||
151 | //FIND | 152 | //FIND |
152 | findBar = new QPEToolBar(this); | 153 | findBar = new QPEToolBar(this); |
153 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); | 154 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
154 | label = new QLabel( tr("Filter: "), findBar ); | 155 | label = new QLabel( tr("Filter: "), findBar ); |
155 | label->setBackgroundColor( findBar->backgroundColor() ); | 156 | label->setBackgroundColor( findBar->backgroundColor() ); |
156 | findBar->setHorizontalStretchable( TRUE ); | 157 | findBar->setHorizontalStretchable( TRUE ); |
157 | findEdit = new QLineEdit( findBar, "findEdit" ); | 158 | findEdit = new QLineEdit( findBar, "findEdit" ); |
158 | findBar->setStretchableWidget( findEdit ); | 159 | findBar->setStretchableWidget( findEdit ); |
159 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 160 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
160 | this, SLOT( displayList() ) ); | 161 | this, SLOT( displayList() ) ); |
161 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 162 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
162 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 163 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
163 | a->addTo( findBar ); | 164 | a->addTo( findBar ); |
164 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 165 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
165 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 166 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
166 | a->addTo( findBar ); | 167 | a->addTo( findBar ); |
167 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); | 168 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
168 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 169 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
169 | findAction->setToggleAction( true ); | 170 | findAction->setToggleAction( true ); |
170 | findAction->addTo( viewMenu ); | 171 | findAction->addTo( viewMenu ); |
171 | 172 | ||
172 | //SEARCH | 173 | //SEARCH |
173 | searchBar = new QPEToolBar(this); | 174 | searchBar = new QPEToolBar(this); |
174 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 175 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
175 | label = new QLabel( tr("ipkgfind: "), searchBar ); | 176 | label = new QLabel( tr("ipkgfind: "), searchBar ); |
176 | label->setBackgroundColor( searchBar->backgroundColor() ); | 177 | label->setBackgroundColor( searchBar->backgroundColor() ); |
177 | searchBar->setHorizontalStretchable( TRUE ); | 178 | searchBar->setHorizontalStretchable( TRUE ); |
178 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 179 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
179 | searchBar->setStretchableWidget( searchEdit ); | 180 | searchBar->setStretchableWidget( searchEdit ); |
180 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 181 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
181 | // this, SLOT( displayList() ) ); | 182 | // this, SLOT( displayList() ) ); |
182 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 183 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
183 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | 184 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); |
184 | a->addTo( searchBar ); | 185 | a->addTo( searchBar ); |
185 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 186 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
186 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | 187 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); |
187 | searchCommit->addTo( searchBar ); | 188 | searchCommit->addTo( searchBar ); |
188 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 189 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
189 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | 190 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); |
190 | a->addTo( searchBar ); | 191 | a->addTo( searchBar ); |
191 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | 192 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); |
192 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | 193 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); |
193 | searchAction->setToggleAction( true ); | 194 | searchAction->setToggleAction( true ); |
194 | searchAction->addTo( viewMenu ); | 195 | searchAction->addTo( viewMenu ); |
195 | 196 | ||
196 | //DEST | 197 | //DEST |
197 | destBar = new QPEToolBar(this); | 198 | destBar = new QPEToolBar(this); |
198 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 199 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
199 | label = new QLabel( tr("Destination: "), destBar ); | 200 | label = new QLabel( tr("Destination: "), destBar ); |
200 | label->setBackgroundColor( destBar->backgroundColor() ); | 201 | label->setBackgroundColor( destBar->backgroundColor() ); |
201 | destBar->setHorizontalStretchable( TRUE ); | 202 | destBar->setHorizontalStretchable( TRUE ); |
202 | destination = new QComboBox( false, destBar ); | 203 | destination = new QComboBox( false, destBar ); |
203 | destination->insertStringList( settings->getDestinationNames() ); | 204 | destination->insertStringList( settings->getDestinationNames() ); |
204 | setComboName(destination,settings->getDestinationName()); | 205 | setComboName(destination,settings->getDestinationName()); |
205 | connect( destination, SIGNAL(activated(int)), | 206 | connect( destination, SIGNAL(activated(int)), |
206 | settings, SLOT(activeDestinationChange(int)) ); | 207 | settings, SLOT(activeDestinationChange(int)) ); |
207 | spacer = new QLabel( " ", destBar ); | 208 | spacer = new QLabel( " ", destBar ); |
208 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 209 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
209 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 210 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
210 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 211 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
211 | CheckBoxLink->setChecked( settings->createLinks() ); | 212 | CheckBoxLink->setChecked( settings->createLinks() ); |
212 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 213 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
213 | settings, SLOT(linkEnabled(bool)) ); | 214 | settings, SLOT(linkEnabled(bool)) ); |
214 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 215 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
215 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 216 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
216 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 217 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
217 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 218 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
218 | a->addTo( destBar ); | 219 | a->addTo( destBar ); |
219 | destBar->setStretchableWidget( CheckBoxLink ); | 220 | destBar->setStretchableWidget( CheckBoxLink ); |
220 | destAction->setToggleAction( true ); | 221 | destAction->setToggleAction( true ); |
221 | // destAction->addTo( viewMenu ); | 222 | // destAction->addTo( viewMenu ); |
222 | 223 | ||
223 | // configure the menus | 224 | // configure the menus |
224 | Config cfg( "oipkg", Config::User ); | 225 | Config cfg( "oipkg", Config::User ); |
225 | cfg.setGroup( "gui" ); | 226 | cfg.setGroup( "gui" ); |
226 | 227 | ||
227 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 228 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
228 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 229 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
229 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 230 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
230 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 231 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
231 | } | 232 | } |
232 | 233 | ||
233 | MainWindow::~MainWindow() | 234 | MainWindow::~MainWindow() |
234 | { | 235 | { |
235 | Config cfg( "oipkg", Config::User ); | 236 | Config cfg( "oipkg", Config::User ); |
236 | cfg.setGroup( "gui" ); | 237 | cfg.setGroup( "gui" ); |
237 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 238 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
238 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 239 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
239 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 240 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
240 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 241 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
241 | 242 | ||
242 | } | 243 | } |
243 | 244 | ||
244 | void MainWindow::runIpkg() | 245 | void MainWindow::runIpkg() |
245 | { | 246 | { |
246 | packageList.allPackages(); | 247 | packageList.allPackages(); |
247 | ipkg->loadList( packageListSearch ); | 248 | ipkg->loadList( packageListSearch ); |
248 | ipkg->commit( packageList ); | 249 | ipkg->commit( packageList ); |
249 | // ##### If we looked in the list of files, we could send out accurate | 250 | // ##### If we looked in the list of files, we could send out accurate |
250 | // ##### messages. But we don't bother yet, and just do an "all". | 251 | // ##### messages. But we don't bother yet, and just do an "all". |
251 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 252 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
252 | QString lf = QString::null; | 253 | QString lf = QString::null; |
253 | e << lf; | 254 | e << lf; |
254 | displayList(); | 255 | displayList(); |
255 | } | 256 | } |
256 | 257 | ||
257 | void MainWindow::updateList() | 258 | void MainWindow::updateList() |
258 | { | 259 | { |
259 | //wait->show(); | 260 | //wait->show(); |
260 | QTimer *t = new QTimer( this ); | 261 | QTimer *t = new QTimer( this ); |
261 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 262 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
262 | t->start( 0, false ); | 263 | t->start( 0, false ); |
263 | packageList.clear(); | 264 | packageList.clear(); |
264 | ipkg->update(); | 265 | ipkg->update(); |
265 | packageList.update(); | 266 | packageList.update(); |
266 | t->stop(); | 267 | t->stop(); |
267 | // wait->hide(); | 268 | // wait->hide(); |
268 | } | 269 | } |
269 | 270 | ||
270 | void MainWindow::filterList() | 271 | void MainWindow::filterList() |
271 | { | 272 | { |
272 | //wait->show(); | 273 | //wait->show(); |
273 | QString f = ""; | 274 | QString f = ""; |
274 | if ( findAction->isOn() ) f = findEdit->text(); | 275 | if ( findAction->isOn() ) f = findEdit->text(); |
275 | packageList.filterPackages( f ); | 276 | packageList.filterPackages( f ); |
276 | //wait->hide(); | 277 | //wait->hide(); |
277 | } | 278 | } |
278 | 279 | ||
279 | void MainWindow::displayList() | 280 | void MainWindow::displayList() |
280 | { | 281 | { |
281 | //wait->hide(); | 282 | //wait->hide(); |
282 | filterList(); | 283 | filterList(); |
283 | listViewPackages->clear(); | 284 | listViewPackages->display(); |
284 | Package *pack = packageList.first(); | 285 | //// if (!rootLocal) |
285 | PackageListItem *item; | 286 | //// { |
286 | 287 | //QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); | |
287 | // if (!rootLocal) | 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 ) | ||
288 | // { | 300 | // { |
289 | QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); | 301 | // item = new PackageListItem( rootSearch, pack, settings ); |
290 | QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); | 302 | // pack = packageListSearch.next(); |
291 | // } | 303 | // } |
292 | while( pack ) | ||
293 | { | ||
294 | item = new PackageListItem( rootLocal, pack, settings ); | ||
295 | pack = packageList.next(); | ||
296 | } | ||
297 | pack = packageListSearch.first(); | ||
298 | while( pack ) | ||
299 | { | ||
300 | item = new PackageListItem( rootSearch, pack, settings ); | ||
301 | pack = packageListSearch.next(); | ||
302 | } | ||
303 | } | 304 | } |
304 | 305 | ||
305 | void MainWindow::sectionChanged() | 306 | void MainWindow::sectionChanged() |
306 | { | 307 | { |
307 | disconnect( section, SIGNAL( activated(int) ), | 308 | disconnect( section, SIGNAL( activated(int) ), |
308 | this, SLOT( sectionChanged() ) ); | 309 | this, SLOT( sectionChanged() ) ); |
309 | disconnect( subsection, SIGNAL(activated(int) ), | 310 | disconnect( subsection, SIGNAL(activated(int) ), |
310 | this, SLOT( subSectionChanged() ) ); | 311 | this, SLOT( subSectionChanged() ) ); |
311 | subsection->clear(); | 312 | subsection->clear(); |
312 | packageList.setSection( section->currentText() ); | 313 | packageList.setSection( section->currentText() ); |
313 | setSubSections(); | 314 | setSubSections(); |
314 | connect( section, SIGNAL( activated(int) ), | 315 | connect( section, SIGNAL( activated(int) ), |
315 | this, SLOT( sectionChanged() ) ); | 316 | this, SLOT( sectionChanged() ) ); |
316 | connect( subsection, SIGNAL(activated(int) ), | 317 | connect( subsection, SIGNAL(activated(int) ), |
317 | this, SLOT( subSectionChanged() ) ); | 318 | this, SLOT( subSectionChanged() ) ); |
318 | displayList(); | 319 | displayList(); |
319 | } | 320 | } |
320 | 321 | ||
321 | void MainWindow::subSectionChanged() | 322 | void MainWindow::subSectionChanged() |
322 | { | 323 | { |
323 | disconnect( section, SIGNAL( activated(int) ), | 324 | disconnect( section, SIGNAL( activated(int) ), |
324 | this, SLOT( sectionChanged() ) ); | 325 | this, SLOT( sectionChanged() ) ); |
325 | disconnect( subsection, SIGNAL(activated(int) ), | 326 | disconnect( subsection, SIGNAL(activated(int) ), |
326 | this, SLOT( subSectionChanged() ) ); | 327 | this, SLOT( subSectionChanged() ) ); |
327 | packageList.setSubSection( subsection->currentText() ); | 328 | packageList.setSubSection( subsection->currentText() ); |
328 | connect( section, SIGNAL( activated(int) ), | 329 | connect( section, SIGNAL( activated(int) ), |
329 | this, SLOT( sectionChanged() ) ); | 330 | this, SLOT( sectionChanged() ) ); |
330 | connect( subsection, SIGNAL(activated(int) ), | 331 | connect( subsection, SIGNAL(activated(int) ), |
331 | this, SLOT( subSectionChanged() ) ); | 332 | this, SLOT( subSectionChanged() ) ); |
332 | displayList(); | 333 | displayList(); |
333 | } | 334 | } |
334 | 335 | ||
335 | void MainWindow::setSections() | 336 | void MainWindow::setSections() |
336 | { | 337 | { |
337 | section->clear(); | 338 | section->clear(); |
338 | section->insertStringList( packageList.getSections() ); | 339 | section->insertStringList( packageList.getSections() ); |
339 | } | 340 | } |
340 | 341 | ||
341 | void MainWindow::setSubSections() | 342 | void MainWindow::setSubSections() |
342 | { | 343 | { |
343 | subsection->clear(); | 344 | subsection->clear(); |
344 | subsection->insertStringList( packageList.getSubSections() ); | 345 | subsection->insertStringList( packageList.getSubSections() ); |
345 | } | 346 | } |
346 | 347 | ||
347 | 348 | ||
348 | void MainWindow::showSettings() | 349 | void MainWindow::showSettings() |
349 | { | 350 | { |
350 | if ( settings->showDialog( 0 ) ) | 351 | if ( settings->showDialog( 0 ) ) |
351 | updateList(); | 352 | updateList(); |
352 | } | 353 | } |
353 | void MainWindow::showSettingsSrv() | 354 | void MainWindow::showSettingsSrv() |
354 | { | 355 | { |
355 | if ( settings->showDialog( 1 ) ) | 356 | if ( settings->showDialog( 1 ) ) |
356 | updateList(); | 357 | updateList(); |
357 | } | 358 | } |
358 | void MainWindow::showSettingsDst() | 359 | void MainWindow::showSettingsDst() |
359 | { | 360 | { |
360 | if ( settings->showDialog( 2 ) ) | 361 | if ( settings->showDialog( 2 ) ) |
361 | updateList(); | 362 | updateList(); |
362 | } | 363 | } |
363 | 364 | ||
364 | void MainWindow::sectionShow(bool b) | 365 | void MainWindow::sectionShow(bool b) |
365 | { | 366 | { |
366 | if (b) sectionBar->show(); | 367 | if (b) sectionBar->show(); |
367 | else sectionBar->hide(); | 368 | else sectionBar->hide(); |
368 | sectionAction->setOn( b ); | 369 | sectionAction->setOn( b ); |
369 | } | 370 | } |
370 | 371 | ||
371 | void MainWindow::sectionClose() | 372 | void MainWindow::sectionClose() |
372 | { | 373 | { |
373 | sectionAction->setOn( false ); | 374 | sectionAction->setOn( false ); |
374 | } | 375 | } |
375 | 376 | ||
376 | void MainWindow::findShow(bool b) | 377 | void MainWindow::findShow(bool b) |
377 | { | 378 | { |
378 | if (b) findBar->show(); | 379 | if (b) findBar->show(); |
379 | else findBar->hide(); | 380 | else findBar->hide(); |
380 | findAction->setOn( b ); | 381 | findAction->setOn( b ); |
381 | } | 382 | } |
382 | 383 | ||
383 | void MainWindow::findClose() | 384 | void MainWindow::findClose() |
384 | { | 385 | { |
385 | findAction->setOn( false ); | 386 | findAction->setOn( false ); |
386 | } | 387 | } |
387 | 388 | ||
388 | void MainWindow::searchShow(bool b) | 389 | void MainWindow::searchShow(bool b) |
389 | { | 390 | { |
390 | if (b) searchBar->show(); | 391 | if (b) searchBar->show(); |
391 | else searchBar->hide(); | 392 | else searchBar->hide(); |
392 | searchAction->setOn( b ); | 393 | searchAction->setOn( b ); |
393 | } | 394 | } |
394 | 395 | ||
395 | void MainWindow::searchClose() | 396 | void MainWindow::searchClose() |
396 | { | 397 | { |
397 | searchAction->setOn( false ); | 398 | searchAction->setOn( false ); |
398 | } | 399 | } |
399 | 400 | ||
400 | 401 | ||
401 | void MainWindow::destShow(bool b) | 402 | void MainWindow::destShow(bool b) |
402 | { | 403 | { |
403 | if (b) destBar->show(); | 404 | if (b) destBar->show(); |
404 | else destBar->hide(); | 405 | else destBar->hide(); |
405 | destAction->setOn( b ); | 406 | destAction->setOn( b ); |
406 | } | 407 | } |
407 | 408 | ||
408 | void MainWindow::destClose() | 409 | void MainWindow::destClose() |
409 | { | 410 | { |
410 | destAction->setOn( false ); | 411 | destAction->setOn( false ); |
411 | } | 412 | } |
412 | 413 | ||
413 | void MainWindow::rotateUpdateIcon() | 414 | void MainWindow::rotateUpdateIcon() |
414 | { | 415 | { |
415 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 416 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
416 | if ( updateIcon ) | 417 | if ( updateIcon ) |
417 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 418 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
418 | else | 419 | else |
419 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 420 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
420 | updateIcon = !updateIcon; | 421 | updateIcon = !updateIcon; |
421 | } | 422 | } |
422 | 423 | ||
423 | 424 | ||
424 | void MainWindow::setDocument(const QString &fileName) | 425 | void MainWindow::setDocument(const QString &fileName) |
425 | { | 426 | { |
426 | installFile(fileName); | 427 | installFile(fileName); |
427 | // ##### If we looked in the list of files, we could send out accurate | 428 | // ##### If we looked in the list of files, we could send out accurate |
428 | // ##### messages. But we don't bother yet, and just do an "all". | 429 | // ##### messages. But we don't bother yet, and just do an "all". |
429 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 430 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
430 | QString lf = QString::null; | 431 | QString lf = QString::null; |
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 26b1ce7..5137c64 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -1,96 +1,132 @@ | |||
1 | #include "packagelistview.h" | 1 | #include "packagelistview.h" |
2 | 2 | ||
3 | #include <qpopupmenu.h> | 3 | #include <qpopupmenu.h> |
4 | #include <qaction.h> | 4 | #include <qaction.h> |
5 | 5 | ||
6 | #include "packagelistitem.h" | 6 | #include "packagelistitem.h" |
7 | #include "pksettings.h" | 7 | #include "pksettings.h" |
8 | 8 | ||
9 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | 9 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) |
10 | : QListView(p,n) | 10 | : QListView(p,n) |
11 | { | 11 | { |
12 | settings = s; | 12 | settings = s; |
13 | popupMenu = new QPopupMenu( this ); | 13 | popupMenu = new QPopupMenu( this ); |
14 | destsMenu = new QPopupMenu( popupMenu ); | 14 | destsMenu = new QPopupMenu( popupMenu ); |
15 | popupTimer = new QTimer( this ); | 15 | popupTimer = new QTimer( this ); |
16 | setSelectionMode(QListView::NoSelection); | 16 | setSelectionMode(QListView::NoSelection); |
17 | addColumn( tr("Package") ); | 17 | addColumn( tr("Package") ); |
18 | setRootIsDecorated( true ); | 18 | setRootIsDecorated( true ); |
19 | 19 | ||
20 | connect( popupTimer, SIGNAL(timeout()), | 20 | connect( popupTimer, SIGNAL(timeout()), |
21 | this, SLOT(showPopup()) ); | 21 | this, SLOT(showPopup()) ); |
22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), |
23 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 23 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), |
25 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 25 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | //PackageListView::~PackageListView() | 29 | //PackageListView::~PackageListView() |
30 | //{ | 30 | //{ |
31 | //} | 31 | //} |
32 | 32 | ||
33 | void PackageListView::setCurrent( QListViewItem* p ) | 33 | void PackageListView::setCurrent( QListViewItem* p ) |
34 | { | 34 | { |
35 | if ( !p ) return; | 35 | if ( !p ) return; |
36 | activePackageListItem = (PackageListItem*)p; | 36 | activePackageListItem = (PackageListItem*)p; |
37 | activePackage = activePackageListItem->getPackage(); | 37 | activePackage = activePackageListItem->getPackage(); |
38 | if (!activePackage) return; | 38 | if (!activePackage) return; |
39 | popupTimer->start( 750, true ); | 39 | popupTimer->start( 750, true ); |
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | void PackageListView::showPopup() | 43 | void PackageListView::showPopup() |
44 | { | 44 | { |
45 | popupMenu->clear(); | 45 | popupMenu->clear(); |
46 | destsMenu->clear(); | 46 | destsMenu->clear(); |
47 | 47 | ||
48 | QAction *popupAction; | 48 | QAction *popupAction; |
49 | if ( !activePackage->installed() ) | 49 | if ( !activePackage->installed() ) |
50 | { | 50 | { |
51 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | 51 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); |
52 | QStringList dests = settings->getDestinationNames(); | 52 | QStringList dests = settings->getDestinationNames(); |
53 | QString ad = settings->getDestinationName(); | 53 | QString ad = settings->getDestinationName(); |
54 | for (uint i = 0; i < dests.count(); i++ ) | 54 | for (uint i = 0; i < dests.count(); i++ ) |
55 | { | 55 | { |
56 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 56 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
57 | popupAction->addTo( destsMenu ); | 57 | popupAction->addTo( destsMenu ); |
58 | if ( dests[i] == ad && activePackage->toInstall() ) | 58 | if ( dests[i] == ad && activePackage->toInstall() ) |
59 | { | 59 | { |
60 | popupAction->setToggleAction( true ); | 60 | popupAction->setToggleAction( true ); |
61 | popupAction->setOn(true); | 61 | popupAction->setOn(true); |
62 | }; | 62 | }; |
63 | } | 63 | } |
64 | connect( destsMenu, SIGNAL( activated( int ) ), | 64 | connect( destsMenu, SIGNAL( activated( int ) ), |
65 | this, SLOT( changePackageDest( int ) ) ); | 65 | this, SLOT( changePackageDest( int ) ) ); |
66 | }else{ | 66 | }else{ |
67 | popupAction = new QAction( QObject::tr("Remove"),QString::null, 0, this, 0 ); | 67 | popupAction = new QAction( QObject::tr("Remove"),QString::null, 0, this, 0 ); |
68 | popupAction->addTo( popupMenu ); | 68 | popupAction->addTo( popupMenu ); |
69 | connect( popupAction, SIGNAL( activated() ), | 69 | connect( popupAction, SIGNAL( activated() ), |
70 | this , SLOT( toggleProcess() ) ); | 70 | this , SLOT( toggleProcess() ) ); |
71 | popupAction = new QAction( QObject::tr("Reinstall"),QString::null, 0, this, 0 ); | 71 | popupAction = new QAction( QObject::tr("Reinstall"),QString::null, 0, this, 0 ); |
72 | popupAction->addTo( popupMenu ); | 72 | popupAction->addTo( popupMenu ); |
73 | popupAction->setEnabled( false ); | 73 | popupAction->setEnabled( false ); |
74 | } | 74 | } |
75 | popupMenu->popup( QCursor::pos() ); | 75 | popupMenu->popup( QCursor::pos() ); |
76 | } | 76 | } |
77 | 77 | ||
78 | void PackageListView::stopTimer( QListViewItem* ) | 78 | void PackageListView::stopTimer( QListViewItem* ) |
79 | { | 79 | { |
80 | popupTimer->stop(); | 80 | popupTimer->stop(); |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | void PackageListView::changePackageDest( int i ) | 84 | void PackageListView::changePackageDest( int i ) |
85 | { | 85 | { |
86 | activePackage->setDest( destsMenu->text(i) ); | 86 | activePackage->setDest( destsMenu->text(i) ); |
87 | activePackage->setOn(); | 87 | activePackage->setOn(); |
88 | activePackage->setLink( settings->createLinks() ); | 88 | activePackage->setLink( settings->createLinks() ); |
89 | activePackageListItem->displayDetails(); | 89 | activePackageListItem->displayDetails(); |
90 | } | 90 | } |
91 | 91 | ||
92 | void PackageListView::toggleProcess() | 92 | void PackageListView::toggleProcess() |
93 | { | 93 | { |
94 | activePackage->toggleProcess() ; | 94 | activePackage->toggleProcess() ; |
95 | activePackageListItem->displayDetails(); | 95 | activePackageListItem->displayDetails(); |
96 | } | 96 | } |
97 | |||
98 | void PackageListView::display() | ||
99 | { | ||
100 | QDictIterator<PackageList> list( PackageLists ); | ||
101 | PackageList *packlist; | ||
102 | Package *pack; | ||
103 | PackageListItem *item; | ||
104 | QCheckListItem *rootItem; | ||
105 | QListViewItem* it; | ||
106 | QListViewItem* itdel; | ||
107 | while ( list.current() ) { | ||
108 | packlist = list.current(); | ||
109 | rootItem = rootItems.find( list.currentKey() ); | ||
110 | //rootItem->clear(); | ||
111 | it=rootItem->firstChild(); | ||
112 | while ( it ) | ||
113 | { | ||
114 | itdel = it; | ||
115 | it = it->nextSibling(); | ||
116 | delete itdel; | ||
117 | } | ||
118 | pack = packlist->first(); | ||
119 | while( pack ) | ||
120 | { | ||
121 | item = new PackageListItem( rootItem, pack, settings ); | ||
122 | pack = packlist->next(); | ||
123 | } | ||
124 | ++list; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | void PackageListView::addList( QString n, PackageList* pl) | ||
129 | { | ||
130 | PackageLists.insert(n, pl); | ||
131 | rootItems.insert(n, new QCheckListItem(this,n)); | ||
132 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index d371a34..00c0320 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h | |||
@@ -1,54 +1,61 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | packagelistview.h - description | 2 | packagelistview.h - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Sat Apr 27 2002 | 4 | begin : Sat Apr 27 2002 |
5 | copyright : (C) 2002 by tille | 5 | copyright : (C) 2002 by tille |
6 | email : tille@handhelds.org | 6 | email : tille@handhelds.org |
7 | ***************************************************************************/ | 7 | ***************************************************************************/ |
8 | 8 | ||
9 | /*************************************************************************** | 9 | /*************************************************************************** |
10 | * * | 10 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | 17 | ||
18 | #ifndef PACKAGELISTVIEW_H | 18 | #ifndef PACKAGELISTVIEW_H |
19 | #define PACKAGELISTVIEW_H | 19 | #define PACKAGELISTVIEW_H |
20 | 20 | ||
21 | #include <qlistview.h> | 21 | #include <qlistview.h> |
22 | #include <qaction.h> | 22 | #include <qaction.h> |
23 | #include <qdict.h> | ||
24 | #include <qstring.h> | ||
23 | #include <qtimer.h> | 25 | #include <qtimer.h> |
24 | #include <qwidget.h> | 26 | #include <qwidget.h> |
25 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
28 | #include "packagelist.h" | ||
26 | #include "debug.h" | 29 | #include "debug.h" |
27 | 30 | ||
28 | class PackageListItem; | 31 | class PackageListItem; |
29 | class Package; | 32 | class Package; |
30 | class PackageManagerSettings; | 33 | class PackageManagerSettings; |
31 | 34 | ||
32 | class PackageListView : public QListView | 35 | class PackageListView : public QListView |
33 | { | 36 | { |
34 | Q_OBJECT | 37 | Q_OBJECT |
35 | 38 | ||
36 | public: | 39 | public: |
37 | PackageListView(QWidget*, const char*, PackageManagerSettings*); | 40 | PackageListView(QWidget*, const char*, PackageManagerSettings*); |
41 | void addList( QString, PackageList* ); | ||
38 | //~PackageListView(); | 42 | //~PackageListView(); |
39 | QTimer *popupTimer; | 43 | QTimer *popupTimer; |
40 | private: | 44 | private: |
45 | QDict<PackageList> PackageLists; | ||
46 | QDict<QCheckListItem> rootItems; | ||
41 | PackageManagerSettings *settings; | 47 | PackageManagerSettings *settings; |
42 | Package *activePackage; | 48 | Package *activePackage; |
43 | PackageListItem *activePackageListItem; | 49 | PackageListItem *activePackageListItem; |
44 | QPopupMenu *popupMenu; | 50 | QPopupMenu *popupMenu; |
45 | QPopupMenu *destsMenu; | 51 | QPopupMenu *destsMenu; |
46 | public slots: | 52 | public slots: |
47 | void showPopup(); | 53 | void showPopup(); |
48 | void changePackageDest( int ); | 54 | void changePackageDest( int ); |
49 | void setCurrent( QListViewItem* ); | 55 | void setCurrent( QListViewItem* ); |
50 | void stopTimer( QListViewItem* ); | 56 | void stopTimer( QListViewItem* ); |
51 | void toggleProcess(); | 57 | void toggleProcess(); |
58 | void display(); | ||
52 | }; | 59 | }; |
53 | 60 | ||
54 | #endif | 61 | #endif |