author | tille <tille> | 2002-05-04 14:09:41 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-04 14:09:41 (UTC) |
commit | 27f8629d4e6e16e9a33410ffe650f4a6d0bb17be (patch) (unidiff) | |
tree | 924a9449cff5d062d421f580644ea98ab8f42429 | |
parent | 4eddfebd1b4f70bbfe9106a16e9a3eeb6601f653 (diff) | |
download | opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.zip opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.tar.gz opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.tar.bz2 |
version handling
-rw-r--r-- | noncore/unsupported/oipkg/main.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 7 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 58 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 14 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 21 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 27 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 9 | ||||
-rw-r--r-- | pics/oipkg/installedOld.png | bin | 0 -> 197 bytes | |||
-rw-r--r-- | pics/oipkg/uninstalledInstalledOld.png | bin | 0 -> 257 bytes | |||
-rw-r--r-- | pics/oipkg/uninstalledOld.png | bin | 0 -> 225 bytes | |||
-rw-r--r-- | pics/oipkg/uninstalledOldinstalledNew.png | bin | 0 -> 261 bytes |
12 files changed, 124 insertions, 16 deletions
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp index 4af11df..d98bcaa 100644 --- a/noncore/unsupported/oipkg/main.cpp +++ b/noncore/unsupported/oipkg/main.cpp | |||
@@ -1,24 +1,24 @@ | |||
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 | #include <qmessagebox.h> |
7 | int debugLevel; | 7 | int debugLevel; |
8 | 8 | ||
9 | int main( int argc, char ** argv ) | 9 | int main( int argc, char ** argv ) |
10 | { | 10 | { |
11 | 11 | ||
12 | debugLevel = 2; | 12 | debugLevel = 2; |
13 | if (argc > 0) | 13 | if (argc > 1) |
14 | { | 14 | { |
15 | debugLevel = QString ( argv[1] ).toInt(); | 15 | debugLevel = QString ( argv[1] ).toInt(); |
16 | qDebug("setting debug level to %i",debugLevel); | 16 | qDebug("setting debug level to %i",debugLevel); |
17 | } | 17 | } |
18 | QPEApplication a( argc, argv ); | 18 | QPEApplication a( argc, argv ); |
19 | MainWindow mw; | 19 | MainWindow mw; |
20 | if (argc > 2) | 20 | if (argc > 2) |
21 | QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); | 21 | QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); |
22 | a.showMainDocumentWidget( &mw ); | 22 | a.showMainDocumentWidget( &mw ); |
23 | return a.exec(); | 23 | return a.exec(); |
24 | } | 24 | } |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 4f6e4cc..55f915d 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,342 +1,345 @@ | |||
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 | listViewPackages->addList( tr("feeds"), &packageListServers ); | 41 | listViewPackages->addList( tr("feeds"), &packageListServers ); |
42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | 42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); |
43 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); | 43 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); |
44 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | 44 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); |
45 | //wait = new QMessageBox(this); | 45 | //wait = new QMessageBox(this); |
46 | // wait->setText(tr("Please wait")); | 46 | // wait->setText(tr("Please wait")); |
47 | ipkg = new PmIpkg( settings, this ); | 47 | ipkg = new PmIpkg( settings, this ); |
48 | // settings->setIpkg( ipkg ); | 48 | // settings->setIpkg( ipkg ); |
49 | packageListServers.setSettings( settings ); | 49 | packageListServers.setSettings( settings ); |
50 | packageListSearch.setSettings( settings ); | 50 | packageListSearch.setSettings( settings ); |
51 | packageListDocLnk.setSettings( settings ); | 51 | packageListDocLnk.setSettings( settings ); |
52 | pvDebug(9,"packageListServers.update"); | ||
52 | packageListServers.update(); | 53 | packageListServers.update(); |
54 | pvDebug(9,"packageListDocLnk.update"); | ||
53 | packageListDocLnk.update(); | 55 | packageListDocLnk.update(); |
56 | pvDebug(9,"makeMenu"); | ||
54 | makeMenu(); | 57 | makeMenu(); |
55 | makeChannel(); | 58 | makeChannel(); |
56 | //opie is hardcoded default ;) | 59 | //opie is hardcoded default ;) |
60 | pvDebug(9,"section->setCurrentItem"); | ||
57 | for (int i=0;i<section->count();i++) | 61 | for (int i=0;i<section->count();i++) |
58 | if (section->text(i)=="opie") | 62 | if (section->text(i)=="opie") |
59 | section->setCurrentItem(i); | 63 | section->setCurrentItem(i); |
60 | sectionChanged(); | 64 | sectionChanged(); |
61 | 65 | ||
62 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 66 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
63 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 67 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
64 | 68 | ||
65 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 69 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
66 | SLOT(removeLinks()) ); | 70 | SLOT(removeLinks()) ); |
67 | connect( settings->createLinksButton, SIGNAL( clicked()), | 71 | connect( settings->createLinksButton, SIGNAL( clicked()), |
68 | SLOT(createLinks()) ); | 72 | SLOT(createLinks()) ); |
69 | 73 | ||
74 | pvDebug(9,"displayList"); | ||
70 | displayList(); | 75 | displayList(); |
71 | } | 76 | } |
72 | 77 | ||
73 | void MainWindow::makeMenu() | 78 | void MainWindow::makeMenu() |
74 | { | 79 | { |
75 | 80 | ||
76 | QPEToolBar *toolBar = new QPEToolBar( this ); | 81 | QPEToolBar *toolBar = new QPEToolBar( this ); |
77 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 82 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
78 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 83 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
79 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 84 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
80 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 85 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
81 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 86 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
82 | 87 | ||
83 | setToolBarsMovable( false ); | 88 | setToolBarsMovable( false ); |
84 | toolBar->setHorizontalStretchable( true ); | 89 | toolBar->setHorizontalStretchable( true ); |
85 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 90 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
86 | menuBar->insertItem( tr( "View" ), viewMenu ); | 91 | menuBar->insertItem( tr( "View" ), viewMenu ); |
87 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 92 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
88 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 93 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
89 | 94 | ||
90 | QLabel *spacer = new QLabel( "", toolBar ); | 95 | QLabel *spacer = new QLabel( "", toolBar ); |
91 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 96 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
92 | toolBar->setStretchableWidget( spacer ); | 97 | toolBar->setStretchableWidget( spacer ); |
93 | 98 | ||
94 | 99 | ||
95 | runAction = new QAction( tr( "Apply" ), | 100 | runAction = new QAction( tr( "Apply" ), |
96 | Resource::loadPixmap( "oipkg/install" ), | 101 | Resource::loadPixmap( "oipkg/install" ), |
97 | QString::null, 0, this, 0 ); | 102 | QString::null, 0, this, 0 ); |
98 | connect( runAction, SIGNAL( activated() ), | 103 | connect( runAction, SIGNAL( activated() ), |
99 | this, SLOT( runIpkg() ) ); | 104 | this, SLOT( runIpkg() ) ); |
100 | runAction->addTo( toolBar ); | 105 | runAction->addTo( toolBar ); |
101 | runAction->addTo( srvMenu ); | 106 | runAction->addTo( srvMenu ); |
102 | 107 | ||
103 | srvMenu->insertSeparator (); | 108 | srvMenu->insertSeparator (); |
104 | 109 | ||
105 | updateAction = new QAction( tr( "Update" ), | 110 | updateAction = new QAction( tr( "Update" ), |
106 | Resource::loadIconSet( "oipkg/update" ), | 111 | Resource::loadIconSet( "oipkg/update" ), |
107 | QString::null, 0, this, 0 ); | 112 | QString::null, 0, this, 0 ); |
108 | connect( updateAction, SIGNAL( activated() ), | 113 | connect( updateAction, SIGNAL( activated() ), |
109 | this , SLOT( updateList() ) ); | 114 | this , SLOT( updateList() ) ); |
110 | updateAction->addTo( toolBar ); | 115 | updateAction->addTo( toolBar ); |
111 | updateAction->addTo( srvMenu ); | 116 | updateAction->addTo( srvMenu ); |
112 | 117 | ||
113 | QAction *cfgact; | 118 | QAction *cfgact; |
114 | 119 | ||
115 | cfgact = new QAction( tr( "Setups" ), | 120 | cfgact = new QAction( tr( "Setups" ), |
116 | QString::null, 0, this, 0 ); | 121 | QString::null, 0, this, 0 ); |
117 | connect( cfgact, SIGNAL( activated() ), | 122 | connect( cfgact, SIGNAL( activated() ), |
118 | SLOT( showSettings() ) ); | 123 | SLOT( showSettings() ) ); |
119 | cfgact->addTo( cfgMenu ); | 124 | cfgact->addTo( cfgMenu ); |
120 | 125 | ||
121 | cfgact = new QAction( tr( "Servers" ), | 126 | cfgact = new QAction( tr( "Servers" ), |
122 | QString::null, 0, this, 0 ); | 127 | QString::null, 0, this, 0 ); |
123 | connect( cfgact, SIGNAL( activated() ), | 128 | connect( cfgact, SIGNAL( activated() ), |
124 | SLOT( showSettingsSrv() ) ); | 129 | SLOT( showSettingsSrv() ) ); |
125 | cfgact->addTo( cfgMenu ); | 130 | cfgact->addTo( cfgMenu ); |
126 | cfgact = new QAction( tr( "Destinations" ), | 131 | cfgact = new QAction( tr( "Destinations" ), |
127 | QString::null, 0, this, 0 ); | 132 | QString::null, 0, this, 0 ); |
128 | connect( cfgact, SIGNAL( activated() ), | 133 | connect( cfgact, SIGNAL( activated() ), |
129 | SLOT( showSettingsDst() ) ); | 134 | SLOT( showSettingsDst() ) ); |
130 | cfgact->addTo( cfgMenu ); | 135 | cfgact->addTo( cfgMenu ); |
131 | 136 | ||
132 | QAction *a; | 137 | QAction *a; |
133 | 138 | ||
134 | // SECTIONS | 139 | // SECTIONS |
135 | sectionBar = new QPEToolBar( this ); | 140 | sectionBar = new QPEToolBar( this ); |
136 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 141 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
137 | sectionBar->setHorizontalStretchable( true ); | 142 | sectionBar->setHorizontalStretchable( true ); |
138 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 143 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
139 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 144 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
140 | sectionBar->setStretchableWidget( label ); | 145 | sectionBar->setStretchableWidget( label ); |
141 | section = new QComboBox( false, sectionBar ); | 146 | section = new QComboBox( false, sectionBar ); |
142 | label = new QLabel( " / ", sectionBar ); | 147 | label = new QLabel( " / ", sectionBar ); |
143 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 148 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
144 | subsection = new QComboBox( false, sectionBar ); | 149 | subsection = new QComboBox( false, sectionBar ); |
145 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 150 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
146 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 151 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
147 | a->addTo( sectionBar ); | 152 | a->addTo( sectionBar ); |
148 | setSections(); | 153 | setSections(); |
149 | setSubSections(); | 154 | setSubSections(); |
150 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 155 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
151 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 156 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
152 | sectionAction->setToggleAction( true ); | 157 | sectionAction->setToggleAction( true ); |
153 | sectionAction->addTo( viewMenu ); | 158 | sectionAction->addTo( viewMenu ); |
154 | 159 | ||
155 | //FIND | 160 | //FIND |
156 | findBar = new QPEToolBar(this); | 161 | findBar = new QPEToolBar(this); |
157 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); | 162 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
158 | label = new QLabel( tr("Filter: "), findBar ); | 163 | label = new QLabel( tr("Filter: "), findBar ); |
159 | label->setBackgroundColor( findBar->backgroundColor() ); | 164 | label->setBackgroundColor( findBar->backgroundColor() ); |
160 | findBar->setHorizontalStretchable( TRUE ); | 165 | findBar->setHorizontalStretchable( TRUE ); |
161 | findEdit = new QLineEdit( findBar, "findEdit" ); | 166 | findEdit = new QLineEdit( findBar, "findEdit" ); |
162 | findBar->setStretchableWidget( findEdit ); | 167 | findBar->setStretchableWidget( findEdit ); |
163 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 168 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
164 | this, SLOT( displayList() ) ); | 169 | this, SLOT( displayList() ) ); |
165 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
166 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 171 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
167 | a->addTo( findBar ); | 172 | a->addTo( findBar ); |
168 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 173 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
169 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 174 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
170 | a->addTo( findBar ); | 175 | a->addTo( findBar ); |
171 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); | 176 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
172 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 177 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
173 | findAction->setToggleAction( true ); | 178 | findAction->setToggleAction( true ); |
174 | findAction->addTo( viewMenu ); | 179 | findAction->addTo( viewMenu ); |
175 | 180 | ||
176 | //SEARCH | 181 | //SEARCH |
177 | searchBar = new QPEToolBar(this); | 182 | searchBar = new QPEToolBar(this); |
178 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 183 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
179 | label = new QLabel( tr("ipkgfind: "), searchBar ); | 184 | label = new QLabel( tr("ipkgfind: "), searchBar ); |
180 | label->setBackgroundColor( searchBar->backgroundColor() ); | 185 | label->setBackgroundColor( searchBar->backgroundColor() ); |
181 | searchBar->setHorizontalStretchable( TRUE ); | 186 | searchBar->setHorizontalStretchable( TRUE ); |
182 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 187 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
183 | searchBar->setStretchableWidget( searchEdit ); | 188 | searchBar->setStretchableWidget( searchEdit ); |
184 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 189 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
185 | // this, SLOT( displayList() ) ); | 190 | // this, SLOT( displayList() ) ); |
186 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 191 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
187 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | 192 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); |
188 | a->addTo( searchBar ); | 193 | a->addTo( searchBar ); |
189 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 194 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
190 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | 195 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); |
191 | searchCommit->addTo( searchBar ); | 196 | searchCommit->addTo( searchBar ); |
192 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 197 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
193 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | 198 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); |
194 | a->addTo( searchBar ); | 199 | a->addTo( searchBar ); |
195 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | 200 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); |
196 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | 201 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); |
197 | searchAction->setToggleAction( true ); | 202 | searchAction->setToggleAction( true ); |
198 | searchAction->addTo( viewMenu ); | 203 | searchAction->addTo( viewMenu ); |
199 | 204 | ||
200 | //DEST | 205 | //DEST |
201 | destBar = new QPEToolBar(this); | 206 | destBar = new QPEToolBar(this); |
202 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 207 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
203 | label = new QLabel( tr("Destination: "), destBar ); | 208 | label = new QLabel( tr("Destination: "), destBar ); |
204 | label->setBackgroundColor( destBar->backgroundColor() ); | 209 | label->setBackgroundColor( destBar->backgroundColor() ); |
205 | destBar->setHorizontalStretchable( TRUE ); | 210 | destBar->setHorizontalStretchable( TRUE ); |
206 | destination = new QComboBox( false, destBar ); | 211 | destination = new QComboBox( false, destBar ); |
207 | destination->insertStringList( settings->getDestinationNames() ); | 212 | destination->insertStringList( settings->getDestinationNames() ); |
208 | setComboName(destination,settings->getDestinationName()); | 213 | setComboName(destination,settings->getDestinationName()); |
209 | connect( destination, SIGNAL(activated(int)), | 214 | connect( destination, SIGNAL(activated(int)), |
210 | settings, SLOT(activeDestinationChange(int)) ); | 215 | settings, SLOT(activeDestinationChange(int)) ); |
211 | spacer = new QLabel( " ", destBar ); | 216 | spacer = new QLabel( " ", destBar ); |
212 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 217 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
213 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 218 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
214 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 219 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
215 | CheckBoxLink->setChecked( settings->createLinks() ); | 220 | CheckBoxLink->setChecked( settings->createLinks() ); |
216 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 221 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
217 | settings, SLOT(linkEnabled(bool)) ); | 222 | settings, SLOT(linkEnabled(bool)) ); |
218 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 223 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
219 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 224 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
220 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 225 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
221 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 226 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
222 | a->addTo( destBar ); | 227 | a->addTo( destBar ); |
223 | destBar->setStretchableWidget( CheckBoxLink ); | 228 | destBar->setStretchableWidget( CheckBoxLink ); |
224 | destAction->setToggleAction( true ); | 229 | destAction->setToggleAction( true ); |
225 | // destAction->addTo( viewMenu ); | 230 | // destAction->addTo( viewMenu ); |
226 | 231 | ||
227 | // configure the menus | 232 | // configure the menus |
228 | Config cfg( "oipkg", Config::User ); | 233 | Config cfg( "oipkg", Config::User ); |
229 | cfg.setGroup( "gui" ); | 234 | cfg.setGroup( "gui" ); |
230 | 235 | ||
231 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 236 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
232 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 237 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
233 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 238 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
234 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 239 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
235 | } | 240 | } |
236 | 241 | ||
237 | MainWindow::~MainWindow() | 242 | MainWindow::~MainWindow() |
238 | { | 243 | { |
239 | pvDebug(7,"MainWindow::~MainWindow "); | ||
240 | Config cfg( "oipkg", Config::User ); | 244 | Config cfg( "oipkg", Config::User ); |
241 | cfg.setGroup( "gui" ); | 245 | cfg.setGroup( "gui" ); |
242 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 246 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
243 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 247 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
244 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 248 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
245 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 249 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
246 | pvDebug(7,"MainWindow::~MainWindow "); | ||
247 | 250 | ||
248 | } | 251 | } |
249 | 252 | ||
250 | void MainWindow::runIpkg() | 253 | void MainWindow::runIpkg() |
251 | { | 254 | { |
252 | packageListServers.allPackages(); | 255 | packageListServers.allPackages(); |
253 | ipkg->loadList( &packageListSearch ); | 256 | ipkg->loadList( &packageListSearch ); |
254 | ipkg->loadList( &packageListDocLnk ); | 257 | ipkg->loadList( &packageListDocLnk ); |
255 | ipkg->loadList( &packageListServers ); | 258 | ipkg->loadList( &packageListServers ); |
256 | ipkg->commit(); | 259 | ipkg->commit(); |
257 | // ##### If we looked in the list of files, we could send out accurate | 260 | // ##### If we looked in the list of files, we could send out accurate |
258 | // ##### messages. But we don't bother yet, and just do an "all". | 261 | // ##### messages. But we don't bother yet, and just do an "all". |
259 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 262 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
260 | QString lf = QString::null; | 263 | QString lf = QString::null; |
261 | e << lf; | 264 | e << lf; |
262 | displayList(); | 265 | displayList(); |
263 | } | 266 | } |
264 | 267 | ||
265 | void MainWindow::updateList() | 268 | void MainWindow::updateList() |
266 | { | 269 | { |
267 | //wait->show(); | 270 | //wait->show(); |
268 | QTimer *t = new QTimer( this ); | 271 | QTimer *t = new QTimer( this ); |
269 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 272 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
270 | t->start( 0, false ); | 273 | t->start( 0, false ); |
271 | packageListServers.clear(); | 274 | packageListServers.clear(); |
272 | packageListSearch.clear(); | 275 | packageListSearch.clear(); |
273 | packageListDocLnk.clear(); | 276 | packageListDocLnk.clear(); |
274 | ipkg->update(); | 277 | ipkg->update(); |
275 | packageListServers.update(); | 278 | packageListServers.update(); |
276 | packageListSearch.update(); | 279 | packageListSearch.update(); |
277 | packageListDocLnk.update(); | 280 | packageListDocLnk.update(); |
278 | t->stop(); | 281 | t->stop(); |
279 | // wait->hide(); | 282 | // wait->hide(); |
280 | } | 283 | } |
281 | 284 | ||
282 | void MainWindow::filterList() | 285 | void MainWindow::filterList() |
283 | { | 286 | { |
284 | //wait->show(); | 287 | //wait->show(); |
285 | QString f = ""; | 288 | QString f = ""; |
286 | if ( findAction->isOn() ) f = findEdit->text(); | 289 | if ( findAction->isOn() ) f = findEdit->text(); |
287 | packageListServers.filterPackages( f ); | 290 | packageListServers.filterPackages( f ); |
288 | //wait->hide(); | 291 | //wait->hide(); |
289 | } | 292 | } |
290 | 293 | ||
291 | void MainWindow::displayList() | 294 | void MainWindow::displayList() |
292 | { | 295 | { |
293 | //wait->hide(); | 296 | //wait->hide(); |
294 | filterList(); | 297 | filterList(); |
295 | listViewPackages->display(); | 298 | listViewPackages->display(); |
296 | } | 299 | } |
297 | 300 | ||
298 | void MainWindow::sectionChanged() | 301 | void MainWindow::sectionChanged() |
299 | { | 302 | { |
300 | disconnect( section, SIGNAL( activated(int) ), | 303 | disconnect( section, SIGNAL( activated(int) ), |
301 | this, SLOT( sectionChanged() ) ); | 304 | this, SLOT( sectionChanged() ) ); |
302 | disconnect( subsection, SIGNAL(activated(int) ), | 305 | disconnect( subsection, SIGNAL(activated(int) ), |
303 | this, SLOT( subSectionChanged() ) ); | 306 | this, SLOT( subSectionChanged() ) ); |
304 | subsection->clear(); | 307 | subsection->clear(); |
305 | packageListServers.setSection( section->currentText() ); | 308 | packageListServers.setSection( section->currentText() ); |
306 | setSubSections(); | 309 | setSubSections(); |
307 | connect( section, SIGNAL( activated(int) ), | 310 | connect( section, SIGNAL( activated(int) ), |
308 | this, SLOT( sectionChanged() ) ); | 311 | this, SLOT( sectionChanged() ) ); |
309 | connect( subsection, SIGNAL(activated(int) ), | 312 | connect( subsection, SIGNAL(activated(int) ), |
310 | this, SLOT( subSectionChanged() ) ); | 313 | this, SLOT( subSectionChanged() ) ); |
311 | displayList(); | 314 | displayList(); |
312 | } | 315 | } |
313 | 316 | ||
314 | void MainWindow::subSectionChanged() | 317 | void MainWindow::subSectionChanged() |
315 | { | 318 | { |
316 | disconnect( section, SIGNAL( activated(int) ), | 319 | disconnect( section, SIGNAL( activated(int) ), |
317 | this, SLOT( sectionChanged() ) ); | 320 | this, SLOT( sectionChanged() ) ); |
318 | disconnect( subsection, SIGNAL(activated(int) ), | 321 | disconnect( subsection, SIGNAL(activated(int) ), |
319 | this, SLOT( subSectionChanged() ) ); | 322 | this, SLOT( subSectionChanged() ) ); |
320 | packageListServers.setSubSection( subsection->currentText() ); | 323 | packageListServers.setSubSection( subsection->currentText() ); |
321 | connect( section, SIGNAL( activated(int) ), | 324 | connect( section, SIGNAL( activated(int) ), |
322 | this, SLOT( sectionChanged() ) ); | 325 | this, SLOT( sectionChanged() ) ); |
323 | connect( subsection, SIGNAL(activated(int) ), | 326 | connect( subsection, SIGNAL(activated(int) ), |
324 | this, SLOT( subSectionChanged() ) ); | 327 | this, SLOT( subSectionChanged() ) ); |
325 | displayList(); | 328 | displayList(); |
326 | } | 329 | } |
327 | 330 | ||
328 | void MainWindow::setSections() | 331 | void MainWindow::setSections() |
329 | { | 332 | { |
330 | section->clear(); | 333 | section->clear(); |
331 | section->insertStringList( packageListServers.getSections() ); | 334 | section->insertStringList( packageListServers.getSections() ); |
332 | } | 335 | } |
333 | 336 | ||
334 | void MainWindow::setSubSections() | 337 | void MainWindow::setSubSections() |
335 | { | 338 | { |
336 | subsection->clear(); | 339 | subsection->clear(); |
337 | subsection->insertStringList( packageListServers.getSubSections() ); | 340 | subsection->insertStringList( packageListServers.getSubSections() ); |
338 | } | 341 | } |
339 | 342 | ||
340 | 343 | ||
341 | void MainWindow::showSettings() | 344 | void MainWindow::showSettings() |
342 | { | 345 | { |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 9280d89..c947c64 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,227 +1,256 @@ | |||
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 | _old = false; | ||
32 | _status = ""; | 33 | _status = ""; |
33 | _dest = settings->getDestinationName(); | 34 | _dest = settings->getDestinationName(); |
34 | _link = settings->createLinks(); | 35 | _link = settings->createLinks(); |
36 | _versions=0; | ||
35 | } | 37 | } |
36 | 38 | ||
37 | Package::Package( QStringList pack, PackageManagerSettings *s ) | 39 | Package::Package( QStringList pack, PackageManagerSettings *s ) |
38 | { | 40 | { |
39 | init(s); | 41 | init(s); |
40 | parsePackage( pack ); | 42 | parsePackage( pack ); |
41 | } | 43 | } |
42 | 44 | ||
43 | Package::Package( QString n, PackageManagerSettings *s ) | 45 | Package::Package( QString n, PackageManagerSettings *s ) |
44 | { | 46 | { |
45 | init(s); | 47 | init(s); |
46 | if ( !QFile::exists( n ) ) | 48 | if ( !QFile::exists( n ) ) |
47 | { | 49 | { |
48 | _name = QString( n ); | 50 | _name = QString( n ); |
49 | }else{ | 51 | }else{ |
50 | parseIpkgFile( n ); | 52 | parseIpkgFile( n ); |
51 | _useFileName = true; | 53 | _useFileName = true; |
52 | _fileName = QString( n ); | 54 | _fileName = QString( n ); |
53 | } | 55 | } |
54 | } | 56 | } |
55 | 57 | ||
56 | Package::Package( Package *pi ) | 58 | Package::Package( Package *pi ) |
57 | { | 59 | { |
58 | init(pi->settings); | 60 | init(pi->settings); |
59 | copyValues( pi ); | 61 | copyValues( pi ); |
60 | } | 62 | } |
61 | 63 | ||
62 | 64 | ||
63 | void Package::setValue( QString n, QString t ) | 65 | void Package::setValue( QString n, QString t ) |
64 | { | 66 | { |
65 | if ( n == "Package" ) | 67 | if ( n == "Package" ) |
66 | { | 68 | { |
67 | _name = QString( t ); | 69 | _name = QString( t ); |
68 | }else if ( n == "Installed-Size" ) | 70 | }else if ( n == "Installed-Size" ) |
69 | { | 71 | { |
70 | _size = t; | 72 | _size = t; |
71 | // }else if ( n == "Priority") | 73 | // }else if ( n == "Priority") |
72 | // { | 74 | // { |
73 | 75 | ||
74 | }else if ( n == "Section") | 76 | }else if ( n == "Section") |
75 | { | 77 | { |
76 | setSection( t ); | 78 | setSection( t ); |
77 | // }else if ( n == "Maintainer") | 79 | // }else if ( n == "Maintainer") |
78 | // { | 80 | // { |
79 | // | 81 | // |
80 | // }else if ( n == "Architecture") | 82 | // }else if ( n == "Architecture") |
81 | // { | 83 | // { |
82 | 84 | ||
83 | }else if ( n == "Version") | 85 | }else if ( n == "Version") |
84 | { | 86 | { |
85 | _version = t; | 87 | _version = t; |
86 | // }else if ( n == "Pre-Depends") | 88 | // }else if ( n == "Pre-Depends") |
87 | // { | 89 | // { |
88 | // | 90 | // |
89 | // }else if ( n == "Depends") | 91 | // }else if ( n == "Depends") |
90 | // { | 92 | // { |
91 | 93 | ||
92 | }else if ( n == "Filename") | 94 | }else if ( n == "Filename") |
93 | { | 95 | { |
94 | _fileName = t; | 96 | _fileName = t; |
95 | // }else if ( n == "Size") | 97 | // }else if ( n == "Size") |
96 | // { | 98 | // { |
97 | // | 99 | // |
98 | //}else if ( n == "MD5Sum") | 100 | //}else if ( n == "MD5Sum") |
99 | //{ | 101 | //{ |
100 | 102 | ||
101 | }else if ( n == "Description") | 103 | }else if ( n == "Description") |
102 | { | 104 | { |
103 | setDesc( t ); | 105 | setDesc( t ); |
104 | }else if ( n == "Status") | 106 | }else if ( n == "Status") |
105 | { | 107 | { |
106 | if ( installed() ) return; | 108 | if ( installed() ) return; |
107 | _status = t; | 109 | _status = t; |
108 | // }else if ( n == "Essential") | 110 | // }else if ( n == "Essential") |
109 | // { | 111 | // { |
110 | 112 | ||
111 | }else{ | 113 | }else{ |
112 | _values.insert(n,new QString(t)); | 114 | _values.insert(n,new QString(t)); |
113 | } | 115 | } |
114 | } | 116 | } |
115 | 117 | ||
116 | QString Package::name() | 118 | QString Package::name() |
117 | { | 119 | { |
118 | if (_displayName.isEmpty() ) return _name; | 120 | if (_displayName.isEmpty() ) return _name; |
119 | else return _displayName; | 121 | else return _displayName; |
120 | } | 122 | } |
121 | 123 | ||
122 | 124 | ||
123 | QString Package::installName() | 125 | QString Package::installName() |
124 | { | 126 | { |
125 | if (_useFileName) return _fileName; | 127 | if (_useFileName) return _fileName; |
126 | else return _name; | 128 | else return _name; |
127 | } | 129 | } |
128 | 130 | ||
129 | bool Package::installed() | 131 | bool Package::installed() |
130 | { | 132 | { |
131 | return _status.contains("installed"); | 133 | if (_status.contains("installed")) return true; |
134 | else | ||
135 | if (_versions) | ||
136 | { | ||
137 | QDictIterator<Package> other( *_versions ); | ||
138 | while ( other.current() ) | ||
139 | { | ||
140 | if (other.current()->status().contains("installed") | ||
141 | && other.current()->version() == version()) | ||
142 | return true; | ||
143 | ++other; | ||
144 | } | ||
145 | } | ||
146 | return false; | ||
147 | } | ||
148 | |||
149 | bool Package::otherInstalled() | ||
150 | { | ||
151 | if (_versions) | ||
152 | { | ||
153 | QDictIterator<Package> other( *_versions ); | ||
154 | while ( other.current() ) | ||
155 | { | ||
156 | if (other.current()->installed()) return true; | ||
157 | ++other; | ||
158 | } | ||
159 | } | ||
160 | return false; | ||
132 | } | 161 | } |
133 | 162 | ||
134 | void Package::setDesc( QString s ) | 163 | void Package::setDesc( QString s ) |
135 | { | 164 | { |
136 | _desc = s; | 165 | _desc = s; |
137 | _shortDesc = s.left( s.find("\n") ); | 166 | _shortDesc = s.left( s.find("\n") ); |
138 | } | 167 | } |
139 | 168 | ||
140 | QString Package::desc() | 169 | QString Package::desc() |
141 | { | 170 | { |
142 | return _desc; | 171 | return _desc; |
143 | } | 172 | } |
144 | 173 | ||
145 | QString Package::shortDesc() | 174 | QString Package::shortDesc() |
146 | { | 175 | { |
147 | return _shortDesc; | 176 | return _shortDesc; |
148 | } | 177 | } |
149 | 178 | ||
150 | QString Package::size() | 179 | QString Package::size() |
151 | { | 180 | { |
152 | return _size; | 181 | return _size; |
153 | } | 182 | } |
154 | 183 | ||
155 | 184 | ||
156 | QString Package::version() | 185 | QString Package::version() |
157 | { | 186 | { |
158 | return _version; | 187 | return _version; |
159 | } | 188 | } |
160 | 189 | ||
161 | QString Package::sizeUnits() | 190 | QString Package::sizeUnits() |
162 | { | 191 | { |
163 | int i = _size.toInt(); | 192 | int i = _size.toInt(); |
164 | int c = 0; | 193 | int c = 0; |
165 | QString ret; | 194 | QString ret; |
166 | QStringList unit; | 195 | QStringList unit; |
167 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) | 196 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) |
168 | while (i > 1) | 197 | while (i > 1) |
169 | { | 198 | { |
170 | ret=QString::number(i)+" "+unit[c]; | 199 | ret=QString::number(i)+" "+unit[c]; |
171 | c++; | 200 | c++; |
172 | i /= 1024; | 201 | i /= 1024; |
173 | } | 202 | } |
174 | return ret; | 203 | return ret; |
175 | } | 204 | } |
176 | 205 | ||
177 | bool Package::toProcess() | 206 | bool Package::toProcess() |
178 | { | 207 | { |
179 | return _toProcess; | 208 | return _toProcess; |
180 | } | 209 | } |
181 | 210 | ||
182 | bool Package::toRemove() | 211 | bool Package::toRemove() |
183 | { | 212 | { |
184 | if ( _toProcess && installed() ) return true; | 213 | if ( _toProcess && installed() ) return true; |
185 | else return false; | 214 | else return false; |
186 | } | 215 | } |
187 | 216 | ||
188 | bool Package::toInstall() | 217 | bool Package::toInstall() |
189 | { | 218 | { |
190 | if ( _toProcess && !installed() ) return true; | 219 | if ( _toProcess && !installed() ) return true; |
191 | else return false; | 220 | else return false; |
192 | } | 221 | } |
193 | 222 | ||
194 | void Package::toggleProcess() | 223 | void Package::toggleProcess() |
195 | { | 224 | { |
196 | _toProcess = ! _toProcess; | 225 | _toProcess = ! _toProcess; |
197 | } | 226 | } |
198 | 227 | ||
199 | 228 | ||
200 | 229 | ||
201 | void Package::copyValues( Package* pack ) | 230 | void Package::copyValues( Package* pack ) |
202 | { | 231 | { |
203 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); | 232 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); |
204 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); | 233 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); |
205 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); | 234 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); |
206 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); | 235 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); |
207 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); | 236 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); |
208 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); | 237 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); |
209 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); | 238 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); |
210 | } | 239 | } |
211 | 240 | ||
212 | QString Package::section() | 241 | QString Package::section() |
213 | { | 242 | { |
214 | return _section; | 243 | return _section; |
215 | } | 244 | } |
216 | 245 | ||
217 | void Package::setSection( QString s) | 246 | void Package::setSection( QString s) |
218 | { | 247 | { |
219 | int i = s.find("/"); | 248 | int i = s.find("/"); |
220 | if ( i > 0 ) | 249 | if ( i > 0 ) |
221 | { | 250 | { |
222 | _section = s.left(i); | 251 | _section = s.left(i); |
223 | _subsection = s.mid(i+1); | 252 | _subsection = s.mid(i+1); |
224 | }else{ | 253 | }else{ |
225 | _section = s; | 254 | _section = s; |
226 | _subsection = ""; | 255 | _subsection = ""; |
227 | } | 256 | } |
@@ -277,96 +306,123 @@ QString Package::details() | |||
277 | QString tag = line.left(sep); | 306 | QString tag = line.left(sep); |
278 | description.append("<br>"); | 307 | description.append("<br>"); |
279 | description.append("<b>"); | 308 | description.append("<b>"); |
280 | description.append(Qtopia::escapeString(tag)); | 309 | description.append(Qtopia::escapeString(tag)); |
281 | description.append(":</b> "); | 310 | description.append(":</b> "); |
282 | description.append(Qtopia::escapeString(line.mid(sep+2))); | 311 | description.append(Qtopia::escapeString(line.mid(sep+2))); |
283 | } else { | 312 | } else { |
284 | description.append(" "); | 313 | description.append(" "); |
285 | description.append(Qtopia::escapeString(line)); | 314 | description.append(Qtopia::escapeString(line)); |
286 | } | 315 | } |
287 | } | 316 | } |
288 | } | 317 | } |
289 | } | 318 | } |
290 | return description; | 319 | return description; |
291 | } | 320 | } |
292 | 321 | ||
293 | void Package::processed() | 322 | void Package::processed() |
294 | { | 323 | { |
295 | _toProcess = false; | 324 | _toProcess = false; |
296 | //hack, but we're not writing status anyway... | 325 | //hack, but we're not writing status anyway... |
297 | if ( installed() ) _status = "install"; | 326 | if ( installed() ) _status = "install"; |
298 | else _status = "installed"; | 327 | else _status = "installed"; |
299 | } | 328 | } |
300 | 329 | ||
301 | QString Package::dest() | 330 | QString Package::dest() |
302 | { | 331 | { |
303 | if ( installed()||(!installed() && _toProcess) ) | 332 | if ( installed()||(!installed() && _toProcess) ) |
304 | return _dest!=""?_dest:settings->getDestinationName(); | 333 | return _dest!=""?_dest:settings->getDestinationName(); |
305 | else return ""; | 334 | else return ""; |
306 | } | 335 | } |
307 | 336 | ||
308 | void Package::setDest( QString d ) | 337 | void Package::setDest( QString d ) |
309 | { | 338 | { |
310 | _dest = d; | 339 | _dest = d; |
311 | } | 340 | } |
312 | 341 | ||
313 | void Package::setOn() | 342 | void Package::setOn() |
314 | { | 343 | { |
315 | _toProcess = true; | 344 | _toProcess = true; |
316 | } | 345 | } |
317 | 346 | ||
318 | bool Package::link() | 347 | bool Package::link() |
319 | { | 348 | { |
320 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 349 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
321 | return _link; | 350 | return _link; |
322 | } | 351 | } |
323 | 352 | ||
324 | void Package::setLink(bool b) | 353 | void Package::setLink(bool b) |
325 | { | 354 | { |
326 | _link = b; | 355 | _link = b; |
327 | } | 356 | } |
328 | 357 | ||
329 | void Package::parseIpkgFile( QString file) | 358 | void Package::parseIpkgFile( QString file) |
330 | { | 359 | { |
331 | system("tar xzf "+file+" -C /tmp"); | 360 | system("tar xzf "+file+" -C /tmp"); |
332 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | 361 | system("tar xzf /tmp/control.tar.gz -C /tmp"); |
333 | QFile f("/tmp/control"); | 362 | QFile f("/tmp/control"); |
334 | if ( f.open(IO_ReadOnly) ) | 363 | if ( f.open(IO_ReadOnly) ) |
335 | { | 364 | { |
336 | QTextStream t( &f ); | 365 | QTextStream t( &f ); |
337 | QStringList pack; | 366 | QStringList pack; |
338 | while ( !t.eof() ) | 367 | while ( !t.eof() ) |
339 | { | 368 | { |
340 | pack << t.readLine(); | 369 | pack << t.readLine(); |
341 | } | 370 | } |
342 | f.close(); | 371 | f.close(); |
343 | parsePackage( pack ); | 372 | parsePackage( pack ); |
344 | } | 373 | } |
345 | 374 | ||
346 | } | 375 | } |
347 | 376 | ||
348 | //QString Package::getPackageName() | 377 | //QString Package::getPackageName() |
349 | //{ | 378 | //{ |
350 | //if ( _packageName.isEmpty() ) return _name; | 379 | //if ( _packageName.isEmpty() ) return _name; |
351 | //else return _packageName; | 380 | //else return _packageName; |
352 | //} | 381 | //} |
353 | 382 | ||
354 | void Package::instalFromFile(bool iff) | 383 | void Package::instalFromFile(bool iff) |
355 | { | 384 | { |
356 | _useFileName = iff; | 385 | _useFileName = iff; |
357 | } | 386 | } |
358 | 387 | ||
359 | void Package::setName(QString n) | 388 | void Package::setName(QString n) |
360 | { | 389 | { |
361 | _displayName = n; | 390 | _displayName = n; |
362 | } | 391 | } |
363 | 392 | ||
364 | QDict<QString>* Package::getFields() | 393 | QDict<QString>* Package::getFields() |
365 | { | 394 | { |
366 | return &_values; | 395 | return &_values; |
367 | } | 396 | } |
368 | 397 | ||
369 | QString Package::status() | 398 | QString Package::status() |
370 | { | 399 | { |
371 | return _status; | 400 | return _status; |
372 | } | 401 | } |
402 | |||
403 | bool Package::isOld() | ||
404 | { | ||
405 | if (!_versions) return false; | ||
406 | QDictIterator<Package> other( *_versions ); | ||
407 | while ( other.current() ) { | ||
408 | if (other.current()->version() > version() ) return true; | ||
409 | ++other; | ||
410 | } | ||
411 | return false; | ||
412 | } | ||
413 | |||
414 | bool Package::hasVersions() | ||
415 | { | ||
416 | if (!_versions) return false; | ||
417 | else return true; | ||
418 | } | ||
419 | |||
420 | QDict<Package>* Package::getOtherVersions() | ||
421 | { | ||
422 | return _versions; | ||
423 | } | ||
424 | |||
425 | void Package::setOtherVersions(QDict<Package> *v) | ||
426 | { | ||
427 | _versions=v; | ||
428 | } | ||
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 257d9c7..68090dc 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -1,79 +1,89 @@ | |||
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 | bool otherInstalled(); | ||
29 | 30 | ||
30 | void setDesc( QString ); | 31 | void setDesc( QString ); |
31 | QString shortDesc(); | 32 | QString shortDesc(); |
32 | QString desc(); | 33 | QString desc(); |
33 | QString size(); | 34 | QString size(); |
34 | QString sizeUnits(); | 35 | QString sizeUnits(); |
35 | QString version(); | 36 | QString version(); |
36 | void setSection( QString ); | 37 | void setSection( QString ); |
37 | QString section(); | 38 | QString section(); |
38 | QString subSection(); | 39 | QString subSection(); |
39 | QString details(); | 40 | QString details(); |
40 | bool toProcess(); | 41 | bool toProcess(); |
41 | bool toInstall(); | 42 | bool toInstall(); |
42 | bool toRemove(); | 43 | bool toRemove(); |
43 | void processed(); | 44 | void processed(); |
44 | QString dest(); | 45 | QString dest(); |
45 | void setDest( QString d ); | 46 | void setDest( QString d ); |
46 | void setOn(); | 47 | void setOn(); |
47 | bool link(); | 48 | bool link(); |
48 | void setLink(bool); | 49 | void setLink(bool); |
50 | bool isOld(); | ||
51 | bool hasVersions(); | ||
49 | void parseIpkgFile( QString ); | 52 | void parseIpkgFile( QString ); |
50 | void instalFromFile(bool iff=true); | 53 | void instalFromFile(bool iff=true); |
51 | void setName(QString); | 54 | void setName(QString); |
52 | QDict<QString>* getFields(); | 55 | QDict<QString>* getFields(); |
53 | QString status(); | 56 | QString status(); |
57 | |||
58 | QDict<Package>* getOtherVersions(); | ||
59 | void setOtherVersions(QDict<Package>*); | ||
60 | |||
54 | public slots: | 61 | public slots: |
55 | void toggleProcess(); | 62 | void toggleProcess(); |
56 | 63 | ||
57 | private: | 64 | private: |
58 | PackageManagerSettings *settings; | 65 | PackageManagerSettings *settings; |
59 | QString _displayName; | 66 | QString _displayName; |
60 | QString _name; | 67 | QString _name; |
61 | QString _fileName; | 68 | QString _fileName; |
69 | bool _old; | ||
70 | bool _hasVersions; | ||
62 | bool _toProcess; | 71 | bool _toProcess; |
63 | bool _link; | 72 | bool _link; |
64 | QString _status; | 73 | QString _status; |
65 | QString _size; | 74 | QString _size; |
66 | QString _section; | 75 | QString _section; |
67 | QString _subsection; | 76 | QString _subsection; |
68 | QString _shortDesc; | 77 | QString _shortDesc; |
69 | QString _desc; | 78 | QString _desc; |
70 | QString _version; | 79 | QString _version; |
71 | QString _dest; | 80 | QString _dest; |
72 | QDict<QString> _values; | 81 | QDict<QString> _values; |
82 | QDict<Package> *_versions; | ||
73 | bool _useFileName; | 83 | bool _useFileName; |
74 | void parsePackage( QStringList ); | 84 | void parsePackage( QStringList ); |
75 | void init(PackageManagerSettings *); | 85 | void init(PackageManagerSettings *); |
76 | }; | 86 | }; |
77 | 87 | ||
78 | 88 | ||
79 | #endif | 89 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index be20c71..2fc4c41 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,147 +1,162 @@ | |||
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 | static QDict<Package> *packageListAll; | ||
11 | |||
10 | PackageList::PackageList() | 12 | PackageList::PackageList() |
11 | : packageIter( packageList ) | 13 | : packageIter( packageList ) |
12 | { | 14 | { |
13 | empty=true; | 15 | empty=true; |
16 | if (!packageListAll) packageListAll = new QDict<Package>(); | ||
14 | sections << "All"; | 17 | sections << "All"; |
15 | subSections.insert("All", new QStringList() ); | 18 | subSections.insert("All", new QStringList() ); |
16 | QStringList *ss = subSections["All"]; | 19 | QStringList *ss = subSections["All"]; |
17 | *ss << "All"; | 20 | *ss << "All"; |
18 | aktSection = "All"; | 21 | aktSection = "All"; |
19 | aktSubSection = "All"; | 22 | aktSubSection = "All"; |
20 | } | 23 | } |
21 | 24 | ||
22 | PackageList::PackageList( PackageManagerSettings* s) | 25 | PackageList::PackageList( PackageManagerSettings* s) |
23 | : packageIter( packageList ) | 26 | : packageIter( packageList ) |
24 | { | 27 | { |
25 | settings = s; | 28 | settings = s; |
26 | PackageList(); | 29 | PackageList(); |
27 | } | 30 | } |
28 | 31 | ||
29 | PackageList::~PackageList() | 32 | PackageList::~PackageList() |
30 | { | 33 | { |
31 | } | 34 | } |
32 | 35 | ||
33 | /** Inserts a package into the list */ | 36 | /** Inserts a package into the list */ |
34 | void PackageList::insertPackage( Package* pack ) | 37 | void PackageList::insertPackage( Package* pack ) |
35 | { | 38 | { |
36 | if (!pack) return; | 39 | if (!pack) return; |
37 | Package* p = packageList.find( pack->name() ); | 40 | Package* p = packageListAll->find( pack->name() ); |
38 | if ( p ) | 41 | if ( p ) |
39 | { | 42 | { |
40 | if ( p->version() == pack->version() ) | 43 | if ( (p->version() == pack->version()) |
44 | && (p->dest() == pack->dest()) ) | ||
41 | { | 45 | { |
42 | p->copyValues( pack ); | 46 | p->copyValues( pack ); |
43 | delete pack; | 47 | delete pack; |
44 | pack = p; | 48 | pack = p; |
45 | } else { | 49 | } else { |
46 | p->setName( pack->name()+"["+p->version()+"]" ); | 50 | QDict<Package> *packver = p->getOtherVersions(); |
51 | // p->setName( pack->name()+"["+p->version()+"]" ); | ||
52 | if (!packver) | ||
53 | { | ||
54 | packver = new QDict<Package>; | ||
55 | packver->insert( pack->name(), p ); | ||
56 | p->setOtherVersions( packver ); | ||
57 | } | ||
47 | pack->setName( pack->name()+"["+pack->version()+"]" ); | 58 | pack->setName( pack->name()+"["+pack->version()+"]" ); |
59 | pack->setOtherVersions( packver ); | ||
60 | packver->insert( pack->name(), pack ); | ||
61 | packageListAll->insert( pack->name(), pack ); | ||
48 | packageList.insert( pack->name(), pack ); | 62 | packageList.insert( pack->name(), pack ); |
49 | origPackageList.insert( pack->name(), pack ); | 63 | origPackageList.insert( pack->name(), pack ); |
50 | } | 64 | } |
51 | }else{ | 65 | }else{ |
66 | packageListAll->insert( pack->name(), pack ); | ||
52 | packageList.insert( pack->name(), pack ); | 67 | packageList.insert( pack->name(), pack ); |
53 | origPackageList.insert( pack->name(), pack ); | 68 | origPackageList.insert( pack->name(), pack ); |
54 | }; | 69 | }; |
55 | empty=false; | 70 | empty=false; |
56 | updateSections( pack ); | 71 | updateSections( pack ); |
57 | } | 72 | } |
58 | 73 | ||
59 | void PackageList::filterPackages( QString f ) | 74 | void PackageList::filterPackages( QString f ) |
60 | { | 75 | { |
61 | packageList.clear(); | 76 | packageList.clear(); |
62 | QDictIterator<Package> filterIter( origPackageList ); | 77 | QDictIterator<Package> filterIter( origPackageList ); |
63 | filterIter.toFirst(); | 78 | filterIter.toFirst(); |
64 | Package *pack= filterIter.current() ; | 79 | Package *pack= filterIter.current() ; |
65 | while ( pack ) | 80 | while ( pack ) |
66 | { | 81 | { |
67 | if ( | 82 | if ( |
68 | ((aktSection=="All")||(pack->section()==aktSection)) && | 83 | ((aktSection=="All")||(pack->section()==aktSection)) && |
69 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && | 84 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && |
70 | pack->name().contains( f ) | 85 | pack->name().contains( f ) |
71 | ) | 86 | ) |
72 | { | 87 | { |
73 | packageList.insert( pack->name(), pack ); | 88 | packageList.insert( pack->name(), pack ); |
74 | } | 89 | } |
75 | ++filterIter; | 90 | ++filterIter; |
76 | pack = filterIter.current(); | 91 | pack = filterIter.current(); |
77 | } | 92 | } |
78 | } | 93 | } |
79 | 94 | ||
80 | Package* PackageList::find( QString n ) | 95 | Package* PackageList::find( QString n ) |
81 | { | 96 | { |
82 | return packageList.find( n ); | 97 | return packageList.find( n ); |
83 | } | 98 | } |
84 | 99 | ||
85 | Package* PackageList::first() | 100 | Package* PackageList::first() |
86 | { | 101 | { |
87 | packageIter.toFirst(); | 102 | packageIter.toFirst(); |
88 | return packageIter.current(); | 103 | return packageIter.current(); |
89 | } | 104 | } |
90 | 105 | ||
91 | Package* PackageList::next() | 106 | Package* PackageList::next() |
92 | { | 107 | { |
93 | ++packageIter; | 108 | ++packageIter; |
94 | return packageIter.current(); | 109 | return packageIter.current(); |
95 | } | 110 | } |
96 | 111 | ||
97 | QStringList PackageList::getSections() | 112 | QStringList PackageList::getSections() |
98 | { | 113 | { |
99 | sections.sort(); | 114 | sections.sort(); |
100 | return sections; | 115 | return sections; |
101 | } | 116 | } |
102 | 117 | ||
103 | QStringList PackageList::getSubSections() | 118 | QStringList PackageList::getSubSections() |
104 | { | 119 | { |
105 | QStringList ss; | 120 | QStringList ss; |
106 | if ( !subSections[aktSection] ) return ss; | 121 | if ( !subSections[aktSection] ) return ss; |
107 | ss = *subSections[aktSection]; | 122 | ss = *subSections[aktSection]; |
108 | ss.sort(); | 123 | ss.sort(); |
109 | return ss; | 124 | return ss; |
110 | } | 125 | } |
111 | 126 | ||
112 | void PackageList::setSection( QString sec ) | 127 | void PackageList::setSection( QString sec ) |
113 | { | 128 | { |
114 | aktSection = sec; | 129 | aktSection = sec; |
115 | } | 130 | } |
116 | 131 | ||
117 | void PackageList::setSubSection( QString ssec ) | 132 | void PackageList::setSubSection( QString ssec ) |
118 | { | 133 | { |
119 | aktSubSection = ssec; | 134 | aktSubSection = ssec; |
120 | } | 135 | } |
121 | 136 | ||
122 | void PackageList::updateSections( Package* pack ) | 137 | void PackageList::updateSections( Package* pack ) |
123 | { | 138 | { |
124 | QString s = pack->section(); | 139 | QString s = pack->section(); |
125 | if ( s.isEmpty() || s == "") return; | 140 | if ( s.isEmpty() || s == "") return; |
126 | if ( sections.contains(s) ) return; | 141 | if ( sections.contains(s) ) return; |
127 | sections += s; | 142 | sections += s; |
128 | QString ss = pack->subSection(); | 143 | QString ss = pack->subSection(); |
129 | if ( ss.isEmpty() || ss == "" ) return; | 144 | if ( ss.isEmpty() || ss == "" ) return; |
130 | if ( !subSections[s] ) { | 145 | if ( !subSections[s] ) { |
131 | subSections.insert( s, new QStringList() ); | 146 | subSections.insert( s, new QStringList() ); |
132 | QStringList *subsecs = subSections[s]; | 147 | QStringList *subsecs = subSections[s]; |
133 | *subsecs += "All"; | 148 | *subsecs += "All"; |
134 | } | 149 | } |
135 | QStringList *subsecs = subSections[s]; | 150 | QStringList *subsecs = subSections[s]; |
136 | *subsecs += ss; | 151 | *subsecs += ss; |
137 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 152 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
138 | subsecs = subSections["All"]; | 153 | subsecs = subSections["All"]; |
139 | *subsecs += ss; | 154 | *subsecs += ss; |
140 | } | 155 | } |
141 | 156 | ||
142 | 157 | ||
143 | void PackageList::readFileEntries( QString filename, QString dest ) | 158 | void PackageList::readFileEntries( QString filename, QString dest ) |
144 | { | 159 | { |
145 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | 160 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); |
146 | QStringList packEntry; | 161 | QStringList packEntry; |
147 | QFile f( filename ); | 162 | QFile f( filename ); |
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index acea3b9..d0f8897 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -1,58 +1,60 @@ | |||
1 | #ifndef PACKAGELIST_H | 1 | #ifndef PACKAGELIST_H |
2 | #define PACKAGELIST_H | 2 | #define PACKAGELIST_H |
3 | 3 | ||
4 | #include <qdict.h> | 4 | #include <qdict.h> |
5 | #include "package.h" | 5 | #include "package.h" |
6 | #include "pksettings.h" | 6 | #include "pksettings.h" |
7 | #include "debug.h" | 7 | #include "debug.h" |
8 | 8 | ||
9 | class PackageList //:QObject | 9 | class PackageList //:QObject |
10 | { | 10 | { |
11 | // Q_OBJECT | 11 | // Q_OBJECT |
12 | public: | 12 | public: |
13 | //static QString all = QObject::tr("All"); | 13 | //static QString all = QObject::tr("All"); |
14 | 14 | ||
15 | PackageList(); | 15 | PackageList(); |
16 | PackageList( PackageManagerSettings* ); | 16 | PackageList( PackageManagerSettings* ); |
17 | virtual ~PackageList(); | 17 | virtual ~PackageList(); |
18 | void insertPackage( Package* ); | 18 | void insertPackage( Package* ); |
19 | Package* find( QString ); | 19 | Package* find( QString ); |
20 | Package* next(); | 20 | Package* next(); |
21 | Package* first(); | 21 | Package* first(); |
22 | 22 | ||
23 | QStringList getSections(); | 23 | QStringList getSections(); |
24 | QStringList getSubSections(); | 24 | QStringList getSubSections(); |
25 | void setSettings( PackageManagerSettings* ); | 25 | void setSettings( PackageManagerSettings* ); |
26 | void filterPackages( QString ); | 26 | void filterPackages( QString ); |
27 | Package* getByName( QString ); | 27 | Package* getByName( QString ); |
28 | void clear(); | 28 | void clear(); |
29 | void allPackages(); | 29 | void allPackages(); |
30 | 30 | ||
31 | QDict<Package> *versions; | ||
32 | |||
31 | public slots: | 33 | public slots: |
32 | void setSection(QString); | 34 | void setSection(QString); |
33 | void setSubSection(QString); | 35 | void setSubSection(QString); |
34 | // virtual void update(); | 36 | // virtual void update(); |
35 | 37 | ||
36 | protected: | 38 | protected: |
37 | int currentPackage; | 39 | int currentPackage; |
38 | int packageCount; | 40 | int packageCount; |
39 | 41 | ||
40 | PackageManagerSettings *settings; | 42 | PackageManagerSettings *settings; |
41 | QDict<Package> packageList; | 43 | QDict<Package> packageList; |
42 | QDict<Package> origPackageList; | 44 | QDict<Package> origPackageList; |
43 | QDictIterator<Package> packageIter; | 45 | QDictIterator<Package> packageIter; |
44 | 46 | ||
45 | bool empty; | 47 | bool empty; |
46 | QString aktSection; | 48 | QString aktSection; |
47 | QString aktSubSection; | 49 | QString aktSubSection; |
48 | QStringList sections; | 50 | QStringList sections; |
49 | QDict<QStringList> subSections; | 51 | QDict<QStringList> subSections; |
50 | QDict<bool> sectionsDict; | 52 | QDict<bool> sectionsDict; |
51 | 53 | ||
52 | 54 | ||
53 | void updateSections( Package* ); | 55 | void updateSections( Package* ); |
54 | void readFileEntries( QString file, QString dest="" ); | 56 | void readFileEntries( QString file, QString dest="" ); |
55 | }; | 57 | }; |
56 | 58 | ||
57 | 59 | ||
58 | #endif | 60 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 45aaf1d..c743a49 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,144 +1,165 @@ | |||
1 | #include "packagelistitem.h" | 1 | #include "packagelistitem.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | 5 | ||
6 | #include "debug.h" | 6 | #include "debug.h" |
7 | 7 | ||
8 | static QPixmap *pm_uninstalled=0; | 8 | static QPixmap *pm_uninstalled=0; |
9 | static QPixmap *pm_uninstalled_old=0; | ||
9 | static QPixmap *pm_installed=0; | 10 | static QPixmap *pm_installed=0; |
11 | static QPixmap *pm_installed_old=0; | ||
10 | static QPixmap *pm_uninstall=0; | 12 | static QPixmap *pm_uninstall=0; |
11 | static QPixmap *pm_install=0; | 13 | static QPixmap *pm_install=0; |
14 | static QPixmap *pm_uninstalled_old_installed_new=0; | ||
15 | static QPixmap *pm_uninstalled_installed_old=0; | ||
12 | 16 | ||
13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) | 17 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
14 | :QCheckListItem(lv,pi->name(),CheckBox) | 18 | :QCheckListItem(lv,pi->name(),CheckBox) |
15 | { | 19 | { |
16 | init(pi,s); | 20 | init(pi,s); |
17 | } | 21 | } |
18 | 22 | ||
19 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) | 23 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) |
20 | :QCheckListItem(lvi,pi->name(),CheckBox) | 24 | :QCheckListItem(lvi,pi->name(),CheckBox) |
21 | { | 25 | { |
22 | init(pi,s); | 26 | init(pi,s); |
23 | } | 27 | } |
24 | 28 | ||
25 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) | 29 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) |
26 | { | 30 | { |
27 | package = pi; | 31 | package = pi; |
28 | settings = s; | 32 | settings = s; |
29 | setExpandable( true ); | 33 | setExpandable( true ); |
30 | QCheckListItem *item; | 34 | QCheckListItem *item; |
31 | nameItem = new QCheckListItem( this, "" ); | 35 | nameItem = new QCheckListItem( this, "" ); |
32 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | 36 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); |
33 | destItem = new QCheckListItem( this, "" ); | 37 | destItem = new QCheckListItem( this, "" ); |
34 | linkItem = new QCheckListItem( this, "" ); | 38 | linkItem = new QCheckListItem( this, "" ); |
35 | statusItem = new QCheckListItem( this, "" ); | 39 | statusItem = new QCheckListItem( this, "" ); |
36 | QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); | 40 | QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); |
37 | item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() ); | 41 | item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() ); |
38 | QDict<QString> *fields = pi->getFields(); | 42 | QDict<QString> *fields = pi->getFields(); |
39 | QDictIterator<QString> it( *fields ); | 43 | QDictIterator<QString> it( *fields ); |
40 | while ( it.current() ) { | 44 | while ( it.current() ) { |
41 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); | 45 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); |
42 | ++it; | 46 | ++it; |
43 | } | 47 | } |
44 | displayDetails(); | 48 | displayDetails(); |
45 | 49 | ||
46 | if (!pm_uninstalled) | 50 | if (!pm_uninstalled) |
47 | { | 51 | { |
48 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 52 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
53 | pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); | ||
54 | pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); | ||
55 | pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); | ||
49 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 56 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
57 | pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); | ||
50 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 58 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
51 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 59 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
52 | } | 60 | } |
53 | } | 61 | } |
54 | 62 | ||
55 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 63 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
56 | int column, int width, int alignment ) | 64 | int column, int width, int alignment ) |
57 | { | 65 | { |
58 | if ( !p ) | 66 | if ( !p ) |
59 | return; | 67 | return; |
60 | 68 | ||
61 | p->fillRect( 0, 0, width, height(), | 69 | p->fillRect( 0, 0, width, height(), |
62 | isSelected()? cg.highlight() : cg.base() ); | 70 | isSelected()? cg.highlight() : cg.base() ); |
63 | 71 | ||
64 | if ( column != 0 ) { | 72 | if ( column != 0 ) { |
65 | // The rest is text | 73 | // The rest is text |
66 | QListViewItem::paintCell( p, cg, column, width, alignment ); | 74 | QListViewItem::paintCell( p, cg, column, width, alignment ); |
67 | return; | 75 | return; |
68 | } | 76 | } |
69 | 77 | ||
70 | QListView *lv = listView(); | 78 | QListView *lv = listView(); |
71 | if ( !lv ) | 79 | if ( !lv ) |
72 | return; | 80 | return; |
73 | int marg = lv->itemMargin(); | 81 | int marg = lv->itemMargin(); |
74 | int r = marg; | 82 | int r = marg; |
75 | 83 | ||
76 | QPixmap pm = statePixmap(); | 84 | QPixmap pm = statePixmap(); |
77 | p->drawPixmap(marg,(height()-pm.height())/2,pm); | 85 | p->drawPixmap(marg,(height()-pm.height())/2,pm); |
78 | r += pm.width()+1; | 86 | r += pm.width()+1; |
79 | 87 | ||
80 | p->translate( r, 0 ); | 88 | p->translate( r, 0 ); |
81 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); | 89 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); |
82 | } | 90 | } |
83 | 91 | ||
84 | 92 | ||
85 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, | 93 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, |
86 | const QRect & r ) | 94 | const QRect & r ) |
87 | { | 95 | { |
88 | // Skip QCheckListItem | 96 | // Skip QCheckListItem |
89 | // (makes you wonder what we're getting from QCheckListItem) | 97 | // (makes you wonder what we're getting from QCheckListItem) |
90 | QListViewItem::paintFocus(p,cg,r); | 98 | QListViewItem::paintFocus(p,cg,r); |
91 | } | 99 | } |
92 | 100 | ||
93 | QPixmap PackageListItem::statePixmap() const | 101 | QPixmap PackageListItem::statePixmap() const |
94 | { | 102 | { |
95 | bool installed = package->installed(); | 103 | bool installed = package->installed(); |
104 | bool old = package->isOld(); | ||
105 | bool versions = package->hasVersions(); | ||
106 | bool verinstalled = package->otherInstalled(); | ||
96 | if ( !package->toProcess() ) { | 107 | if ( !package->toProcess() ) { |
97 | if ( !installed ) | 108 | if ( !installed ) |
98 | return *pm_uninstalled; | 109 | if (old) |
110 | { | ||
111 | if (verinstalled) return *pm_uninstalled_old_installed_new; | ||
112 | else return *pm_uninstalled_old; | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | if (verinstalled) return *pm_uninstalled_installed_old; | ||
117 | else return *pm_uninstalled; | ||
118 | } | ||
99 | else | 119 | else |
100 | return *pm_installed; | 120 | if (old) return *pm_installed_old; |
101 | } else { | 121 | else return *pm_installed; |
122 | } else { //toProcess() == true | ||
102 | if ( !installed ) | 123 | if ( !installed ) |
103 | return *pm_install; | 124 | return *pm_install; |
104 | else | 125 | else |
105 | return *pm_uninstall; | 126 | return *pm_uninstall; |
106 | } | 127 | } |
107 | } | 128 | } |
108 | 129 | ||
109 | QString PackageListItem::key( int column, bool ascending ) const | 130 | QString PackageListItem::key( int column, bool ascending ) const |
110 | { | 131 | { |
111 | if ( column == 2 ) { | 132 | if ( column == 2 ) { |
112 | QString t = text(2); | 133 | QString t = text(2); |
113 | double bytes=t.toDouble(); | 134 | double bytes=t.toDouble(); |
114 | if ( t.contains('M') ) bytes*=1024*1024; | 135 | if ( t.contains('M') ) bytes*=1024*1024; |
115 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; | 136 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; |
116 | if ( !ascending ) bytes=999999999-bytes; | 137 | if ( !ascending ) bytes=999999999-bytes; |
117 | return QString().sprintf("%09d",(int)bytes); | 138 | return QString().sprintf("%09d",(int)bytes); |
118 | } else { | 139 | } else { |
119 | return QListViewItem::key(column,ascending); | 140 | return QListViewItem::key(column,ascending); |
120 | } | 141 | } |
121 | } | 142 | } |
122 | 143 | ||
123 | void PackageListItem::setOn( bool b ) | 144 | void PackageListItem::setOn( bool b ) |
124 | { | 145 | { |
125 | QCheckListItem::setOn( b ); | 146 | QCheckListItem::setOn( b ); |
126 | package->toggleProcess(); | 147 | package->toggleProcess(); |
127 | package->setLink( settings->createLinks() ); | 148 | package->setLink( settings->createLinks() ); |
128 | displayDetails(); | 149 | displayDetails(); |
129 | } | 150 | } |
130 | 151 | ||
131 | void PackageListItem::displayDetails() | 152 | void PackageListItem::displayDetails() |
132 | { | 153 | { |
133 | QString sod; | 154 | QString sod; |
134 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); | 155 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); |
135 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); | 156 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); |
136 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); | 157 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); |
137 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); | 158 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); |
138 | setText(0, package->name()+sod ); | 159 | setText(0, package->name()+sod ); |
139 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); | 160 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); |
140 | linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); | 161 | linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); |
141 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); | 162 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); |
142 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); | 163 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); |
143 | repaint(); | 164 | repaint(); |
144 | } | 165 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 0ae74da..5996e63 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,171 +1,172 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 2 | #include "pksettings.h" |
3 | #include "package.h" | 3 | #include "package.h" |
4 | #include "packagelistitem.h" | 4 | #include "packagelistitem.h" |
5 | 5 | ||
6 | #include <qpe/process.h> | 6 | #include <qpe/process.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
9 | #include <qpe/stringutil.h> | 9 | #include <qpe/stringutil.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qgroupbox.h> | 12 | #include <qgroupbox.h> |
13 | #include <qmultilineedit.h> | 13 | #include <qmultilineedit.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qcheckbox.h> | 15 | #include <qcheckbox.h> |
16 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #include <qtextview.h> | 17 | #include <qtextview.h> |
18 | 18 | ||
19 | #include <qprogressbar.h> | 19 | #include <qprogressbar.h> |
20 | #include <qpushbutton.h> | 20 | #include <qpushbutton.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | 22 | ||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | 25 | ||
26 | #include "mainwindow.h" | 26 | #include "mainwindow.h" |
27 | 27 | ||
28 | 28 | ||
29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
30 | : QObject ( p ) | 30 | : QObject ( p ) |
31 | { | 31 | { |
32 | settings = s; | 32 | settings = s; |
33 | runwindow = new RunWindow( p, name, true, f ); | 33 | runwindow = new RunWindow( p, name, true, f ); |
34 | } | 34 | } |
35 | 35 | ||
36 | PmIpkg::~PmIpkg() | 36 | PmIpkg::~PmIpkg() |
37 | { | 37 | { |
38 | } | 38 | } |
39 | 39 | ||
40 | //#define PROC | 40 | //#define PROC |
41 | #define SYSTEM | 41 | #define SYSTEM |
42 | #define QT_QPROCESS_DEBUG | ||
42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | 43 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
43 | { | 44 | { |
44 | pvDebug(2,"PmIpkg::runIpkg "+args); | 45 | pvDebug(2,"PmIpkg::runIpkg "+args); |
45 | 46 | QDir::setCurrent("/tmp"); | |
46 | #ifdef PROC | 47 | #ifdef PROC |
47 | QStringList cmd = "ipkg "; | 48 | QString cmd; |
48 | #endif | 49 | #endif |
49 | #ifdef SYSTEM | 50 | #ifdef SYSTEM |
50 | QString cmd = "/usr/bin/ipkg "; | 51 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | 52 | #endif |
52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 53 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
53 | if ( dest == "" ) | 54 | if ( dest == "" ) |
54 | cmd += " -dest "+settings->getDestinationName(); | 55 | cmd += " -dest "+settings->getDestinationName(); |
55 | else | 56 | else |
56 | cmd += " -dest "+ dest; | 57 | cmd += " -dest "+ dest; |
57 | 58 | ||
58 | cmd += " -force-defaults "; | 59 | cmd += " -force-defaults "; |
59 | 60 | ||
60 | if (installDialog->_force_depends) | 61 | if (installDialog->_force_depends) |
61 | { | 62 | { |
62 | if (installDialog->_force_depends->isChecked()) | 63 | if (installDialog->_force_depends->isChecked()) |
63 | cmd += " -force-depends "; | 64 | cmd += " -force-depends "; |
64 | if (installDialog->_force_reinstall->isChecked()) | 65 | if (installDialog->_force_reinstall->isChecked()) |
65 | cmd += " -force-reinstall "; | 66 | cmd += " -force-reinstall "; |
66 | if (installDialog->_force_remove->isChecked()) | 67 | if (installDialog->_force_remove->isChecked()) |
67 | cmd += " -force-removal-of-essential-packages "; | 68 | cmd += " -force-removal-of-essential-packages "; |
68 | } | 69 | } |
69 | 70 | ||
70 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 71 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
71 | cmd += args; | 72 | cmd += args; |
72 | int r = 0; | 73 | int r = 0; |
73 | #ifdef PROC | 74 | #ifdef PROC |
74 | QString o = "start"; | 75 | QString o = "start"; |
75 | Process *ipkg = new Process( cmd ); | 76 | Process *ipkg = new Process(QStringList() << "ipkg" << cmd ); |
76 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | 77 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); |
77 | QString description; | 78 | QString description; |
78 | r = ipkg->exec("",o); | 79 | r = ipkg->exec("",o); |
79 | out( o ); | 80 | out( o ); |
80 | #endif | 81 | #endif |
81 | #ifdef SYSTEM | 82 | #ifdef SYSTEM |
82 | out( "running:<br>\n"+cmd+"<br>\n" ); | 83 | out( "running:<br>\n"+cmd+"<br>\n" ); |
83 | QString redirect = "/tmp/oipkg.pipe"; | 84 | QString redirect = "/tmp/oipkg.pipe"; |
84 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 85 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
85 | pvDebug(2, "running >"+cmd+"<"); | 86 | pvDebug(2, "running >"+cmd+"<"); |
86 | r = system(cmd.latin1()); | 87 | r = system(cmd.latin1()); |
87 | QFile f( redirect ); | 88 | QFile f( redirect ); |
88 | QString line; | 89 | QString line; |
89 | QString oldLine; | 90 | QString oldLine; |
90 | while ( ! f.open(IO_ReadOnly) ) {}; | 91 | while ( ! f.open(IO_ReadOnly) ) {}; |
91 | QTextStream t( &f ); | 92 | QTextStream t( &f ); |
92 | while ( !t.eof() ) | 93 | while ( !t.eof() ) |
93 | { | 94 | { |
94 | line = t.readLine(); | 95 | line = t.readLine(); |
95 | if ( line != oldLine ) | 96 | if ( line != oldLine ) |
96 | { | 97 | { |
97 | out( line +"<br>" ); | 98 | out( line +"<br>" ); |
98 | oldLine = line; | 99 | oldLine = line; |
99 | } | 100 | } |
100 | } | 101 | } |
101 | f.close(); | 102 | f.close(); |
102 | out( "Finished!<br>"); | 103 | out( "Finished!<br>"); |
103 | #endif | 104 | #endif |
104 | 105 | ||
105 | return r; | 106 | return r; |
106 | } | 107 | } |
107 | 108 | ||
108 | void PmIpkg::makeLinks(Package *pack) | 109 | void PmIpkg::makeLinks(Package *pack) |
109 | { | 110 | { |
110 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 111 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
111 | linkPackage( pack->name(), pack->dest() ); | 112 | linkPackage( pack->name(), pack->dest() ); |
112 | } | 113 | } |
113 | 114 | ||
114 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 115 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
115 | { | 116 | { |
116 | QString dest = settings->getDestinationUrlByName( d ); | 117 | QString dest = settings->getDestinationUrlByName( d ); |
117 | dest = dest==""?d:dest; | 118 | dest = dest==""?d:dest; |
118 | if (dest == "/" ) return 0; | 119 | if (dest == "/" ) return 0; |
119 | { | 120 | { |
120 | Config cfg( "oipkg", Config::User ); | 121 | Config cfg( "oipkg", Config::User ); |
121 | cfg.setGroup( "Common" ); | 122 | cfg.setGroup( "Common" ); |
122 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 123 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
123 | } | 124 | } |
124 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 125 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
125 | QFile f( packFileName ); | 126 | QFile f( packFileName ); |
126 | if ( ! f.open(IO_ReadOnly) ) | 127 | if ( ! f.open(IO_ReadOnly) ) |
127 | { | 128 | { |
128 | pvDebug(1," Panik! Could not open"); | 129 | pvDebug(1," Panik! Could not open"); |
129 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); | 130 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
130 | return (QStringList*)0; | 131 | return (QStringList*)0; |
131 | } | 132 | } |
132 | QStringList *fileList = new QStringList(); | 133 | QStringList *fileList = new QStringList(); |
133 | QTextStream t( &f ); | 134 | QTextStream t( &f ); |
134 | while ( !t.eof() ) | 135 | while ( !t.eof() ) |
135 | { | 136 | { |
136 | *fileList += t.readLine(); | 137 | *fileList += t.readLine(); |
137 | } | 138 | } |
138 | return fileList; | 139 | return fileList; |
139 | } | 140 | } |
140 | 141 | ||
141 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 142 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
142 | { | 143 | { |
143 | QStringList *fileList = getList( packFileName, dest ); | 144 | QStringList *fileList = getList( packFileName, dest ); |
144 | processFileList( fileList, dest ); | 145 | processFileList( fileList, dest ); |
145 | delete fileList; | 146 | delete fileList; |
146 | } | 147 | } |
147 | 148 | ||
148 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 149 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
149 | { | 150 | { |
150 | if (!fileList) return; | 151 | if (!fileList) return; |
151 | for (uint i=0; i < fileList->count(); i++) | 152 | for (uint i=0; i < fileList->count(); i++) |
152 | { | 153 | { |
153 | QString dest = settings->getDestinationUrlByName( d ); | 154 | QString dest = settings->getDestinationUrlByName( d ); |
154 | dest = dest==""?d:dest; | 155 | dest = dest==""?d:dest; |
155 | processLinkDir( (*fileList)[i], dest ); | 156 | processLinkDir( (*fileList)[i], dest ); |
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
159 | 160 | ||
160 | void PmIpkg::processLinkDir( QString file, QString dest ) | 161 | void PmIpkg::processLinkDir( QString file, QString dest ) |
161 | { | 162 | { |
162 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 163 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
163 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 164 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
164 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 165 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
165 | if ( dest == "???" || dest == "" ) return; | 166 | if ( dest == "???" || dest == "" ) return; |
166 | QString destFile = file; | 167 | QString destFile = file; |
167 | file = dest+"/"+file; | 168 | file = dest+"/"+file; |
168 | if (file == dest) return; | 169 | if (file == dest) return; |
169 | QFileInfo fileInfo( file ); | 170 | QFileInfo fileInfo( file ); |
170 | if ( fileInfo.isDir() ) | 171 | if ( fileInfo.isDir() ) |
171 | { | 172 | { |
@@ -204,193 +205,193 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
204 | unlink( linkFile ); | 205 | unlink( linkFile ); |
205 | } | 206 | } |
206 | } | 207 | } |
207 | } | 208 | } |
208 | } | 209 | } |
209 | 210 | ||
210 | void PmIpkg::loadList( PackageList *pl ) | 211 | void PmIpkg::loadList( PackageList *pl ) |
211 | { | 212 | { |
212 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) | 213 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) |
213 | { | 214 | { |
214 | if ( pack && (pack->name() != "") && pack) | 215 | if ( pack && (pack->name() != "") && pack) |
215 | { | 216 | { |
216 | if ( pack->toInstall() ) | 217 | if ( pack->toInstall() ) |
217 | to_install.append( pack ); | 218 | to_install.append( pack ); |
218 | if ( pack->toRemove() ) | 219 | if ( pack->toRemove() ) |
219 | to_remove.append( pack ); | 220 | to_remove.append( pack ); |
220 | } | 221 | } |
221 | } | 222 | } |
222 | } | 223 | } |
223 | 224 | ||
224 | void PmIpkg::commit() | 225 | void PmIpkg::commit() |
225 | { | 226 | { |
226 | int sizecount = 0; | 227 | int sizecount = 0; |
227 | installDialog = new InstallDialog(settings,0,0,true); | 228 | installDialog = new InstallDialog(settings,0,0,true); |
228 | QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); | 229 | QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); |
229 | QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); | 230 | QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); |
230 | toRemoveItem->setOpen( true ); | 231 | toRemoveItem->setOpen( true ); |
231 | toInstallItem->setOpen( true ); | 232 | toInstallItem->setOpen( true ); |
232 | for (uint i=0; i < to_remove.count(); i++) | 233 | for (uint i=0; i < to_remove.count(); i++) |
233 | { | 234 | { |
234 | sizecount += 1; | 235 | sizecount += 1; |
235 | toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 236 | toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
236 | } | 237 | } |
237 | for (uint i=0; i < to_install.count(); i++) | 238 | for (uint i=0; i < to_install.count(); i++) |
238 | { | 239 | { |
239 | sizecount += to_install.at(i)->size().toInt(); | 240 | sizecount += to_install.at(i)->size().toInt(); |
240 | toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 241 | toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
241 | } | 242 | } |
242 | runwindow->progress->setTotalSteps(sizecount); | 243 | runwindow->progress->setTotalSteps(sizecount); |
243 | qDebug("Install size %i",sizecount); | 244 | qDebug("Install size %i",sizecount); |
244 | installDialog->showMaximized(); | 245 | installDialog->showMaximized(); |
245 | if ( installDialog->exec() ) doIt(); | 246 | if ( installDialog->exec() ) doIt(); |
246 | installDialog->close(); | 247 | installDialog->close(); |
247 | runwindow->showMaximized(); | 248 | runwindow->showMaximized(); |
248 | out(tr("<b>All done.</b>")); | 249 | out(tr("<b>All done.</b>")); |
249 | } | 250 | } |
250 | 251 | ||
251 | void PmIpkg::doIt() | 252 | void PmIpkg::doIt() |
252 | { | 253 | { |
253 | show( true ); | 254 | show( true ); |
254 | remove(); | 255 | remove(); |
255 | install(); | 256 | install(); |
256 | } | 257 | } |
257 | 258 | ||
258 | 259 | ||
259 | void PmIpkg::remove() | 260 | void PmIpkg::remove() |
260 | { | 261 | { |
261 | if ( to_remove.count() == 0 ) return; | 262 | if ( to_remove.count() == 0 ) return; |
262 | 263 | ||
263 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); | 264 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); |
264 | 265 | ||
265 | QStringList *fileList; | 266 | QStringList *fileList; |
266 | for (uint i=0; i < to_remove.count(); i++) | 267 | for (uint i=0; i < to_remove.count(); i++) |
267 | { | 268 | { |
268 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 269 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
269 | if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() ) == 0) | 270 | if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() ) == 0) |
270 | { | 271 | { |
271 | runwindow->progress->setProgress( 1 ); | 272 | runwindow->progress->setProgress( 1 ); |
272 | linkOpp = removeLink; | 273 | linkOpp = removeLink; |
273 | if ( to_remove.at(i)->link() ) | 274 | if ( to_remove.at(i)->link() ) |
274 | { | 275 | { |
275 | out( "<br>removing links<br>" ); | 276 | out( "<br>removing links<br>" ); |
276 | out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"<br>" ); | 277 | out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"<br>" ); |
277 | processFileList( fileList, to_remove.at(i)->dest() ); | 278 | processFileList( fileList, to_remove.at(i)->dest() ); |
278 | } | 279 | } |
279 | to_remove.at(i)->processed(); | 280 | to_remove.at(i)->processed(); |
280 | to_remove.take( i ); | 281 | to_remove.take( i ); |
281 | out("<br><hr>"); | 282 | out("<br><hr>"); |
282 | }else{ | 283 | }else{ |
283 | out("<b>"+tr("Error while removing")+"</b><hr>"+to_remove.at(i)->name()); | 284 | out("<b>"+tr("Error while removing")+"</b><hr>"+to_remove.at(i)->name()); |
284 | } | 285 | } |
285 | if ( to_remove.at(i)->link() )delete fileList; | 286 | if ( to_remove.at(i)->link() )delete fileList; |
286 | } | 287 | } |
287 | to_remove.clear(); | 288 | to_remove.clear(); |
288 | out("<br>"); | 289 | out("<br>"); |
289 | } | 290 | } |
290 | 291 | ||
291 | 292 | ||
292 | void PmIpkg::install() | 293 | void PmIpkg::install() |
293 | { | 294 | { |
294 | if ( to_install.count() == 0 ) return; | 295 | if ( to_install.count() == 0 ) return; |
295 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 296 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
296 | for (uint i=0; i < to_install.count(); i++) | 297 | for (uint i=0; i < to_install.count(); i++) |
297 | { | 298 | { |
298 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 ) | 299 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 ) |
299 | { | 300 | { |
300 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() ); | 301 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
301 | linkOpp = createLink; | 302 | linkOpp = createLink; |
302 | if ( to_install.at(i)->link() ) | 303 | if ( to_install.at(i)->link() ) |
303 | { | 304 | { |
304 | out( "<br>creating links<br>" ); | 305 | out( "<br>creating links<br>" ); |
305 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" ); | 306 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" ); |
306 | makeLinks( to_install.at(i) ); | 307 | makeLinks( to_install.at(i) ); |
307 | } | 308 | } |
308 | to_install.at(i)->processed(); | 309 | to_install.at(i)->processed(); |
309 | to_install.take( i ); | 310 | to_install.take( i ); |
310 | out("<br><hr>"); | 311 | out("<br><hr>"); |
311 | }else{ | 312 | }else{ |
312 | out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name()); | 313 | out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name()); |
313 | } | 314 | } |
314 | } | 315 | } |
315 | out("<br>"); | 316 | out("<br>"); |
316 | to_install.clear(); | 317 | to_install.clear(); |
317 | } | 318 | } |
318 | 319 | ||
319 | void PmIpkg::createLinks( const QString &dest ) | 320 | void PmIpkg::createLinks( const QString &dest ) |
320 | { | 321 | { |
321 | pvDebug(2,"PmIpkg::createLinks "+dest); | 322 | pvDebug(2,"PmIpkg::createLinks "+dest); |
322 | linkOpp=createLink; | 323 | linkOpp=createLink; |
323 | QString url = settings->getDestinationUrlByName( dest ); | 324 | QString url = settings->getDestinationUrlByName( dest ); |
324 | url = url==""?dest:url; | 325 | url = url==""?dest:url; |
325 | processLinkDir( "/opt", url ); | 326 | processLinkDir( "/opt", url ); |
326 | processLinkDir( "/usr", url ); | 327 | processLinkDir( "/usr", url ); |
327 | } | 328 | } |
328 | 329 | ||
329 | void PmIpkg::removeLinks( const QString &dest ) | 330 | void PmIpkg::removeLinks( const QString &dest ) |
330 | { | 331 | { |
331 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 332 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
332 | linkOpp=removeLink; | 333 | linkOpp=removeLink; |
333 | QString url = settings->getDestinationUrlByName( dest ); | 334 | QString url = settings->getDestinationUrlByName( dest ); |
334 | url = url==""?dest:url; | 335 | url = url==""?dest:url; |
335 | processLinkDir( "/opt", url ); | 336 | processLinkDir( "/opt", url ); |
336 | processLinkDir( "/usr", url ); | 337 | processLinkDir( "/usr", url ); |
337 | } | 338 | } |
338 | 339 | ||
339 | void PmIpkg::update() | 340 | void PmIpkg::update() |
340 | { | 341 | { |
341 | show( false ); | 342 | show( false ); |
342 | runIpkg( "update" ); | 343 | runIpkg( "update" ); |
343 | runwindow->close(); | 344 | runwindow->close(); |
344 | } | 345 | } |
345 | 346 | ||
346 | void PmIpkg::out( QString o ) | 347 | void PmIpkg::out( QString o ) |
347 | { | 348 | { |
348 | runwindow->outPut->append(o); | 349 | runwindow->outPut->append(o); |
349 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); | 350 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); |
350 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); | 351 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); |
351 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 352 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
352 | } | 353 | } |
353 | 354 | ||
354 | 355 | ||
355 | void PmIpkg::showButtons(bool b) | 356 | void PmIpkg::showButtons(bool b) |
356 | { | 357 | { |
357 | if ( b ) | 358 | if ( b ) |
358 | { | 359 | { |
359 | runwindow->cancelButton->hide(); | 360 | runwindow->cancelButton->hide(); |
360 | runwindow->doItButton->hide(); | 361 | runwindow->doItButton->hide(); |
361 | runwindow->removeButton->hide(); | 362 | runwindow->removeButton->hide(); |
362 | runwindow->installButton->hide(); | 363 | runwindow->installButton->hide(); |
363 | }else{ | 364 | }else{ |
364 | runwindow->cancelButton->show(); | 365 | runwindow->cancelButton->show(); |
365 | runwindow->doItButton->show(); | 366 | runwindow->doItButton->show(); |
366 | runwindow->removeButton->show(); | 367 | runwindow->removeButton->show(); |
367 | runwindow->installButton->show(); | 368 | runwindow->installButton->show(); |
368 | 369 | ||
369 | } | 370 | } |
370 | } | 371 | } |
371 | 372 | ||
372 | void PmIpkg::show(bool b) | 373 | void PmIpkg::show(bool b) |
373 | { | 374 | { |
374 | if (!runwindow->isVisible()) | 375 | if (!runwindow->isVisible()) |
375 | runwindow->showMaximized(); | 376 | runwindow->showMaximized(); |
376 | showButtons(b); | 377 | showButtons(b); |
377 | if ( !b ) | 378 | if ( !b ) |
378 | runwindow->progress->hide(); | 379 | runwindow->progress->hide(); |
379 | else | 380 | else |
380 | runwindow->progress->show(); | 381 | runwindow->progress->show(); |
381 | } | 382 | } |
382 | 383 | ||
383 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 384 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
384 | { | 385 | { |
385 | 386 | ||
386 | to_install.clear(); | 387 | to_install.clear(); |
387 | to_remove.clear(); | 388 | to_remove.clear(); |
388 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 389 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
389 | Package *p = new Package(fileName,settings); | 390 | Package *p = new Package(fileName,settings); |
390 | if ( dest!="") p->setDest( dest ); | 391 | if ( dest!="") p->setDest( dest ); |
391 | to_install.append( p ); | 392 | to_install.append( p ); |
392 | commit(); | 393 | commit(); |
393 | delete p; | 394 | delete p; |
394 | } | 395 | } |
395 | 396 | ||
396 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 397 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
diff --git a/pics/oipkg/installedOld.png b/pics/oipkg/installedOld.png new file mode 100644 index 0000000..8a042fc --- a/dev/null +++ b/pics/oipkg/installedOld.png | |||
Binary files differ | |||
diff --git a/pics/oipkg/uninstalledInstalledOld.png b/pics/oipkg/uninstalledInstalledOld.png new file mode 100644 index 0000000..f369c63 --- a/dev/null +++ b/pics/oipkg/uninstalledInstalledOld.png | |||
Binary files differ | |||
diff --git a/pics/oipkg/uninstalledOld.png b/pics/oipkg/uninstalledOld.png new file mode 100644 index 0000000..5dce3ea --- a/dev/null +++ b/pics/oipkg/uninstalledOld.png | |||
Binary files differ | |||
diff --git a/pics/oipkg/uninstalledOldinstalledNew.png b/pics/oipkg/uninstalledOldinstalledNew.png new file mode 100644 index 0000000..3bfe126 --- a/dev/null +++ b/pics/oipkg/uninstalledOldinstalledNew.png | |||
Binary files differ | |||