-rw-r--r-- | noncore/unsupported/oipkg/TODO | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 18 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 40 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 4 |
5 files changed, 65 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 744cba4..b07542a 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,8 +1,10 @@ | |||
1 | * setDocument function | ||
1 | * Settings Class | 2 | * Settings Class |
2 | * tr() ;) | 3 | * tr() ;) |
3 | * Dialog to display ipkg output live | 4 | * Dialog to display ipkg output live |
4 | * parse "to install" and "to remove" from status | 5 | * parse "to install" and "to remove" from status |
5 | * install local file | 6 | * install local file |
6 | * qcop | 7 | * qcop |
7 | * error handling | 8 | * error handling |
8 | * manage links | 9 | * manage links |
10 | * dependency checking \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 25ca889..e3abf36 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,418 +1,436 @@ | |||
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/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qcopenvelope_qws.h> | 10 | #include <qpe/qcopenvelope_qws.h> |
11 | #include <qaction.h> | 11 | #include <qaction.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qpopupmenu.h> | 13 | #include <qpopupmenu.h> |
14 | #include <qtoolbutton.h> | 14 | #include <qtoolbutton.h> |
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qlabel.h> | 16 | #include <qlabel.h> |
17 | #include <qlistview.h> | 17 | #include <qlistview.h> |
18 | #include <qtextview.h> | 18 | #include <qtextview.h> |
19 | #include <qlineedit.h> | 19 | #include <qlineedit.h> |
20 | #include <qtabwidget.h> | 20 | #include <qtabwidget.h> |
21 | #include <qcombobox.h> | 21 | #include <qcombobox.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | 23 | ||
24 | #include "pksettingsbase.h" | 24 | #include "pksettingsbase.h" |
25 | #include "packagelistitem.h" | 25 | #include "packagelistitem.h" |
26 | 26 | ||
27 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 27 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
28 | QMainWindow( parent, name, f ) | 28 | QMainWindow( parent, name, f ) |
29 | { | 29 | { |
30 | setCaption( tr("Package Manager") ); | 30 | setCaption( tr("Package Manager") ); |
31 | 31 | ||
32 | listViewPackages = new QListView( this,0,0 ); | 32 | listViewPackages = new QListView( this,0,0 ); |
33 | listViewPackages->setSelectionMode(QListView::NoSelection); | 33 | listViewPackages->setSelectionMode(QListView::NoSelection); |
34 | setCentralWidget( listViewPackages ); | 34 | setCentralWidget( listViewPackages ); |
35 | 35 | ||
36 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | ||
37 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
38 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | ||
39 | |||
36 | makeMenu(); | 40 | makeMenu(); |
37 | #ifdef NEWLAYOUT | 41 | #ifdef NEWLAYOUT |
38 | listViewPackages->addColumn( tr("Package") ); | 42 | listViewPackages->addColumn( tr("Package") ); |
39 | listViewPackages->setRootIsDecorated( true ); | 43 | listViewPackages->setRootIsDecorated( true ); |
40 | #endif | 44 | #endif |
41 | #ifndef NEWLAYOUT | 45 | #ifndef NEWLAYOUT |
42 | QFontMetrics fm = fontMetrics(); | 46 | QFontMetrics fm = fontMetrics(); |
43 | int wlw = width()*2; | 47 | int wlw = width()*2; |
44 | int w0 = fm.width(tr("Package"))+30; | 48 | int w0 = fm.width(tr("Package"))+30; |
45 | // int w0 = fm.width(tr("Package"))+30; | 49 | // int w0 = fm.width(tr("Package"))+30; |
46 | int w2 = fm.width("00000")+4; | 50 | int w2 = fm.width("00000")+4; |
47 | int w1 = wlw-w2-w0-24; | 51 | int w1 = wlw-w2-w0-24; |
48 | listViewPackages->addColumn( tr("Package"), w0 ); | 52 | listViewPackages->addColumn( tr("Package"), w0 ); |
49 | listViewPackages->addColumn( tr("Description"), w1 ); | 53 | listViewPackages->addColumn( tr("Description"), w1 ); |
50 | listViewPackages->addColumn( tr("Size"), w2 ); | 54 | listViewPackages->addColumn( tr("Size"), w2 ); |
51 | listViewPackages->setColumnWidthMode(0,QListView::Manual); | 55 | listViewPackages->setColumnWidthMode(0,QListView::Manual); |
52 | listViewPackages->setColumnWidthMode(1,QListView::Manual); | 56 | listViewPackages->setColumnWidthMode(1,QListView::Manual); |
53 | listViewPackages->setColumnWidthMode(2,QListView::Manual); | 57 | listViewPackages->setColumnWidthMode(2,QListView::Manual); |
54 | listViewPackages->setSelectionMode( QListView::Multi ); | 58 | listViewPackages->setSelectionMode( QListView::Multi ); |
55 | #endif | 59 | #endif |
56 | connect( section, SIGNAL( activated(int) ), | 60 | connect( section, SIGNAL( activated(int) ), |
57 | this, SLOT( sectionChanged() ) ); | 61 | this, SLOT( sectionChanged() ) ); |
58 | connect( subsection, SIGNAL(activated(int) ), | 62 | connect( subsection, SIGNAL(activated(int) ), |
59 | this, SLOT( subSectionChanged() ) ); | 63 | this, SLOT( subSectionChanged() ) ); |
60 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), | 64 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), |
61 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 65 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
62 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), | 66 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), |
63 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 67 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
64 | 68 | ||
65 | popupMenu = new QPopupMenu( this ); | 69 | popupMenu = new QPopupMenu( this ); |
66 | 70 | ||
67 | settings = new PackageManagerSettings(this,0,TRUE); | 71 | settings = new PackageManagerSettings(this,0,TRUE); |
68 | 72 | ||
69 | ipkg = new PmIpkg( settings, this ); | 73 | ipkg = new PmIpkg( settings, this ); |
70 | packageList.setSettings( settings ); | 74 | packageList.setSettings( settings ); |
71 | getList(); | 75 | getList(); |
72 | setSections(); | 76 | setSections(); |
73 | setSubSections(); | 77 | setSubSections(); |
74 | displayList(); | 78 | displayList(); |
75 | } | 79 | } |
76 | 80 | ||
77 | void MainWindow::makeMenu() | 81 | void MainWindow::makeMenu() |
78 | { | 82 | { |
79 | 83 | ||
80 | QPEToolBar *toolBar = new QPEToolBar( this ); | 84 | QPEToolBar *toolBar = new QPEToolBar( this ); |
81 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 85 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
82 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 86 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
83 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 87 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
84 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 88 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
85 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 89 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
86 | 90 | ||
87 | popupMenu = new QPopupMenu( this ); | 91 | popupMenu = new QPopupMenu( this ); |
88 | destsMenu = new QPopupMenu( popupMenu ); | 92 | destsMenu = new QPopupMenu( popupMenu ); |
89 | popupTimer = new QTimer( this ); | 93 | popupTimer = new QTimer( this ); |
90 | connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); | 94 | connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); |
91 | 95 | ||
92 | setToolBarsMovable( false ); | 96 | setToolBarsMovable( false ); |
93 | toolBar->setHorizontalStretchable( true ); | 97 | toolBar->setHorizontalStretchable( true ); |
94 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 98 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
95 | menuBar->insertItem( tr( "View" ), viewMenu ); | 99 | menuBar->insertItem( tr( "View" ), viewMenu ); |
96 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 100 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
97 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 101 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
98 | 102 | ||
99 | QLabel *spacer = new QLabel( "", toolBar ); | 103 | QLabel *spacer = new QLabel( "", toolBar ); |
100 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 104 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
101 | toolBar->setStretchableWidget( spacer ); | 105 | toolBar->setStretchableWidget( spacer ); |
102 | 106 | ||
103 | 107 | ||
104 | runAction = new QAction( tr( "Apply" ), | 108 | runAction = new QAction( tr( "Apply" ), |
105 | Resource::loadPixmap( "oipkg/install" ), | 109 | Resource::loadPixmap( "oipkg/install" ), |
106 | QString::null, 0, this, 0 ); | 110 | QString::null, 0, this, 0 ); |
107 | connect( runAction, SIGNAL( activated() ), | 111 | connect( runAction, SIGNAL( activated() ), |
108 | this, SLOT( runIpkg() ) ); | 112 | this, SLOT( runIpkg() ) ); |
109 | runAction->addTo( toolBar ); | 113 | runAction->addTo( toolBar ); |
110 | runAction->addTo( srvMenu ); | 114 | runAction->addTo( srvMenu ); |
111 | 115 | ||
112 | srvMenu->insertSeparator (); | 116 | srvMenu->insertSeparator (); |
113 | 117 | ||
114 | updateAction = new QAction( tr( "Update" ), | 118 | updateAction = new QAction( tr( "Update" ), |
115 | Resource::loadIconSet( "oipkg/update" ), | 119 | Resource::loadIconSet( "oipkg/update" ), |
116 | QString::null, 0, this, 0 ); | 120 | QString::null, 0, this, 0 ); |
117 | connect( updateAction, SIGNAL( activated() ), | 121 | connect( updateAction, SIGNAL( activated() ), |
118 | this , SLOT( updateList() ) ); | 122 | this , SLOT( updateList() ) ); |
119 | updateAction->addTo( toolBar ); | 123 | updateAction->addTo( toolBar ); |
120 | updateAction->addTo( srvMenu ); | 124 | updateAction->addTo( srvMenu ); |
121 | 125 | ||
122 | detailsAction = new QAction( tr( "Details" ), | 126 | detailsAction = new QAction( tr( "Details" ), |
123 | Resource::loadIconSet( "find" ), | 127 | Resource::loadIconSet( "find" ), |
124 | QString::null, 0, this, 0 ); | 128 | QString::null, 0, this, 0 ); |
125 | connect( detailsAction, SIGNAL( activated() ), | 129 | connect( detailsAction, SIGNAL( activated() ), |
126 | this , SLOT( showDetails() ) ); | 130 | this , SLOT( showDetails() ) ); |
127 | detailsAction->addTo( toolBar ); | 131 | detailsAction->addTo( toolBar ); |
128 | detailsAction->addTo( srvMenu ); | 132 | detailsAction->addTo( srvMenu ); |
129 | 133 | ||
130 | QAction *cfgact; | 134 | QAction *cfgact; |
131 | 135 | ||
132 | cfgact = new QAction( tr( "Setups" ), | 136 | cfgact = new QAction( tr( "Setups" ), |
133 | // Resource::loadIconSet( "" ), | 137 | // Resource::loadIconSet( "" ), |
134 | QString::null, 0, this, 0 ); | 138 | QString::null, 0, this, 0 ); |
135 | connect( cfgact, SIGNAL( activated() ), | 139 | connect( cfgact, SIGNAL( activated() ), |
136 | SLOT( showSettings() ) ); | 140 | SLOT( showSettings() ) ); |
137 | cfgact->addTo( cfgMenu ); | 141 | cfgact->addTo( cfgMenu ); |
138 | 142 | ||
139 | cfgact = new QAction( tr( "Servers" ), | 143 | cfgact = new QAction( tr( "Servers" ), |
140 | // Resource::loadIconSet( "" ), | 144 | // Resource::loadIconSet( "" ), |
141 | QString::null, 0, this, 0 ); | 145 | QString::null, 0, this, 0 ); |
142 | connect( cfgact, SIGNAL( activated() ), | 146 | connect( cfgact, SIGNAL( activated() ), |
143 | SLOT( showSettingsSrv() ) ); | 147 | SLOT( showSettingsSrv() ) ); |
144 | cfgact->addTo( cfgMenu ); | 148 | cfgact->addTo( cfgMenu ); |
145 | cfgact = new QAction( tr( "Destinations" ), | 149 | cfgact = new QAction( tr( "Destinations" ), |
146 | //Resource::loadIconSet( "" ), | 150 | //Resource::loadIconSet( "" ), |
147 | QString::null, 0, this, 0 ); | 151 | QString::null, 0, this, 0 ); |
148 | connect( cfgact, SIGNAL( activated() ), | 152 | connect( cfgact, SIGNAL( activated() ), |
149 | SLOT( showSettingsDst() ) ); | 153 | SLOT( showSettingsDst() ) ); |
150 | cfgact->addTo( cfgMenu ); | 154 | cfgact->addTo( cfgMenu ); |
151 | 155 | ||
152 | QAction *a; | 156 | QAction *a; |
153 | 157 | ||
154 | sectionBar = new QPEToolBar( this ); | 158 | sectionBar = new QPEToolBar( this ); |
155 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 159 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
156 | sectionBar->setHorizontalStretchable( true ); | 160 | sectionBar->setHorizontalStretchable( true ); |
157 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 161 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
158 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 162 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
159 | sectionBar->setStretchableWidget( label ); | 163 | sectionBar->setStretchableWidget( label ); |
160 | section = new QComboBox( false, sectionBar ); | 164 | section = new QComboBox( false, sectionBar ); |
161 | // section->setBackgroundMode( PaletteBackground ); | 165 | // section->setBackgroundMode( PaletteBackground ); |
162 | label = new QLabel( " / ", sectionBar ); | 166 | label = new QLabel( " / ", sectionBar ); |
163 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 167 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
164 | subsection = new QComboBox( false, sectionBar ); | 168 | subsection = new QComboBox( false, sectionBar ); |
165 | 169 | ||
166 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
167 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 171 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
168 | a->addTo( sectionBar ); | 172 | a->addTo( sectionBar ); |
169 | 173 | ||
170 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 174 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
171 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 175 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
172 | sectionAction->setToggleAction( true ); | 176 | sectionAction->setToggleAction( true ); |
173 | sectionAction->setOn( true ); | 177 | sectionAction->setOn( true ); |
174 | sectionAction->addTo( viewMenu ); | 178 | sectionAction->addTo( viewMenu ); |
175 | 179 | ||
176 | findBar = new QPEToolBar(this); | 180 | findBar = new QPEToolBar(this); |
177 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 181 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); |
178 | label = new QLabel( tr("Filter: "), findBar ); | 182 | label = new QLabel( tr("Filter: "), findBar ); |
179 | label->setBackgroundColor( findBar->backgroundColor() ); | 183 | label->setBackgroundColor( findBar->backgroundColor() ); |
180 | findBar->setHorizontalStretchable( TRUE ); | 184 | findBar->setHorizontalStretchable( TRUE ); |
181 | findEdit = new QLineEdit( findBar, "findEdit" ); | 185 | findEdit = new QLineEdit( findBar, "findEdit" ); |
182 | findBar->setStretchableWidget( findEdit ); | 186 | findBar->setStretchableWidget( findEdit ); |
183 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 187 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
184 | this, SLOT( displayList() ) ); | 188 | this, SLOT( displayList() ) ); |
185 | 189 | ||
186 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 190 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
187 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 191 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
188 | a->addTo( findBar ); | 192 | a->addTo( findBar ); |
189 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | 193 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); |
190 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 194 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
191 | findAction->setToggleAction( true ); | 195 | findAction->setToggleAction( true ); |
192 | findAction->setOn( true ); | 196 | findAction->setOn( true ); |
193 | findAction->addTo( viewMenu ); | 197 | findAction->addTo( viewMenu ); |
194 | 198 | ||
195 | #ifdef NEW | 199 | #ifdef NEW |
196 | Config cfg( "oipkg", Config::User ); | 200 | Config cfg( "oipkg", Config::User ); |
197 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 201 | cfg.setGroup( "Setting_" + QString::number( setting ) ); |
198 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | 202 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); |
199 | findShow(bool b) | 203 | findShow(bool b) |
200 | sectionShow(bool b) | 204 | sectionShow(bool b) |
201 | #endif | 205 | #endif |
202 | } | 206 | } |
203 | 207 | ||
204 | MainWindow::~MainWindow() | 208 | MainWindow::~MainWindow() |
205 | { | 209 | { |
206 | } | 210 | } |
207 | 211 | ||
208 | void MainWindow::runIpkg() | 212 | void MainWindow::runIpkg() |
209 | { | 213 | { |
210 | ipkg->commit( packageList ); | 214 | ipkg->commit( packageList ); |
211 | // ##### If we looked in the list of files, we could send out accurate | 215 | // ##### If we looked in the list of files, we could send out accurate |
212 | // ##### messages. But we don't bother yet, and just do an "all". | 216 | // ##### messages. But we don't bother yet, and just do an "all". |
213 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 217 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
214 | QString lf = QString::null; | 218 | QString lf = QString::null; |
215 | e << lf; | 219 | e << lf; |
216 | displayList(); | 220 | displayList(); |
217 | } | 221 | } |
218 | 222 | ||
219 | void MainWindow::updateList() | 223 | void MainWindow::updateList() |
220 | { | 224 | { |
221 | QTimer *t = new QTimer( this ); | 225 | QTimer *t = new QTimer( this ); |
222 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 226 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
223 | t->start( 0, false ); | 227 | t->start( 0, false ); |
224 | packageList.clear(); | 228 | packageList.clear(); |
225 | ipkg->update(); | 229 | ipkg->update(); |
226 | getList(); | 230 | getList(); |
227 | t->stop(); | 231 | t->stop(); |
228 | } | 232 | } |
229 | 233 | ||
230 | void MainWindow::getList() | 234 | void MainWindow::getList() |
231 | { | 235 | { |
232 | packageList.update(); | 236 | packageList.update(); |
233 | displayList(); | 237 | displayList(); |
234 | } | 238 | } |
235 | 239 | ||
236 | void MainWindow::filterList() | 240 | void MainWindow::filterList() |
237 | { | 241 | { |
238 | QString f = ""; | 242 | QString f = ""; |
239 | if ( findAction->isOn() ) f = findEdit->text(); | 243 | if ( findAction->isOn() ) f = findEdit->text(); |
240 | packageList.filterPackages( f ); | 244 | packageList.filterPackages( f ); |
241 | } | 245 | } |
242 | 246 | ||
243 | void MainWindow::displayList() | 247 | void MainWindow::displayList() |
244 | { | 248 | { |
245 | filterList(); | 249 | filterList(); |
246 | listViewPackages->clear(); | 250 | listViewPackages->clear(); |
247 | Package *pack = packageList.first(); | 251 | Package *pack = packageList.first(); |
248 | while( pack ) | 252 | while( pack ) |
249 | { | 253 | { |
250 | if ( pack && (pack->name() != "") ) | 254 | if ( pack && (pack->name() != "") ) |
251 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); | 255 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); |
252 | pack = packageList.next(); | 256 | pack = packageList.next(); |
253 | } | 257 | } |
254 | } | 258 | } |
255 | 259 | ||
256 | void MainWindow::sectionChanged() | 260 | void MainWindow::sectionChanged() |
257 | { | 261 | { |
258 | disconnect( section, SIGNAL( activated(int) ), | 262 | disconnect( section, SIGNAL( activated(int) ), |
259 | this, SLOT( sectionChanged() ) ); | 263 | this, SLOT( sectionChanged() ) ); |
260 | disconnect( subsection, SIGNAL(activated(int) ), | 264 | disconnect( subsection, SIGNAL(activated(int) ), |
261 | this, SLOT( subSectionChanged() ) ); | 265 | this, SLOT( subSectionChanged() ) ); |
262 | subsection->clear(); | 266 | subsection->clear(); |
263 | packageList.setSection( section->currentText() ); | 267 | packageList.setSection( section->currentText() ); |
264 | setSubSections(); | 268 | setSubSections(); |
265 | connect( section, SIGNAL( activated(int) ), | 269 | connect( section, SIGNAL( activated(int) ), |
266 | this, SLOT( sectionChanged() ) ); | 270 | this, SLOT( sectionChanged() ) ); |
267 | connect( subsection, SIGNAL(activated(int) ), | 271 | connect( subsection, SIGNAL(activated(int) ), |
268 | this, SLOT( subSectionChanged() ) ); | 272 | this, SLOT( subSectionChanged() ) ); |
269 | displayList(); | 273 | displayList(); |
270 | } | 274 | } |
271 | 275 | ||
272 | void MainWindow::subSectionChanged() | 276 | void MainWindow::subSectionChanged() |
273 | { | 277 | { |
274 | disconnect( section, SIGNAL( activated(int) ), | 278 | disconnect( section, SIGNAL( activated(int) ), |
275 | this, SLOT( sectionChanged() ) ); | 279 | this, SLOT( sectionChanged() ) ); |
276 | disconnect( subsection, SIGNAL(activated(int) ), | 280 | disconnect( subsection, SIGNAL(activated(int) ), |
277 | this, SLOT( subSectionChanged() ) ); | 281 | this, SLOT( subSectionChanged() ) ); |
278 | packageList.setSubSection( subsection->currentText() ); | 282 | packageList.setSubSection( subsection->currentText() ); |
279 | connect( section, SIGNAL( activated(int) ), | 283 | connect( section, SIGNAL( activated(int) ), |
280 | this, SLOT( sectionChanged() ) ); | 284 | this, SLOT( sectionChanged() ) ); |
281 | connect( subsection, SIGNAL(activated(int) ), | 285 | connect( subsection, SIGNAL(activated(int) ), |
282 | this, SLOT( subSectionChanged() ) ); | 286 | this, SLOT( subSectionChanged() ) ); |
283 | displayList(); | 287 | displayList(); |
284 | } | 288 | } |
285 | 289 | ||
286 | void MainWindow::setSections() | 290 | void MainWindow::setSections() |
287 | { | 291 | { |
288 | section->clear(); | 292 | section->clear(); |
289 | section->insertStringList( packageList.getSections() ); | 293 | section->insertStringList( packageList.getSections() ); |
290 | } | 294 | } |
291 | 295 | ||
292 | void MainWindow::setSubSections() | 296 | void MainWindow::setSubSections() |
293 | { | 297 | { |
294 | subsection->clear(); | 298 | subsection->clear(); |
295 | subsection->insertStringList( packageList.getSubSections() ); | 299 | subsection->insertStringList( packageList.getSubSections() ); |
296 | } | 300 | } |
297 | 301 | ||
298 | 302 | ||
299 | void MainWindow::showSettings() | 303 | void MainWindow::showSettings() |
300 | { | 304 | { |
301 | if ( settings->showDialog( 0 ) ) | 305 | if ( settings->showDialog( 0 ) ) |
302 | updateList(); | 306 | updateList(); |
303 | } | 307 | } |
304 | void MainWindow::showSettingsSrv() | 308 | void MainWindow::showSettingsSrv() |
305 | { | 309 | { |
306 | if ( settings->showDialog( 1 ) ) | 310 | if ( settings->showDialog( 1 ) ) |
307 | updateList(); | 311 | updateList(); |
308 | } | 312 | } |
309 | void MainWindow::showSettingsDst() | 313 | void MainWindow::showSettingsDst() |
310 | { | 314 | { |
311 | if ( settings->showDialog( 2 ) ) | 315 | if ( settings->showDialog( 2 ) ) |
312 | updateList(); | 316 | updateList(); |
313 | } | 317 | } |
314 | 318 | ||
315 | 319 | ||
316 | void MainWindow::showDetails() | 320 | void MainWindow::showDetails() |
317 | { | 321 | { |
318 | if ( details ) | 322 | if ( details ) |
319 | { | 323 | { |
320 | details = new PackageDetails( this ); | 324 | details = new PackageDetails( this ); |
321 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 325 | connect( details->install, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
322 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); | 326 | connect( details->remove, SIGNAL(clicked()), SLOT( toggleActivePackage() ) ); |
323 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); | 327 | connect( details->ignore, SIGNAL(clicked()), details, SLOT(close())); |
324 | details->description->setTextFormat(RichText); | 328 | details->description->setTextFormat(RichText); |
325 | } | 329 | } |
326 | if ( !activePackage ) | 330 | if ( !activePackage ) |
327 | { | 331 | { |
328 | details->description->setText(tr("no package selected")); | 332 | details->description->setText(tr("no package selected")); |
329 | details->description->setText(tr("errmm...<br>...not working?")); | 333 | details->description->setText(tr("errmm...<br>...not working?")); |
330 | }else{ | 334 | }else{ |
331 | details->setCaption("Package: " + activePackage->name()); | 335 | details->setCaption("Package: " + activePackage->name()); |
332 | details->description->setText(activePackage->details() ); | 336 | details->description->setText(activePackage->details() ); |
333 | details->install->setEnabled(!activePackage->installed()); | 337 | details->install->setEnabled(!activePackage->installed()); |
334 | details->remove->setEnabled(activePackage->installed()); | 338 | details->remove->setEnabled(activePackage->installed()); |
335 | } | 339 | } |
336 | details->showMaximized(); | 340 | details->showMaximized(); |
337 | } | 341 | } |
338 | 342 | ||
339 | void MainWindow::toggleActivePackage() | 343 | void MainWindow::toggleActivePackage() |
340 | { | 344 | { |
341 | activePackage->toggleProcess(); | 345 | activePackage->toggleProcess(); |
342 | if ( details ) details->close(); | 346 | if ( details ) details->close(); |
343 | } | 347 | } |
344 | 348 | ||
345 | void MainWindow::setCurrent( QListViewItem* p ) | 349 | void MainWindow::setCurrent( QListViewItem* p ) |
346 | { | 350 | { |
347 | if ( !p ) return; | 351 | if ( !p ) return; |
348 | activePackageListItem = (PackageListItem*)p; | 352 | activePackageListItem = (PackageListItem*)p; |
349 | activePackage = activePackageListItem->getPackage(); | 353 | activePackage = activePackageListItem->getPackage(); |
350 | pvDebug(5, "start timer"); | 354 | pvDebug(5, "start timer"); |
351 | popupTimer->start( 750, true ); | 355 | popupTimer->start( 750, true ); |
352 | } | 356 | } |
353 | 357 | ||
354 | void MainWindow::sectionShow(bool b) | 358 | void MainWindow::sectionShow(bool b) |
355 | { | 359 | { |
356 | if (b) sectionBar->show(); | 360 | if (b) sectionBar->show(); |
357 | else sectionBar->hide(); | 361 | else sectionBar->hide(); |
358 | sectionAction->setOn( b ); | 362 | sectionAction->setOn( b ); |
359 | } | 363 | } |
360 | 364 | ||
361 | void MainWindow::sectionClose() | 365 | void MainWindow::sectionClose() |
362 | { | 366 | { |
363 | sectionAction->setOn( false ); | 367 | sectionAction->setOn( false ); |
364 | } | 368 | } |
365 | 369 | ||
366 | void MainWindow::findShow(bool b) | 370 | void MainWindow::findShow(bool b) |
367 | { | 371 | { |
368 | if (b) findBar->show(); | 372 | if (b) findBar->show(); |
369 | else findBar->hide(); | 373 | else findBar->hide(); |
370 | findAction->setOn( b ); | 374 | findAction->setOn( b ); |
371 | } | 375 | } |
372 | 376 | ||
373 | void MainWindow::findClose() | 377 | void MainWindow::findClose() |
374 | { | 378 | { |
375 | findAction->setOn( false ); | 379 | findAction->setOn( false ); |
376 | } | 380 | } |
377 | 381 | ||
378 | void MainWindow::rotateUpdateIcon() | 382 | void MainWindow::rotateUpdateIcon() |
379 | { | 383 | { |
380 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 384 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
381 | if ( updateIcon ) | 385 | if ( updateIcon ) |
382 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 386 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
383 | else | 387 | else |
384 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 388 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
385 | updateIcon = !updateIcon; | 389 | updateIcon = !updateIcon; |
386 | } | 390 | } |
387 | 391 | ||
388 | void MainWindow::showPopup() | 392 | void MainWindow::showPopup() |
389 | { | 393 | { |
390 | popupMenu->clear(); | 394 | popupMenu->clear(); |
391 | destsMenu->clear(); | 395 | destsMenu->clear(); |
392 | 396 | ||
393 | QAction *popupAction; | 397 | QAction *popupAction; |
394 | popupMenu->insertItem( tr("Install to"), destsMenu ); | 398 | popupMenu->insertItem( tr("Install to"), destsMenu ); |
395 | QStringList dests = settings->getDestinationNames(); | 399 | QStringList dests = settings->getDestinationNames(); |
396 | for (uint i = 0; i < dests.count(); i++ ) | 400 | for (uint i = 0; i < dests.count(); i++ ) |
397 | { | 401 | { |
398 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 402 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
399 | popupAction->addTo( destsMenu ); | 403 | popupAction->addTo( destsMenu ); |
400 | } | 404 | } |
401 | connect( destsMenu, SIGNAL( activated( int ) ), | 405 | connect( destsMenu, SIGNAL( activated( int ) ), |
402 | this, SLOT( changePackageDest( int ) ) ); | 406 | this, SLOT( changePackageDest( int ) ) ); |
403 | popupMenu->popup( QCursor::pos() ); | 407 | popupMenu->popup( QCursor::pos() ); |
404 | } | 408 | } |
405 | 409 | ||
406 | void MainWindow::changePackageDest( int i ) | 410 | void MainWindow::changePackageDest( int i ) |
407 | { | 411 | { |
408 | activePackage->setDest( destsMenu->text(i) ); | 412 | activePackage->setDest( destsMenu->text(i) ); |
409 | activePackage->setOn(); | 413 | activePackage->setOn(); |
410 | activePackage->setLink( settings->createLinks() ); | 414 | activePackage->setLink( settings->createLinks() ); |
411 | activePackageListItem->displayDetails(); | 415 | activePackageListItem->displayDetails(); |
412 | } | 416 | } |
413 | 417 | ||
414 | void MainWindow::stopTimer( QListViewItem* ) | 418 | void MainWindow::stopTimer( QListViewItem* ) |
415 | { | 419 | { |
416 | pvDebug( 5, "stop timer" ); | 420 | pvDebug( 5, "stop timer" ); |
417 | popupTimer->stop(); | 421 | popupTimer->stop(); |
418 | } | 422 | } |
423 | |||
424 | void MainWindow::setDocument(const QString &fileName) | ||
425 | { | ||
426 | ipkg->installFile( fileName ); | ||
427 | } | ||
428 | |||
429 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | ||
430 | { | ||
431 | pvDebug(3, "QCop "+msg); | ||
432 | if ( msg == "setDocument(QString)" ) | ||
433 | { | ||
434 | setDocument( QString(arg) ); | ||
435 | } | ||
436 | } \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index adc5e78..34943f2 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -1,83 +1,88 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
8 | 8 | ||
9 | #include "packagelist.h" | 9 | #include "packagelist.h" |
10 | #include "pmipkg.h" | 10 | #include "pmipkg.h" |
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | #include "pkdesc.h" | 12 | #include "pkdesc.h" |
13 | 13 | ||
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QPEToolBar; | 15 | class QPEToolBar; |
16 | class QLineEdit; | 16 | class QLineEdit; |
17 | class QListView; | 17 | class QListView; |
18 | class PackageListItem; | 18 | class PackageListItem; |
19 | class QCopChannel; | ||
19 | 20 | ||
20 | class MainWindow : public QMainWindow | 21 | class MainWindow : public QMainWindow |
21 | { | 22 | { |
22 | Q_OBJECT | 23 | Q_OBJECT |
23 | 24 | ||
24 | 25 | ||
25 | public: | 26 | public: |
26 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 27 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
27 | ~MainWindow(); | 28 | ~MainWindow(); |
28 | 29 | ||
30 | QCopChannel *channel; | ||
31 | |||
29 | protected slots: | 32 | protected slots: |
30 | void runIpkg(); | 33 | void runIpkg(); |
31 | void getList(); | 34 | void getList(); |
32 | void updateList(); | 35 | void updateList(); |
33 | void displayList(); | 36 | void displayList(); |
34 | void subSectionChanged(); | 37 | void subSectionChanged(); |
35 | void sectionChanged(); | 38 | void sectionChanged(); |
36 | void showSettings(); | 39 | void showSettings(); |
37 | void showSettingsSrv(); | 40 | void showSettingsSrv(); |
38 | void showSettingsDst(); | 41 | void showSettingsDst(); |
42 | void setDocument (const QString &); | ||
39 | 43 | ||
40 | public slots: | 44 | public slots: |
41 | void showDetails(); | 45 | void showDetails(); |
42 | void toggleActivePackage(); | 46 | void toggleActivePackage(); |
43 | void setCurrent( QListViewItem* ); | 47 | void setCurrent( QListViewItem* ); |
44 | void sectionClose(); | 48 | void sectionClose(); |
45 | void sectionShow(bool); | 49 | void sectionShow(bool); |
46 | void findClose(); | 50 | void findClose(); |
47 | void findShow(bool); | 51 | void findShow(bool); |
48 | void filterList(); | 52 | void filterList(); |
49 | void showPopup(); | 53 | void showPopup(); |
50 | void changePackageDest( int ); | 54 | void changePackageDest( int ); |
51 | void stopTimer( QListViewItem* ); | 55 | void stopTimer( QListViewItem* ); |
56 | void receive (const QCString &, const QByteArray &); | ||
52 | 57 | ||
53 | private: | 58 | private: |
54 | void makeMenu(); | 59 | void makeMenu(); |
55 | void setSections(); | 60 | void setSections(); |
56 | void setSubSections(); | 61 | void setSubSections(); |
57 | 62 | ||
58 | PmIpkg* ipkg; | 63 | PmIpkg* ipkg; |
59 | PackageManagerSettings *settings; | 64 | PackageManagerSettings *settings; |
60 | PackageDetails* details; | 65 | PackageDetails* details; |
61 | PackageList packageList; | 66 | PackageList packageList; |
62 | Package *activePackage; | 67 | Package *activePackage; |
63 | PackageListItem *activePackageListItem; | 68 | PackageListItem *activePackageListItem; |
64 | QAction *runAction; | 69 | QAction *runAction; |
65 | QAction *detailsAction; | 70 | QAction *detailsAction; |
66 | QAction *updateAction; | 71 | QAction *updateAction; |
67 | QAction *findAction; | 72 | QAction *findAction; |
68 | QAction *sectionAction; | 73 | QAction *sectionAction; |
69 | QListView *listViewPackages; | 74 | QListView *listViewPackages; |
70 | QPEToolBar *findBar; | 75 | QPEToolBar *findBar; |
71 | QLineEdit *findEdit; | 76 | QLineEdit *findEdit; |
72 | QPEToolBar *sectionBar; | 77 | QPEToolBar *sectionBar; |
73 | QComboBox *section; | 78 | QComboBox *section; |
74 | QComboBox *subsection; | 79 | QComboBox *subsection; |
75 | QTimer *popupTimer; | 80 | QTimer *popupTimer; |
76 | QPopupMenu *popupMenu; | 81 | QPopupMenu *popupMenu; |
77 | QPopupMenu *destsMenu; | 82 | QPopupMenu *destsMenu; |
78 | bool updateIcon; | 83 | bool updateIcon; |
79 | private slots: | 84 | private slots: |
80 | void rotateUpdateIcon(); | 85 | void rotateUpdateIcon(); |
81 | }; | 86 | }; |
82 | 87 | ||
83 | #endif | 88 | #endif |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 3b31b4d..45c89c5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,316 +1,348 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pkdesc.h" | 2 | #include "pkdesc.h" |
3 | #include "pksettings.h" | 3 | #include "pksettings.h" |
4 | #include "package.h" | 4 | #include "package.h" |
5 | #include "packagelistitem.h" | 5 | #include "packagelistitem.h" |
6 | 6 | ||
7 | #include <qpe/process.h> | 7 | #include <qpe/process.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/stringutil.h> | 10 | #include <qpe/stringutil.h> |
11 | #include <qdir.h> | 11 | #include <qdir.h> |
12 | #include <qfile.h> | 12 | #include <qfile.h> |
13 | #include <qmultilineedit.h> | 13 | #include <qmultilineedit.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
16 | #include <qtextview.h> | 16 | #include <qtextview.h> |
17 | 17 | ||
18 | #include <qprogressbar.h> | 18 | #include <qprogressbar.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qlayout.h> | 20 | #include <qlayout.h> |
21 | 21 | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | 24 | ||
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | 26 | ||
27 | 27 | ||
28 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 28 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
29 | : QObject ( p ) | 29 | : QObject ( p ) |
30 | { | 30 | { |
31 | settings = s; | 31 | settings = s; |
32 | runwindowopen = false; | 32 | runwindowopen = false; |
33 | runwindow = new RunWindow( p, name, true, f ); | 33 | runwindow = new RunWindow( p, name, true, f ); |
34 | } | 34 | } |
35 | 35 | ||
36 | PmIpkg::~PmIpkg() | 36 | PmIpkg::~PmIpkg() |
37 | { | 37 | { |
38 | } | 38 | } |
39 | 39 | ||
40 | //#define PROC | 40 | //#define PROC |
41 | #define SYSTEM | 41 | #define SYSTEM |
42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | 42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
43 | { | 43 | { |
44 | pvDebug(2,"PmIpkg::runIpkg "+args); | 44 | pvDebug(2,"PmIpkg::runIpkg "+args); |
45 | 45 | ||
46 | #ifdef PROC | 46 | #ifdef PROC |
47 | QStringList cmd = "/usr/bin/ipkg "; | 47 | QStringList cmd = "/usr/bin/ipkg "; |
48 | #endif | 48 | #endif |
49 | #ifdef SYSTEM | 49 | #ifdef SYSTEM |
50 | QString cmd = "/usr/bin/ipkg "; | 50 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | 51 | #endif |
52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
53 | if ( dest == "" ) | 53 | if ( dest == "" ) |
54 | cmd += " -dest "+settings->getDestinationName(); | 54 | cmd += " -dest "+settings->getDestinationName(); |
55 | else | 55 | else |
56 | cmd += " -dest "+ dest; | 56 | cmd += " -dest "+ dest; |
57 | 57 | ||
58 | cmd += " -force-defaults "; | 58 | cmd += " -force-defaults "; |
59 | 59 | ||
60 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 60 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
61 | cmd += args; | 61 | cmd += args; |
62 | int r = 0; | 62 | int r = 0; |
63 | #ifdef PROC | 63 | #ifdef PROC |
64 | QString o = "start"; | 64 | QString o = "start"; |
65 | Process *ipkg = new Process( "ls");//cmd ); | 65 | Process *ipkg = new Process( "ls");//cmd ); |
66 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | 66 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); |
67 | QString description; | 67 | QString description; |
68 | ipkg->exec("",o); | 68 | ipkg->exec("",o); |
69 | // out( o ); | 69 | // out( o ); |
70 | #endif | 70 | #endif |
71 | #ifdef SYSTEM | 71 | #ifdef SYSTEM |
72 | out( "running:<br>\n"+cmd+"<br>\n" ); | 72 | out( "running:<br>\n"+cmd+"<br>\n" ); |
73 | QString redirect = "/tmp/oipkg.pipe"; | 73 | QString redirect = "/tmp/oipkg.pipe"; |
74 | cmd += " | tee "+redirect+" 2>&1"; | 74 | cmd += " | tee "+redirect+" 2>&1"; |
75 | pvDebug(2, "running >"+cmd+"<"); | 75 | pvDebug(2, "running >"+cmd+"<"); |
76 | r = system(cmd.latin1()); | 76 | r = system(cmd.latin1()); |
77 | QFile f( redirect ); | 77 | QFile f( redirect ); |
78 | QString line; | 78 | QString line; |
79 | QString oldLine; | 79 | QString oldLine; |
80 | while ( ! f.open(IO_ReadOnly) ) {}; | 80 | while ( ! f.open(IO_ReadOnly) ) {}; |
81 | // { | 81 | // { |
82 | QTextStream t( &f ); | 82 | QTextStream t( &f ); |
83 | // QString fp; | 83 | // QString fp; |
84 | while ( !t.eof() ) | 84 | while ( !t.eof() ) |
85 | { | 85 | { |
86 | line = t.readLine(); | 86 | line = t.readLine(); |
87 | if ( line != oldLine ) | 87 | if ( line != oldLine ) |
88 | { | 88 | { |
89 | out( line +"<br>" ); | 89 | out( line +"<br>" ); |
90 | oldLine = line; | 90 | oldLine = line; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | // } | 93 | // } |
94 | f.close(); | 94 | f.close(); |
95 | out( "Finished!<br>"); | 95 | out( "Finished!<br>"); |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | return r; | 98 | return r; |
99 | } | 99 | } |
100 | 100 | ||
101 | void PmIpkg::makeLinks(Package *pack) | 101 | void PmIpkg::makeLinks(Package *pack) |
102 | { | 102 | { |
103 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 103 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
104 | QString dest = settings->getDestinationUrlByName( pack->dest() ); | 104 | QString dest = settings->getDestinationUrlByName( pack->dest() ); |
105 | if (dest == "/" ) return; | 105 | if (dest == "/" ) return; |
106 | out( "<br>creating links<br>" ); | 106 | out( "<br>creating links<br>" ); |
107 | out("for package "+pack->name()+" in "+dest+"<br>"); | 107 | out("for package "+pack->name()+" in "+dest+"<br>"); |
108 | { | 108 | { |
109 | Config cfg( "oipkg", Config::User ); | 109 | Config cfg( "oipkg", Config::User ); |
110 | cfg.setGroup( "Common" ); | 110 | cfg.setGroup( "Common" ); |
111 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 111 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
112 | } | 112 | } |
113 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; | 113 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; |
114 | QFile f( fn ); | 114 | linkPackage( fn, dest ); |
115 | if ( ! f.open(IO_ReadOnly) ) | 115 | } |
116 | |||
117 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
118 | { | ||
119 | QFile f( packFileName ); | ||
120 | if ( ! f.open(IO_ReadOnly) ) | ||
116 | { | 121 | { |
117 | out( "<b>Panik!</b> Could not open:<br>"+fn ); | 122 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
118 | return; | 123 | return; |
119 | }; | 124 | }; |
120 | QTextStream t( &f ); | 125 | QTextStream t( &f ); |
121 | QString fp; | 126 | QString fp; |
122 | while ( !t.eof() ) | 127 | while ( !t.eof() ) |
123 | { | 128 | { |
124 | fp = t.readLine(); | 129 | fp = t.readLine(); |
125 | processLinkDir( fp, dest ); | 130 | processLinkDir( fp, dest ); |
126 | } | 131 | } |
127 | f.close(); | 132 | f.close(); |
128 | } | 133 | } |
129 | 134 | ||
130 | void PmIpkg::processLinkDir( QString file, QString dest ) | 135 | void PmIpkg::processLinkDir( QString file, QString dest ) |
131 | { | 136 | { |
132 | if ( dest == "???" ) return; | 137 | if ( dest == "???" ) return; |
133 | QString destFile = file; | 138 | QString destFile = file; |
134 | file = dest+"/"+file; | 139 | file = dest+"/"+file; |
135 | if (file == dest) return; | 140 | if (file == dest) return; |
136 | QFileInfo fileInfo( file ); | 141 | QFileInfo fileInfo( file ); |
137 | if ( fileInfo.isDir() ) | 142 | if ( fileInfo.isDir() ) |
138 | { | 143 | { |
139 | QDir destDir( destFile ); | 144 | QDir destDir( destFile ); |
140 | destDir.mkdir( destFile, true ); | 145 | destDir.mkdir( destFile, true ); |
141 | QDir d( file ); | 146 | QDir d( file ); |
142 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 147 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
143 | const QFileInfoList *list = d.entryInfoList(); | 148 | const QFileInfoList *list = d.entryInfoList(); |
144 | QFileInfoListIterator it( *list ); | 149 | QFileInfoListIterator it( *list ); |
145 | QFileInfo *fi; | 150 | QFileInfo *fi; |
146 | while ( (fi=it.current()) ) | 151 | while ( (fi=it.current()) ) |
147 | { | 152 | { |
148 | // out( "<b>"+fi->absFilePath()+"</b>" ); | 153 | // out( "<b>"+fi->absFilePath()+"</b>" ); |
149 | processLinkDir( fi->absFilePath(), dest ); | 154 | processLinkDir( fi->absFilePath(), dest ); |
150 | ++it; | 155 | ++it; |
151 | } | 156 | } |
152 | } else | 157 | } else |
153 | if ( fileInfo.isFile() ) | 158 | if ( fileInfo.isFile() ) |
154 | { | 159 | { |
155 | const char *instFile = strdup( (file).ascii() ); | 160 | const char *instFile = strdup( (file).ascii() ); |
156 | const char *linkFile = strdup( (destFile).ascii()); | 161 | const char *linkFile = strdup( (destFile).ascii()); |
157 | // out( "linking: "+file+" -> "+destFile ); | 162 | // out( "linking: "+file+" -> "+destFile ); |
158 | qDebug( "linking: %s -> %s", instFile, linkFile ); | 163 | qDebug( "linking: %s -> %s", instFile, linkFile ); |
159 | symlink( instFile, linkFile ); | 164 | symlink( instFile, linkFile ); |
160 | } | 165 | } |
161 | } | 166 | } |
162 | 167 | ||
163 | void PmIpkg::commit( PackageList pl ) | 168 | void PmIpkg::commit( PackageList pl ) |
164 | { | 169 | { |
165 | show( false ); | 170 | show( false ); |
166 | runwindow->outPut->setText(""); | 171 | runwindow->outPut->setText(""); |
167 | out( "<h1>"+tr("Todo")+"</h1>\n"); | 172 | out( "<h1>"+tr("Todo")+"</h1>\n"); |
168 | 173 | ||
169 | to_install.clear(); | 174 | to_install.clear(); |
170 | to_remove.clear(); | 175 | to_remove.clear(); |
171 | int sizecount = 0; | 176 | int sizecount = 0; |
172 | QString rem="<b>To remove:</b><br>\n"; | 177 | QString rem="<b>To remove:</b><br>\n"; |
173 | QString inst="<b>To install:</b><br>\n";; | 178 | QString inst="<b>To install:</b><br>\n";; |
174 | pl.allPackages(); | 179 | pl.allPackages(); |
175 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 180 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
176 | { | 181 | { |
177 | if ( pack && (pack->name() != "") && pack) | 182 | if ( pack && (pack->name() != "") && pack) |
178 | { | 183 | { |
179 | if ( pack->toInstall() ) | 184 | if ( pack->toInstall() ) |
180 | { | 185 | { |
181 | to_install.append( pack ); | 186 | to_install.append( pack ); |
182 | sizecount += pack->size().toInt(); | 187 | sizecount += pack->size().toInt(); |
183 | inst += pack->name()+"\t(on "+pack->dest()+")<br>"; | 188 | inst += pack->name()+"\t(on "+pack->dest()+")<br>"; |
184 | } | 189 | } |
185 | if ( pack->toRemove() ) | 190 | if ( pack->toRemove() ) |
186 | { | 191 | { |
187 | to_remove.append( pack ); | 192 | to_remove.append( pack ); |
188 | sizecount += 1; | 193 | sizecount += 1; |
189 | rem += pack->name()+"<br>"; | 194 | rem += pack->name()+"<br>"; |
190 | } | 195 | } |
191 | } | 196 | } |
192 | } | 197 | } |
193 | 198 | ||
194 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); | 199 | out("<p>"+inst+"</p>"+"<p>"+rem+"</p><hl>"); |
195 | 200 | ||
196 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); | 201 | qDebug("to remove=%i; to install=%i",to_remove.count(),to_install.count()); |
197 | 202 | ||
198 | runwindow->progress->setTotalSteps( sizecount ); | 203 | runwindow->progress->setTotalSteps( sizecount ); |
199 | 204 | ||
200 | connect( runwindow->doItButton, SIGNAL( clicked() ), | 205 | connect( runwindow->doItButton, SIGNAL( clicked() ), |
201 | SLOT( doIt() ) ); | 206 | SLOT( doIt() ) ); |
202 | connect( runwindow->installButton, SIGNAL( clicked() ), | 207 | connect( runwindow->installButton, SIGNAL( clicked() ), |
203 | this, SLOT( install() ) ); | 208 | this, SLOT( install() ) ); |
204 | connect( runwindow->removeButton, SIGNAL( clicked() ), | 209 | connect( runwindow->removeButton, SIGNAL( clicked() ), |
205 | this, SLOT( remove() ) ); | 210 | this, SLOT( remove() ) ); |
206 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | 211 | connect( runwindow->cancelButton, SIGNAL( clicked() ), |
207 | runwindow, SLOT( close() ) ); | 212 | runwindow, SLOT( close() ) ); |
208 | 213 | ||
209 | runwindow->exec(); | 214 | runwindow->exec(); |
210 | return; | 215 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); |
211 | } | 216 | } |
212 | 217 | ||
213 | void PmIpkg::doIt() | 218 | void PmIpkg::doIt() |
214 | { | 219 | { |
215 | remove(); | 220 | remove(); |
216 | install(); | 221 | install(); |
217 | } | 222 | } |
218 | 223 | ||
219 | 224 | ||
220 | void PmIpkg::remove() | 225 | void PmIpkg::remove() |
221 | { | 226 | { |
222 | if ( to_remove.count() == 0 ) return; | 227 | if ( to_remove.count() == 0 ) return; |
223 | show( true ); | 228 | show( true ); |
224 | 229 | ||
225 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); | 230 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); |
226 | 231 | ||
227 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 232 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
228 | { | 233 | { |
229 | if ( runIpkg("remove " + it->name()) == 0) | 234 | if ( runIpkg("remove " + it->name()) == 0) |
230 | { | 235 | { |
231 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 236 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
232 | it->processed(); | 237 | it->processed(); |
233 | runwindow->progress->setProgress( 1 ); | 238 | runwindow->progress->setProgress( 1 ); |
234 | }else{ | 239 | }else{ |
235 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); | 240 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); |
236 | } | 241 | } |
237 | } | 242 | } |
238 | } | 243 | } |
239 | 244 | ||
240 | 245 | ||
241 | void PmIpkg::install() | 246 | void PmIpkg::install() |
242 | { | 247 | { |
243 | if ( to_install.count() == 0 ) return; | 248 | if ( to_install.count() == 0 ) return; |
244 | show( true ); | 249 | show( true ); |
245 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 250 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
246 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 251 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
247 | { | 252 | { |
248 | 253 | ||
249 | if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) | 254 | if ( runIpkg("install " + it->name(), it->dest() ) == 0 ) |
250 | { | 255 | { |
251 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 256 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
252 | if ( it->link() ) | 257 | if ( it->link() ) |
253 | makeLinks( it ); | 258 | makeLinks( it ); |
254 | it->processed(); | 259 | it->processed(); |
255 | }else{ | 260 | }else{ |
256 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); | 261 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); |
257 | } | 262 | } |
258 | } | 263 | } |
259 | } | 264 | } |
260 | 265 | ||
261 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 266 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) |
262 | { | 267 | { |
263 | qDebug("msg="+msg+" -- "+QString(dest) ); | 268 | qDebug("msg="+msg+" -- "+QString(dest) ); |
264 | // QDir d( src ); | 269 | // QDir d( src ); |
265 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 270 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
266 | //// if (! d.exists() ) return; | 271 | //// if (! d.exists() ) return; |
267 | // const QFileInfoList *list = d.entryInfoList(); | 272 | // const QFileInfoList *list = d.entryInfoList(); |
268 | // QFileInfoListIterator it( *list ); | 273 | // QFileInfoListIterator it( *list ); |
269 | // QFileInfo *fi; | 274 | // QFileInfo *fi; |
270 | // while ( (fi=it.current()) ) { | 275 | // while ( (fi=it.current()) ) { |
271 | // processLinkDir( fi->absFilePath(), dest ); | 276 | // processLinkDir( fi->absFilePath(), dest ); |
272 | // ++it; | 277 | // ++it; |
273 | // } | 278 | // } |
274 | } | 279 | } |
275 | 280 | ||
276 | void PmIpkg::update() | 281 | void PmIpkg::update() |
277 | { | 282 | { |
278 | show( false ); | 283 | show( false ); |
279 | runIpkg( "update" ); | 284 | runIpkg( "update" ); |
280 | runwindow->close(); | 285 | runwindow->close(); |
281 | } | 286 | } |
282 | 287 | ||
283 | void PmIpkg::out( QString o ) | 288 | void PmIpkg::out( QString o ) |
284 | { | 289 | { |
285 | runwindow->outPut->setText( runwindow->outPut->text()+o ); | 290 | runwindow->outPut->setText( runwindow->outPut->text()+o ); |
286 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 291 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
287 | } | 292 | } |
288 | 293 | ||
289 | 294 | ||
290 | void PmIpkg::showButtons(bool b) | 295 | void PmIpkg::showButtons(bool b) |
291 | { | 296 | { |
292 | if ( b ) | 297 | if ( b ) |
293 | { | 298 | { |
294 | runwindow->cancelButton->hide(); | 299 | runwindow->cancelButton->hide(); |
295 | runwindow->doItButton->hide(); | 300 | runwindow->doItButton->hide(); |
296 | runwindow->removeButton->hide(); | 301 | runwindow->removeButton->hide(); |
297 | runwindow->installButton->hide(); | 302 | runwindow->installButton->hide(); |
298 | }else{ | 303 | }else{ |
299 | runwindow->cancelButton->show(); | 304 | runwindow->cancelButton->show(); |
300 | runwindow->doItButton->show(); | 305 | runwindow->doItButton->show(); |
301 | runwindow->removeButton->show(); | 306 | runwindow->removeButton->show(); |
302 | runwindow->installButton->show(); | 307 | runwindow->installButton->show(); |
303 | 308 | ||
304 | } | 309 | } |
305 | } | 310 | } |
306 | 311 | ||
307 | void PmIpkg::show(bool b) | 312 | void PmIpkg::show(bool b) |
308 | { | 313 | { |
309 | if (!runwindow->isVisible()) | 314 | if (!runwindow->isVisible()) |
310 | runwindow->showMaximized(); | 315 | runwindow->showMaximized(); |
311 | showButtons(b); | 316 | showButtons(b); |
312 | if ( b ) | 317 | if ( b ) |
313 | runwindow->progress->hide(); | 318 | runwindow->progress->hide(); |
314 | else | 319 | else |
315 | runwindow->progress->show(); | 320 | runwindow->progress->show(); |
316 | } | 321 | } |
322 | |||
323 | void PmIpkg::installFile(const QString &fileName) | ||
324 | { | ||
325 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | ||
326 | show( false ); | ||
327 | runwindow->outPut->setText(""); | ||
328 | fileNameToInstall = fileName; | ||
329 | runwindow->doItButton->hide(); | ||
330 | runwindow->removeButton->hide(); | ||
331 | out("<b>"+tr("Install: ")+fileName); | ||
332 | connect( runwindow->installButton, SIGNAL( clicked() ), | ||
333 | this, SLOT( installFileName() ) ); | ||
334 | connect( runwindow->cancelButton, SIGNAL( clicked() ), | ||
335 | runwindow, SLOT( close() ) ); | ||
336 | |||
337 | runwindow->exec(); | ||
338 | } | ||
339 | |||
340 | void PmIpkg::installFileName() | ||
341 | { | ||
342 | if ( !QFile::exists( fileNameToInstall ) ) return; | ||
343 | out(tr("Installing pacakge ")+fileNameToInstall+"<br>"+tr("please wait")+"</b><br>"); | ||
344 | runIpkg("install " + fileNameToInstall ); | ||
345 | if ( settings->createLinks() ) | ||
346 | linkPackage( fileNameToInstall, settings->getDestinationUrl() ); | ||
347 | out("<h1>"+tr("Its now save to close this window")+"<h1>"); | ||
348 | } \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index c57adb7..8e06f4c 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,47 +1,51 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
11 | #include "packagelist.h" | 11 | #include "packagelist.h" |
12 | #include "debug.h" | 12 | #include "debug.h" |
13 | 13 | ||
14 | class Package; | 14 | class Package; |
15 | class PmIpkg : public QObject | 15 | class PmIpkg : public QObject |
16 | { | 16 | { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | public: | 18 | public: |
19 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 19 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
20 | ~PmIpkg(); | 20 | ~PmIpkg(); |
21 | 21 | ||
22 | void commit( PackageList ); | 22 | void commit( PackageList ); |
23 | void update(); | 23 | void update(); |
24 | PackageList* getPackageList(); | 24 | PackageList* getPackageList(); |
25 | void showButtons(bool b=true); | 25 | void showButtons(bool b=true); |
26 | void show( bool buttons=true ); | 26 | void show( bool buttons=true ); |
27 | 27 | ||
28 | private: | 28 | private: |
29 | PackageManagerSettings* settings; | 29 | PackageManagerSettings* settings; |
30 | RunWindow *runwindow; | 30 | RunWindow *runwindow; |
31 | QList<Package> to_remove; | 31 | QList<Package> to_remove; |
32 | QList<Package> to_install; | 32 | QList<Package> to_install; |
33 | bool runwindowopen; | 33 | bool runwindowopen; |
34 | QString fileNameToInstall; | ||
34 | 35 | ||
35 | void makeLinks(Package*); | 36 | void makeLinks(Package*); |
37 | void linkPackage( QString, QString ); | ||
36 | void processLinkDir( QString, QString ); | 38 | void processLinkDir( QString, QString ); |
37 | int runIpkg(const QString& args, const QString& dest="" ); | 39 | int runIpkg(const QString& args, const QString& dest="" ); |
38 | void out( QString ); | 40 | void out( QString ); |
39 | 41 | ||
40 | public slots: | 42 | public slots: |
41 | void doIt(); | 43 | void doIt(); |
42 | void install(); | 44 | void install(); |
45 | void installFileName(); | ||
43 | void remove(); | 46 | void remove(); |
47 | void installFile(const QString &fileName); | ||
44 | void linkDestination( const QString, const QByteArray ); | 48 | void linkDestination( const QString, const QByteArray ); |
45 | }; | 49 | }; |
46 | 50 | ||
47 | #endif | 51 | #endif |