-rw-r--r-- | noncore/unsupported/oipkg/main.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 65 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 7 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 17 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 1 |
8 files changed, 62 insertions, 47 deletions
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp index 4af59b0..5cef2dc 100644 --- a/noncore/unsupported/oipkg/main.cpp +++ b/noncore/unsupported/oipkg/main.cpp | |||
@@ -1,19 +1,22 @@ | |||
1 | 1 | ||
2 | #include "mainwindow.h" | 2 | #include "mainwindow.h" |
3 | 3 | ||
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | #include <qmessagebox.h> | ||
6 | int debugLevel; | 7 | int debugLevel; |
7 | 8 | ||
8 | int main( int argc, char ** argv ) | 9 | int main( int argc, char ** argv ) |
9 | { | 10 | { |
11 | |||
10 | debugLevel = 2; | 12 | debugLevel = 2; |
11 | if (argc > 0) | 13 | if (argc > 0) |
12 | { | 14 | { |
13 | debugLevel = QString ( argv[1] ).toInt(); | 15 | debugLevel = QString ( argv[1] ).toInt(); |
14 | } | 16 | } |
15 | QPEApplication a( argc, argv ); | 17 | QPEApplication a( argc, argv ); |
16 | MainWindow mw; | 18 | MainWindow mw; |
19 | QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); | ||
17 | a.showMainDocumentWidget( &mw ); | 20 | a.showMainDocumentWidget( &mw ); |
18 | return a.exec(); | 21 | return a.exec(); |
19 | } | 22 | } |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 06828e0..4865c39 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,482 +1,483 @@ | |||
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 | ||
42 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | 42 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); |
43 | //wait = new QMessageBox(this); | 43 | //wait = new QMessageBox(this); |
44 | // wait->setText(tr("Please wait")); | 44 | // wait->setText(tr("Please wait")); |
45 | ipkg = new PmIpkg( settings, this ); | 45 | ipkg = new PmIpkg( settings, this ); |
46 | // settings->setIpkg( ipkg ); | 46 | // settings->setIpkg( ipkg ); |
47 | packageList.setSettings( settings ); | 47 | packageList.setSettings( settings ); |
48 | packageListSearch.setSettings( settings ); | 48 | packageListSearch.setSettings( settings ); |
49 | packageList.update(); | 49 | packageList.update(); |
50 | makeMenu(); | 50 | makeMenu(); |
51 | makeChannel(); | 51 | makeChannel(); |
52 | //opie is hardcoded default ;) | 52 | //opie is hardcoded default ;) |
53 | for (int i=0;i<section->count();i++) | 53 | for (int i=0;i<section->count();i++) |
54 | if (section->text(i)=="opie") | 54 | if (section->text(i)=="opie") |
55 | section->setCurrentItem(i); | 55 | section->setCurrentItem(i); |
56 | sectionChanged(); | 56 | sectionChanged(); |
57 | 57 | ||
58 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 58 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
59 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 59 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
60 | 60 | ||
61 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 61 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
62 | SLOT(removeLinks()) ); | 62 | SLOT(removeLinks()) ); |
63 | connect( settings->createLinksButton, SIGNAL( clicked()), | 63 | connect( settings->createLinksButton, SIGNAL( clicked()), |
64 | SLOT(createLinks()) ); | 64 | SLOT(createLinks()) ); |
65 | 65 | ||
66 | //rootLocal = new QCheckListItem(listViewPackages,tr("local")); | ||
67 | //rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); | ||
68 | displayList(); | 66 | displayList(); |
69 | } | 67 | } |
70 | 68 | ||
71 | void MainWindow::makeMenu() | 69 | void MainWindow::makeMenu() |
72 | { | 70 | { |
73 | 71 | ||
74 | QPEToolBar *toolBar = new QPEToolBar( this ); | 72 | QPEToolBar *toolBar = new QPEToolBar( this ); |
75 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 73 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
76 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 74 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
77 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 75 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
78 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 76 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
79 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 77 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
80 | 78 | ||
81 | setToolBarsMovable( false ); | 79 | setToolBarsMovable( false ); |
82 | toolBar->setHorizontalStretchable( true ); | 80 | toolBar->setHorizontalStretchable( true ); |
83 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 81 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
84 | menuBar->insertItem( tr( "View" ), viewMenu ); | 82 | menuBar->insertItem( tr( "View" ), viewMenu ); |
85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 83 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 84 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
87 | 85 | ||
88 | QLabel *spacer = new QLabel( "", toolBar ); | 86 | QLabel *spacer = new QLabel( "", toolBar ); |
89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 87 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
90 | toolBar->setStretchableWidget( spacer ); | 88 | toolBar->setStretchableWidget( spacer ); |
91 | 89 | ||
92 | 90 | ||
93 | runAction = new QAction( tr( "Apply" ), | 91 | runAction = new QAction( tr( "Apply" ), |
94 | Resource::loadPixmap( "oipkg/install" ), | 92 | Resource::loadPixmap( "oipkg/install" ), |
95 | QString::null, 0, this, 0 ); | 93 | QString::null, 0, this, 0 ); |
96 | connect( runAction, SIGNAL( activated() ), | 94 | connect( runAction, SIGNAL( activated() ), |
97 | this, SLOT( runIpkg() ) ); | 95 | this, SLOT( runIpkg() ) ); |
98 | runAction->addTo( toolBar ); | 96 | runAction->addTo( toolBar ); |
99 | runAction->addTo( srvMenu ); | 97 | runAction->addTo( srvMenu ); |
100 | 98 | ||
101 | srvMenu->insertSeparator (); | 99 | srvMenu->insertSeparator (); |
102 | 100 | ||
103 | updateAction = new QAction( tr( "Update" ), | 101 | updateAction = new QAction( tr( "Update" ), |
104 | Resource::loadIconSet( "oipkg/update" ), | 102 | Resource::loadIconSet( "oipkg/update" ), |
105 | QString::null, 0, this, 0 ); | 103 | QString::null, 0, this, 0 ); |
106 | connect( updateAction, SIGNAL( activated() ), | 104 | connect( updateAction, SIGNAL( activated() ), |
107 | this , SLOT( updateList() ) ); | 105 | this , SLOT( updateList() ) ); |
108 | updateAction->addTo( toolBar ); | 106 | updateAction->addTo( toolBar ); |
109 | updateAction->addTo( srvMenu ); | 107 | updateAction->addTo( srvMenu ); |
110 | 108 | ||
111 | QAction *cfgact; | 109 | QAction *cfgact; |
112 | 110 | ||
113 | cfgact = new QAction( tr( "Setups" ), | 111 | cfgact = new QAction( tr( "Setups" ), |
114 | QString::null, 0, this, 0 ); | 112 | QString::null, 0, this, 0 ); |
115 | connect( cfgact, SIGNAL( activated() ), | 113 | connect( cfgact, SIGNAL( activated() ), |
116 | SLOT( showSettings() ) ); | 114 | SLOT( showSettings() ) ); |
117 | cfgact->addTo( cfgMenu ); | 115 | cfgact->addTo( cfgMenu ); |
118 | 116 | ||
119 | cfgact = new QAction( tr( "Servers" ), | 117 | cfgact = new QAction( tr( "Servers" ), |
120 | QString::null, 0, this, 0 ); | 118 | QString::null, 0, this, 0 ); |
121 | connect( cfgact, SIGNAL( activated() ), | 119 | connect( cfgact, SIGNAL( activated() ), |
122 | SLOT( showSettingsSrv() ) ); | 120 | SLOT( showSettingsSrv() ) ); |
123 | cfgact->addTo( cfgMenu ); | 121 | cfgact->addTo( cfgMenu ); |
124 | cfgact = new QAction( tr( "Destinations" ), | 122 | cfgact = new QAction( tr( "Destinations" ), |
125 | QString::null, 0, this, 0 ); | 123 | QString::null, 0, this, 0 ); |
126 | connect( cfgact, SIGNAL( activated() ), | 124 | connect( cfgact, SIGNAL( activated() ), |
127 | SLOT( showSettingsDst() ) ); | 125 | SLOT( showSettingsDst() ) ); |
128 | cfgact->addTo( cfgMenu ); | 126 | cfgact->addTo( cfgMenu ); |
129 | 127 | ||
130 | QAction *a; | 128 | QAction *a; |
131 | 129 | ||
132 | // SECTIONS | 130 | // SECTIONS |
133 | sectionBar = new QPEToolBar( this ); | 131 | sectionBar = new QPEToolBar( this ); |
134 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 132 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
135 | sectionBar->setHorizontalStretchable( true ); | 133 | sectionBar->setHorizontalStretchable( true ); |
136 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 134 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
137 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 135 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
138 | sectionBar->setStretchableWidget( label ); | 136 | sectionBar->setStretchableWidget( label ); |
139 | section = new QComboBox( false, sectionBar ); | 137 | section = new QComboBox( false, sectionBar ); |
140 | label = new QLabel( " / ", sectionBar ); | 138 | label = new QLabel( " / ", sectionBar ); |
141 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 139 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
142 | subsection = new QComboBox( false, sectionBar ); | 140 | subsection = new QComboBox( false, sectionBar ); |
143 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 141 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
144 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 142 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
145 | a->addTo( sectionBar ); | 143 | a->addTo( sectionBar ); |
146 | setSections(); | 144 | setSections(); |
147 | setSubSections(); | 145 | setSubSections(); |
148 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 146 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
149 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 147 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
150 | sectionAction->setToggleAction( true ); | 148 | sectionAction->setToggleAction( true ); |
151 | sectionAction->addTo( viewMenu ); | 149 | sectionAction->addTo( viewMenu ); |
152 | 150 | ||
153 | //FIND | 151 | //FIND |
154 | findBar = new QPEToolBar(this); | 152 | findBar = new QPEToolBar(this); |
155 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); | 153 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
156 | label = new QLabel( tr("Filter: "), findBar ); | 154 | label = new QLabel( tr("Filter: "), findBar ); |
157 | label->setBackgroundColor( findBar->backgroundColor() ); | 155 | label->setBackgroundColor( findBar->backgroundColor() ); |
158 | findBar->setHorizontalStretchable( TRUE ); | 156 | findBar->setHorizontalStretchable( TRUE ); |
159 | findEdit = new QLineEdit( findBar, "findEdit" ); | 157 | findEdit = new QLineEdit( findBar, "findEdit" ); |
160 | findBar->setStretchableWidget( findEdit ); | 158 | findBar->setStretchableWidget( findEdit ); |
161 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 159 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
162 | this, SLOT( displayList() ) ); | 160 | this, SLOT( displayList() ) ); |
163 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 161 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
164 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 162 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
165 | a->addTo( findBar ); | 163 | a->addTo( findBar ); |
166 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 164 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
167 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 165 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
168 | a->addTo( findBar ); | 166 | a->addTo( findBar ); |
169 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); | 167 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
170 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 168 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
171 | findAction->setToggleAction( true ); | 169 | findAction->setToggleAction( true ); |
172 | findAction->addTo( viewMenu ); | 170 | findAction->addTo( viewMenu ); |
173 | 171 | ||
174 | //SEARCH | 172 | //SEARCH |
175 | searchBar = new QPEToolBar(this); | 173 | searchBar = new QPEToolBar(this); |
176 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 174 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
177 | label = new QLabel( tr("ipkgfind: "), searchBar ); | 175 | label = new QLabel( tr("ipkgfind: "), searchBar ); |
178 | label->setBackgroundColor( searchBar->backgroundColor() ); | 176 | label->setBackgroundColor( searchBar->backgroundColor() ); |
179 | searchBar->setHorizontalStretchable( TRUE ); | 177 | searchBar->setHorizontalStretchable( TRUE ); |
180 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 178 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
181 | searchBar->setStretchableWidget( searchEdit ); | 179 | searchBar->setStretchableWidget( searchEdit ); |
182 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 180 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
183 | // this, SLOT( displayList() ) ); | 181 | // this, SLOT( displayList() ) ); |
184 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 182 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
185 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | 183 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); |
186 | a->addTo( searchBar ); | 184 | a->addTo( searchBar ); |
187 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 185 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
188 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | 186 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); |
189 | searchCommit->addTo( searchBar ); | 187 | searchCommit->addTo( searchBar ); |
190 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 188 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
191 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | 189 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); |
192 | a->addTo( searchBar ); | 190 | a->addTo( searchBar ); |
193 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | 191 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); |
194 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | 192 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); |
195 | searchAction->setToggleAction( true ); | 193 | searchAction->setToggleAction( true ); |
196 | searchAction->addTo( viewMenu ); | 194 | searchAction->addTo( viewMenu ); |
197 | 195 | ||
198 | //DEST | 196 | //DEST |
199 | destBar = new QPEToolBar(this); | 197 | destBar = new QPEToolBar(this); |
200 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 198 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
201 | label = new QLabel( tr("Destination: "), destBar ); | 199 | label = new QLabel( tr("Destination: "), destBar ); |
202 | label->setBackgroundColor( destBar->backgroundColor() ); | 200 | label->setBackgroundColor( destBar->backgroundColor() ); |
203 | destBar->setHorizontalStretchable( TRUE ); | 201 | destBar->setHorizontalStretchable( TRUE ); |
204 | destination = new QComboBox( false, destBar ); | 202 | destination = new QComboBox( false, destBar ); |
205 | destination->insertStringList( settings->getDestinationNames() ); | 203 | destination->insertStringList( settings->getDestinationNames() ); |
206 | setComboName(destination,settings->getDestinationName()); | 204 | setComboName(destination,settings->getDestinationName()); |
207 | connect( destination, SIGNAL(activated(int)), | 205 | connect( destination, SIGNAL(activated(int)), |
208 | settings, SLOT(activeDestinationChange(int)) ); | 206 | settings, SLOT(activeDestinationChange(int)) ); |
209 | spacer = new QLabel( " ", destBar ); | 207 | spacer = new QLabel( " ", destBar ); |
210 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 208 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
211 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 209 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
212 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 210 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
213 | CheckBoxLink->setChecked( settings->createLinks() ); | 211 | CheckBoxLink->setChecked( settings->createLinks() ); |
214 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 212 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
215 | settings, SLOT(linkEnabled(bool)) ); | 213 | settings, SLOT(linkEnabled(bool)) ); |
216 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 214 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
217 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 215 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
218 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 216 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
219 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 217 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
220 | a->addTo( destBar ); | 218 | a->addTo( destBar ); |
221 | destBar->setStretchableWidget( CheckBoxLink ); | 219 | destBar->setStretchableWidget( CheckBoxLink ); |
222 | destAction->setToggleAction( true ); | 220 | destAction->setToggleAction( true ); |
223 | // destAction->addTo( viewMenu ); | 221 | // destAction->addTo( viewMenu ); |
224 | 222 | ||
225 | // configure the menus | 223 | // configure the menus |
226 | Config cfg( "oipkg", Config::User ); | 224 | Config cfg( "oipkg", Config::User ); |
227 | cfg.setGroup( "gui" ); | 225 | cfg.setGroup( "gui" ); |
228 | 226 | ||
229 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 227 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
230 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 228 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
231 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 229 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
232 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 230 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
233 | } | 231 | } |
234 | 232 | ||
235 | MainWindow::~MainWindow() | 233 | MainWindow::~MainWindow() |
236 | { | 234 | { |
237 | Config cfg( "oipkg", Config::User ); | 235 | Config cfg( "oipkg", Config::User ); |
238 | cfg.setGroup( "gui" ); | 236 | cfg.setGroup( "gui" ); |
239 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 237 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
240 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 238 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
241 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 239 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
242 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 240 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
243 | 241 | ||
244 | } | 242 | } |
245 | 243 | ||
246 | void MainWindow::runIpkg() | 244 | void MainWindow::runIpkg() |
247 | { | 245 | { |
248 | packageList.allPackages(); | 246 | packageList.allPackages(); |
249 | ipkg->loadList( packageListSearch ); | 247 | ipkg->loadList( packageListSearch ); |
250 | ipkg->commit( packageList ); | 248 | ipkg->commit( packageList ); |
251 | // ##### If we looked in the list of files, we could send out accurate | 249 | // ##### If we looked in the list of files, we could send out accurate |
252 | // ##### messages. But we don't bother yet, and just do an "all". | 250 | // ##### messages. But we don't bother yet, and just do an "all". |
253 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 251 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
254 | QString lf = QString::null; | 252 | QString lf = QString::null; |
255 | e << lf; | 253 | e << lf; |
256 | displayList(); | 254 | displayList(); |
257 | } | 255 | } |
258 | 256 | ||
259 | void MainWindow::updateList() | 257 | void MainWindow::updateList() |
260 | { | 258 | { |
261 | //wait->show(); | 259 | //wait->show(); |
262 | QTimer *t = new QTimer( this ); | 260 | QTimer *t = new QTimer( this ); |
263 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 261 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
264 | t->start( 0, false ); | 262 | t->start( 0, false ); |
265 | packageList.clear(); | 263 | packageList.clear(); |
266 | ipkg->update(); | 264 | ipkg->update(); |
267 | packageList.update(); | 265 | packageList.update(); |
268 | t->stop(); | 266 | t->stop(); |
269 | // wait->hide(); | 267 | // wait->hide(); |
270 | } | 268 | } |
271 | 269 | ||
272 | void MainWindow::filterList() | 270 | void MainWindow::filterList() |
273 | { | 271 | { |
274 | //wait->show(); | 272 | //wait->show(); |
275 | QString f = ""; | 273 | QString f = ""; |
276 | if ( findAction->isOn() ) f = findEdit->text(); | 274 | if ( findAction->isOn() ) f = findEdit->text(); |
277 | packageList.filterPackages( f ); | 275 | packageList.filterPackages( f ); |
278 | //wait->hide(); | 276 | //wait->hide(); |
279 | } | 277 | } |
280 | 278 | ||
281 | void MainWindow::displayList() | 279 | void MainWindow::displayList() |
282 | { | 280 | { |
283 | //wait->hide(); | 281 | //wait->hide(); |
284 | filterList(); | 282 | filterList(); |
285 | listViewPackages->clear(); | 283 | listViewPackages->clear(); |
286 | Package *pack = packageList.first(); | 284 | Package *pack = packageList.first(); |
287 | PackageListItem *item; | 285 | PackageListItem *item; |
288 | 286 | ||
287 | // if (!rootLocal) | ||
288 | // { | ||
289 | QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); | 289 | QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); |
290 | QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); | 290 | QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); |
291 | // } | ||
291 | while( pack ) | 292 | while( pack ) |
292 | { | 293 | { |
293 | item = new PackageListItem( rootLocal, pack, settings ); | 294 | item = new PackageListItem( rootLocal, pack, settings ); |
294 | pack = packageList.next(); | 295 | pack = packageList.next(); |
295 | } | 296 | } |
296 | pack = packageListSearch.first(); | 297 | pack = packageListSearch.first(); |
297 | while( pack ) | 298 | while( pack ) |
298 | { | 299 | { |
299 | item = new PackageListItem( rootSearch, pack, settings ); | 300 | item = new PackageListItem( rootSearch, pack, settings ); |
300 | pack = packageListSearch.next(); | 301 | pack = packageListSearch.next(); |
301 | } | 302 | } |
302 | } | 303 | } |
303 | 304 | ||
304 | void MainWindow::sectionChanged() | 305 | void MainWindow::sectionChanged() |
305 | { | 306 | { |
306 | disconnect( section, SIGNAL( activated(int) ), | 307 | disconnect( section, SIGNAL( activated(int) ), |
307 | this, SLOT( sectionChanged() ) ); | 308 | this, SLOT( sectionChanged() ) ); |
308 | disconnect( subsection, SIGNAL(activated(int) ), | 309 | disconnect( subsection, SIGNAL(activated(int) ), |
309 | this, SLOT( subSectionChanged() ) ); | 310 | this, SLOT( subSectionChanged() ) ); |
310 | subsection->clear(); | 311 | subsection->clear(); |
311 | packageList.setSection( section->currentText() ); | 312 | packageList.setSection( section->currentText() ); |
312 | setSubSections(); | 313 | setSubSections(); |
313 | connect( section, SIGNAL( activated(int) ), | 314 | connect( section, SIGNAL( activated(int) ), |
314 | this, SLOT( sectionChanged() ) ); | 315 | this, SLOT( sectionChanged() ) ); |
315 | connect( subsection, SIGNAL(activated(int) ), | 316 | connect( subsection, SIGNAL(activated(int) ), |
316 | this, SLOT( subSectionChanged() ) ); | 317 | this, SLOT( subSectionChanged() ) ); |
317 | displayList(); | 318 | displayList(); |
318 | } | 319 | } |
319 | 320 | ||
320 | void MainWindow::subSectionChanged() | 321 | void MainWindow::subSectionChanged() |
321 | { | 322 | { |
322 | disconnect( section, SIGNAL( activated(int) ), | 323 | disconnect( section, SIGNAL( activated(int) ), |
323 | this, SLOT( sectionChanged() ) ); | 324 | this, SLOT( sectionChanged() ) ); |
324 | disconnect( subsection, SIGNAL(activated(int) ), | 325 | disconnect( subsection, SIGNAL(activated(int) ), |
325 | this, SLOT( subSectionChanged() ) ); | 326 | this, SLOT( subSectionChanged() ) ); |
326 | packageList.setSubSection( subsection->currentText() ); | 327 | packageList.setSubSection( subsection->currentText() ); |
327 | connect( section, SIGNAL( activated(int) ), | 328 | connect( section, SIGNAL( activated(int) ), |
328 | this, SLOT( sectionChanged() ) ); | 329 | this, SLOT( sectionChanged() ) ); |
329 | connect( subsection, SIGNAL(activated(int) ), | 330 | connect( subsection, SIGNAL(activated(int) ), |
330 | this, SLOT( subSectionChanged() ) ); | 331 | this, SLOT( subSectionChanged() ) ); |
331 | displayList(); | 332 | displayList(); |
332 | } | 333 | } |
333 | 334 | ||
334 | void MainWindow::setSections() | 335 | void MainWindow::setSections() |
335 | { | 336 | { |
336 | section->clear(); | 337 | section->clear(); |
337 | section->insertStringList( packageList.getSections() ); | 338 | section->insertStringList( packageList.getSections() ); |
338 | } | 339 | } |
339 | 340 | ||
340 | void MainWindow::setSubSections() | 341 | void MainWindow::setSubSections() |
341 | { | 342 | { |
342 | subsection->clear(); | 343 | subsection->clear(); |
343 | subsection->insertStringList( packageList.getSubSections() ); | 344 | subsection->insertStringList( packageList.getSubSections() ); |
344 | } | 345 | } |
345 | 346 | ||
346 | 347 | ||
347 | void MainWindow::showSettings() | 348 | void MainWindow::showSettings() |
348 | { | 349 | { |
349 | if ( settings->showDialog( 0 ) ) | 350 | if ( settings->showDialog( 0 ) ) |
350 | updateList(); | 351 | updateList(); |
351 | } | 352 | } |
352 | void MainWindow::showSettingsSrv() | 353 | void MainWindow::showSettingsSrv() |
353 | { | 354 | { |
354 | if ( settings->showDialog( 1 ) ) | 355 | if ( settings->showDialog( 1 ) ) |
355 | updateList(); | 356 | updateList(); |
356 | } | 357 | } |
357 | void MainWindow::showSettingsDst() | 358 | void MainWindow::showSettingsDst() |
358 | { | 359 | { |
359 | if ( settings->showDialog( 2 ) ) | 360 | if ( settings->showDialog( 2 ) ) |
360 | updateList(); | 361 | updateList(); |
361 | } | 362 | } |
362 | 363 | ||
363 | void MainWindow::sectionShow(bool b) | 364 | void MainWindow::sectionShow(bool b) |
364 | { | 365 | { |
365 | if (b) sectionBar->show(); | 366 | if (b) sectionBar->show(); |
366 | else sectionBar->hide(); | 367 | else sectionBar->hide(); |
367 | sectionAction->setOn( b ); | 368 | sectionAction->setOn( b ); |
368 | } | 369 | } |
369 | 370 | ||
370 | void MainWindow::sectionClose() | 371 | void MainWindow::sectionClose() |
371 | { | 372 | { |
372 | sectionAction->setOn( false ); | 373 | sectionAction->setOn( false ); |
373 | } | 374 | } |
374 | 375 | ||
375 | void MainWindow::findShow(bool b) | 376 | void MainWindow::findShow(bool b) |
376 | { | 377 | { |
377 | if (b) findBar->show(); | 378 | if (b) findBar->show(); |
378 | else findBar->hide(); | 379 | else findBar->hide(); |
379 | findAction->setOn( b ); | 380 | findAction->setOn( b ); |
380 | } | 381 | } |
381 | 382 | ||
382 | void MainWindow::findClose() | 383 | void MainWindow::findClose() |
383 | { | 384 | { |
384 | findAction->setOn( false ); | 385 | findAction->setOn( false ); |
385 | } | 386 | } |
386 | 387 | ||
387 | void MainWindow::searchShow(bool b) | 388 | void MainWindow::searchShow(bool b) |
388 | { | 389 | { |
389 | if (b) searchBar->show(); | 390 | if (b) searchBar->show(); |
390 | else searchBar->hide(); | 391 | else searchBar->hide(); |
391 | searchAction->setOn( b ); | 392 | searchAction->setOn( b ); |
392 | } | 393 | } |
393 | 394 | ||
394 | void MainWindow::searchClose() | 395 | void MainWindow::searchClose() |
395 | { | 396 | { |
396 | searchAction->setOn( false ); | 397 | searchAction->setOn( false ); |
397 | } | 398 | } |
398 | 399 | ||
399 | 400 | ||
400 | void MainWindow::destShow(bool b) | 401 | void MainWindow::destShow(bool b) |
401 | { | 402 | { |
402 | if (b) destBar->show(); | 403 | if (b) destBar->show(); |
403 | else destBar->hide(); | 404 | else destBar->hide(); |
404 | destAction->setOn( b ); | 405 | destAction->setOn( b ); |
405 | } | 406 | } |
406 | 407 | ||
407 | void MainWindow::destClose() | 408 | void MainWindow::destClose() |
408 | { | 409 | { |
409 | destAction->setOn( false ); | 410 | destAction->setOn( false ); |
410 | } | 411 | } |
411 | 412 | ||
412 | void MainWindow::rotateUpdateIcon() | 413 | void MainWindow::rotateUpdateIcon() |
413 | { | 414 | { |
414 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 415 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
415 | if ( updateIcon ) | 416 | if ( updateIcon ) |
416 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 417 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
417 | else | 418 | else |
418 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 419 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
419 | updateIcon = !updateIcon; | 420 | updateIcon = !updateIcon; |
420 | } | 421 | } |
421 | 422 | ||
422 | 423 | ||
423 | void MainWindow::setDocument(const QString &fileName) | 424 | void MainWindow::setDocument(const QString &fileName) |
424 | { | 425 | { |
425 | installFile(fileName); | 426 | installFile(fileName); |
426 | // ##### If we looked in the list of files, we could send out accurate | 427 | // ##### If we looked in the list of files, we could send out accurate |
427 | // ##### messages. But we don't bother yet, and just do an "all". | 428 | // ##### messages. But we don't bother yet, and just do an "all". |
428 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 429 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
429 | QString lf = QString::null; | 430 | QString lf = QString::null; |
430 | e << lf; | 431 | e << lf; |
431 | displayList(); | 432 | displayList(); |
432 | } | 433 | } |
433 | 434 | ||
434 | void MainWindow::installFile(const QString &fileName) | 435 | void MainWindow::installFile(const QString &fileName) |
435 | { | 436 | { |
436 | pvDebug(3, "MainWindow::installFile "+fileName); | 437 | pvDebug(3, "MainWindow::installFile "+fileName); |
437 | if ( !QFile::exists( fileName ) ) return; | 438 | if ( !QFile::exists( fileName ) ) return; |
438 | ipkg->installFile( fileName ); | 439 | ipkg->installFile( fileName ); |
439 | // ##### If we looked in the list of files, we could send out accurate | 440 | // ##### If we looked in the list of files, we could send out accurate |
440 | // ##### messages. But we don't bother yet, and just do an "all". | 441 | // ##### messages. But we don't bother yet, and just do an "all". |
441 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 442 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
442 | QString lf = QString::null; | 443 | QString lf = QString::null; |
443 | e << lf; | 444 | e << lf; |
444 | displayList(); | 445 | displayList(); |
445 | } | 446 | } |
446 | 447 | ||
447 | void MainWindow::makeChannel() | 448 | void MainWindow::makeChannel() |
448 | { | 449 | { |
449 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 450 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
450 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 451 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
451 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 452 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
452 | } | 453 | } |
453 | 454 | ||
454 | 455 | ||
455 | 456 | ||
456 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 457 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
457 | { | 458 | { |
458 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); | 459 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
459 | if ( msg == "installFile(QString)" ) | 460 | if ( msg == "installFile(QString)" ) |
460 | { | 461 | { |
461 | ipkg->installFile( QString(arg) ); | 462 | ipkg->installFile( QString(arg) ); |
462 | }else if( msg == "removeFile(QString)" ) | 463 | }else if( msg == "removeFile(QString)" ) |
463 | { | 464 | { |
464 | ipkg->removeFile( QString(arg) ); | 465 | ipkg->removeFile( QString(arg) ); |
465 | }else if( msg == "createLinks(QString)" ) | 466 | }else if( msg == "createLinks(QString)" ) |
466 | { | 467 | { |
467 | ipkg->createLinks( QString(arg) ); | 468 | ipkg->createLinks( QString(arg) ); |
468 | }else if( msg == "removeLinks(QString)" ) | 469 | }else if( msg == "removeLinks(QString)" ) |
469 | { | 470 | { |
470 | ipkg->removeLinks( QString(arg) ); | 471 | ipkg->removeLinks( QString(arg) ); |
471 | }else{ | 472 | }else{ |
472 | pvDebug(2,"Huh what do ya want") | 473 | pvDebug(2,"Huh what do ya want") |
473 | } | 474 | } |
474 | } | 475 | } |
475 | 476 | ||
476 | 477 | ||
477 | void MainWindow::createLinks() | 478 | void MainWindow::createLinks() |
478 | { | 479 | { |
479 | pvDebug(2,"creating links..."); | 480 | pvDebug(2,"creating links..."); |
480 | ipkg->createLinks( settings->destinationurl->text() ); | 481 | ipkg->createLinks( settings->destinationurl->text() ); |
481 | } | 482 | } |
482 | 483 | ||
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 6bb53a9..0787ece 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,352 +1,363 @@ | |||
1 | #include "package.h" | 1 | #include "package.h" |
2 | 2 | ||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/stringutil.h> | 4 | #include <qpe/stringutil.h> |
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | 9 | ||
10 | #include "debug.h" | 10 | #include "debug.h" |
11 | 11 | ||
12 | //Package::~Package() | 12 | //Package::~Package() |
13 | //{ | 13 | //{ |
14 | //} | 14 | //} |
15 | 15 | ||
16 | Package::Package( PackageManagerSettings *s ) | 16 | Package::Package( PackageManagerSettings *s ) |
17 | { | 17 | { |
18 | init(s); | 18 | init(s); |
19 | } | 19 | } |
20 | 20 | ||
21 | void Package::init( PackageManagerSettings *s ) | 21 | void Package::init( PackageManagerSettings *s ) |
22 | { | 22 | { |
23 | settings = s; | 23 | settings = s; |
24 | _size = ""; | 24 | _size = ""; |
25 | _section = ""; | 25 | _section = ""; |
26 | _subsection = ""; | 26 | _subsection = ""; |
27 | _shortDesc = ""; | 27 | _shortDesc = ""; |
28 | _desc = ""; | 28 | _desc = ""; |
29 | _name = ""; | 29 | _name = ""; |
30 | _toProcess = false; | 30 | _toProcess = false; |
31 | _useFileName = false; | 31 | _useFileName = false; |
32 | _status = ""; | 32 | _status = ""; |
33 | _dest = settings->getDestinationName(); | 33 | _dest = settings->getDestinationName(); |
34 | _link = settings->createLinks(); | 34 | _link = settings->createLinks(); |
35 | } | 35 | } |
36 | 36 | ||
37 | Package::Package( QStringList pack, PackageManagerSettings *s ) | 37 | Package::Package( QStringList pack, PackageManagerSettings *s ) |
38 | { | 38 | { |
39 | init(s); | 39 | init(s); |
40 | parsePackage( pack ); | 40 | parsePackage( pack ); |
41 | } | 41 | } |
42 | 42 | ||
43 | Package::Package( QString n, PackageManagerSettings *s ) | 43 | Package::Package( QString n, PackageManagerSettings *s ) |
44 | { | 44 | { |
45 | init(s); | 45 | init(s); |
46 | if ( !QFile::exists( n ) ) | 46 | if ( !QFile::exists( n ) ) |
47 | { | 47 | { |
48 | _name = QString( n ); | 48 | _name = QString( n ); |
49 | }else{ | 49 | }else{ |
50 | parseIpkgFile( n ); | 50 | parseIpkgFile( n ); |
51 | _toProcess = true; | 51 | _toProcess = true; |
52 | _useFileName = true; | 52 | _useFileName = true; |
53 | _fileName = QString( n ); | 53 | _fileName = QString( n ); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | Package::Package( Package *pi ) | 57 | Package::Package( Package *pi ) |
58 | { | 58 | { |
59 | init(pi->settings); | 59 | init(pi->settings); |
60 | copyValues( pi ); | 60 | copyValues( pi ); |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | void Package::setValue( QString n, QString t ) | 64 | void Package::setValue( QString n, QString t ) |
65 | { | 65 | { |
66 | if ( n == "Package" ) | 66 | if ( n == "Package" ) |
67 | { | 67 | { |
68 | _name = QString( t ); | 68 | _name = QString( t ); |
69 | }else if ( n == "Installed-Size" ) | 69 | }else if ( n == "Installed-Size" ) |
70 | { | 70 | { |
71 | _size = t; | 71 | _size = t; |
72 | }else if ( n == "Priority") | 72 | // }else if ( n == "Priority") |
73 | { | 73 | // { |
74 | 74 | ||
75 | }else if ( n == "Section") | 75 | }else if ( n == "Section") |
76 | { | 76 | { |
77 | setSection( t ); | 77 | setSection( t ); |
78 | }else if ( n == "Maintainer") | 78 | // }else if ( n == "Maintainer") |
79 | { | 79 | // { |
80 | 80 | // | |
81 | }else if ( n == "Architecture") | 81 | // }else if ( n == "Architecture") |
82 | { | 82 | // { |
83 | 83 | ||
84 | }else if ( n == "Version") | 84 | }else if ( n == "Version") |
85 | { | 85 | { |
86 | 86 | _version = t; | |
87 | }else if ( n == "Pre-Depends") | 87 | // }else if ( n == "Pre-Depends") |
88 | { | 88 | // { |
89 | 89 | // | |
90 | }else if ( n == "Depends") | 90 | // }else if ( n == "Depends") |
91 | { | 91 | // { |
92 | 92 | ||
93 | }else if ( n == "Filename") | 93 | }else if ( n == "Filename") |
94 | { | 94 | { |
95 | _fileName = t; | 95 | _fileName = t; |
96 | }else if ( n == "Size") | 96 | // }else if ( n == "Size") |
97 | { | 97 | // { |
98 | 98 | // | |
99 | }else if ( n == "MD5Sum") | 99 | //}else if ( n == "MD5Sum") |
100 | { | 100 | //{ |
101 | 101 | ||
102 | } | 102 | }else if ( n == "Description") |
103 | if ( n == "Description") | ||
104 | { | 103 | { |
105 | setDesc( t ); | 104 | setDesc( t ); |
106 | } | 105 | }else if ( n == "Status") |
107 | if ( n == "Status") | ||
108 | { | 106 | { |
109 | if ( installed() ) return; | 107 | if ( installed() ) return; |
110 | _status = t; | 108 | _status = t; |
111 | } | 109 | // }else if ( n == "Essential") |
112 | if ( t == "Essential") | 110 | // { |
113 | { | ||
114 | 111 | ||
112 | }else{ | ||
113 | _values.insert(n,new QString(t)); | ||
115 | } | 114 | } |
116 | }; | 115 | } |
117 | 116 | ||
118 | QString Package::name() | 117 | QString Package::name() |
119 | { | 118 | { |
120 | return _name; | 119 | if (_displayName.isEmpty() ) return _name; |
120 | else return _displayName; | ||
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | QString Package::installName() | 124 | QString Package::installName() |
125 | { | 125 | { |
126 | if (_useFileName) return _fileName; | 126 | if (_useFileName) return _fileName; |
127 | else return _name; | 127 | else return _name; |
128 | } | 128 | } |
129 | 129 | ||
130 | bool Package::installed() | 130 | bool Package::installed() |
131 | { | 131 | { |
132 | return _status.contains("installed"); | 132 | return _status.contains("installed"); |
133 | } | 133 | } |
134 | 134 | ||
135 | void Package::setDesc( QString s ) | 135 | void Package::setDesc( QString s ) |
136 | { | 136 | { |
137 | _desc = s; | 137 | _desc = s; |
138 | _shortDesc = s.left( s.find("\n") ); | 138 | _shortDesc = s.left( s.find("\n") ); |
139 | } | 139 | } |
140 | 140 | ||
141 | QString Package::desc() | 141 | QString Package::desc() |
142 | { | 142 | { |
143 | return _desc; | 143 | return _desc; |
144 | } | 144 | } |
145 | 145 | ||
146 | QString Package::shortDesc() | 146 | QString Package::shortDesc() |
147 | { | 147 | { |
148 | return _shortDesc; | 148 | return _shortDesc; |
149 | } | 149 | } |
150 | 150 | ||
151 | QString Package::size() | 151 | QString Package::size() |
152 | { | 152 | { |
153 | return _size; | 153 | return _size; |
154 | } | 154 | } |
155 | 155 | ||
156 | |||
157 | QString Package::version() | ||
158 | { | ||
159 | return _version; | ||
160 | } | ||
161 | |||
156 | QString Package::sizeUnits() | 162 | QString Package::sizeUnits() |
157 | { | 163 | { |
158 | int i = _size.toInt(); | 164 | int i = _size.toInt(); |
159 | int c = 0; | 165 | int c = 0; |
160 | QString ret; | 166 | QString ret; |
161 | QStringList unit; | 167 | QStringList unit; |
162 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) | 168 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) |
163 | while (i > 1) | 169 | while (i > 1) |
164 | { | 170 | { |
165 | ret=QString::number(i)+" "+unit[c]; | 171 | ret=QString::number(i)+" "+unit[c]; |
166 | c++; | 172 | c++; |
167 | i /= 1024; | 173 | i /= 1024; |
168 | } | 174 | } |
169 | return ret; | 175 | return ret; |
170 | } | 176 | } |
171 | 177 | ||
172 | bool Package::toProcess() | 178 | bool Package::toProcess() |
173 | { | 179 | { |
174 | return _toProcess; | 180 | return _toProcess; |
175 | } | 181 | } |
176 | 182 | ||
177 | bool Package::toRemove() | 183 | bool Package::toRemove() |
178 | { | 184 | { |
179 | if ( _toProcess && installed() ) return true; | 185 | if ( _toProcess && installed() ) return true; |
180 | else return false; | 186 | else return false; |
181 | } | 187 | } |
182 | 188 | ||
183 | bool Package::toInstall() | 189 | bool Package::toInstall() |
184 | { | 190 | { |
185 | if ( _toProcess && !installed() ) return true; | 191 | if ( _toProcess && !installed() ) return true; |
186 | else return false; | 192 | else return false; |
187 | } | 193 | } |
188 | 194 | ||
189 | void Package::toggleProcess() | 195 | void Package::toggleProcess() |
190 | { | 196 | { |
191 | _toProcess = ! _toProcess; | 197 | _toProcess = ! _toProcess; |
192 | } | 198 | } |
193 | 199 | ||
194 | 200 | ||
195 | 201 | ||
196 | void Package::copyValues( Package* pack ) | 202 | void Package::copyValues( Package* pack ) |
197 | { | 203 | { |
198 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); | 204 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); |
199 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); | 205 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); |
200 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); | 206 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); |
201 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); | 207 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); |
202 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); | 208 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); |
203 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); | 209 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); |
204 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); | 210 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); |
205 | } | 211 | } |
206 | 212 | ||
207 | QString Package::section() | 213 | QString Package::section() |
208 | { | 214 | { |
209 | return _section; | 215 | return _section; |
210 | } | 216 | } |
211 | 217 | ||
212 | void Package::setSection( QString s) | 218 | void Package::setSection( QString s) |
213 | { | 219 | { |
214 | int i = s.find("/"); | 220 | int i = s.find("/"); |
215 | if ( i > 0 ) | 221 | if ( i > 0 ) |
216 | { | 222 | { |
217 | _section = s.left(i); | 223 | _section = s.left(i); |
218 | _subsection = s.mid(i+1); | 224 | _subsection = s.mid(i+1); |
219 | }else{ | 225 | }else{ |
220 | _section = s; | 226 | _section = s; |
221 | _subsection = ""; | 227 | _subsection = ""; |
222 | } | 228 | } |
223 | } | 229 | } |
224 | 230 | ||
225 | QString Package::subSection() | 231 | QString Package::subSection() |
226 | { | 232 | { |
227 | return _subsection; | 233 | return _subsection; |
228 | } | 234 | } |
229 | 235 | ||
230 | void Package::parsePackage( QStringList pack ) | 236 | void Package::parsePackage( QStringList pack ) |
231 | { | 237 | { |
232 | if ( pack.isEmpty() ) return; | 238 | if ( pack.isEmpty() ) return; |
233 | int count = pack.count(); | 239 | int count = pack.count(); |
234 | for( int i = 0; i < count; i++ ) | 240 | for( int i = 0; i < count; i++ ) |
235 | { | 241 | { |
236 | QString line = pack[i]; | 242 | QString line = pack[i]; |
237 | int sep = line.find( QRegExp(":[\t ]+") ); | 243 | int sep = line.find( QRegExp(":[\t ]+") ); |
238 | if ( sep >= 0 ) | 244 | if ( sep >= 0 ) |
239 | { | 245 | { |
240 | QString tag = line.left(sep); | 246 | QString tag = line.left(sep); |
241 | QString value = line.mid(sep+2).simplifyWhiteSpace(); | 247 | QString value = line.mid(sep+2).simplifyWhiteSpace(); |
242 | setValue( tag, value ); | 248 | setValue( tag, value ); |
243 | }else{ | 249 | }else{ |
244 | } | 250 | } |
245 | } | 251 | } |
246 | return; | 252 | return; |
247 | } | 253 | } |
248 | 254 | ||
249 | QString Package::details() | 255 | QString Package::details() |
250 | { | 256 | { |
251 | QString status; | 257 | QString status; |
252 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); | 258 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); |
253 | QString description; | 259 | QString description; |
254 | if ( ipkg_status.exec("",status) ) | 260 | if ( ipkg_status.exec("",status) ) |
255 | { | 261 | { |
256 | QStringList lines = QStringList::split('\n',status,TRUE); | 262 | QStringList lines = QStringList::split('\n',status,TRUE); |
257 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { | 263 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { |
258 | QString line = *it; | 264 | QString line = *it; |
259 | if ( line == " ." ) | 265 | if ( line == " ." ) |
260 | { | 266 | { |
261 | description.append("<p>"); | 267 | description.append("<p>"); |
262 | } else | 268 | } else |
263 | if ( line[0] == ' ' || line[0] == '\t' ) | 269 | if ( line[0] == ' ' || line[0] == '\t' ) |
264 | { | 270 | { |
265 | // continuation | 271 | // continuation |
266 | description.append(" "); | 272 | description.append(" "); |
267 | description.append(Qtopia::escapeString(line)); | 273 | description.append(Qtopia::escapeString(line)); |
268 | } else { | 274 | } else { |
269 | int sep = line.find(QRegExp(":[\t ]+")); | 275 | int sep = line.find(QRegExp(":[\t ]+")); |
270 | if ( sep >= 0 ) | 276 | if ( sep >= 0 ) |
271 | { | 277 | { |
272 | QString tag = line.left(sep); | 278 | QString tag = line.left(sep); |
273 | description.append("<br>"); | 279 | description.append("<br>"); |
274 | description.append("<b>"); | 280 | description.append("<b>"); |
275 | description.append(Qtopia::escapeString(tag)); | 281 | description.append(Qtopia::escapeString(tag)); |
276 | description.append(":</b> "); | 282 | description.append(":</b> "); |
277 | description.append(Qtopia::escapeString(line.mid(sep+2))); | 283 | description.append(Qtopia::escapeString(line.mid(sep+2))); |
278 | } else { | 284 | } else { |
279 | description.append(" "); | 285 | description.append(" "); |
280 | description.append(Qtopia::escapeString(line)); | 286 | description.append(Qtopia::escapeString(line)); |
281 | } | 287 | } |
282 | } | 288 | } |
283 | } | 289 | } |
284 | } | 290 | } |
285 | return description; | 291 | return description; |
286 | } | 292 | } |
287 | 293 | ||
288 | void Package::processed() | 294 | void Package::processed() |
289 | { | 295 | { |
290 | _toProcess = false; | 296 | _toProcess = false; |
291 | //hack, but we're not writing status anyway... | 297 | //hack, but we're not writing status anyway... |
292 | if ( installed() ) _status = "install"; | 298 | if ( installed() ) _status = "install"; |
293 | else _status = "installed"; | 299 | else _status = "installed"; |
294 | } | 300 | } |
295 | 301 | ||
296 | QString Package::dest() | 302 | QString Package::dest() |
297 | { | 303 | { |
298 | if ( installed()||(!installed() && _toProcess) ) | 304 | if ( installed()||(!installed() && _toProcess) ) |
299 | return _dest!=""?_dest:settings->getDestinationName(); | 305 | return _dest!=""?_dest:settings->getDestinationName(); |
300 | else return ""; | 306 | else return ""; |
301 | } | 307 | } |
302 | 308 | ||
303 | void Package::setDest( QString d ) | 309 | void Package::setDest( QString d ) |
304 | { | 310 | { |
305 | _dest = d; | 311 | _dest = d; |
306 | } | 312 | } |
307 | 313 | ||
308 | void Package::setOn() | 314 | void Package::setOn() |
309 | { | 315 | { |
310 | _toProcess = true; | 316 | _toProcess = true; |
311 | } | 317 | } |
312 | 318 | ||
313 | bool Package::link() | 319 | bool Package::link() |
314 | { | 320 | { |
315 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 321 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
316 | return _link; | 322 | return _link; |
317 | } | 323 | } |
318 | 324 | ||
319 | void Package::setLink(bool b) | 325 | void Package::setLink(bool b) |
320 | { | 326 | { |
321 | _link = b; | 327 | _link = b; |
322 | } | 328 | } |
323 | 329 | ||
324 | void Package::parseIpkgFile( QString file) | 330 | void Package::parseIpkgFile( QString file) |
325 | { | 331 | { |
326 | system("tar xzf "+file+" -C /tmp"); | 332 | system("tar xzf "+file+" -C /tmp"); |
327 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | 333 | system("tar xzf /tmp/control.tar.gz -C /tmp"); |
328 | QFile f("/tmp/control"); | 334 | QFile f("/tmp/control"); |
329 | if ( f.open(IO_ReadOnly) ) | 335 | if ( f.open(IO_ReadOnly) ) |
330 | { | 336 | { |
331 | QTextStream t( &f ); | 337 | QTextStream t( &f ); |
332 | QStringList pack; | 338 | QStringList pack; |
333 | while ( !t.eof() ) | 339 | while ( !t.eof() ) |
334 | { | 340 | { |
335 | pack << t.readLine(); | 341 | pack << t.readLine(); |
336 | } | 342 | } |
337 | f.close(); | 343 | f.close(); |
338 | parsePackage( pack ); | 344 | parsePackage( pack ); |
339 | } | 345 | } |
340 | 346 | ||
341 | } | 347 | } |
342 | 348 | ||
343 | //QString Package::getPackageName() | 349 | //QString Package::getPackageName() |
344 | //{ | 350 | //{ |
345 | //if ( _packageName.isEmpty() ) return _name; | 351 | //if ( _packageName.isEmpty() ) return _name; |
346 | //else return _packageName; | 352 | //else return _packageName; |
347 | //} | 353 | //} |
348 | 354 | ||
349 | void Package::instalFromFile(bool iff) | 355 | void Package::instalFromFile(bool iff) |
350 | { | 356 | { |
351 | _useFileName = iff; | 357 | _useFileName = iff; |
352 | } | 358 | } |
359 | |||
360 | void Package::setName(QString n) | ||
361 | { | ||
362 | _displayName = n; | ||
363 | } | ||
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 4618c3a..2ca966d 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -1,74 +1,77 @@ | |||
1 | #ifndef PK_ITEM_H | 1 | #ifndef PK_ITEM_H |
2 | #define PK_ITEM_H | 2 | #define PK_ITEM_H |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | #include <qpainter.h> | 6 | #include <qpainter.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qdict.h> | 8 | #include <qdict.h> |
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | 10 | ||
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | 12 | ||
13 | class Package //: public QObject | 13 | class Package //: public QObject |
14 | { | 14 | { |
15 | // Q_OBJECT | 15 | // Q_OBJECT |
16 | public: | 16 | public: |
17 | Package(PackageManagerSettings *); | 17 | Package(PackageManagerSettings *); |
18 | // ~Package(); | 18 | // ~Package(); |
19 | Package( QStringList, PackageManagerSettings * ); | 19 | Package( QStringList, PackageManagerSettings * ); |
20 | Package( QString, PackageManagerSettings * ); | 20 | Package( QString, PackageManagerSettings * ); |
21 | Package( Package* ); | 21 | Package( Package* ); |
22 | 22 | ||
23 | void setValue( QString, QString ); | 23 | void setValue( QString, QString ); |
24 | void copyValues( Package* ); | 24 | void copyValues( Package* ); |
25 | 25 | ||
26 | QString name() ; | 26 | QString name() ; |
27 | QString installName() ; | 27 | QString installName() ; |
28 | bool installed(); | 28 | bool installed(); |
29 | 29 | ||
30 | void setDesc( QString ); | 30 | void setDesc( QString ); |
31 | QString shortDesc(); | 31 | QString shortDesc(); |
32 | QString desc(); | 32 | QString desc(); |
33 | QString size(); | 33 | QString size(); |
34 | QString sizeUnits(); | 34 | QString sizeUnits(); |
35 | QString version(); | ||
35 | void setSection( QString ); | 36 | void setSection( QString ); |
36 | QString section(); | 37 | QString section(); |
37 | QString subSection(); | 38 | QString subSection(); |
38 | QString details(); | 39 | QString details(); |
39 | bool toProcess(); | 40 | bool toProcess(); |
40 | bool toInstall(); | 41 | bool toInstall(); |
41 | bool toRemove(); | 42 | bool toRemove(); |
42 | void processed(); | 43 | void processed(); |
43 | QString dest(); | 44 | QString dest(); |
44 | void setDest( QString d ); | 45 | void setDest( QString d ); |
45 | void setOn(); | 46 | void setOn(); |
46 | bool link(); | 47 | bool link(); |
47 | void setLink(bool); | 48 | void setLink(bool); |
48 | void parseIpkgFile( QString ); | 49 | void parseIpkgFile( QString ); |
49 | void instalFromFile(bool iff=true); | 50 | void instalFromFile(bool iff=true); |
51 | void setName(QString); | ||
50 | public slots: | 52 | public slots: |
51 | // QString getPackageName(); | ||
52 | void toggleProcess(); | 53 | void toggleProcess(); |
53 | 54 | ||
54 | private: | 55 | private: |
55 | PackageManagerSettings *settings; | 56 | PackageManagerSettings *settings; |
56 | // QString _packageName; | 57 | QString _displayName; |
57 | QString _name; | 58 | QString _name; |
58 | QString _fileName; | 59 | QString _fileName; |
59 | bool _toProcess; | 60 | bool _toProcess; |
60 | bool _link; | 61 | bool _link; |
61 | QString _status; | 62 | QString _status; |
62 | QString _size; | 63 | QString _size; |
63 | QString _section; | 64 | QString _section; |
64 | QString _subsection; | 65 | QString _subsection; |
65 | QString _shortDesc; | 66 | QString _shortDesc; |
66 | QString _desc; | 67 | QString _desc; |
68 | QString _version; | ||
67 | QString _dest; | 69 | QString _dest; |
70 | QDict<QString> _values; | ||
68 | bool _useFileName; | 71 | bool _useFileName; |
69 | void parsePackage( QStringList ); | 72 | void parsePackage( QStringList ); |
70 | void init(PackageManagerSettings *); | 73 | void init(PackageManagerSettings *); |
71 | }; | 74 | }; |
72 | 75 | ||
73 | 76 | ||
74 | #endif | 77 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index b892b30..be20c71 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,192 +1,201 @@ | |||
1 | #include "packagelist.h" | 1 | #include "packagelist.h" |
2 | 2 | ||
3 | #include <assert.h> | 3 | #include <assert.h> |
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | 7 | ||
8 | #include "debug.h" | 8 | #include "debug.h" |
9 | 9 | ||
10 | PackageList::PackageList() | 10 | PackageList::PackageList() |
11 | : packageIter( packageList ) | 11 | : packageIter( packageList ) |
12 | { | 12 | { |
13 | empty=true; | 13 | empty=true; |
14 | sections << "All"; | 14 | sections << "All"; |
15 | subSections.insert("All", new QStringList() ); | 15 | subSections.insert("All", new QStringList() ); |
16 | QStringList *ss = subSections["All"]; | 16 | QStringList *ss = subSections["All"]; |
17 | *ss << "All"; | 17 | *ss << "All"; |
18 | aktSection = "All"; | 18 | aktSection = "All"; |
19 | aktSubSection = "All"; | 19 | aktSubSection = "All"; |
20 | } | 20 | } |
21 | 21 | ||
22 | PackageList::PackageList( PackageManagerSettings* s) | 22 | PackageList::PackageList( PackageManagerSettings* s) |
23 | : packageIter( packageList ) | 23 | : packageIter( packageList ) |
24 | { | 24 | { |
25 | settings = s; | 25 | settings = s; |
26 | PackageList(); | 26 | PackageList(); |
27 | } | 27 | } |
28 | 28 | ||
29 | PackageList::~PackageList() | 29 | PackageList::~PackageList() |
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | /** Inserts a package into the list */ | 33 | /** Inserts a package into the list */ |
34 | void PackageList::insertPackage( Package* pack ) | 34 | void PackageList::insertPackage( Package* pack ) |
35 | { | 35 | { |
36 | if (!pack) return; | ||
36 | Package* p = packageList.find( pack->name() ); | 37 | Package* p = packageList.find( pack->name() ); |
37 | if ( p ) | 38 | if ( p ) |
38 | { | 39 | { |
39 | p->copyValues( pack ); | 40 | if ( p->version() == pack->version() ) |
40 | delete pack; | 41 | { |
41 | pack = p; | 42 | p->copyValues( pack ); |
43 | delete pack; | ||
44 | pack = p; | ||
45 | } else { | ||
46 | p->setName( pack->name()+"["+p->version()+"]" ); | ||
47 | pack->setName( pack->name()+"["+pack->version()+"]" ); | ||
48 | packageList.insert( pack->name(), pack ); | ||
49 | origPackageList.insert( pack->name(), pack ); | ||
50 | } | ||
42 | }else{ | 51 | }else{ |
43 | packageList.insert( pack->name(), pack ); | 52 | packageList.insert( pack->name(), pack ); |
44 | origPackageList.insert( pack->name(), pack ); | 53 | origPackageList.insert( pack->name(), pack ); |
45 | empty=false; | ||
46 | }; | 54 | }; |
55 | empty=false; | ||
47 | updateSections( pack ); | 56 | updateSections( pack ); |
48 | } | 57 | } |
49 | 58 | ||
50 | void PackageList::filterPackages( QString f ) | 59 | void PackageList::filterPackages( QString f ) |
51 | { | 60 | { |
52 | packageList.clear(); | 61 | packageList.clear(); |
53 | QDictIterator<Package> filterIter( origPackageList ); | 62 | QDictIterator<Package> filterIter( origPackageList ); |
54 | filterIter.toFirst(); | 63 | filterIter.toFirst(); |
55 | Package *pack= filterIter.current() ; | 64 | Package *pack= filterIter.current() ; |
56 | while ( pack ) | 65 | while ( pack ) |
57 | { | 66 | { |
58 | if ( | 67 | if ( |
59 | ((aktSection=="All")||(pack->section()==aktSection)) && | 68 | ((aktSection=="All")||(pack->section()==aktSection)) && |
60 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && | 69 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && |
61 | pack->name().contains( f ) | 70 | pack->name().contains( f ) |
62 | ) | 71 | ) |
63 | { | 72 | { |
64 | packageList.insert( pack->name(), pack ); | 73 | packageList.insert( pack->name(), pack ); |
65 | } | 74 | } |
66 | ++filterIter; | 75 | ++filterIter; |
67 | pack = filterIter.current(); | 76 | pack = filterIter.current(); |
68 | } | 77 | } |
69 | } | 78 | } |
70 | 79 | ||
71 | Package* PackageList::find( QString n ) | 80 | Package* PackageList::find( QString n ) |
72 | { | 81 | { |
73 | return packageList.find( n ); | 82 | return packageList.find( n ); |
74 | } | 83 | } |
75 | 84 | ||
76 | Package* PackageList::first() | 85 | Package* PackageList::first() |
77 | { | 86 | { |
78 | packageIter.toFirst(); | 87 | packageIter.toFirst(); |
79 | return packageIter.current(); | 88 | return packageIter.current(); |
80 | } | 89 | } |
81 | 90 | ||
82 | Package* PackageList::next() | 91 | Package* PackageList::next() |
83 | { | 92 | { |
84 | ++packageIter; | 93 | ++packageIter; |
85 | return packageIter.current(); | 94 | return packageIter.current(); |
86 | } | 95 | } |
87 | 96 | ||
88 | QStringList PackageList::getSections() | 97 | QStringList PackageList::getSections() |
89 | { | 98 | { |
90 | sections.sort(); | 99 | sections.sort(); |
91 | return sections; | 100 | return sections; |
92 | } | 101 | } |
93 | 102 | ||
94 | QStringList PackageList::getSubSections() | 103 | QStringList PackageList::getSubSections() |
95 | { | 104 | { |
96 | QStringList ss; | 105 | QStringList ss; |
97 | if ( !subSections[aktSection] ) return ss; | 106 | if ( !subSections[aktSection] ) return ss; |
98 | ss = *subSections[aktSection]; | 107 | ss = *subSections[aktSection]; |
99 | ss.sort(); | 108 | ss.sort(); |
100 | return ss; | 109 | return ss; |
101 | } | 110 | } |
102 | 111 | ||
103 | void PackageList::setSection( QString sec ) | 112 | void PackageList::setSection( QString sec ) |
104 | { | 113 | { |
105 | aktSection = sec; | 114 | aktSection = sec; |
106 | } | 115 | } |
107 | 116 | ||
108 | void PackageList::setSubSection( QString ssec ) | 117 | void PackageList::setSubSection( QString ssec ) |
109 | { | 118 | { |
110 | aktSubSection = ssec; | 119 | aktSubSection = ssec; |
111 | } | 120 | } |
112 | 121 | ||
113 | void PackageList::updateSections( Package* pack ) | 122 | void PackageList::updateSections( Package* pack ) |
114 | { | 123 | { |
115 | QString s = pack->section(); | 124 | QString s = pack->section(); |
116 | if ( s.isEmpty() || s == "") return; | 125 | if ( s.isEmpty() || s == "") return; |
117 | if ( sections.contains(s) ) return; | 126 | if ( sections.contains(s) ) return; |
118 | sections += s; | 127 | sections += s; |
119 | QString ss = pack->subSection(); | 128 | QString ss = pack->subSection(); |
120 | if ( ss.isEmpty() || ss == "" ) return; | 129 | if ( ss.isEmpty() || ss == "" ) return; |
121 | if ( !subSections[s] ) { | 130 | if ( !subSections[s] ) { |
122 | subSections.insert( s, new QStringList() ); | 131 | subSections.insert( s, new QStringList() ); |
123 | QStringList *subsecs = subSections[s]; | 132 | QStringList *subsecs = subSections[s]; |
124 | *subsecs += "All"; | 133 | *subsecs += "All"; |
125 | } | 134 | } |
126 | QStringList *subsecs = subSections[s]; | 135 | QStringList *subsecs = subSections[s]; |
127 | *subsecs += ss; | 136 | *subsecs += ss; |
128 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 137 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
129 | subsecs = subSections["All"]; | 138 | subsecs = subSections["All"]; |
130 | *subsecs += ss; | 139 | *subsecs += ss; |
131 | } | 140 | } |
132 | 141 | ||
133 | 142 | ||
134 | void PackageList::readFileEntries( QString filename, QString dest ) | 143 | void PackageList::readFileEntries( QString filename, QString dest ) |
135 | { | 144 | { |
136 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | 145 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); |
137 | QStringList packEntry; | 146 | QStringList packEntry; |
138 | QFile f( filename ); | 147 | QFile f( filename ); |
139 | if ( !f.open(IO_ReadOnly) ) return; | 148 | if ( !f.open(IO_ReadOnly) ) return; |
140 | QTextStream *statusStream = new QTextStream( &f ); | 149 | QTextStream *statusStream = new QTextStream( &f ); |
141 | while ( !statusStream ->eof() ) | 150 | while ( !statusStream ->eof() ) |
142 | { | 151 | { |
143 | QString line = statusStream->readLine(); | 152 | QString line = statusStream->readLine(); |
144 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 153 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
145 | { | 154 | { |
146 | //end of package | 155 | //end of package |
147 | if ( ! packEntry.isEmpty() ) | 156 | if ( ! packEntry.isEmpty() ) |
148 | { | 157 | { |
149 | Package *p = new Package( packEntry, settings ); | 158 | Package *p = new Package( packEntry, settings ); |
150 | p->setDest( dest ); | 159 | p->setDest( dest ); |
151 | if ( p ) | 160 | if ( p ) |
152 | { | 161 | { |
153 | insertPackage( p ); | 162 | insertPackage( p ); |
154 | packEntry.clear(); | 163 | packEntry.clear(); |
155 | } | 164 | } |
156 | } | 165 | } |
157 | }else{ | 166 | }else{ |
158 | packEntry << line; | 167 | packEntry << line; |
159 | }; | 168 | }; |
160 | } | 169 | } |
161 | return; | 170 | return; |
162 | } | 171 | } |
163 | 172 | ||
164 | void PackageList::setSettings( PackageManagerSettings *s ) | 173 | void PackageList::setSettings( PackageManagerSettings *s ) |
165 | { | 174 | { |
166 | settings = s; | 175 | settings = s; |
167 | } | 176 | } |
168 | 177 | ||
169 | Package* PackageList::getByName( QString n ) | 178 | Package* PackageList::getByName( QString n ) |
170 | { | 179 | { |
171 | origPackageList[n]; | 180 | origPackageList[n]; |
172 | } | 181 | } |
173 | 182 | ||
174 | void PackageList::clear() | 183 | void PackageList::clear() |
175 | { | 184 | { |
176 | origPackageList.clear(); | 185 | origPackageList.clear(); |
177 | packageList.clear(); | 186 | packageList.clear(); |
178 | } | 187 | } |
179 | 188 | ||
180 | void PackageList::allPackages() | 189 | void PackageList::allPackages() |
181 | { | 190 | { |
182 | packageList.clear(); | 191 | packageList.clear(); |
183 | QDictIterator<Package> filterIter( origPackageList ); | 192 | QDictIterator<Package> filterIter( origPackageList ); |
184 | filterIter.toFirst(); | 193 | filterIter.toFirst(); |
185 | Package *pack= filterIter.current() ; | 194 | Package *pack= filterIter.current() ; |
186 | while ( pack ) | 195 | while ( pack ) |
187 | { | 196 | { |
188 | packageList.insert( pack->name(), pack ); | 197 | packageList.insert( pack->name(), pack ); |
189 | ++filterIter; | 198 | ++filterIter; |
190 | pack = filterIter.current(); | 199 | pack = filterIter.current(); |
191 | } | 200 | } |
192 | } | 201 | } |
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 610a0e1..36d081b 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -1,90 +1,89 @@ | |||
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 | // popupActcat setOn( activePackage->toProcess() ); | ||
68 | } | 67 | } |
69 | popupMenu->popup( QCursor::pos() ); | 68 | popupMenu->popup( QCursor::pos() ); |
70 | } | 69 | } |
71 | 70 | ||
72 | void PackageListView::stopTimer( QListViewItem* ) | 71 | void PackageListView::stopTimer( QListViewItem* ) |
73 | { | 72 | { |
74 | popupTimer->stop(); | 73 | popupTimer->stop(); |
75 | } | 74 | } |
76 | 75 | ||
77 | 76 | ||
78 | void PackageListView::changePackageDest( int i ) | 77 | void PackageListView::changePackageDest( int i ) |
79 | { | 78 | { |
80 | activePackage->setDest( destsMenu->text(i) ); | 79 | activePackage->setDest( destsMenu->text(i) ); |
81 | activePackage->setOn(); | 80 | activePackage->setOn(); |
82 | activePackage->setLink( settings->createLinks() ); | 81 | activePackage->setLink( settings->createLinks() ); |
83 | activePackageListItem->displayDetails(); | 82 | activePackageListItem->displayDetails(); |
84 | } | 83 | } |
85 | 84 | ||
86 | void PackageListView::toggleProcess() | 85 | void PackageListView::toggleProcess() |
87 | { | 86 | { |
88 | activePackage->toggleProcess() ; | 87 | activePackage->toggleProcess() ; |
89 | activePackageListItem->displayDetails(); | 88 | activePackageListItem->displayDetails(); |
90 | } | 89 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index fe200f5..1798c80 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -97,362 +97,352 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
97 | { | 97 | { |
98 | out( line +"<br>" ); | 98 | out( line +"<br>" ); |
99 | oldLine = line; | 99 | oldLine = line; |
100 | } | 100 | } |
101 | } | 101 | } |
102 | f.close(); | 102 | f.close(); |
103 | out( "Finished!<br>"); | 103 | out( "Finished!<br>"); |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | return r; | 106 | return r; |
107 | } | 107 | } |
108 | 108 | ||
109 | void PmIpkg::makeLinks(Package *pack) | 109 | void PmIpkg::makeLinks(Package *pack) |
110 | { | 110 | { |
111 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 111 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
112 | linkPackage( pack->name(), pack->dest() ); | 112 | linkPackage( pack->name(), pack->dest() ); |
113 | } | 113 | } |
114 | 114 | ||
115 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 115 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
116 | { | 116 | { |
117 | QString dest = settings->getDestinationUrlByName( d ); | 117 | QString dest = settings->getDestinationUrlByName( d ); |
118 | dest = dest==""?d:dest; | 118 | dest = dest==""?d:dest; |
119 | if (dest == "/" ) return 0; | 119 | if (dest == "/" ) return 0; |
120 | { | 120 | { |
121 | Config cfg( "oipkg", Config::User ); | 121 | Config cfg( "oipkg", Config::User ); |
122 | cfg.setGroup( "Common" ); | 122 | cfg.setGroup( "Common" ); |
123 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 123 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
124 | } | 124 | } |
125 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 125 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
126 | QFile f( packFileName ); | 126 | QFile f( packFileName ); |
127 | if ( ! f.open(IO_ReadOnly) ) | 127 | if ( ! f.open(IO_ReadOnly) ) |
128 | { | 128 | { |
129 | pvDebug(1," Panik! Could not open"); | 129 | pvDebug(1," Panik! Could not open"); |
130 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); | 130 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
131 | return (QStringList*)0; | 131 | return (QStringList*)0; |
132 | } | 132 | } |
133 | QStringList *fileList = new QStringList(); | 133 | QStringList *fileList = new QStringList(); |
134 | QTextStream t( &f ); | 134 | QTextStream t( &f ); |
135 | while ( !t.eof() ) | 135 | while ( !t.eof() ) |
136 | { | 136 | { |
137 | *fileList += t.readLine(); | 137 | *fileList += t.readLine(); |
138 | } | 138 | } |
139 | return fileList; | 139 | return fileList; |
140 | } | 140 | } |
141 | 141 | ||
142 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 142 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
143 | { | 143 | { |
144 | QStringList *fileList = getList( packFileName, dest ); | 144 | QStringList *fileList = getList( packFileName, dest ); |
145 | processFileList( fileList, dest ); | 145 | processFileList( fileList, dest ); |
146 | delete fileList; | 146 | delete fileList; |
147 | } | 147 | } |
148 | 148 | ||
149 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 149 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
150 | { | 150 | { |
151 | if (!fileList) return; | 151 | if (!fileList) return; |
152 | for (uint i=0; i < fileList->count(); i++) | 152 | for (uint i=0; i < fileList->count(); i++) |
153 | { | 153 | { |
154 | QString dest = settings->getDestinationUrlByName( d ); | 154 | QString dest = settings->getDestinationUrlByName( d ); |
155 | dest = dest==""?d:dest; | 155 | dest = dest==""?d:dest; |
156 | processLinkDir( (*fileList)[i], dest ); | 156 | processLinkDir( (*fileList)[i], dest ); |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
160 | 160 | ||
161 | void PmIpkg::processLinkDir( QString file, QString dest ) | 161 | void PmIpkg::processLinkDir( QString file, QString dest ) |
162 | { | 162 | { |
163 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); | 163 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); |
164 | if (linkOpp==createLink) pvDebug( 2,"opp: createLink"); | 164 | if (linkOpp==createLink) pvDebug( 2,"opp: createLink"); |
165 | if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink"); | 165 | if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink"); |
166 | if ( dest == "???" || dest == "" ) return; | 166 | if ( dest == "???" || dest == "" ) return; |
167 | QString destFile = file; | 167 | QString destFile = file; |
168 | file = dest+"/"+file; | 168 | file = dest+"/"+file; |
169 | if (file == dest) return; | 169 | if (file == dest) return; |
170 | QFileInfo fileInfo( file ); | 170 | QFileInfo fileInfo( file ); |
171 | if ( fileInfo.isDir() ) | 171 | if ( fileInfo.isDir() ) |
172 | { | 172 | { |
173 | QDir destDir( destFile ); | 173 | QDir destDir( destFile ); |
174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
175 | QDir d( file ); | 175 | QDir d( file ); |
176 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 176 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
177 | const QFileInfoList *list = d.entryInfoList(); | 177 | const QFileInfoList *list = d.entryInfoList(); |
178 | QFileInfoListIterator it( *list ); | 178 | QFileInfoListIterator it( *list ); |
179 | QFileInfo *fi; | 179 | QFileInfo *fi; |
180 | while ( (fi=it.current()) ) | 180 | while ( (fi=it.current()) ) |
181 | { | 181 | { |
182 | pvDebug(4, "process dir "+fi->absFilePath()); | 182 | pvDebug(4, "process dir "+fi->absFilePath()); |
183 | processLinkDir( fi->absFilePath(), dest ); | 183 | processLinkDir( fi->absFilePath(), dest ); |
184 | ++it; | 184 | ++it; |
185 | } | 185 | } |
186 | // if (linkOpp==removeLink) | 186 | // if (linkOpp==removeLink) |
187 | // { | 187 | // { |
188 | // pvDebug(2,"remove destDir "+ destFile ); | 188 | // pvDebug(2,"remove destDir "+ destFile ); |
189 | // destDir.remove( destFile, true ); | 189 | // destDir.remove( destFile, true ); |
190 | // } | 190 | // } |
191 | } else | 191 | } else |
192 | if ( fileInfo.isFile() ) | 192 | if ( fileInfo.isFile() ) |
193 | { | 193 | { |
194 | const char *instFile = strdup( (file).ascii() ); | 194 | const char *instFile = strdup( (file).ascii() ); |
195 | const char *linkFile = strdup( (destFile).ascii()); | 195 | const char *linkFile = strdup( (destFile).ascii()); |
196 | if( linkOpp==createLink ) | 196 | if( linkOpp==createLink ) |
197 | { | 197 | { |
198 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 198 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
199 | symlink( instFile, linkFile ); | 199 | symlink( instFile, linkFile ); |
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | const char *linkFile = strdup( (destFile).ascii()); | 202 | const char *linkFile = strdup( (destFile).ascii()); |
203 | if( linkOpp==removeLink ) | 203 | if( linkOpp==removeLink ) |
204 | { | 204 | { |
205 | pvDebug(4,"removing "+destFile+" no "+file); | 205 | pvDebug(4,"removing "+destFile+" no "+file); |
206 | QFileInfo toRemoveLink( destFile ); | 206 | QFileInfo toRemoveLink( destFile ); |
207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
208 | unlink( linkFile ); | 208 | unlink( linkFile ); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | void PmIpkg::loadList( PackageList pl ) | 213 | void PmIpkg::loadList( PackageList pl ) |
214 | { | 214 | { |
215 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 215 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
216 | { | 216 | { |
217 | if ( pack && (pack->name() != "") && pack) | 217 | if ( pack && (pack->name() != "") && pack) |
218 | { | 218 | { |
219 | if ( pack->toInstall() ) | 219 | if ( pack->toInstall() ) |
220 | to_install.append( pack ); | 220 | to_install.append( pack ); |
221 | if ( pack->toRemove() ) | 221 | if ( pack->toRemove() ) |
222 | to_remove.append( pack ); | 222 | to_remove.append( pack ); |
223 | } | 223 | } |
224 | } | 224 | } |
225 | } | 225 | } |
226 | 226 | ||
227 | void PmIpkg::commit( PackageList pl ) | 227 | void PmIpkg::commit( PackageList pl ) |
228 | { | 228 | { |
229 | sizecount = 0; | 229 | sizecount = 0; |
230 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | 230 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; |
231 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | 231 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; |
232 | loadList(pl); | 232 | loadList(pl); |
233 | for (uint i=0; i < to_remove.count(); i++) | 233 | for (uint i=0; i < to_remove.count(); i++) |
234 | sizecount += 1; | 234 | sizecount += 1; |
235 | for (uint i=0; i < to_install.count(); i++) | 235 | for (uint i=0; i < to_install.count(); i++) |
236 | sizecount += to_install.at(i)->size().toInt(); | 236 | sizecount += to_install.at(i)->size().toInt(); |
237 | startDialog(); | 237 | startDialog(); |
238 | } | 238 | } |
239 | 239 | ||
240 | void PmIpkg::startDialog() | 240 | void PmIpkg::startDialog() |
241 | { | 241 | { |
242 | installDialog = new QDialog(0,0,true); | 242 | installDialog = new QDialog(0,0,true); |
243 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 243 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); |
244 | RunWindowLayout->setSpacing( 2 ); | 244 | RunWindowLayout->setSpacing( 2 ); |
245 | RunWindowLayout->setMargin( 2 ); | 245 | RunWindowLayout->setMargin( 2 ); |
246 | 246 | ||
247 | PackageListView *plv = new PackageListView(installDialog, "install",settings); | 247 | PackageListView *plv = new PackageListView(installDialog, "install",settings); |
248 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); | 248 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); |
249 | RunWindowLayout->addWidget( plv, 1, 0 ); | 249 | RunWindowLayout->addWidget( plv, 1, 0 ); |
250 | QCheckListItem *toRemoveItem; | 250 | QCheckListItem *toRemoveItem; |
251 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); | 251 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); |
252 | toRemoveItem->setOpen( true ); | 252 | toRemoveItem->setOpen( true ); |
253 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 253 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
254 | { | 254 | { |
255 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); | 255 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); |
256 | } | 256 | } |
257 | QCheckListItem *toInstallItem; | 257 | QCheckListItem *toInstallItem; |
258 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); | 258 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); |
259 | toInstallItem->setOpen( true ); | 259 | toInstallItem->setOpen( true ); |
260 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 260 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
261 | { | 261 | { |
262 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); | 262 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); |
263 | } | 263 | } |
264 | 264 | ||
265 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); | 265 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); |
266 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); | 266 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); |
267 | GroupBox1->setTitle( tr( "Ipkg options" ) ); | 267 | GroupBox1->setTitle( tr( "Ipkg options" ) ); |
268 | GroupBox1->setColumnLayout(0, Qt::Vertical ); | 268 | GroupBox1->setColumnLayout(0, Qt::Vertical ); |
269 | GroupBox1->layout()->setSpacing( 0 ); | 269 | GroupBox1->layout()->setSpacing( 0 ); |
270 | GroupBox1->layout()->setMargin( 0 ); | 270 | GroupBox1->layout()->setMargin( 0 ); |
271 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); | 271 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); |
272 | GroupBox1Layout->setAlignment( Qt::AlignTop ); | 272 | GroupBox1Layout->setAlignment( Qt::AlignTop ); |
273 | GroupBox1Layout->setSpacing( 3 ); | 273 | GroupBox1Layout->setSpacing( 3 ); |
274 | GroupBox1Layout->setMargin( 3 ); | 274 | GroupBox1Layout->setMargin( 3 ); |
275 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); | 275 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); |
276 | _force_depends->setText( tr( "-force-depends" ) ); | 276 | _force_depends->setText( tr( "-force-depends" ) ); |
277 | _force_depends->setAutoResize( TRUE ); | 277 | _force_depends->setAutoResize( TRUE ); |
278 | _force_depends->setChecked(true); | 278 | _force_depends->setChecked(true); |
279 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); | 279 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); |
280 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); | 280 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); |
281 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | 281 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
282 | _force_reinstall->setAutoResize( TRUE ); | 282 | _force_reinstall->setAutoResize( TRUE ); |
283 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); | 283 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); |
284 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); | 284 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); |
285 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | 285 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
286 | _force_remove->setAutoResize( TRUE ); | 286 | _force_remove->setAutoResize( TRUE ); |
287 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); | 287 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); |
288 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); | 288 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); |
289 | |||
290 | // connect( doItButton, SIGNAL( clicked() ), | ||
291 | // this, SLOT( doIt() ) ); | ||
292 | // connect( installButton, SIGNAL( clicked() ), | ||
293 | // this, SLOT( install() ) ); | ||
294 | // connect( removeButton, SIGNAL( clicked() ), | ||
295 | // this, SLOT( remove() ) ); | ||
296 | // connect( cancelButton, SIGNAL( clicked() ), | ||
297 | // installDialog, SLOT( close() ) ); | ||
298 | installDialog->showMaximized(); | 289 | installDialog->showMaximized(); |
299 | if ( installDialog->exec() ) doIt(); | 290 | if ( installDialog->exec() ) doIt(); |
300 | installDialog->close(); | 291 | installDialog->close(); |
301 | out(tr("<b>All done.</b>")); | 292 | out(tr("<b>All done.</b>")); |
302 | } | 293 | } |
303 | 294 | ||
304 | void PmIpkg::doIt() | 295 | void PmIpkg::doIt() |
305 | { | 296 | { |
306 | show( true ); | 297 | show( true ); |
307 | remove(); | 298 | remove(); |
308 | install(); | 299 | install(); |
309 | } | 300 | } |
310 | 301 | ||
311 | 302 | ||
312 | void PmIpkg::remove() | 303 | void PmIpkg::remove() |
313 | { | 304 | { |
314 | if ( to_remove.count() == 0 ) return; | 305 | if ( to_remove.count() == 0 ) return; |
315 | 306 | ||
316 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); | 307 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); |
317 | 308 | ||
318 | QStringList *fileList; | 309 | QStringList *fileList; |
319 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 310 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
320 | { | 311 | { |
321 | if ( it->link() )fileList = getList( it->name(), it->dest() ); | 312 | if ( it->link() )fileList = getList( it->name(), it->dest() ); |
322 | if ( runIpkg("remove " + it->name()) == 0) | 313 | if ( runIpkg("remove " + it->name()) == 0) |
323 | { | 314 | { |
324 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); | 315 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); |
325 | linkOpp = removeLink; | 316 | linkOpp = removeLink; |
326 | if ( it->link() ) | 317 | if ( it->link() ) |
327 | { | 318 | { |
328 | out( "<br>removing links<br>" ); | 319 | out( "<br>removing links<br>" ); |
329 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 320 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
330 | processFileList( fileList, it->dest() ); | 321 | processFileList( fileList, it->dest() ); |
331 | } | 322 | } |
332 | it->processed(); | 323 | it->processed(); |
333 | 324 | ||
334 | out("<br><hr>"); | 325 | out("<br><hr>"); |
335 | }else{ | 326 | }else{ |
336 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); | 327 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); |
337 | } | 328 | } |
338 | pvDebug(2,"delete File List"); | ||
339 | if ( it->link() )delete fileList; | 329 | if ( it->link() )delete fileList; |
340 | } | 330 | } |
341 | out("<br>"); | 331 | out("<br>"); |
342 | } | 332 | } |
343 | 333 | ||
344 | 334 | ||
345 | void PmIpkg::install() | 335 | void PmIpkg::install() |
346 | { | 336 | { |
347 | if ( to_install.count() == 0 ) return; | 337 | if ( to_install.count() == 0 ) return; |
348 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 338 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
349 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 339 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
350 | { | 340 | { |
351 | 341 | ||
352 | if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) | 342 | if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) |
353 | { | 343 | { |
354 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 344 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
355 | linkOpp = createLink; | 345 | linkOpp = createLink; |
356 | if ( it->link() ) | 346 | if ( it->link() ) |
357 | { | 347 | { |
358 | out( "<br>creating links<br>" ); | 348 | out( "<br>creating links<br>" ); |
359 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 349 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
360 | makeLinks( it ); | 350 | makeLinks( it ); |
361 | } | 351 | } |
362 | it->processed(); | 352 | it->processed(); |
363 | out("<br><hr>"); | 353 | out("<br><hr>"); |
364 | }else{ | 354 | }else{ |
365 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); | 355 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); |
366 | } | 356 | } |
367 | } | 357 | } |
368 | out("<br>"); | 358 | out("<br>"); |
369 | } | 359 | } |
370 | 360 | ||
371 | void PmIpkg::createLinks( const QString &dest ) | 361 | void PmIpkg::createLinks( const QString &dest ) |
372 | { | 362 | { |
373 | pvDebug(2,"PmIpkg::createLinks "+dest); | 363 | pvDebug(2,"PmIpkg::createLinks "+dest); |
374 | linkOpp=createLink; | 364 | linkOpp=createLink; |
375 | QString url = settings->getDestinationUrlByName( dest ); | 365 | QString url = settings->getDestinationUrlByName( dest ); |
376 | url = url==""?dest:url; | 366 | url = url==""?dest:url; |
377 | processLinkDir( "/", url ); | 367 | processLinkDir( "/", url ); |
378 | } | 368 | } |
379 | 369 | ||
380 | void PmIpkg::removeLinks( const QString &dest ) | 370 | void PmIpkg::removeLinks( const QString &dest ) |
381 | { | 371 | { |
382 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 372 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
383 | linkOpp=removeLink; | 373 | linkOpp=removeLink; |
384 | QString url = settings->getDestinationUrlByName( dest ); | 374 | QString url = settings->getDestinationUrlByName( dest ); |
385 | url = url==""?dest:url; | 375 | url = url==""?dest:url; |
386 | processLinkDir( "/", url ); | 376 | processLinkDir( "/", url ); |
387 | } | 377 | } |
388 | 378 | ||
389 | void PmIpkg::update() | 379 | void PmIpkg::update() |
390 | { | 380 | { |
391 | show( false ); | 381 | show( false ); |
392 | runIpkg( "update" ); | 382 | runIpkg( "update" ); |
393 | runwindow->close(); | 383 | runwindow->close(); |
394 | } | 384 | } |
395 | 385 | ||
396 | void PmIpkg::out( QString o ) | 386 | void PmIpkg::out( QString o ) |
397 | { | 387 | { |
398 | runwindow->outPut->append(o); | 388 | runwindow->outPut->append(o); |
399 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); | 389 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); |
400 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); | 390 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); |
401 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 391 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
402 | } | 392 | } |
403 | 393 | ||
404 | 394 | ||
405 | void PmIpkg::showButtons(bool b) | 395 | void PmIpkg::showButtons(bool b) |
406 | { | 396 | { |
407 | if ( b ) | 397 | if ( b ) |
408 | { | 398 | { |
409 | runwindow->cancelButton->hide(); | 399 | runwindow->cancelButton->hide(); |
410 | runwindow->doItButton->hide(); | 400 | runwindow->doItButton->hide(); |
411 | runwindow->removeButton->hide(); | 401 | runwindow->removeButton->hide(); |
412 | runwindow->installButton->hide(); | 402 | runwindow->installButton->hide(); |
413 | }else{ | 403 | }else{ |
414 | runwindow->cancelButton->show(); | 404 | runwindow->cancelButton->show(); |
415 | runwindow->doItButton->show(); | 405 | runwindow->doItButton->show(); |
416 | runwindow->removeButton->show(); | 406 | runwindow->removeButton->show(); |
417 | runwindow->installButton->show(); | 407 | runwindow->installButton->show(); |
418 | 408 | ||
419 | } | 409 | } |
420 | } | 410 | } |
421 | 411 | ||
422 | void PmIpkg::show(bool b) | 412 | void PmIpkg::show(bool b) |
423 | { | 413 | { |
424 | if (!runwindow->isVisible()) | 414 | if (!runwindow->isVisible()) |
425 | runwindow->showMaximized(); | 415 | runwindow->showMaximized(); |
426 | showButtons(b); | 416 | showButtons(b); |
427 | if ( !b ) | 417 | if ( !b ) |
428 | runwindow->progress->hide(); | 418 | runwindow->progress->hide(); |
429 | else | 419 | else |
430 | runwindow->progress->show(); | 420 | runwindow->progress->show(); |
431 | } | 421 | } |
432 | 422 | ||
433 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 423 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
434 | { | 424 | { |
435 | 425 | ||
436 | to_install.clear(); | 426 | to_install.clear(); |
437 | to_remove.clear(); | 427 | to_remove.clear(); |
438 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 428 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
439 | Package *p = new Package(fileName,settings); | 429 | Package *p = new Package(fileName,settings); |
440 | if ( dest!="") p->setDest( dest ); | 430 | if ( dest!="") p->setDest( dest ); |
441 | to_install.append( p ); | 431 | to_install.append( p ); |
442 | startDialog(); | 432 | startDialog(); |
443 | delete p; | 433 | delete p; |
444 | } | 434 | } |
445 | 435 | ||
446 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 436 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
447 | { | 437 | { |
448 | 438 | ||
449 | to_install.clear(); | 439 | to_install.clear(); |
450 | to_remove.clear(); | 440 | to_remove.clear(); |
451 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 441 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
452 | Package *p = new Package(fileName,settings); | 442 | Package *p = new Package(fileName,settings); |
453 | if ( dest!="") p->setDest( dest ); | 443 | if ( dest!="") p->setDest( dest ); |
454 | to_remove.append( p ); | 444 | to_remove.append( p ); |
455 | startDialog(); | 445 | startDialog(); |
456 | delete p; | 446 | delete p; |
457 | } | 447 | } |
458 | 448 | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 2b89023..fa00048 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,66 +1,65 @@ | |||
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 | #define createLink 0 | 14 | #define createLink 0 |
15 | #define removeLink 1 | 15 | #define removeLink 1 |
16 | 16 | ||
17 | class Package; | 17 | class Package; |
18 | class PmIpkg : public QObject | 18 | class PmIpkg : public QObject |
19 | { | 19 | { |
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | public: | 21 | public: |
22 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 22 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
23 | ~PmIpkg(); | 23 | ~PmIpkg(); |
24 | 24 | ||
25 | int linkOpp; | 25 | int linkOpp; |
26 | void loadList( PackageList ); | 26 | void loadList( PackageList ); |
27 | void commit( PackageList ); | 27 | void commit( PackageList ); |
28 | void update(); | 28 | void update(); |
29 | // PackageList* getPackageList(); | ||
30 | void showButtons(bool b=true); | 29 | void showButtons(bool b=true); |
31 | void show( bool buttons=true ); | 30 | void show( bool buttons=true ); |
32 | 31 | ||
33 | public slots: | 32 | public slots: |
34 | void doIt(); | 33 | void doIt(); |
35 | void install(); | 34 | void install(); |
36 | void remove(); | 35 | void remove(); |
37 | void installFile(const QString &fileName, const QString &dest=""); | 36 | void installFile(const QString &fileName, const QString &dest=""); |
38 | void removeFile(const QString &fileName, const QString &dest=""); | 37 | void removeFile(const QString &fileName, const QString &dest=""); |
39 | void createLinks( const QString &dest ); | 38 | void createLinks( const QString &dest ); |
40 | void removeLinks( const QString &dest ); | 39 | void removeLinks( const QString &dest ); |
41 | 40 | ||
42 | private: | 41 | private: |
43 | int sizecount; | 42 | int sizecount; |
44 | PackageManagerSettings* settings; | 43 | PackageManagerSettings* settings; |
45 | RunWindow *runwindow; | 44 | RunWindow *runwindow; |
46 | QDialog *installDialog; | 45 | QDialog *installDialog; |
47 | QList<Package> to_remove; | 46 | QList<Package> to_remove; |
48 | QList<Package> to_install; | 47 | QList<Package> to_install; |
49 | bool runwindowopen; | 48 | bool runwindowopen; |
50 | QString fileNameToInstall; | 49 | QString fileNameToInstall; |
51 | QCheckBox *_force_reinstall; | 50 | QCheckBox *_force_reinstall; |
52 | QCheckBox *_force_remove; | 51 | QCheckBox *_force_remove; |
53 | QCheckBox *_force_depends; | 52 | QCheckBox *_force_depends; |
54 | void startDialog(); | 53 | void startDialog(); |
55 | void makeLinks(Package*); | 54 | void makeLinks(Package*); |
56 | void linkPackage( QString, QString ); | 55 | void linkPackage( QString, QString ); |
57 | void processLinkDir( QString , QString ); | 56 | void processLinkDir( QString , QString ); |
58 | int runIpkg(const QString& args, const QString& dest="" ); | 57 | int runIpkg(const QString& args, const QString& dest="" ); |
59 | void out( QString ); | 58 | void out( QString ); |
60 | QStringList* getList( QString, QString ); | 59 | QStringList* getList( QString, QString ); |
61 | void processFileList( QStringList*, QString ); | 60 | void processFileList( QStringList*, QString ); |
62 | 61 | ||
63 | 62 | ||
64 | }; | 63 | }; |
65 | 64 | ||
66 | #endif | 65 | #endif |