author | tille <tille> | 2002-05-01 14:00:09 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-01 14:00:09 (UTC) |
commit | e729a9bdd9f37f4bd610d10122f002a0540c93ed (patch) (unidiff) | |
tree | a23696d8742a36b57256281dc7e2f7848407be61 | |
parent | 7e5615473c1d103db66f42ae60bf9ed57d52566c (diff) | |
download | opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.zip opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.gz opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.bz2 |
added ipkgfind remote query
24 files changed, 552 insertions, 234 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 790766c..fc2e8a4 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,9 +1,14 @@ | |||
1 | * Settings Class | 1 | * Settings Class |
2 | * tr() ;) | 2 | * tr() ;) |
3 | * Dialog to display ipkg output live | 3 | * Dialog to display ipkg output live |
4 | * parse "to install" and "to remove" from status | 4 | * parse "to install" and "to remove" from status |
5 | * install local file dialog | 5 | * install local file dialog |
6 | * qcop | 6 | * qcop |
7 | * error handling | 7 | * error handling |
8 | * manage links | 8 | * manage links |
9 | * dependency checking | 9 | * dependency checking |
10 | * create dest if it does not exist | ||
11 | * allow reinstalling | ||
12 | * handle different versions | ||
13 | * different types of filters and searches | ||
14 | i.e. name, desc, files etc \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h index 206dea5..d20a5eb 100644 --- a/noncore/unsupported/oipkg/debug.h +++ b/noncore/unsupported/oipkg/debug.h | |||
@@ -1,21 +1,21 @@ | |||
1 | #ifndef _DEBUG_H_ | 1 | #ifndef _DEBUG_H_ |
2 | #define _DEBUG_H_ | 2 | #define _DEBUG_H_ |
3 | 3 | ||
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | 5 | ||
6 | extern int debugLevel; | 6 | extern int debugLevel; |
7 | 7 | ||
8 | #define HACK | 8 | #define HACK |
9 | 9 | #define PACKAGELISTLOCAL | |
10 | #define NEWLAYOUT | 10 | #define NEWLAYOUT |
11 | 11 | ||
12 | #define pvDebug(I, S) \ | 12 | #define pvDebug(I, S) \ |
13 | if ( debugLevel < 3 ) \ | 13 | if ( debugLevel < 3 ) \ |
14 | { \ | 14 | { \ |
15 | if ( I <= debugLevel ) qDebug(S);\ | 15 | if ( I <= debugLevel ) qDebug(S);\ |
16 | }else{\ | 16 | }else{\ |
17 | if ( I <= debugLevel ) \ | 17 | if ( I <= debugLevel ) \ |
18 | qDebug("#%s:%i: %s \t\t(Level: %i)",__FILE__,__LINE__,QString(S).latin1(),I);\ | 18 | qDebug("#%s:%i: %s \t\t(Level: %i)",__FILE__,__LINE__,QString(S).latin1(),I);\ |
19 | } | 19 | } |
20 | 20 | ||
21 | #endif \ No newline at end of file | 21 | #endif \ No newline at end of file |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index ca1e5e8..06828e0 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,294 +1,333 @@ | |||
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 <qlayout.h> | 27 | #include <qlayout.h> |
27 | 28 | ||
28 | #include "pksettingsbase.h" | 29 | #include "pksettingsbase.h" |
29 | #include "utils.h" | 30 | #include "utils.h" |
30 | #include "packagelistitem.h" | 31 | #include "packagelistitem.h" |
31 | 32 | ||
32 | 33 | ||
33 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
34 | QMainWindow( parent, name, f ) | 35 | QMainWindow( parent, name, f ) |
35 | { | 36 | { |
36 | setCaption( tr("Package Manager") ); | 37 | setCaption( tr("Package Manager") ); |
37 | settings = new PackageManagerSettings(this,0,TRUE); | 38 | settings = new PackageManagerSettings(this,0,TRUE); |
38 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 39 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
39 | setCentralWidget( listViewPackages ); | 40 | setCentralWidget( listViewPackages ); |
40 | 41 | ||
41 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | 42 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); |
42 | //wait = new QMessageBox(this); | 43 | //wait = new QMessageBox(this); |
43 | // wait->setText(tr("Please wait")); | 44 | // wait->setText(tr("Please wait")); |
44 | ipkg = new PmIpkg( settings, this ); | 45 | ipkg = new PmIpkg( settings, this ); |
46 | // settings->setIpkg( ipkg ); | ||
45 | packageList.setSettings( settings ); | 47 | packageList.setSettings( settings ); |
48 | packageListSearch.setSettings( settings ); | ||
46 | packageList.update(); | 49 | packageList.update(); |
47 | makeMenu(); | 50 | makeMenu(); |
48 | makeChannel(); | 51 | makeChannel(); |
49 | //opie is hardcoded default ;) | 52 | //opie is hardcoded default ;) |
50 | for (int i=0;i<section->count();i++) | 53 | for (int i=0;i<section->count();i++) |
51 | if (section->text(i)=="opie") | 54 | if (section->text(i)=="opie") |
52 | section->setCurrentItem(i); | 55 | section->setCurrentItem(i); |
53 | sectionChanged(); | 56 | sectionChanged(); |
54 | 57 | ||
55 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 58 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
56 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 59 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
60 | |||
61 | connect( settings->removeLinksButton, SIGNAL( clicked()), | ||
62 | SLOT(removeLinks()) ); | ||
63 | connect( settings->createLinksButton, SIGNAL( clicked()), | ||
64 | SLOT(createLinks()) ); | ||
65 | |||
66 | //rootLocal = new QCheckListItem(listViewPackages,tr("local")); | ||
67 | //rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); | ||
57 | displayList(); | 68 | displayList(); |
58 | } | 69 | } |
59 | 70 | ||
60 | void MainWindow::makeMenu() | 71 | void MainWindow::makeMenu() |
61 | { | 72 | { |
62 | 73 | ||
63 | QPEToolBar *toolBar = new QPEToolBar( this ); | 74 | QPEToolBar *toolBar = new QPEToolBar( this ); |
64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 75 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 76 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
66 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 77 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
67 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 78 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
68 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 79 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
69 | 80 | ||
70 | setToolBarsMovable( false ); | 81 | setToolBarsMovable( false ); |
71 | toolBar->setHorizontalStretchable( true ); | 82 | toolBar->setHorizontalStretchable( true ); |
72 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 83 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
73 | menuBar->insertItem( tr( "View" ), viewMenu ); | 84 | menuBar->insertItem( tr( "View" ), viewMenu ); |
74 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 85 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
75 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 86 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
76 | 87 | ||
77 | QLabel *spacer = new QLabel( "", toolBar ); | 88 | QLabel *spacer = new QLabel( "", toolBar ); |
78 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 89 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
79 | toolBar->setStretchableWidget( spacer ); | 90 | toolBar->setStretchableWidget( spacer ); |
80 | 91 | ||
81 | 92 | ||
82 | runAction = new QAction( tr( "Apply" ), | 93 | runAction = new QAction( tr( "Apply" ), |
83 | Resource::loadPixmap( "oipkg/install" ), | 94 | Resource::loadPixmap( "oipkg/install" ), |
84 | QString::null, 0, this, 0 ); | 95 | QString::null, 0, this, 0 ); |
85 | connect( runAction, SIGNAL( activated() ), | 96 | connect( runAction, SIGNAL( activated() ), |
86 | this, SLOT( runIpkg() ) ); | 97 | this, SLOT( runIpkg() ) ); |
87 | runAction->addTo( toolBar ); | 98 | runAction->addTo( toolBar ); |
88 | runAction->addTo( srvMenu ); | 99 | runAction->addTo( srvMenu ); |
89 | 100 | ||
90 | srvMenu->insertSeparator (); | 101 | srvMenu->insertSeparator (); |
91 | 102 | ||
92 | updateAction = new QAction( tr( "Update" ), | 103 | updateAction = new QAction( tr( "Update" ), |
93 | Resource::loadIconSet( "oipkg/update" ), | 104 | Resource::loadIconSet( "oipkg/update" ), |
94 | QString::null, 0, this, 0 ); | 105 | QString::null, 0, this, 0 ); |
95 | connect( updateAction, SIGNAL( activated() ), | 106 | connect( updateAction, SIGNAL( activated() ), |
96 | this , SLOT( updateList() ) ); | 107 | this , SLOT( updateList() ) ); |
97 | updateAction->addTo( toolBar ); | 108 | updateAction->addTo( toolBar ); |
98 | updateAction->addTo( srvMenu ); | 109 | updateAction->addTo( srvMenu ); |
99 | 110 | ||
100 | // could we use for find | ||
101 | // detailsAction = new QAction( tr( "Find" ), | ||
102 | // Resource::loadIconSet( "find" ), | ||
103 | // QString::null, 0, this, 0 ); | ||
104 | // connect( detailsAction, SIGNAL( activated() ), | ||
105 | // this , SLOT( showFind() ) ); | ||
106 | // detailsAction->addTo( toolBar ); | ||
107 | |||
108 | QAction *cfgact; | 111 | QAction *cfgact; |
109 | 112 | ||
110 | cfgact = new QAction( tr( "Setups" ), | 113 | cfgact = new QAction( tr( "Setups" ), |
111 | QString::null, 0, this, 0 ); | 114 | QString::null, 0, this, 0 ); |
112 | connect( cfgact, SIGNAL( activated() ), | 115 | connect( cfgact, SIGNAL( activated() ), |
113 | SLOT( showSettings() ) ); | 116 | SLOT( showSettings() ) ); |
114 | cfgact->addTo( cfgMenu ); | 117 | cfgact->addTo( cfgMenu ); |
115 | 118 | ||
116 | cfgact = new QAction( tr( "Servers" ), | 119 | cfgact = new QAction( tr( "Servers" ), |
117 | QString::null, 0, this, 0 ); | 120 | QString::null, 0, this, 0 ); |
118 | connect( cfgact, SIGNAL( activated() ), | 121 | connect( cfgact, SIGNAL( activated() ), |
119 | SLOT( showSettingsSrv() ) ); | 122 | SLOT( showSettingsSrv() ) ); |
120 | cfgact->addTo( cfgMenu ); | 123 | cfgact->addTo( cfgMenu ); |
121 | cfgact = new QAction( tr( "Destinations" ), | 124 | cfgact = new QAction( tr( "Destinations" ), |
122 | QString::null, 0, this, 0 ); | 125 | QString::null, 0, this, 0 ); |
123 | connect( cfgact, SIGNAL( activated() ), | 126 | connect( cfgact, SIGNAL( activated() ), |
124 | SLOT( showSettingsDst() ) ); | 127 | SLOT( showSettingsDst() ) ); |
125 | cfgact->addTo( cfgMenu ); | 128 | cfgact->addTo( cfgMenu ); |
126 | 129 | ||
127 | QAction *a; | 130 | QAction *a; |
128 | 131 | ||
132 | // SECTIONS | ||
129 | sectionBar = new QPEToolBar( this ); | 133 | sectionBar = new QPEToolBar( this ); |
130 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 134 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
131 | sectionBar->setHorizontalStretchable( true ); | 135 | sectionBar->setHorizontalStretchable( true ); |
132 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 136 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
133 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 137 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
134 | sectionBar->setStretchableWidget( label ); | 138 | sectionBar->setStretchableWidget( label ); |
135 | section = new QComboBox( false, sectionBar ); | 139 | section = new QComboBox( false, sectionBar ); |
136 | label = new QLabel( " / ", sectionBar ); | 140 | label = new QLabel( " / ", sectionBar ); |
137 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 141 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
138 | subsection = new QComboBox( false, sectionBar ); | 142 | subsection = new QComboBox( false, sectionBar ); |
139 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 143 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
140 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 144 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
141 | a->addTo( sectionBar ); | 145 | a->addTo( sectionBar ); |
142 | |||
143 | setSections(); | 146 | setSections(); |
144 | setSubSections(); | 147 | setSubSections(); |
145 | |||
146 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 148 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
147 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 149 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
148 | sectionAction->setToggleAction( true ); | 150 | sectionAction->setToggleAction( true ); |
149 | sectionAction->addTo( viewMenu ); | 151 | sectionAction->addTo( viewMenu ); |
150 | 152 | ||
153 | //FIND | ||
151 | findBar = new QPEToolBar(this); | 154 | findBar = new QPEToolBar(this); |
152 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 155 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
153 | label = new QLabel( tr("Filter: "), findBar ); | 156 | label = new QLabel( tr("Filter: "), findBar ); |
154 | label->setBackgroundColor( findBar->backgroundColor() ); | 157 | label->setBackgroundColor( findBar->backgroundColor() ); |
155 | findBar->setHorizontalStretchable( TRUE ); | 158 | findBar->setHorizontalStretchable( TRUE ); |
156 | findEdit = new QLineEdit( findBar, "findEdit" ); | 159 | findEdit = new QLineEdit( findBar, "findEdit" ); |
157 | findBar->setStretchableWidget( findEdit ); | 160 | findBar->setStretchableWidget( findEdit ); |
158 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 161 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
159 | this, SLOT( displayList() ) ); | 162 | this, SLOT( displayList() ) ); |
160 | |||
161 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 163 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
162 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 164 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
163 | a->addTo( findBar ); | 165 | a->addTo( findBar ); |
164 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 166 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
165 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 167 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
166 | a->addTo( findBar ); | 168 | a->addTo( findBar ); |
167 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | 169 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
168 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 170 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
169 | findAction->setToggleAction( true ); | 171 | findAction->setToggleAction( true ); |
170 | findAction->addTo( viewMenu ); | 172 | findAction->addTo( viewMenu ); |
171 | 173 | ||
174 | //SEARCH | ||
175 | searchBar = new QPEToolBar(this); | ||
176 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | ||
177 | label = new QLabel( tr("ipkgfind: "), searchBar ); | ||
178 | label->setBackgroundColor( searchBar->backgroundColor() ); | ||
179 | searchBar->setHorizontalStretchable( TRUE ); | ||
180 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | ||
181 | searchBar->setStretchableWidget( searchEdit ); | ||
182 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | ||
183 | // this, SLOT( displayList() ) ); | ||
184 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | ||
185 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | ||
186 | a->addTo( searchBar ); | ||
187 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | ||
188 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | ||
189 | searchCommit->addTo( searchBar ); | ||
190 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | ||
191 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | ||
192 | a->addTo( searchBar ); | ||
193 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | ||
194 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | ||
195 | searchAction->setToggleAction( true ); | ||
196 | searchAction->addTo( viewMenu ); | ||
197 | |||
198 | //DEST | ||
172 | destBar = new QPEToolBar(this); | 199 | destBar = new QPEToolBar(this); |
173 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 200 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
174 | label = new QLabel( tr("Destination: "), destBar ); | 201 | label = new QLabel( tr("Destination: "), destBar ); |
175 | label->setBackgroundColor( destBar->backgroundColor() ); | 202 | label->setBackgroundColor( destBar->backgroundColor() ); |
176 | destBar->setHorizontalStretchable( TRUE ); | 203 | destBar->setHorizontalStretchable( TRUE ); |
177 | destination = new QComboBox( false, destBar ); | 204 | destination = new QComboBox( false, destBar ); |
178 | destination->insertStringList( settings->getDestinationNames() ); | 205 | destination->insertStringList( settings->getDestinationNames() ); |
179 | setComboName(destination,settings->getDestinationName()); | 206 | setComboName(destination,settings->getDestinationName()); |
180 | // connect( destination, SIGNAL(activated(int)), | 207 | connect( destination, SIGNAL(activated(int)), |
181 | // SLOT(activeDestinationChange(int)) ); | 208 | settings, SLOT(activeDestinationChange(int)) ); |
182 | spacer = new QLabel( " ", destBar ); | 209 | spacer = new QLabel( " ", destBar ); |
183 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 210 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
184 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 211 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
185 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 212 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
186 | CheckBoxLink->setChecked( settings->createLinks() ); | 213 | CheckBoxLink->setChecked( settings->createLinks() ); |
187 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), | 214 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
188 | // settings, SLOT(linkEnabled(bool)) ); | 215 | settings, SLOT(linkEnabled(bool)) ); |
189 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 216 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
190 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 217 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
191 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 218 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
192 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 219 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
193 | a->addTo( destBar ); | 220 | a->addTo( destBar ); |
194 | destBar->setStretchableWidget( CheckBoxLink ); | 221 | destBar->setStretchableWidget( CheckBoxLink ); |
195 | destAction->setToggleAction( true ); | 222 | destAction->setToggleAction( true ); |
196 | // destAction->addTo( viewMenu ); | 223 | // destAction->addTo( viewMenu ); |
197 | 224 | ||
198 | // configure the menus | 225 | // configure the menus |
199 | Config cfg( "oipkg", Config::User ); | 226 | Config cfg( "oipkg", Config::User ); |
200 | cfg.setGroup( "gui" ); | 227 | cfg.setGroup( "gui" ); |
201 | 228 | ||
202 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 229 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
230 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | ||
203 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 231 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
204 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 232 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
205 | } | 233 | } |
206 | 234 | ||
207 | MainWindow::~MainWindow() | 235 | MainWindow::~MainWindow() |
208 | { | 236 | { |
209 | Config cfg( "oipkg", Config::User ); | 237 | Config cfg( "oipkg", Config::User ); |
210 | cfg.setGroup( "gui" ); | 238 | cfg.setGroup( "gui" ); |
211 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 239 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
240 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | ||
212 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 241 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
213 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 242 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
214 | 243 | ||
215 | } | 244 | } |
216 | 245 | ||
217 | void MainWindow::runIpkg() | 246 | void MainWindow::runIpkg() |
218 | { | 247 | { |
219 | packageList.allPackages(); | 248 | packageList.allPackages(); |
249 | ipkg->loadList( packageListSearch ); | ||
220 | ipkg->commit( packageList ); | 250 | ipkg->commit( packageList ); |
221 | // ##### If we looked in the list of files, we could send out accurate | 251 | // ##### If we looked in the list of files, we could send out accurate |
222 | // ##### messages. But we don't bother yet, and just do an "all". | 252 | // ##### messages. But we don't bother yet, and just do an "all". |
223 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 253 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
224 | QString lf = QString::null; | 254 | QString lf = QString::null; |
225 | e << lf; | 255 | e << lf; |
226 | displayList(); | 256 | displayList(); |
227 | } | 257 | } |
228 | 258 | ||
229 | void MainWindow::updateList() | 259 | void MainWindow::updateList() |
230 | { | 260 | { |
231 | //wait->show(); | 261 | //wait->show(); |
232 | QTimer *t = new QTimer( this ); | 262 | QTimer *t = new QTimer( this ); |
233 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 263 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
234 | t->start( 0, false ); | 264 | t->start( 0, false ); |
235 | packageList.clear(); | 265 | packageList.clear(); |
236 | ipkg->update(); | 266 | ipkg->update(); |
237 | packageList.update(); | 267 | packageList.update(); |
238 | t->stop(); | 268 | t->stop(); |
239 | // wait->hide(); | 269 | // wait->hide(); |
240 | } | 270 | } |
241 | 271 | ||
242 | void MainWindow::filterList() | 272 | void MainWindow::filterList() |
243 | { | 273 | { |
244 | //wait->show(); | 274 | //wait->show(); |
245 | QString f = ""; | 275 | QString f = ""; |
246 | if ( findAction->isOn() ) f = findEdit->text(); | 276 | if ( findAction->isOn() ) f = findEdit->text(); |
247 | packageList.filterPackages( f ); | 277 | packageList.filterPackages( f ); |
248 | //wait->hide(); | 278 | //wait->hide(); |
249 | } | 279 | } |
250 | 280 | ||
251 | void MainWindow::displayList() | 281 | void MainWindow::displayList() |
252 | { | 282 | { |
253 | //wait->hide(); | 283 | //wait->hide(); |
254 | filterList(); | 284 | filterList(); |
255 | listViewPackages->clear(); | 285 | listViewPackages->clear(); |
256 | Package *pack = packageList.first(); | 286 | Package *pack = packageList.first(); |
287 | PackageListItem *item; | ||
288 | |||
289 | QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local")); | ||
290 | QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind")); | ||
257 | while( pack ) | 291 | while( pack ) |
258 | { | 292 | { |
259 | if ( pack && (pack->name() != "") ) | 293 | item = new PackageListItem( rootLocal, pack, settings ); |
260 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); | ||
261 | pack = packageList.next(); | 294 | pack = packageList.next(); |
262 | } | 295 | } |
296 | pack = packageListSearch.first(); | ||
297 | while( pack ) | ||
298 | { | ||
299 | item = new PackageListItem( rootSearch, pack, settings ); | ||
300 | pack = packageListSearch.next(); | ||
301 | } | ||
263 | } | 302 | } |
264 | 303 | ||
265 | void MainWindow::sectionChanged() | 304 | void MainWindow::sectionChanged() |
266 | { | 305 | { |
267 | disconnect( section, SIGNAL( activated(int) ), | 306 | disconnect( section, SIGNAL( activated(int) ), |
268 | this, SLOT( sectionChanged() ) ); | 307 | this, SLOT( sectionChanged() ) ); |
269 | disconnect( subsection, SIGNAL(activated(int) ), | 308 | disconnect( subsection, SIGNAL(activated(int) ), |
270 | this, SLOT( subSectionChanged() ) ); | 309 | this, SLOT( subSectionChanged() ) ); |
271 | subsection->clear(); | 310 | subsection->clear(); |
272 | packageList.setSection( section->currentText() ); | 311 | packageList.setSection( section->currentText() ); |
273 | setSubSections(); | 312 | setSubSections(); |
274 | connect( section, SIGNAL( activated(int) ), | 313 | connect( section, SIGNAL( activated(int) ), |
275 | this, SLOT( sectionChanged() ) ); | 314 | this, SLOT( sectionChanged() ) ); |
276 | connect( subsection, SIGNAL(activated(int) ), | 315 | connect( subsection, SIGNAL(activated(int) ), |
277 | this, SLOT( subSectionChanged() ) ); | 316 | this, SLOT( subSectionChanged() ) ); |
278 | displayList(); | 317 | displayList(); |
279 | } | 318 | } |
280 | 319 | ||
281 | void MainWindow::subSectionChanged() | 320 | void MainWindow::subSectionChanged() |
282 | { | 321 | { |
283 | disconnect( section, SIGNAL( activated(int) ), | 322 | disconnect( section, SIGNAL( activated(int) ), |
284 | this, SLOT( sectionChanged() ) ); | 323 | this, SLOT( sectionChanged() ) ); |
285 | disconnect( subsection, SIGNAL(activated(int) ), | 324 | disconnect( subsection, SIGNAL(activated(int) ), |
286 | this, SLOT( subSectionChanged() ) ); | 325 | this, SLOT( subSectionChanged() ) ); |
287 | packageList.setSubSection( subsection->currentText() ); | 326 | packageList.setSubSection( subsection->currentText() ); |
288 | connect( section, SIGNAL( activated(int) ), | 327 | connect( section, SIGNAL( activated(int) ), |
289 | this, SLOT( sectionChanged() ) ); | 328 | this, SLOT( sectionChanged() ) ); |
290 | connect( subsection, SIGNAL(activated(int) ), | 329 | connect( subsection, SIGNAL(activated(int) ), |
291 | this, SLOT( subSectionChanged() ) ); | 330 | this, SLOT( subSectionChanged() ) ); |
292 | displayList(); | 331 | displayList(); |
293 | } | 332 | } |
294 | 333 | ||
@@ -316,64 +355,77 @@ void MainWindow::showSettingsSrv() | |||
316 | updateList(); | 355 | updateList(); |
317 | } | 356 | } |
318 | void MainWindow::showSettingsDst() | 357 | void MainWindow::showSettingsDst() |
319 | { | 358 | { |
320 | if ( settings->showDialog( 2 ) ) | 359 | if ( settings->showDialog( 2 ) ) |
321 | updateList(); | 360 | updateList(); |
322 | } | 361 | } |
323 | 362 | ||
324 | void MainWindow::sectionShow(bool b) | 363 | void MainWindow::sectionShow(bool b) |
325 | { | 364 | { |
326 | if (b) sectionBar->show(); | 365 | if (b) sectionBar->show(); |
327 | else sectionBar->hide(); | 366 | else sectionBar->hide(); |
328 | sectionAction->setOn( b ); | 367 | sectionAction->setOn( b ); |
329 | } | 368 | } |
330 | 369 | ||
331 | void MainWindow::sectionClose() | 370 | void MainWindow::sectionClose() |
332 | { | 371 | { |
333 | sectionAction->setOn( false ); | 372 | sectionAction->setOn( false ); |
334 | } | 373 | } |
335 | 374 | ||
336 | void MainWindow::findShow(bool b) | 375 | void MainWindow::findShow(bool b) |
337 | { | 376 | { |
338 | if (b) findBar->show(); | 377 | if (b) findBar->show(); |
339 | else findBar->hide(); | 378 | else findBar->hide(); |
340 | findAction->setOn( b ); | 379 | findAction->setOn( b ); |
341 | } | 380 | } |
342 | 381 | ||
343 | void MainWindow::findClose() | 382 | void MainWindow::findClose() |
344 | { | 383 | { |
345 | findAction->setOn( false ); | 384 | findAction->setOn( false ); |
346 | } | 385 | } |
347 | 386 | ||
387 | void MainWindow::searchShow(bool b) | ||
388 | { | ||
389 | if (b) searchBar->show(); | ||
390 | else searchBar->hide(); | ||
391 | searchAction->setOn( b ); | ||
392 | } | ||
393 | |||
394 | void MainWindow::searchClose() | ||
395 | { | ||
396 | searchAction->setOn( false ); | ||
397 | } | ||
398 | |||
399 | |||
348 | void MainWindow::destShow(bool b) | 400 | void MainWindow::destShow(bool b) |
349 | { | 401 | { |
350 | if (b) destBar->show(); | 402 | if (b) destBar->show(); |
351 | else destBar->hide(); | 403 | else destBar->hide(); |
352 | destAction->setOn( b ); | 404 | destAction->setOn( b ); |
353 | } | 405 | } |
354 | 406 | ||
355 | void MainWindow::destClose() | 407 | void MainWindow::destClose() |
356 | { | 408 | { |
357 | destAction->setOn( false ); | 409 | destAction->setOn( false ); |
358 | } | 410 | } |
359 | 411 | ||
360 | void MainWindow::rotateUpdateIcon() | 412 | void MainWindow::rotateUpdateIcon() |
361 | { | 413 | { |
362 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 414 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
363 | if ( updateIcon ) | 415 | if ( updateIcon ) |
364 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 416 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
365 | else | 417 | else |
366 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 418 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
367 | updateIcon = !updateIcon; | 419 | updateIcon = !updateIcon; |
368 | } | 420 | } |
369 | 421 | ||
370 | 422 | ||
371 | void MainWindow::setDocument(const QString &fileName) | 423 | void MainWindow::setDocument(const QString &fileName) |
372 | { | 424 | { |
373 | installFile(fileName); | 425 | installFile(fileName); |
374 | // ##### If we looked in the list of files, we could send out accurate | 426 | // ##### If we looked in the list of files, we could send out accurate |
375 | // ##### messages. But we don't bother yet, and just do an "all". | 427 | // ##### messages. But we don't bother yet, and just do an "all". |
376 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 428 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
377 | QString lf = QString::null; | 429 | QString lf = QString::null; |
378 | e << lf; | 430 | e << lf; |
379 | displayList(); | 431 | displayList(); |
@@ -391,32 +443,51 @@ void MainWindow::installFile(const QString &fileName) | |||
391 | e << lf; | 443 | e << lf; |
392 | displayList(); | 444 | displayList(); |
393 | } | 445 | } |
394 | 446 | ||
395 | void MainWindow::makeChannel() | 447 | void MainWindow::makeChannel() |
396 | { | 448 | { |
397 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 449 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
398 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 450 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
399 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 451 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
400 | } | 452 | } |
401 | 453 | ||
402 | 454 | ||
403 | 455 | ||
404 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 456 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
405 | { | 457 | { |
406 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); | 458 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
407 | if ( msg == "installFile(QString)" ) | 459 | if ( msg == "installFile(QString)" ) |
408 | { | 460 | { |
409 | ipkg->installFile( QString(arg) ); | 461 | ipkg->installFile( QString(arg) ); |
410 | }else if( msg == "removeFile(QString)" ) | 462 | }else if( msg == "removeFile(QString)" ) |
411 | { | 463 | { |
412 | ipkg->removeFile( QString(arg) ); | 464 | ipkg->removeFile( QString(arg) ); |
413 | }else if( msg == "createLinks(QString)" ) | 465 | }else if( msg == "createLinks(QString)" ) |
414 | { | 466 | { |
415 | ipkg->createLinks( QString(arg) ); | 467 | ipkg->createLinks( QString(arg) ); |
416 | }else if( msg == "removeLinks(QString)" ) | 468 | }else if( msg == "removeLinks(QString)" ) |
417 | { | 469 | { |
418 | ipkg->removeLinks( QString(arg) ); | 470 | ipkg->removeLinks( QString(arg) ); |
419 | }else{ | 471 | }else{ |
420 | pvDebug(2,"Huh what do ya want") | 472 | pvDebug(2,"Huh what do ya want") |
421 | } | 473 | } |
422 | } | 474 | } |
475 | |||
476 | |||
477 | void MainWindow::createLinks() | ||
478 | { | ||
479 | pvDebug(2,"creating links..."); | ||
480 | ipkg->createLinks( settings->destinationurl->text() ); | ||
481 | } | ||
482 | |||
483 | void MainWindow::removeLinks() | ||
484 | { | ||
485 | pvDebug(2,"removing links..."); | ||
486 | ipkg->removeLinks( settings->destinationurl->text() ); | ||
487 | } | ||
488 | |||
489 | void MainWindow::remotePackageQuery() | ||
490 | { | ||
491 | packageListSearch.query( searchEdit->text() ); | ||
492 | displayList(); | ||
493 | } | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 7615b09..4a73b78 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -1,84 +1,98 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
8 | 8 | ||
9 | #include "packagelist.h" | 9 | #include "packagelist.h" |
10 | #include "packagelistremote.h" | ||
11 | #include "packagelistlocal.h" | ||
10 | #include "pmipkg.h" | 12 | #include "pmipkg.h" |
11 | #include "pksettings.h" | 13 | #include "pksettings.h" |
12 | #include "packagelistview.h" | 14 | #include "packagelistview.h" |
13 | 15 | ||
14 | class QComboBox; | 16 | class QComboBox; |
15 | class QPEToolBar; | 17 | class QPEToolBar; |
16 | class QLineEdit; | 18 | class QLineEdit; |
17 | class PackageListItem; | 19 | class PackageListItem; |
18 | class QCopChannel; | 20 | class QCopChannel; |
19 | class QMessageBox; | 21 | class QMessageBox; |
20 | class QCheckBox; | 22 | class QCheckBox; |
21 | 23 | ||
22 | class MainWindow : public QMainWindow | 24 | class MainWindow : public QMainWindow |
23 | { | 25 | { |
24 | Q_OBJECT | 26 | Q_OBJECT |
25 | 27 | ||
26 | 28 | ||
27 | public: | 29 | public: |
28 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 30 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
29 | ~MainWindow(); | 31 | ~MainWindow(); |
30 | void makeChannel(); | 32 | void makeChannel(); |
31 | 33 | ||
32 | QCopChannel *channel; | 34 | QCopChannel *channel; |
33 | 35 | ||
34 | protected slots: | 36 | protected slots: |
35 | void runIpkg(); | 37 | void runIpkg(); |
36 | void updateList(); | 38 | void updateList(); |
37 | void displayList(); | 39 | void displayList(); |
38 | void subSectionChanged(); | 40 | void subSectionChanged(); |
39 | void sectionChanged(); | 41 | void sectionChanged(); |
40 | void showSettings(); | 42 | void showSettings(); |
41 | void showSettingsSrv(); | 43 | void showSettingsSrv(); |
42 | void showSettingsDst(); | 44 | void showSettingsDst(); |
43 | 45 | ||
44 | public slots: | 46 | public slots: |
45 | void sectionClose(); | 47 | void sectionClose(); |
46 | void sectionShow(bool); | 48 | void sectionShow(bool); |
47 | void findClose(); | 49 | void findClose(); |
48 | void findShow(bool); | 50 | void findShow(bool); |
51 | void searchClose(); | ||
52 | void searchShow(bool); | ||
49 | void destClose(); | 53 | void destClose(); |
50 | void destShow(bool); | 54 | void destShow(bool); |
51 | void filterList(); | 55 | void filterList(); |
56 | void createLinks(); | ||
57 | void removeLinks(); | ||
52 | void receive (const QCString &, const QByteArray &); | 58 | void receive (const QCString &, const QByteArray &); |
53 | void setDocument (const QString &); | 59 | void setDocument (const QString &); |
60 | void remotePackageQuery(); | ||
54 | 61 | ||
55 | private: | 62 | private: |
56 | void makeMenu(); | 63 | void makeMenu(); |
57 | void setSections(); | 64 | void setSections(); |
58 | void setSubSections(); | 65 | void setSubSections(); |
59 | void installFile(const QString &); | 66 | void installFile(const QString &); |
60 | bool updateIcon; | 67 | bool updateIcon; |
61 | 68 | ||
62 | PmIpkg* ipkg; | 69 | PmIpkg* ipkg; |
63 | PackageManagerSettings *settings; | 70 | PackageManagerSettings *settings; |
64 | PackageList packageList; | 71 | PackageListLocal packageList; |
72 | PackageListRemote packageListSearch; | ||
73 | PackageListView *listViewPackages; | ||
74 | // QCheckListItem* rootSearch; | ||
75 | // QCheckListItem* rootLocal; | ||
65 | QAction *runAction; | 76 | QAction *runAction; |
66 | QAction *updateAction; | 77 | QAction *updateAction; |
67 | QAction *findAction; | 78 | QAction *findAction; |
68 | QAction *sectionAction; | ||
69 | QAction *destAction; | ||
70 | PackageListView *listViewPackages; | ||
71 | QPEToolBar *findBar; | 79 | QPEToolBar *findBar; |
72 | QLineEdit *findEdit; | 80 | QLineEdit *findEdit; |
81 | QAction *searchAction; | ||
82 | QAction *searchCommit; | ||
83 | QPEToolBar *searchBar; | ||
84 | QLineEdit *searchEdit; | ||
85 | QAction *sectionAction; | ||
73 | QPEToolBar *sectionBar; | 86 | QPEToolBar *sectionBar; |
74 | QComboBox *section; | 87 | QComboBox *section; |
75 | QComboBox *subsection; | 88 | QComboBox *subsection; |
89 | QAction *destAction; | ||
76 | QPEToolBar *destBar; | 90 | QPEToolBar *destBar; |
77 | QComboBox *destination; | 91 | QComboBox *destination; |
78 | QCheckBox* CheckBoxLink; | 92 | QCheckBox* CheckBoxLink; |
79 | // QMessageBox *wait; | 93 | // QMessageBox *wait; |
80 | private slots: | 94 | private slots: |
81 | void rotateUpdateIcon(); | 95 | void rotateUpdateIcon(); |
82 | }; | 96 | }; |
83 | 97 | ||
84 | #endif | 98 | #endif |
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index c5d3b3d..98f92c8 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro | |||
@@ -1,28 +1,32 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | CONFIG = qt warn_on debug | 4 | CONFIG = qt warn_on debug |
5 | HEADERS = mainwindow.h \ | 5 | HEADERS = mainwindow.h \ |
6 | pksettings.h \ | 6 | pksettings.h \ |
7 | pmipkg.h \ | 7 | pmipkg.h \ |
8 | utils.h \ | 8 | utils.h \ |
9 | packagelistitem.h \ | 9 | packagelistitem.h \ |
10 | packagelistremote.h \ | ||
10 | packagelist.h \ | 11 | packagelist.h \ |
12 | packagelistlocal.h \ | ||
11 | packagelistview.h \ | 13 | packagelistview.h \ |
12 | package.h | 14 | package.h |
13 | SOURCES = main.cpp \ | 15 | SOURCES = main.cpp \ |
14 | mainwindow.cpp \ | 16 | mainwindow.cpp \ |
15 | utils.cpp \ | 17 | utils.cpp \ |
16 | packagelistview.cpp \ | 18 | packagelistview.cpp \ |
19 | packagelistremote.cpp \ | ||
20 | packagelistlocal.cpp \ | ||
17 | pksettings.cpp \ | 21 | pksettings.cpp \ |
18 | pmipkg.cpp \ | 22 | pmipkg.cpp \ |
19 | packagelistitem.cpp \ | 23 | packagelistitem.cpp \ |
20 | packagelist.cpp \ | 24 | packagelist.cpp \ |
21 | package.cpp | 25 | package.cpp |
22 | INCLUDEPATH += $(OPIEDIR)/include | 26 | INCLUDEPATH += $(OPIEDIR)/include |
23 | DEPENDPATH+= $(OPIEDIR)/ioclude | 27 | DEPENDPATH+= $(OPIEDIR)/ioclude |
24 | LIBS += -lqpe | 28 | LIBS += -lqpe |
25 | INTERFACES= runwindow.ui \ | 29 | INTERFACES= runwindow.ui \ |
26 | pksettingsbase.ui | 30 | pksettingsbase.ui |
27 | TARGET = oipkg | 31 | TARGET = oipkg |
28 | 32 | ||
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 0499e19..6bb53a9 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,152 +1,161 @@ | |||
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 | _status = ""; | 32 | _status = ""; |
32 | _dest = settings->getDestinationName(); | 33 | _dest = settings->getDestinationName(); |
33 | _link = settings->createLinks(); | 34 | _link = settings->createLinks(); |
34 | } | 35 | } |
35 | 36 | ||
36 | Package::Package( QStringList pack, PackageManagerSettings *s ) | 37 | Package::Package( QStringList pack, PackageManagerSettings *s ) |
37 | { | 38 | { |
38 | init(s); | 39 | init(s); |
39 | parsePackage( pack ); | 40 | parsePackage( pack ); |
40 | } | 41 | } |
41 | 42 | ||
42 | Package::Package( QString n, PackageManagerSettings *s ) | 43 | Package::Package( QString n, PackageManagerSettings *s ) |
43 | { | 44 | { |
44 | init(s); | 45 | init(s); |
45 | if ( !QFile::exists( n ) ) | 46 | if ( !QFile::exists( n ) ) |
46 | { | 47 | { |
47 | _name = QString( n ); | 48 | _name = QString( n ); |
48 | }else{ | 49 | }else{ |
49 | parseIpkgFile( n ); | 50 | parseIpkgFile( n ); |
50 | _toProcess = true; | 51 | _toProcess = true; |
51 | _packageName = QString( n ); | 52 | _useFileName = true; |
53 | _fileName = QString( n ); | ||
52 | } | 54 | } |
53 | } | 55 | } |
54 | 56 | ||
55 | Package::Package( Package *pi ) | 57 | Package::Package( Package *pi ) |
56 | { | 58 | { |
57 | init(pi->settings); | 59 | init(pi->settings); |
58 | copyValues( pi ); | 60 | copyValues( pi ); |
59 | } | 61 | } |
60 | 62 | ||
61 | 63 | ||
62 | void Package::setValue( QString n, QString t ) | 64 | void Package::setValue( QString n, QString t ) |
63 | { | 65 | { |
64 | if ( n == "Package" ) | 66 | if ( n == "Package" ) |
65 | { | 67 | { |
66 | _name = QString( t ); | 68 | _name = QString( t ); |
67 | }else if ( n == "Installed-Size" ) | 69 | }else if ( n == "Installed-Size" ) |
68 | { | 70 | { |
69 | _size = t; | 71 | _size = t; |
70 | }else if ( n == "Priority") | 72 | }else if ( n == "Priority") |
71 | { | 73 | { |
72 | 74 | ||
73 | }else if ( n == "Section") | 75 | }else if ( n == "Section") |
74 | { | 76 | { |
75 | setSection( t ); | 77 | setSection( t ); |
76 | }else if ( n == "Maintainer") | 78 | }else if ( n == "Maintainer") |
77 | { | 79 | { |
78 | 80 | ||
79 | }else if ( n == "Architecture") | 81 | }else if ( n == "Architecture") |
80 | { | 82 | { |
81 | 83 | ||
82 | }else if ( n == "Version") | 84 | }else if ( n == "Version") |
83 | { | 85 | { |
84 | 86 | ||
85 | }else if ( n == "Pre-Depends") | 87 | }else if ( n == "Pre-Depends") |
86 | { | 88 | { |
87 | 89 | ||
88 | }else if ( n == "Depends") | 90 | }else if ( n == "Depends") |
89 | { | 91 | { |
90 | 92 | ||
91 | }else if ( n == "Filename") | 93 | }else if ( n == "Filename") |
92 | { | 94 | { |
93 | 95 | _fileName = t; | |
94 | }else if ( n == "Size") | 96 | }else if ( n == "Size") |
95 | { | 97 | { |
96 | 98 | ||
97 | }else if ( n == "MD5Sum") | 99 | }else if ( n == "MD5Sum") |
98 | { | 100 | { |
99 | 101 | ||
100 | } | 102 | } |
101 | if ( n == "Description") | 103 | if ( n == "Description") |
102 | { | 104 | { |
103 | setDesc( t ); | 105 | setDesc( t ); |
104 | } | 106 | } |
105 | if ( n == "Status") | 107 | if ( n == "Status") |
106 | { | 108 | { |
107 | if ( installed() ) return; | 109 | if ( installed() ) return; |
108 | _status = t; | 110 | _status = t; |
109 | } | 111 | } |
110 | if ( t == "Essential") | 112 | if ( t == "Essential") |
111 | { | 113 | { |
112 | 114 | ||
113 | } | 115 | } |
114 | }; | 116 | }; |
115 | 117 | ||
116 | QString Package::name() | 118 | QString Package::name() |
117 | { | 119 | { |
118 | return _name; | 120 | return _name; |
119 | } | 121 | } |
120 | 122 | ||
123 | |||
124 | QString Package::installName() | ||
125 | { | ||
126 | if (_useFileName) return _fileName; | ||
127 | else return _name; | ||
128 | } | ||
129 | |||
121 | bool Package::installed() | 130 | bool Package::installed() |
122 | { | 131 | { |
123 | return _status.contains("installed"); | 132 | return _status.contains("installed"); |
124 | } | 133 | } |
125 | 134 | ||
126 | void Package::setDesc( QString s ) | 135 | void Package::setDesc( QString s ) |
127 | { | 136 | { |
128 | _desc = s; | 137 | _desc = s; |
129 | _shortDesc = s.left( s.find("\n") ); | 138 | _shortDesc = s.left( s.find("\n") ); |
130 | } | 139 | } |
131 | 140 | ||
132 | QString Package::desc() | 141 | QString Package::desc() |
133 | { | 142 | { |
134 | return _desc; | 143 | return _desc; |
135 | } | 144 | } |
136 | 145 | ||
137 | QString Package::shortDesc() | 146 | QString Package::shortDesc() |
138 | { | 147 | { |
139 | return _shortDesc; | 148 | return _shortDesc; |
140 | } | 149 | } |
141 | 150 | ||
142 | QString Package::size() | 151 | QString Package::size() |
143 | { | 152 | { |
144 | return _size; | 153 | return _size; |
145 | } | 154 | } |
146 | 155 | ||
147 | QString Package::sizeUnits() | 156 | QString Package::sizeUnits() |
148 | { | 157 | { |
149 | int i = _size.toInt(); | 158 | int i = _size.toInt(); |
150 | int c = 0; | 159 | int c = 0; |
151 | QString ret; | 160 | QString ret; |
152 | QStringList unit; | 161 | QStringList unit; |
@@ -302,37 +311,42 @@ void Package::setOn() | |||
302 | } | 311 | } |
303 | 312 | ||
304 | bool Package::link() | 313 | bool Package::link() |
305 | { | 314 | { |
306 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 315 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
307 | return _link; | 316 | return _link; |
308 | } | 317 | } |
309 | 318 | ||
310 | void Package::setLink(bool b) | 319 | void Package::setLink(bool b) |
311 | { | 320 | { |
312 | _link = b; | 321 | _link = b; |
313 | } | 322 | } |
314 | 323 | ||
315 | void Package::parseIpkgFile( QString file) | 324 | void Package::parseIpkgFile( QString file) |
316 | { | 325 | { |
317 | system("tar xzf "+file+" -C /tmp"); | 326 | system("tar xzf "+file+" -C /tmp"); |
318 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | 327 | system("tar xzf /tmp/control.tar.gz -C /tmp"); |
319 | QFile f("/tmp/control"); | 328 | QFile f("/tmp/control"); |
320 | if ( f.open(IO_ReadOnly) ) | 329 | if ( f.open(IO_ReadOnly) ) |
321 | { | 330 | { |
322 | QTextStream t( &f ); | 331 | QTextStream t( &f ); |
323 | QStringList pack; | 332 | QStringList pack; |
324 | while ( !t.eof() ) | 333 | while ( !t.eof() ) |
325 | { | 334 | { |
326 | pack << t.readLine(); | 335 | pack << t.readLine(); |
327 | } | 336 | } |
328 | f.close(); | 337 | f.close(); |
329 | parsePackage( pack ); | 338 | parsePackage( pack ); |
330 | } | 339 | } |
331 | 340 | ||
332 | } | 341 | } |
333 | 342 | ||
334 | QString Package::getPackageName() | 343 | //QString Package::getPackageName() |
344 | //{ | ||
345 | //if ( _packageName.isEmpty() ) return _name; | ||
346 | //else return _packageName; | ||
347 | //} | ||
348 | |||
349 | void Package::instalFromFile(bool iff) | ||
335 | { | 350 | { |
336 | if ( _packageName.isEmpty() ) return _name; | 351 | _useFileName = iff; |
337 | else return _packageName; | ||
338 | } | 352 | } |
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 49bb3bf..4618c3a 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -1,70 +1,74 @@ | |||
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 | bool installed(); | 28 | bool installed(); |
28 | 29 | ||
29 | void setDesc( QString ); | 30 | void setDesc( QString ); |
30 | QString shortDesc(); | 31 | QString shortDesc(); |
31 | QString desc(); | 32 | QString desc(); |
32 | QString size(); | 33 | QString size(); |
33 | QString sizeUnits(); | 34 | QString sizeUnits(); |
34 | void setSection( QString ); | 35 | void setSection( QString ); |
35 | QString section(); | 36 | QString section(); |
36 | QString subSection(); | 37 | QString subSection(); |
37 | QString details(); | 38 | QString details(); |
38 | bool toProcess(); | 39 | bool toProcess(); |
39 | bool toInstall(); | 40 | bool toInstall(); |
40 | bool toRemove(); | 41 | bool toRemove(); |
41 | void processed(); | 42 | void processed(); |
42 | QString dest(); | 43 | QString dest(); |
43 | void setDest( QString d ); | 44 | void setDest( QString d ); |
44 | void setOn(); | 45 | void setOn(); |
45 | bool link(); | 46 | bool link(); |
46 | void setLink(bool); | 47 | void setLink(bool); |
47 | void parseIpkgFile( QString );; | 48 | void parseIpkgFile( QString ); |
49 | void instalFromFile(bool iff=true); | ||
48 | public slots: | 50 | public slots: |
49 | QString getPackageName(); | 51 | // QString getPackageName(); |
50 | void toggleProcess(); | 52 | void toggleProcess(); |
51 | 53 | ||
52 | private: | 54 | private: |
53 | PackageManagerSettings *settings; | 55 | PackageManagerSettings *settings; |
54 | QString _packageName; | 56 | // QString _packageName; |
55 | QString _name; | 57 | QString _name; |
58 | QString _fileName; | ||
56 | bool _toProcess; | 59 | bool _toProcess; |
57 | bool _link; | 60 | bool _link; |
58 | QString _status; | 61 | QString _status; |
59 | QString _size; | 62 | QString _size; |
60 | QString _section; | 63 | QString _section; |
61 | QString _subsection; | 64 | QString _subsection; |
62 | QString _shortDesc; | 65 | QString _shortDesc; |
63 | QString _desc; | 66 | QString _desc; |
64 | QString _dest; | 67 | QString _dest; |
68 | bool _useFileName; | ||
65 | void parsePackage( QStringList ); | 69 | void parsePackage( QStringList ); |
66 | void init(PackageManagerSettings *); | 70 | void init(PackageManagerSettings *); |
67 | }; | 71 | }; |
68 | 72 | ||
69 | 73 | ||
70 | #endif | 74 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 035ec81..b892b30 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,59 +1,45 @@ | |||
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 | #include <qpe/config.h> | ||
8 | 7 | ||
9 | #include "debug.h" | 8 | #include "debug.h" |
10 | 9 | ||
11 | PackageList::PackageList() | 10 | PackageList::PackageList() |
12 | : packageIter( packageList ) | 11 | : packageIter( packageList ) |
13 | { | 12 | { |
14 | empty=true; | 13 | empty=true; |
15 | { | ||
16 | Config cfg( "oipkg", Config::User ); | ||
17 | cfg.setGroup( "Common" ); | ||
18 | statusDir = cfg.readEntry( "statusDir", "" ); | ||
19 | listsDir = cfg.readEntry( "listsDir", "" ); | ||
20 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) | ||
21 | { | ||
22 | statusDir="/usr/lib/ipkg/"; | ||
23 | listsDir="/usr/lib/ipkg/lists/"; | ||
24 | cfg.writeEntry( "statusDir", statusDir ); | ||
25 | cfg.writeEntry( "listsDir", listsDir ); | ||
26 | } | ||
27 | } | ||
28 | sections << "All"; | 14 | sections << "All"; |
29 | subSections.insert("All", new QStringList() ); | 15 | subSections.insert("All", new QStringList() ); |
30 | QStringList *ss = subSections["All"]; | 16 | QStringList *ss = subSections["All"]; |
31 | *ss << "All"; | 17 | *ss << "All"; |
32 | aktSection = "All"; | 18 | aktSection = "All"; |
33 | aktSubSection = "All"; | 19 | aktSubSection = "All"; |
34 | } | 20 | } |
35 | 21 | ||
36 | PackageList::PackageList( PackageManagerSettings* s) | 22 | PackageList::PackageList( PackageManagerSettings* s) |
37 | : packageIter( packageList ) | 23 | : packageIter( packageList ) |
38 | { | 24 | { |
39 | settings = s; | 25 | settings = s; |
40 | PackageList(); | 26 | PackageList(); |
41 | } | 27 | } |
42 | 28 | ||
43 | PackageList::~PackageList() | 29 | PackageList::~PackageList() |
44 | { | 30 | { |
45 | } | 31 | } |
46 | 32 | ||
47 | /** Inserts a package into the list */ | 33 | /** Inserts a package into the list */ |
48 | void PackageList::insertPackage( Package* pack ) | 34 | void PackageList::insertPackage( Package* pack ) |
49 | { | 35 | { |
50 | Package* p = packageList.find( pack->name() ); | 36 | Package* p = packageList.find( pack->name() ); |
51 | if ( p ) | 37 | if ( p ) |
52 | { | 38 | { |
53 | p->copyValues( pack ); | 39 | p->copyValues( pack ); |
54 | delete pack; | 40 | delete pack; |
55 | pack = p; | 41 | pack = p; |
56 | }else{ | 42 | }else{ |
57 | packageList.insert( pack->name(), pack ); | 43 | packageList.insert( pack->name(), pack ); |
58 | origPackageList.insert( pack->name(), pack ); | 44 | origPackageList.insert( pack->name(), pack ); |
59 | empty=false; | 45 | empty=false; |
@@ -116,126 +102,91 @@ QStringList PackageList::getSubSections() | |||
116 | 102 | ||
117 | void PackageList::setSection( QString sec ) | 103 | void PackageList::setSection( QString sec ) |
118 | { | 104 | { |
119 | aktSection = sec; | 105 | aktSection = sec; |
120 | } | 106 | } |
121 | 107 | ||
122 | void PackageList::setSubSection( QString ssec ) | 108 | void PackageList::setSubSection( QString ssec ) |
123 | { | 109 | { |
124 | aktSubSection = ssec; | 110 | aktSubSection = ssec; |
125 | } | 111 | } |
126 | 112 | ||
127 | void PackageList::updateSections( Package* pack ) | 113 | void PackageList::updateSections( Package* pack ) |
128 | { | 114 | { |
129 | QString s = pack->section(); | 115 | QString s = pack->section(); |
130 | if ( s.isEmpty() || s == "") return; | 116 | if ( s.isEmpty() || s == "") return; |
131 | if ( sections.contains(s) ) return; | 117 | if ( sections.contains(s) ) return; |
132 | sections += s; | 118 | sections += s; |
133 | QString ss = pack->subSection(); | 119 | QString ss = pack->subSection(); |
134 | if ( ss.isEmpty() || ss == "" ) return; | 120 | if ( ss.isEmpty() || ss == "" ) return; |
135 | if ( !subSections[s] ) { | 121 | if ( !subSections[s] ) { |
136 | subSections.insert( s, new QStringList() ); | 122 | subSections.insert( s, new QStringList() ); |
137 | QStringList *subsecs = subSections[s]; | 123 | QStringList *subsecs = subSections[s]; |
138 | *subsecs += "All"; | 124 | *subsecs += "All"; |
139 | } | 125 | } |
140 | QStringList *subsecs = subSections[s]; | 126 | QStringList *subsecs = subSections[s]; |
141 | *subsecs += ss; | 127 | *subsecs += ss; |
142 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 128 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
143 | subsecs = subSections["All"]; | 129 | subsecs = subSections["All"]; |
144 | *subsecs += ss; | 130 | *subsecs += ss; |
145 | } | 131 | } |
146 | 132 | ||
147 | 133 | ||
148 | |||
149 | /** No descriptions */ | ||
150 | void PackageList::parseStatus() | ||
151 | { | ||
152 | QStringList dests = settings->getDestinationUrls(); | ||
153 | QStringList destnames = settings->getDestinationNames(); | ||
154 | QStringList::Iterator name = destnames.begin(); | ||
155 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) | ||
156 | { | ||
157 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); | ||
158 | readFileEntries( *dir+statusDir+"/status", *name ); | ||
159 | ++name; | ||
160 | }; | ||
161 | } | ||
162 | |||
163 | void PackageList::parseList() | ||
164 | { | ||
165 | QStringList srvs = settings->getActiveServers(); | ||
166 | |||
167 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) | ||
168 | { | ||
169 | pvDebug( 2, "List: "+listsDir+"/"+*it); | ||
170 | readFileEntries( listsDir+"/"+*it, "" ); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | void PackageList::readFileEntries( QString filename, QString dest ) | 134 | void PackageList::readFileEntries( QString filename, QString dest ) |
175 | { | 135 | { |
136 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | ||
176 | QStringList packEntry; | 137 | QStringList packEntry; |
177 | QFile f( filename ); | 138 | QFile f( filename ); |
178 | if ( !f.open(IO_ReadOnly) ) return; | 139 | if ( !f.open(IO_ReadOnly) ) return; |
179 | QTextStream *statusStream = new QTextStream( &f ); | 140 | QTextStream *statusStream = new QTextStream( &f ); |
180 | while ( !statusStream ->eof() ) | 141 | while ( !statusStream ->eof() ) |
181 | { | 142 | { |
182 | QString line = statusStream->readLine(); | 143 | QString line = statusStream->readLine(); |
183 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 144 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
184 | { | 145 | { |
185 | //end of package | 146 | //end of package |
186 | if ( ! packEntry.isEmpty() ) | 147 | if ( ! packEntry.isEmpty() ) |
187 | { | 148 | { |
188 | Package *p = new Package( packEntry, settings ); | 149 | Package *p = new Package( packEntry, settings ); |
189 | p->setDest( dest ); | 150 | p->setDest( dest ); |
190 | if ( p ) | 151 | if ( p ) |
191 | { | 152 | { |
192 | insertPackage( p ); | 153 | insertPackage( p ); |
193 | packEntry.clear(); | 154 | packEntry.clear(); |
194 | } | 155 | } |
195 | } | 156 | } |
196 | }else{ | 157 | }else{ |
197 | packEntry << line; | 158 | packEntry << line; |
198 | }; | 159 | }; |
199 | } | 160 | } |
200 | return; | 161 | return; |
201 | } | 162 | } |
202 | 163 | ||
203 | |||
204 | void PackageList::update() | ||
205 | { | ||
206 | pvDebug( 2, "parseStatus"); | ||
207 | parseStatus(); | ||
208 | pvDebug( 2, "parseList"); | ||
209 | parseList(); | ||
210 | pvDebug( 2, "finished parsing"); | ||
211 | } | ||
212 | |||
213 | void PackageList::setSettings( PackageManagerSettings *s ) | 164 | void PackageList::setSettings( PackageManagerSettings *s ) |
214 | { | 165 | { |
215 | settings = s; | 166 | settings = s; |
216 | } | 167 | } |
217 | 168 | ||
218 | Package* PackageList::getByName( QString n ) | 169 | Package* PackageList::getByName( QString n ) |
219 | { | 170 | { |
220 | origPackageList[n]; | 171 | origPackageList[n]; |
221 | } | 172 | } |
222 | 173 | ||
223 | void PackageList::clear() | 174 | void PackageList::clear() |
224 | { | 175 | { |
225 | origPackageList.clear(); | 176 | origPackageList.clear(); |
226 | packageList.clear(); | 177 | packageList.clear(); |
227 | } | 178 | } |
228 | 179 | ||
229 | void PackageList::allPackages() | 180 | void PackageList::allPackages() |
230 | { | 181 | { |
231 | packageList.clear(); | 182 | packageList.clear(); |
232 | QDictIterator<Package> filterIter( origPackageList ); | 183 | QDictIterator<Package> filterIter( origPackageList ); |
233 | filterIter.toFirst(); | 184 | filterIter.toFirst(); |
234 | Package *pack= filterIter.current() ; | 185 | Package *pack= filterIter.current() ; |
235 | while ( pack ) | 186 | while ( pack ) |
236 | { | 187 | { |
237 | packageList.insert( pack->name(), pack ); | 188 | packageList.insert( pack->name(), pack ); |
238 | ++filterIter; | 189 | ++filterIter; |
239 | pack = filterIter.current(); | 190 | pack = filterIter.current(); |
240 | } | 191 | } |
241 | } | 192 | } |
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index 7c326ca..acea3b9 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -1,70 +1,58 @@ | |||
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 | #define HACK | ||
10 | #ifdef HACK | ||
11 | static QString listsDir="/usr/lib/ipkg/"; | ||
12 | static QString statusDir="/usr/lib/ipkg/"; | ||
13 | #endif | ||
14 | |||
15 | class PackageList //:QObject | 9 | class PackageList //:QObject |
16 | { | 10 | { |
17 | // Q_OBJECT | 11 | // Q_OBJECT |
18 | public: | 12 | public: |
19 | //static QString all = QObject::tr("All"); | 13 | //static QString all = QObject::tr("All"); |
20 | 14 | ||
21 | PackageList(); | 15 | PackageList(); |
22 | PackageList( PackageManagerSettings* ); | 16 | PackageList( PackageManagerSettings* ); |
23 | ~PackageList(); | 17 | virtual ~PackageList(); |
24 | void insertPackage( Package* ); | 18 | void insertPackage( Package* ); |
25 | Package* find( QString ); | 19 | Package* find( QString ); |
26 | Package* next(); | 20 | Package* next(); |
27 | Package* first(); | 21 | Package* first(); |
28 | 22 | ||
29 | QStringList getSections(); | 23 | QStringList getSections(); |
30 | QStringList getSubSections(); | 24 | QStringList getSubSections(); |
31 | void setSettings( PackageManagerSettings* ); | 25 | void setSettings( PackageManagerSettings* ); |
32 | void filterPackages( QString ); | 26 | void filterPackages( QString ); |
33 | Package* getByName( QString ); | 27 | Package* getByName( QString ); |
34 | void clear(); | 28 | void clear(); |
35 | void allPackages(); | 29 | void allPackages(); |
36 | 30 | ||
37 | public slots: | 31 | public slots: |
38 | void setSection(QString); | 32 | void setSection(QString); |
39 | void setSubSection(QString); | 33 | void setSubSection(QString); |
40 | void update(); | 34 | // virtual void update(); |
41 | 35 | ||
42 | private: | 36 | protected: |
43 | int currentPackage; | 37 | int currentPackage; |
44 | int packageCount; | 38 | int packageCount; |
45 | 39 | ||
46 | PackageManagerSettings *settings; | 40 | PackageManagerSettings *settings; |
47 | QDict<Package> packageList; | 41 | QDict<Package> packageList; |
48 | QDict<Package> origPackageList; | 42 | QDict<Package> origPackageList; |
49 | QDictIterator<Package> packageIter; | 43 | QDictIterator<Package> packageIter; |
50 | 44 | ||
51 | bool empty; | 45 | bool empty; |
52 | #ifndef HACK | ||
53 | QString listsDir; | ||
54 | QString statusDir; | ||
55 | #endif | ||
56 | QString aktSection; | 46 | QString aktSection; |
57 | QString aktSubSection; | 47 | QString aktSubSection; |
58 | QStringList sections; | 48 | QStringList sections; |
59 | QDict<QStringList> subSections; | 49 | QDict<QStringList> subSections; |
60 | QDict<bool> sectionsDict; | 50 | QDict<bool> sectionsDict; |
61 | 51 | ||
62 | 52 | ||
63 | void updateSections( Package* ); | 53 | void updateSections( Package* ); |
64 | void parseStatus(); | 54 | void readFileEntries( QString file, QString dest="" ); |
65 | void parseList(); | ||
66 | void readFileEntries( QString file, QString dest ); | ||
67 | }; | 55 | }; |
68 | 56 | ||
69 | 57 | ||
70 | #endif | 58 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 0c7c928..b7af9a6 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,47 +1,58 @@ | |||
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_installed=0; | 9 | static QPixmap *pm_installed=0; |
10 | static QPixmap *pm_uninstall=0; | 10 | static QPixmap *pm_uninstall=0; |
11 | static QPixmap *pm_install=0; | 11 | static QPixmap *pm_install=0; |
12 | 12 | ||
13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) | 13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
14 | :QCheckListItem(lv,pi->name(),CheckBox) | 14 | :QCheckListItem(lv,pi->name(),CheckBox) |
15 | { | 15 | { |
16 | init(pi,s); | ||
17 | } | ||
18 | |||
19 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) | ||
20 | :QCheckListItem(lvi,pi->name(),CheckBox) | ||
21 | { | ||
22 | init(pi,s); | ||
23 | } | ||
24 | |||
25 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) | ||
26 | { | ||
16 | package = pi; | 27 | package = pi; |
17 | settings = s; | 28 | settings = s; |
18 | setExpandable( true ); | 29 | setExpandable( true ); |
19 | QCheckListItem *item; | 30 | QCheckListItem *item; |
20 | nameItem = new QCheckListItem( this, "" ); | 31 | nameItem = new QCheckListItem( this, "" ); |
21 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); | 32 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); |
22 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | 33 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); |
23 | destItem = new QCheckListItem( this, "" ); | 34 | destItem = new QCheckListItem( this, "" ); |
24 | linkItem = new QCheckListItem( this, "" ); | 35 | linkItem = new QCheckListItem( this, "" ); |
25 | displayDetails(); | 36 | displayDetails(); |
26 | 37 | ||
27 | if (!pm_uninstalled) | 38 | if (!pm_uninstalled) |
28 | { | 39 | { |
29 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 40 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
30 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 41 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
31 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 42 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
32 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 43 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
33 | } | 44 | } |
34 | } | 45 | } |
35 | 46 | ||
36 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 47 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
37 | int column, int width, int alignment ) | 48 | int column, int width, int alignment ) |
38 | { | 49 | { |
39 | if ( !p ) | 50 | if ( !p ) |
40 | return; | 51 | return; |
41 | 52 | ||
42 | p->fillRect( 0, 0, width, height(), | 53 | p->fillRect( 0, 0, width, height(), |
43 | isSelected()? cg.highlight() : cg.base() ); | 54 | isSelected()? cg.highlight() : cg.base() ); |
44 | 55 | ||
45 | if ( column != 0 ) { | 56 | if ( column != 0 ) { |
46 | // The rest is text | 57 | // The rest is text |
47 | QListViewItem::paintCell( p, cg, column, width, alignment ); | 58 | QListViewItem::paintCell( p, cg, column, width, alignment ); |
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index 54d9f9e..b128f0d 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h | |||
@@ -1,38 +1,40 @@ | |||
1 | #ifndef PK_LISTITEM_H | 1 | #ifndef PK_LISTITEM_H |
2 | #define PK_LISTITEM_H | 2 | #define PK_LISTITEM_H |
3 | 3 | ||
4 | #include "package.h" | 4 | #include "package.h" |
5 | 5 | ||
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qlistview.h> | 7 | #include <qlistview.h> |
8 | #include <qpainter.h> | 8 | #include <qpainter.h> |
9 | #include <qpixmap.h> | 9 | #include <qpixmap.h> |
10 | #include <qdict.h> | 10 | #include <qdict.h> |
11 | 11 | ||
12 | #include "pksettings.h" | 12 | #include "pksettings.h" |
13 | 13 | ||
14 | class PackageListItem | 14 | class PackageListItem |
15 | : public QCheckListItem | 15 | : public QCheckListItem |
16 | { | 16 | { |
17 | public: | 17 | public: |
18 | PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); | ||
18 | PackageListItem(QListView*, Package*, PackageManagerSettings*); | 19 | PackageListItem(QListView*, Package*, PackageManagerSettings*); |
19 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); | 20 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); |
20 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); | 21 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); |
21 | QPixmap statePixmap() const; | 22 | QPixmap statePixmap() const; |
22 | QString key( int, bool ) const; | 23 | QString key( int, bool ) const; |
23 | Package* getPackage() { return package; } ; | 24 | Package* getPackage() { return package; } ; |
24 | QString getName() { return package->name(); } ; | 25 | QString getName() { return package->name(); } ; |
25 | bool isInstalled(){ return package->installed(); }; | 26 | bool isInstalled(){ return package->installed(); }; |
26 | virtual void setOn ( bool ); | 27 | virtual void setOn ( bool ); |
27 | void displayDetails(); | 28 | void displayDetails(); |
28 | 29 | ||
29 | private: | 30 | private: |
31 | void init(Package*, PackageManagerSettings*); | ||
30 | QCheckListItem *nameItem; | 32 | QCheckListItem *nameItem; |
31 | QCheckListItem *destItem; | 33 | QCheckListItem *destItem; |
32 | QCheckListItem *linkItem; | 34 | QCheckListItem *linkItem; |
33 | PackageManagerSettings *settings; | 35 | PackageManagerSettings *settings; |
34 | Package *package; | 36 | Package *package; |
35 | }; | 37 | }; |
36 | 38 | ||
37 | 39 | ||
38 | #endif | 40 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp new file mode 100644 index 0000000..6d931c8 --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistlocal.cpp | |||
@@ -0,0 +1,66 @@ | |||
1 | #include <qpe/config.h> | ||
2 | #include <qfile.h> | ||
3 | #include <qfileinfo.h> | ||
4 | #include <qtextstream.h> | ||
5 | #include <qstringlist.h> | ||
6 | #include "packagelistlocal.h" | ||
7 | |||
8 | PackageListLocal::PackageListLocal() | ||
9 | : PackageList() | ||
10 | { | ||
11 | Config cfg( "oipkg", Config::User ); | ||
12 | cfg.setGroup( "Common" ); | ||
13 | statusDir = cfg.readEntry( "statusDir", "" ); | ||
14 | listsDir = cfg.readEntry( "listsDir", "" ); | ||
15 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) | ||
16 | { | ||
17 | statusDir="/usr/lib/ipkg/"; | ||
18 | listsDir="/usr/lib/ipkg/lists/"; | ||
19 | cfg.writeEntry( "statusDir", statusDir ); | ||
20 | cfg.writeEntry( "listsDir", listsDir ); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | PackageListLocal::PackageListLocal(PackageManagerSettings* s) | ||
25 | : PackageList(s) | ||
26 | { | ||
27 | PackageListLocal(); | ||
28 | } | ||
29 | |||
30 | PackageListLocal::~PackageListLocal() | ||
31 | { | ||
32 | } | ||
33 | |||
34 | void PackageListLocal::parseStatus() | ||
35 | { | ||
36 | QStringList dests = settings->getDestinationUrls(); | ||
37 | QStringList destnames = settings->getDestinationNames(); | ||
38 | QStringList::Iterator name = destnames.begin(); | ||
39 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) | ||
40 | { | ||
41 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); | ||
42 | readFileEntries( *dir+statusDir+"/status", *name ); | ||
43 | ++name; | ||
44 | }; | ||
45 | } | ||
46 | |||
47 | void PackageListLocal::parseList() | ||
48 | { | ||
49 | QStringList srvs = settings->getActiveServers(); | ||
50 | |||
51 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) | ||
52 | { | ||
53 | pvDebug( 2, "List: "+listsDir+"/"+*it); | ||
54 | readFileEntries( listsDir+"/"+*it ); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | |||
59 | void PackageListLocal::update() | ||
60 | { | ||
61 | pvDebug( 2, "parseStatus"); | ||
62 | parseStatus(); | ||
63 | pvDebug( 2, "parseList"); | ||
64 | parseList(); | ||
65 | pvDebug( 2, "finished parsing"); | ||
66 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelistlocal.h b/noncore/unsupported/oipkg/packagelistlocal.h new file mode 100644 index 0000000..887126b --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistlocal.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef PACKAGELISTLOCAL_H | ||
2 | #define PACKAGELISTLOCAL_H | ||
3 | |||
4 | #include "packagelist.h" | ||
5 | |||
6 | |||
7 | #define HACK | ||
8 | #ifdef HACK | ||
9 | static QString listsDir="/usr/lib/ipkg/"; | ||
10 | static QString statusDir="/usr/lib/ipkg/"; | ||
11 | #endif | ||
12 | |||
13 | class PackageListLocal : public PackageList { | ||
14 | public: | ||
15 | PackageListLocal(); | ||
16 | PackageListLocal( PackageManagerSettings* ); | ||
17 | virtual ~PackageListLocal(); | ||
18 | |||
19 | public slots: | ||
20 | void update(); | ||
21 | private: | ||
22 | #ifndef HACK | ||
23 | QString listsDir; | ||
24 | QString statusDir; | ||
25 | #endif | ||
26 | void parseStatus(); | ||
27 | void parseList(); | ||
28 | }; | ||
29 | |||
30 | #endif | ||
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp new file mode 100644 index 0000000..721d4a6 --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistremote.cpp | |||
@@ -0,0 +1,47 @@ | |||
1 | |||
2 | #include "packagelistremote.h" | ||
3 | |||
4 | #include <qstring.h> | ||
5 | #include <stdlib.h> | ||
6 | #include <unistd.h> | ||
7 | |||
8 | PackageListRemote::PackageListRemote(PackageManagerSettings* s) | ||
9 | : PackageList(s) | ||
10 | { | ||
11 | PackageListRemote(); | ||
12 | } | ||
13 | |||
14 | PackageListRemote::PackageListRemote() | ||
15 | : PackageList() | ||
16 | { | ||
17 | } | ||
18 | |||
19 | PackageListRemote::~PackageListRemote() | ||
20 | { | ||
21 | } | ||
22 | |||
23 | void PackageListRemote::query(QString s) | ||
24 | { | ||
25 | int r=0; | ||
26 | QString cmd = "wget"; | ||
27 | QString redirect = "/tmp/oipkg.query"; | ||
28 | |||
29 | // use file for output | ||
30 | cmd += " --output-document="+redirect; | ||
31 | //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= | ||
32 | QString server="http://ipkgfind.handhelds.org/"; | ||
33 | cmd += " \""+server+"/packages.phtml"; | ||
34 | cmd += "?format=pda&searchtype=package§ion="; | ||
35 | cmd += "&query="+s; | ||
36 | cmd += "\""; | ||
37 | |||
38 | pvDebug(2,"search :"+cmd); | ||
39 | r = system(cmd.latin1()); | ||
40 | readFileEntries( redirect ); | ||
41 | |||
42 | } | ||
43 | |||
44 | void PackageListRemote::update() | ||
45 | { | ||
46 | pvDebug(2,"PackageListRemote::update\ndoing nothing "); | ||
47 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelistremote.h b/noncore/unsupported/oipkg/packagelistremote.h new file mode 100644 index 0000000..147da1e --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistremote.h | |||
@@ -0,0 +1,19 @@ | |||
1 | #ifndef PACKAGELISTREMOTE_H | ||
2 | #define PACKAGELISTREMOTE_H | ||
3 | |||
4 | #include "packagelist.h" | ||
5 | #include "package.h" | ||
6 | #include "pksettings.h" | ||
7 | #include "debug.h" | ||
8 | |||
9 | class PackageListRemote : public PackageList { | ||
10 | public: | ||
11 | PackageListRemote(); | ||
12 | PackageListRemote( PackageManagerSettings* s); | ||
13 | virtual ~PackageListRemote(); | ||
14 | void query(QString); | ||
15 | public slots: | ||
16 | void update(); | ||
17 | }; | ||
18 | |||
19 | #endif | ||
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 2915ac6..610a0e1 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -1,49 +1,32 @@ | |||
1 | /*************************************************************************** | ||
2 | packagelistview.cpp - description | ||
3 | ------------------- | ||
4 | begin : Sat Apr 27 2002 | ||
5 | copyright : (C) 2002 by tille | ||
6 | email : tille@handhelds.org | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | |||
18 | #include "packagelistview.h" | 1 | #include "packagelistview.h" |
19 | 2 | ||
20 | #include <qpopupmenu.h> | 3 | #include <qpopupmenu.h> |
21 | #include <qaction.h> | 4 | #include <qaction.h> |
22 | 5 | ||
23 | #include "packagelistitem.h" | 6 | #include "packagelistitem.h" |
24 | #include "pksettings.h" | 7 | #include "pksettings.h" |
25 | 8 | ||
26 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | 9 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) |
27 | : QListView(p,n) | 10 | : QListView(p,n) |
28 | { | 11 | { |
29 | settings = s; | 12 | settings = s; |
30 | popupMenu = new QPopupMenu( this ); | 13 | popupMenu = new QPopupMenu( this ); |
31 | destsMenu = new QPopupMenu( popupMenu ); | 14 | destsMenu = new QPopupMenu( popupMenu ); |
32 | popupTimer = new QTimer( this ); | 15 | popupTimer = new QTimer( this ); |
33 | setSelectionMode(QListView::NoSelection); | 16 | setSelectionMode(QListView::NoSelection); |
34 | addColumn( tr("Package") ); | 17 | addColumn( tr("Package") ); |
35 | setRootIsDecorated( true ); | 18 | setRootIsDecorated( true ); |
36 | 19 | ||
37 | connect( popupTimer, SIGNAL(timeout()), | 20 | connect( popupTimer, SIGNAL(timeout()), |
38 | this, SLOT(showPopup()) ); | 21 | this, SLOT(showPopup()) ); |
39 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), |
40 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 23 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
41 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), |
42 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 25 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
43 | 26 | ||
44 | } | 27 | } |
45 | 28 | ||
46 | //PackageListView::~PackageListView() | 29 | //PackageListView::~PackageListView() |
47 | //{ | 30 | //{ |
48 | //} | 31 | //} |
49 | 32 | ||
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index a3db0d0..d371a34 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h | |||
@@ -19,37 +19,36 @@ | |||
19 | #define PACKAGELISTVIEW_H | 19 | #define PACKAGELISTVIEW_H |
20 | 20 | ||
21 | #include <qlistview.h> | 21 | #include <qlistview.h> |
22 | #include <qaction.h> | 22 | #include <qaction.h> |
23 | #include <qtimer.h> | 23 | #include <qtimer.h> |
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qpopupmenu.h> | 25 | #include <qpopupmenu.h> |
26 | #include "debug.h" | 26 | #include "debug.h" |
27 | 27 | ||
28 | class PackageListItem; | 28 | class PackageListItem; |
29 | class Package; | 29 | class Package; |
30 | class PackageManagerSettings; | 30 | class PackageManagerSettings; |
31 | 31 | ||
32 | class PackageListView : public QListView | 32 | class PackageListView : public QListView |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | 35 | ||
36 | public: | 36 | public: |
37 | PackageListView(QWidget*, const char*, PackageManagerSettings*); | 37 | PackageListView(QWidget*, const char*, PackageManagerSettings*); |
38 | //~PackageListView(); | 38 | //~PackageListView(); |
39 | QTimer *popupTimer; | 39 | QTimer *popupTimer; |
40 | private: | 40 | private: |
41 | PackageManagerSettings *settings; | 41 | PackageManagerSettings *settings; |
42 | Package *activePackage; | 42 | Package *activePackage; |
43 | PackageListItem *activePackageListItem; | 43 | PackageListItem *activePackageListItem; |
44 | QPopupMenu *popupMenu; | 44 | QPopupMenu *popupMenu; |
45 | QPopupMenu *destsMenu; | 45 | QPopupMenu *destsMenu; |
46 | public slots: | 46 | public slots: |
47 | void showPopup(); | 47 | void showPopup(); |
48 | void changePackageDest( int ); | 48 | void changePackageDest( int ); |
49 | void setCurrent( QListViewItem* ); | 49 | void setCurrent( QListViewItem* ); |
50 | void stopTimer( QListViewItem* ); | 50 | void stopTimer( QListViewItem* ); |
51 | /** No descriptions */ | ||
52 | void toggleProcess(); | 51 | void toggleProcess(); |
53 | }; | 52 | }; |
54 | 53 | ||
55 | #endif | 54 | #endif |
diff --git a/noncore/unsupported/oipkg/pkfind.ui b/noncore/unsupported/oipkg/pkfind.ui deleted file mode 100644 index 7a24c00..0000000 --- a/noncore/unsupported/oipkg/pkfind.ui +++ b/dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>Search</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>Form5</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>196</width> | ||
15 | <height>55</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>Search Packages</string> | ||
21 | </property> | ||
22 | <hbox> | ||
23 | <property stdset="1"> | ||
24 | <name>margin</name> | ||
25 | <number>11</number> | ||
26 | </property> | ||
27 | <property stdset="1"> | ||
28 | <name>spacing</name> | ||
29 | <number>6</number> | ||
30 | </property> | ||
31 | <widget> | ||
32 | <class>QLabel</class> | ||
33 | <property stdset="1"> | ||
34 | <name>name</name> | ||
35 | <cstring>TextLabel4</cstring> | ||
36 | </property> | ||
37 | <property stdset="1"> | ||
38 | <name>text</name> | ||
39 | <string>Find:</string> | ||
40 | </property> | ||
41 | </widget> | ||
42 | <widget> | ||
43 | <class>QLineEdit</class> | ||
44 | <property stdset="1"> | ||
45 | <name>name</name> | ||
46 | <cstring>pattern</cstring> | ||
47 | </property> | ||
48 | </widget> | ||
49 | </hbox> | ||
50 | </widget> | ||
51 | </UI> | ||
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 6c8dc2a..7e2ef10 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -105,64 +105,66 @@ void PackageManagerSettings::newDestination() | |||
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | void PackageManagerSettings::editServer(int i) | 108 | void PackageManagerSettings::editServer(int i) |
109 | { | 109 | { |
110 | if ( servername->isEnabled() ) { | 110 | if ( servername->isEnabled() ) { |
111 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 111 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
112 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 112 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
113 | } else { | 113 | } else { |
114 | servername->setEnabled(TRUE); | 114 | servername->setEnabled(TRUE); |
115 | serverurl->setEnabled(TRUE); | 115 | serverurl->setEnabled(TRUE); |
116 | } | 116 | } |
117 | 117 | ||
118 | servername->setText( servers->text(i) ); | 118 | servername->setText( servers->text(i) ); |
119 | serverurl->setText( *serverurlDic[i] ); | 119 | serverurl->setText( *serverurlDic[i] ); |
120 | 120 | ||
121 | editedserver = i; | 121 | editedserver = i; |
122 | 122 | ||
123 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 123 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
124 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 124 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
125 | changed = true; | 125 | changed = true; |
126 | } | 126 | } |
127 | 127 | ||
128 | 128 | ||
129 | void PackageManagerSettings::editDestination(int i) | 129 | void PackageManagerSettings::editDestination(int i) |
130 | { | 130 | { |
131 | if ( destinationname->isEnabled() ) { | 131 | if ( destinationname->isEnabled() ) { |
132 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 132 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
133 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 133 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
134 | } else { | 134 | } else { |
135 | destinationname->setEnabled(TRUE); | 135 | destinationname->setEnabled(TRUE); |
136 | destinationurl->setEnabled(TRUE); | 136 | destinationurl->setEnabled(TRUE); |
137 | createLinksButton->setEnabled(TRUE); | ||
138 | removeLinksButton->setEnabled(TRUE); | ||
137 | } | 139 | } |
138 | 140 | ||
139 | destinationname->setText( destinations->text(i) ); | 141 | destinationname->setText( destinations->text(i) ); |
140 | destinationurl->setText( *destinationurlDic[i] ); | 142 | destinationurl->setText( *destinationurlDic[i] ); |
141 | 143 | ||
142 | editeddestination = i; | 144 | editeddestination = i; |
143 | 145 | ||
144 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 146 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
145 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 147 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
146 | changed = true; | 148 | changed = true; |
147 | } | 149 | } |
148 | 150 | ||
149 | void PackageManagerSettings::removeServer() | 151 | void PackageManagerSettings::removeServer() |
150 | { | 152 | { |
151 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 153 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
152 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 154 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
153 | servername->setText(servers->text(editedserver)); | 155 | servername->setText(servers->text(editedserver)); |
154 | serverurl->setText(*serverurlDic[editedserver]); | 156 | serverurl->setText(*serverurlDic[editedserver]); |
155 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 157 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
156 | servers->removeItem(editedserver); | 158 | servers->removeItem(editedserver); |
157 | activeServers->removeItem(editedserver); | 159 | activeServers->removeItem(editedserver); |
158 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 160 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
159 | servername->setEnabled(FALSE); | 161 | servername->setEnabled(FALSE); |
160 | serverurl->setEnabled(FALSE); | 162 | serverurl->setEnabled(FALSE); |
161 | changed = true; | 163 | changed = true; |
162 | } | 164 | } |
163 | 165 | ||
164 | void PackageManagerSettings::removeDestination() | 166 | void PackageManagerSettings::removeDestination() |
165 | { | 167 | { |
166 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 168 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
167 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 169 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
168 | destinationname->setText(destinations->text(editedserver)); | 170 | destinationname->setText(destinations->text(editedserver)); |
@@ -499,44 +501,64 @@ QStringList PackageManagerSettings::getDestinationUrls() | |||
499 | for (int i=0; i<(int)destinations->count(); i++) | 501 | for (int i=0; i<(int)destinations->count(); i++) |
500 | { | 502 | { |
501 | sl += *destinationurlDic[i]; | 503 | sl += *destinationurlDic[i]; |
502 | } | 504 | } |
503 | return sl; | 505 | return sl; |
504 | } | 506 | } |
505 | 507 | ||
506 | /** returns the destination listed in ipkg.conf */ | 508 | /** returns the destination listed in ipkg.conf */ |
507 | QString PackageManagerSettings::getDestinationUrlByName(QString n) | 509 | QString PackageManagerSettings::getDestinationUrlByName(QString n) |
508 | { | 510 | { |
509 | QStringList sl; | 511 | QStringList sl; |
510 | for (int i=0; i<(int)destinations->count(); i++) | 512 | for (int i=0; i<(int)destinations->count(); i++) |
511 | { | 513 | { |
512 | if ( n == destinations->text(i)) return*destinationurlDic[i]; | 514 | if ( n == destinations->text(i)) return*destinationurlDic[i]; |
513 | } | 515 | } |
514 | return ""; | 516 | return ""; |
515 | } | 517 | } |
516 | 518 | ||
517 | /** returns the destination listed in ipkg.conf */ | 519 | /** returns the destination listed in ipkg.conf */ |
518 | QStringList PackageManagerSettings::getDestinationNames() | 520 | QStringList PackageManagerSettings::getDestinationNames() |
519 | { | 521 | { |
520 | QStringList sl; | 522 | QStringList sl; |
521 | for (int i=0; i<(int)destinations->count(); i++) | 523 | for (int i=0; i<(int)destinations->count(); i++) |
522 | { | 524 | { |
523 | sl += destinations->text(i); | 525 | sl += destinations->text(i); |
524 | } | 526 | } |
525 | return sl; | 527 | return sl; |
526 | } | 528 | } |
527 | 529 | ||
528 | 530 | ||
529 | void PackageManagerSettings::linkEnabled( bool b ) | 531 | void PackageManagerSettings::linkEnabled( bool b ) |
530 | { | 532 | { |
533 | pvDebug(2,"PackageManagerSettings::linkEnabled "+QString(b?"yes":"no")); | ||
531 | activeLinkDestination->setEnabled( b ); | 534 | activeLinkDestination->setEnabled( b ); |
532 | } | 535 | } |
533 | 536 | ||
534 | void PackageManagerSettings::activeServerChanged() | 537 | void PackageManagerSettings::activeServerChanged() |
535 | { | 538 | { |
536 | changed = true; | 539 | changed = true; |
537 | } | 540 | } |
538 | 541 | ||
539 | QComboBox* PackageManagerSettings::getDestCombo() | 542 | QComboBox* PackageManagerSettings::getDestCombo() |
540 | { | 543 | { |
541 | return new QComboBox(activeDestination); | 544 | return new QComboBox(activeDestination); |
542 | } | 545 | } |
546 | |||
547 | void PackageManagerSettings::createLinksToDest() | ||
548 | { | ||
549 | pvDebug(2,"creating links..."); | ||
550 | // emit doCreateLinks( destinationurl->text() ); | ||
551 | //ipkg->createLinks( destinationurl ); | ||
552 | } | ||
553 | |||
554 | void PackageManagerSettings::removeLinksToDest() | ||
555 | { | ||
556 | pvDebug(2,"removing links..."); | ||
557 | // emit doRemoveLinks( destinationurl->text() ); | ||
558 | //ipkg->removeLinks( destinationurl ); | ||
559 | } | ||
560 | |||
561 | //void PackageManagerSettings::setIpkg( PmIpkg* i ) | ||
562 | //{ | ||
563 | //ipkg = i; | ||
564 | //} | ||
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index fbb3b99..1632d4a 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h | |||
@@ -1,68 +1,74 @@ | |||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 1 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 2 | #define PACKAGEMANAGERSETTINGS_H |
3 | 3 | ||
4 | #include "pksettingsbase.h" | 4 | #include "pksettingsbase.h" |
5 | //#include "pmipkg.h" | ||
5 | #include <qintdict.h> | 6 | #include <qintdict.h> |
7 | #include <qobject.h> | ||
6 | 8 | ||
7 | 9 | ||
8 | class PackageManagerSettings : private PackageManagerSettingsBase | 10 | class PackageManagerSettings : public PackageManagerSettingsBase |
9 | { | 11 | { |
10 | // Q_OBJECT | 12 | // Q_OBJECT |
11 | public: | 13 | public: |
12 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 14 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
13 | ~PackageManagerSettings(); | 15 | ~PackageManagerSettings(); |
14 | 16 | ||
15 | bool showDialog( int ) ; | 17 | bool showDialog( int ) ; |
16 | QString getDestinationUrl(); | 18 | QString getDestinationUrl(); |
17 | QString getDestinationName(); | 19 | QString getDestinationName(); |
18 | QString getLinkDestinationName(); | 20 | QString getLinkDestinationName(); |
19 | bool createLinks(); | 21 | bool createLinks(); |
20 | QStringList getServers(); | 22 | QStringList getServers(); |
21 | QStringList getActiveServers(); | 23 | QStringList getActiveServers(); |
22 | QStringList getDestinationUrls(); | 24 | QStringList getDestinationUrls(); |
23 | QStringList getDestinationNames(); | 25 | QStringList getDestinationNames(); |
24 | QString getDestinationUrlByName(QString); | 26 | QString getDestinationUrlByName(QString); |
25 | /** No descriptions */ | ||
26 | QComboBox* getDestCombo(); | 27 | QComboBox* getDestCombo(); |
27 | 28 | // void setIpkg( PmIpkg* ); | |
28 | private: | ||
29 | QIntDict<QString> serverurlDic; | ||
30 | QIntDict<QString> destinationurlDic; | ||
31 | int ipkg_old; | ||
32 | int editedserver; | ||
33 | int editeddestination; | ||
34 | int currentSetting; | ||
35 | int installationSettingsCount; | ||
36 | bool changed; | ||
37 | |||
38 | bool readIpkgConfig(const QString&); | ||
39 | void writeIpkgConfig(const QString&); | ||
40 | void writeSettings(); | ||
41 | void readSettings(); | ||
42 | 29 | ||
43 | public slots: | 30 | public slots: |
44 | void writeInstallationSettings(); | 31 | void writeInstallationSettings(); |
45 | void readInstallationSettings(); | 32 | void readInstallationSettings(); |
46 | void writeCurrentInstallationSetting(); | 33 | void writeCurrentInstallationSetting(); |
47 | void readInstallationSetting(int); | 34 | void readInstallationSetting(int); |
48 | void installationSettingSetName(const QString &); | 35 | void installationSettingSetName(const QString &); |
49 | 36 | void removeLinksToDest(); | |
37 | void createLinksToDest(); | ||
50 | void newServer(); | 38 | void newServer(); |
51 | void editServer(int); | 39 | void editServer(int); |
52 | void removeDestination(); | 40 | void removeDestination(); |
53 | void newDestination(); | 41 | void newDestination(); |
54 | void editDestination(int); | 42 | void editDestination(int); |
55 | void linkEnabled(bool); | 43 | void linkEnabled(bool); |
56 | void removeServer(); | 44 | void removeServer(); |
57 | void serverNameChanged(const QString&); | 45 | void serverNameChanged(const QString&); |
58 | void serverUrlChanged(const QString&); | 46 | void serverUrlChanged(const QString&); |
59 | void destNameChanged(const QString&); | 47 | void destNameChanged(const QString&); |
60 | void destUrlChanged(const QString&); | 48 | void destUrlChanged(const QString&); |
61 | void installationSettingChange(int); | 49 | void installationSettingChange(int); |
62 | void newInstallationSetting(); | 50 | void newInstallationSetting(); |
63 | void removeInstallationSetting(); | 51 | void removeInstallationSetting(); |
64 | void renameInstallationSetting(); | 52 | void renameInstallationSetting(); |
65 | void activeServerChanged(); | 53 | void activeServerChanged(); |
54 | signals: | ||
55 | // void doCreateLinks( QString dest ); | ||
56 | // void doRemoveLinks( QString dest ); | ||
57 | |||
58 | private: | ||
59 | QIntDict<QString> serverurlDic; | ||
60 | QIntDict<QString> destinationurlDic; | ||
61 | int ipkg_old; | ||
62 | int editedserver; | ||
63 | int editeddestination; | ||
64 | int currentSetting; | ||
65 | int installationSettingsCount; | ||
66 | bool changed; | ||
67 | |||
68 | bool readIpkgConfig(const QString&); | ||
69 | void writeIpkgConfig(const QString&); | ||
70 | void writeSettings(); | ||
71 | void readSettings(); | ||
66 | }; | 72 | }; |
67 | 73 | ||
68 | #endif | 74 | #endif |
diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui index fd6d208..5b83248 100644 --- a/noncore/unsupported/oipkg/pksettingsbase.ui +++ b/noncore/unsupported/oipkg/pksettingsbase.ui | |||
@@ -1,46 +1,46 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>PackageManagerSettingsBase</class> | 2 | <class>PackageManagerSettingsBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QDialog</class> | 4 | <class>QDialog</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>Form4</cstring> | 7 | <cstring>Form4</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>345</width> | 14 | <width>337</width> |
15 | <height>454</height> | 15 | <height>454</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Package Servers</string> | 20 | <string>Package Servers</string> |
21 | </property> | 21 | </property> |
22 | <property> | 22 | <property> |
23 | <name>layoutMargin</name> | 23 | <name>layoutMargin</name> |
24 | </property> | 24 | </property> |
25 | <property> | 25 | <property> |
26 | <name>layoutSpacing</name> | 26 | <name>layoutSpacing</name> |
27 | </property> | 27 | </property> |
28 | <grid> | 28 | <grid> |
29 | <property stdset="1"> | 29 | <property stdset="1"> |
30 | <name>margin</name> | 30 | <name>margin</name> |
31 | <number>3</number> | 31 | <number>3</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>3</number> | 35 | <number>3</number> |
36 | </property> | 36 | </property> |
37 | <widget row="0" column="0" > | 37 | <widget row="0" column="0" > |
38 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>TabWidget</cstring> | 41 | <cstring>TabWidget</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>enabled</name> | 44 | <name>enabled</name> |
45 | <bool>true</bool> | 45 | <bool>true</bool> |
46 | </property> | 46 | </property> |
@@ -503,69 +503,69 @@ | |||
503 | <property stdset="1"> | 503 | <property stdset="1"> |
504 | <name>name</name> | 504 | <name>name</name> |
505 | <cstring>newserver</cstring> | 505 | <cstring>newserver</cstring> |
506 | </property> | 506 | </property> |
507 | <property stdset="1"> | 507 | <property stdset="1"> |
508 | <name>enabled</name> | 508 | <name>enabled</name> |
509 | <bool>true</bool> | 509 | <bool>true</bool> |
510 | </property> | 510 | </property> |
511 | <property stdset="1"> | 511 | <property stdset="1"> |
512 | <name>text</name> | 512 | <name>text</name> |
513 | <string>New</string> | 513 | <string>New</string> |
514 | </property> | 514 | </property> |
515 | <property stdset="1"> | 515 | <property stdset="1"> |
516 | <name>autoDefault</name> | 516 | <name>autoDefault</name> |
517 | <bool>false</bool> | 517 | <bool>false</bool> |
518 | </property> | 518 | </property> |
519 | </widget> | 519 | </widget> |
520 | </grid> | 520 | </grid> |
521 | </widget> | 521 | </widget> |
522 | <widget> | 522 | <widget> |
523 | <class>QWidget</class> | 523 | <class>QWidget</class> |
524 | <property stdset="1"> | 524 | <property stdset="1"> |
525 | <name>name</name> | 525 | <name>name</name> |
526 | <cstring>tab</cstring> | 526 | <cstring>tab</cstring> |
527 | </property> | 527 | </property> |
528 | <attribute> | 528 | <attribute> |
529 | <name>title</name> | 529 | <name>title</name> |
530 | <string>Destinations</string> | 530 | <string>Destinations</string> |
531 | </attribute> | 531 | </attribute> |
532 | <grid> | 532 | <grid> |
533 | <property stdset="1"> | 533 | <property stdset="1"> |
534 | <name>margin</name> | 534 | <name>margin</name> |
535 | <number>3</number> | 535 | <number>2</number> |
536 | </property> | 536 | </property> |
537 | <property stdset="1"> | 537 | <property stdset="1"> |
538 | <name>spacing</name> | 538 | <name>spacing</name> |
539 | <number>3</number> | 539 | <number>2</number> |
540 | </property> | 540 | </property> |
541 | <widget row="0" column="0" > | 541 | <widget row="0" column="0" > |
542 | <class>QLayoutWidget</class> | 542 | <class>QLayoutWidget</class> |
543 | <property stdset="1"> | 543 | <property stdset="1"> |
544 | <name>name</name> | 544 | <name>name</name> |
545 | <cstring>Layout3</cstring> | 545 | <cstring>Layout3</cstring> |
546 | </property> | 546 | </property> |
547 | <hbox> | 547 | <hbox> |
548 | <property stdset="1"> | 548 | <property stdset="1"> |
549 | <name>margin</name> | 549 | <name>margin</name> |
550 | <number>0</number> | 550 | <number>0</number> |
551 | </property> | 551 | </property> |
552 | <property stdset="1"> | 552 | <property stdset="1"> |
553 | <name>spacing</name> | 553 | <name>spacing</name> |
554 | <number>6</number> | 554 | <number>6</number> |
555 | </property> | 555 | </property> |
556 | <widget> | 556 | <widget> |
557 | <class>QLabel</class> | 557 | <class>QLabel</class> |
558 | <property stdset="1"> | 558 | <property stdset="1"> |
559 | <name>name</name> | 559 | <name>name</name> |
560 | <cstring>Destinations</cstring> | 560 | <cstring>Destinations</cstring> |
561 | </property> | 561 | </property> |
562 | <property stdset="1"> | 562 | <property stdset="1"> |
563 | <name>text</name> | 563 | <name>text</name> |
564 | <string>Destinations</string> | 564 | <string>Destinations</string> |
565 | </property> | 565 | </property> |
566 | </widget> | 566 | </widget> |
567 | <spacer> | 567 | <spacer> |
568 | <property> | 568 | <property> |
569 | <name>name</name> | 569 | <name>name</name> |
570 | <cstring>Spacer2_2</cstring> | 570 | <cstring>Spacer2_2</cstring> |
571 | </property> | 571 | </property> |
@@ -683,75 +683,204 @@ | |||
683 | <property stdset="1"> | 683 | <property stdset="1"> |
684 | <name>text</name> | 684 | <name>text</name> |
685 | <string>URL:</string> | 685 | <string>URL:</string> |
686 | </property> | 686 | </property> |
687 | </widget> | 687 | </widget> |
688 | <widget row="0" column="1" > | 688 | <widget row="0" column="1" > |
689 | <class>QLineEdit</class> | 689 | <class>QLineEdit</class> |
690 | <property stdset="1"> | 690 | <property stdset="1"> |
691 | <name>name</name> | 691 | <name>name</name> |
692 | <cstring>destinationname</cstring> | 692 | <cstring>destinationname</cstring> |
693 | </property> | 693 | </property> |
694 | </widget> | 694 | </widget> |
695 | <widget row="1" column="1" > | 695 | <widget row="1" column="1" > |
696 | <class>QLineEdit</class> | 696 | <class>QLineEdit</class> |
697 | <property stdset="1"> | 697 | <property stdset="1"> |
698 | <name>name</name> | 698 | <name>name</name> |
699 | <cstring>destinationurl</cstring> | 699 | <cstring>destinationurl</cstring> |
700 | </property> | 700 | </property> |
701 | </widget> | 701 | </widget> |
702 | <widget row="0" column="0" > | 702 | <widget row="0" column="0" > |
703 | <class>QLabel</class> | 703 | <class>QLabel</class> |
704 | <property stdset="1"> | 704 | <property stdset="1"> |
705 | <name>name</name> | 705 | <name>name</name> |
706 | <cstring>TextLabel1_3_2</cstring> | 706 | <cstring>TextLabel1_3_2</cstring> |
707 | </property> | 707 | </property> |
708 | <property stdset="1"> | 708 | <property stdset="1"> |
709 | <name>text</name> | 709 | <name>text</name> |
710 | <string>Name:</string> | 710 | <string>Name:</string> |
711 | </property> | 711 | </property> |
712 | </widget> | 712 | </widget> |
713 | </grid> | 713 | </grid> |
714 | </widget> | 714 | </widget> |
715 | <widget row="4" column="0" > | ||
716 | <class>QLayoutWidget</class> | ||
717 | <property stdset="1"> | ||
718 | <name>name</name> | ||
719 | <cstring>Layout11</cstring> | ||
720 | </property> | ||
721 | <hbox> | ||
722 | <property stdset="1"> | ||
723 | <name>margin</name> | ||
724 | <number>0</number> | ||
725 | </property> | ||
726 | <property stdset="1"> | ||
727 | <name>spacing</name> | ||
728 | <number>6</number> | ||
729 | </property> | ||
730 | <widget> | ||
731 | <class>QPushButton</class> | ||
732 | <property stdset="1"> | ||
733 | <name>name</name> | ||
734 | <cstring>createLinksButton</cstring> | ||
735 | </property> | ||
736 | <property stdset="1"> | ||
737 | <name>enabled</name> | ||
738 | <bool>false</bool> | ||
739 | </property> | ||
740 | <property stdset="1"> | ||
741 | <name>text</name> | ||
742 | <string>link to /</string> | ||
743 | </property> | ||
744 | </widget> | ||
745 | <widget> | ||
746 | <class>QPushButton</class> | ||
747 | <property stdset="1"> | ||
748 | <name>name</name> | ||
749 | <cstring>removeLinksButton</cstring> | ||
750 | </property> | ||
751 | <property stdset="1"> | ||
752 | <name>enabled</name> | ||
753 | <bool>false</bool> | ||
754 | </property> | ||
755 | <property stdset="1"> | ||
756 | <name>text</name> | ||
757 | <string>Remove links</string> | ||
758 | </property> | ||
759 | </widget> | ||
760 | </hbox> | ||
761 | </widget> | ||
762 | <widget row="5" column="0" > | ||
763 | <class>QGroupBox</class> | ||
764 | <property stdset="1"> | ||
765 | <name>name</name> | ||
766 | <cstring>GroupBox1</cstring> | ||
767 | </property> | ||
768 | <property stdset="1"> | ||
769 | <name>title</name> | ||
770 | <string></string> | ||
771 | </property> | ||
772 | <grid> | ||
773 | <property stdset="1"> | ||
774 | <name>margin</name> | ||
775 | <number>11</number> | ||
776 | </property> | ||
777 | <property stdset="1"> | ||
778 | <name>spacing</name> | ||
779 | <number>6</number> | ||
780 | </property> | ||
781 | <widget row="0" column="0" > | ||
782 | <class>QLayoutWidget</class> | ||
783 | <property stdset="1"> | ||
784 | <name>name</name> | ||
785 | <cstring>Layout12</cstring> | ||
786 | </property> | ||
787 | <hbox> | ||
788 | <property stdset="1"> | ||
789 | <name>margin</name> | ||
790 | <number>0</number> | ||
791 | </property> | ||
792 | <property stdset="1"> | ||
793 | <name>spacing</name> | ||
794 | <number>6</number> | ||
795 | </property> | ||
796 | <widget> | ||
797 | <class>QCheckBox</class> | ||
798 | <property stdset="1"> | ||
799 | <name>name</name> | ||
800 | <cstring>CheckBoxvolatile</cstring> | ||
801 | </property> | ||
802 | <property stdset="1"> | ||
803 | <name>enabled</name> | ||
804 | <bool>false</bool> | ||
805 | </property> | ||
806 | <property stdset="1"> | ||
807 | <name>text</name> | ||
808 | <string>volatile</string> | ||
809 | </property> | ||
810 | </widget> | ||
811 | <widget> | ||
812 | <class>QCheckBox</class> | ||
813 | <property stdset="1"> | ||
814 | <name>name</name> | ||
815 | <cstring>removeable</cstring> | ||
816 | </property> | ||
817 | <property stdset="1"> | ||
818 | <name>enabled</name> | ||
819 | <bool>false</bool> | ||
820 | </property> | ||
821 | <property stdset="1"> | ||
822 | <name>text</name> | ||
823 | <string>removeable</string> | ||
824 | </property> | ||
825 | </widget> | ||
826 | </hbox> | ||
827 | </widget> | ||
828 | </grid> | ||
829 | </widget> | ||
715 | </grid> | 830 | </grid> |
716 | </widget> | 831 | </widget> |
717 | </widget> | 832 | </widget> |
718 | </grid> | 833 | </grid> |
719 | </widget> | 834 | </widget> |
720 | <connections> | 835 | <connections> |
721 | <connection> | 836 | <connection> |
722 | <sender>activeServers</sender> | 837 | <sender>activeServers</sender> |
723 | <signal>pressed(QListBoxItem*)</signal> | 838 | <signal>pressed(QListBoxItem*)</signal> |
724 | <receiver>Form4</receiver> | 839 | <receiver>Form4</receiver> |
725 | <slot>activeServerChanged()</slot> | 840 | <slot>activeServerChanged()</slot> |
726 | </connection> | 841 | </connection> |
727 | <connection> | 842 | <connection> |
728 | <sender>activeServers</sender> | 843 | <sender>activeServers</sender> |
729 | <signal>selectionChanged(QListBoxItem*)</signal> | 844 | <signal>selectionChanged(QListBoxItem*)</signal> |
730 | <receiver>Form4</receiver> | 845 | <receiver>Form4</receiver> |
731 | <slot>activeServerChanged()</slot> | 846 | <slot>activeServerChanged()</slot> |
732 | </connection> | 847 | </connection> |
733 | <connection> | 848 | <connection> |
734 | <sender>activeServers</sender> | 849 | <sender>activeServers</sender> |
735 | <signal>pressed(QListBoxItem*)</signal> | 850 | <signal>pressed(QListBoxItem*)</signal> |
736 | <receiver>Form4</receiver> | 851 | <receiver>Form4</receiver> |
737 | <slot>activeServerChanged()</slot> | 852 | <slot>activeServerChanged()</slot> |
738 | </connection> | 853 | </connection> |
854 | <connection> | ||
855 | <sender>createLinksButton</sender> | ||
856 | <signal>clicked()</signal> | ||
857 | <receiver>Form4</receiver> | ||
858 | <slot>createLinksToDest()</slot> | ||
859 | </connection> | ||
860 | <connection> | ||
861 | <sender>removeLinksButton</sender> | ||
862 | <signal>clicked()</signal> | ||
863 | <receiver>Form4</receiver> | ||
864 | <slot>removeLinksToDest()</slot> | ||
865 | </connection> | ||
866 | <slot access="public">activeServerChanged()</slot> | ||
867 | <slot access="public">createLinksToDest()</slot> | ||
739 | <slot access="public">destNameChanged(const QString&)</slot> | 868 | <slot access="public">destNameChanged(const QString&)</slot> |
740 | <slot access="public">destUrlChanged(const QString&)</slot> | 869 | <slot access="public">destUrlChanged(const QString&)</slot> |
741 | <slot access="public">editDestination(int)</slot> | 870 | <slot access="public">editDestination(int)</slot> |
742 | <slot access="public">editServer(int)</slot> | 871 | <slot access="public">editServer(int)</slot> |
743 | <slot access="public">installationSettingChange(int)</slot> | 872 | <slot access="public">installationSettingChange(int)</slot> |
744 | <slot access="public">installationSettingSetName(const QString &)</slot> | 873 | <slot access="public">installationSettingSetName(const QString &)</slot> |
745 | <slot access="public">linkEnabled(bool)</slot> | 874 | <slot access="public">linkEnabled(bool)</slot> |
746 | <slot access="public">newDestination()</slot> | 875 | <slot access="public">newDestination()</slot> |
747 | <slot access="public">newInstallationSetting()</slot> | 876 | <slot access="public">newInstallationSetting()</slot> |
748 | <slot access="public">newServer()</slot> | 877 | <slot access="public">newServer()</slot> |
749 | <slot access="public">activeServerChanged()</slot> | ||
750 | <slot access="public">removeDestination()</slot> | 878 | <slot access="public">removeDestination()</slot> |
751 | <slot access="public">removeInstallationSetting()</slot> | 879 | <slot access="public">removeInstallationSetting()</slot> |
880 | <slot access="public">removeLinksToDest()</slot> | ||
752 | <slot access="public">removeServer()</slot> | 881 | <slot access="public">removeServer()</slot> |
753 | <slot access="public">renameInstallationSetting()</slot> | 882 | <slot access="public">renameInstallationSetting()</slot> |
754 | <slot access="public">serverNameChanged(const QString&)</slot> | 883 | <slot access="public">serverNameChanged(const QString&)</slot> |
755 | <slot access="public">serverUrlChanged(const QString&)</slot> | 884 | <slot access="public">serverUrlChanged(const QString&)</slot> |
756 | </connections> | 885 | </connections> |
757 | </UI> | 886 | </UI> |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 9f6429a..fe200f5 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -181,206 +181,204 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
181 | { | 181 | { |
182 | pvDebug(4, "process dir "+fi->absFilePath()); | 182 | pvDebug(4, "process dir "+fi->absFilePath()); |
183 | processLinkDir( fi->absFilePath(), dest ); | 183 | processLinkDir( fi->absFilePath(), dest ); |
184 | ++it; | 184 | ++it; |
185 | } | 185 | } |
186 | // if (linkOpp==removeLink) | 186 | // if (linkOpp==removeLink) |
187 | // { | 187 | // { |
188 | // pvDebug(2,"remove destDir "+ destFile ); | 188 | // pvDebug(2,"remove destDir "+ destFile ); |
189 | // destDir.remove( destFile, true ); | 189 | // destDir.remove( destFile, true ); |
190 | // } | 190 | // } |
191 | } else | 191 | } else |
192 | if ( fileInfo.isFile() ) | 192 | if ( fileInfo.isFile() ) |
193 | { | 193 | { |
194 | const char *instFile = strdup( (file).ascii() ); | 194 | const char *instFile = strdup( (file).ascii() ); |
195 | const char *linkFile = strdup( (destFile).ascii()); | 195 | const char *linkFile = strdup( (destFile).ascii()); |
196 | if( linkOpp==createLink ) | 196 | if( linkOpp==createLink ) |
197 | { | 197 | { |
198 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 198 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
199 | symlink( instFile, linkFile ); | 199 | symlink( instFile, linkFile ); |
200 | } | 200 | } |
201 | } else { | 201 | } else { |
202 | const char *linkFile = strdup( (destFile).ascii()); | 202 | const char *linkFile = strdup( (destFile).ascii()); |
203 | if( linkOpp==removeLink ) | 203 | if( linkOpp==removeLink ) |
204 | { | 204 | { |
205 | pvDebug(4,"removing "+destFile+" no "+file); | 205 | pvDebug(4,"removing "+destFile+" no "+file); |
206 | QFileInfo toRemoveLink( destFile ); | 206 | QFileInfo toRemoveLink( destFile ); |
207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
208 | unlink( linkFile ); | 208 | unlink( linkFile ); |
209 | } | 209 | } |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | void PmIpkg::commit( PackageList pl ) | 213 | void PmIpkg::loadList( PackageList pl ) |
214 | { | 214 | { |
215 | int sizecount = 0; | ||
216 | to_install.clear(); | ||
217 | to_remove.clear(); | ||
218 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | ||
219 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | ||
220 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 215 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
221 | { | 216 | { |
222 | if ( pack && (pack->name() != "") && pack) | 217 | if ( pack && (pack->name() != "") && pack) |
223 | { | 218 | { |
224 | if ( pack->toInstall() ) | 219 | if ( pack->toInstall() ) |
225 | { | ||
226 | to_install.append( pack ); | 220 | to_install.append( pack ); |
227 | sizecount += pack->size().toInt(); | 221 | if ( pack->toRemove() ) |
228 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; | ||
229 | } | ||
230 | if ( pack->toRemove() ) | ||
231 | { | ||
232 | to_remove.append( pack ); | 222 | to_remove.append( pack ); |
233 | sizecount += 1; | 223 | } |
234 | rem += pack->name()+"<br>"; | 224 | } |
235 | } | 225 | } |
236 | } | ||
237 | } | ||
238 | 226 | ||
227 | void PmIpkg::commit( PackageList pl ) | ||
228 | { | ||
229 | sizecount = 0; | ||
230 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | ||
231 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | ||
232 | loadList(pl); | ||
233 | for (uint i=0; i < to_remove.count(); i++) | ||
234 | sizecount += 1; | ||
235 | for (uint i=0; i < to_install.count(); i++) | ||
236 | sizecount += to_install.at(i)->size().toInt(); | ||
239 | startDialog(); | 237 | startDialog(); |
240 | |||
241 | } | 238 | } |
242 | 239 | ||
243 | void PmIpkg::startDialog() | 240 | void PmIpkg::startDialog() |
244 | { | 241 | { |
245 | installDialog = new QDialog(0,0,true); | 242 | installDialog = new QDialog(0,0,true); |
246 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 243 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); |
247 | RunWindowLayout->setSpacing( 2 ); | 244 | RunWindowLayout->setSpacing( 2 ); |
248 | RunWindowLayout->setMargin( 2 ); | 245 | RunWindowLayout->setMargin( 2 ); |
249 | 246 | ||
250 | PackageListView *plv = new PackageListView(installDialog, "install",settings); | 247 | PackageListView *plv = new PackageListView(installDialog, "install",settings); |
251 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); | 248 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); |
252 | RunWindowLayout->addWidget( plv, 1, 0 ); | 249 | RunWindowLayout->addWidget( plv, 1, 0 ); |
253 | QCheckListItem *toRemoveItem; | 250 | QCheckListItem *toRemoveItem; |
254 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); | 251 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); |
255 | toRemoveItem->setOpen( true ); | 252 | toRemoveItem->setOpen( true ); |
256 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 253 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
257 | { | 254 | { |
258 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); | 255 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); |
259 | } | 256 | } |
260 | QCheckListItem *toInstallItem; | 257 | QCheckListItem *toInstallItem; |
261 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); | 258 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); |
262 | toInstallItem->setOpen( true ); | 259 | toInstallItem->setOpen( true ); |
263 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 260 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
264 | { | 261 | { |
265 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); | 262 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); |
266 | } | 263 | } |
267 | 264 | ||
268 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); | 265 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); |
269 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) ); | 266 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); |
270 | GroupBox1->setTitle( tr( "Ipkg options" ) ); | 267 | GroupBox1->setTitle( tr( "Ipkg options" ) ); |
271 | GroupBox1->setColumnLayout(0, Qt::Vertical ); | 268 | GroupBox1->setColumnLayout(0, Qt::Vertical ); |
272 | GroupBox1->layout()->setSpacing( 0 ); | 269 | GroupBox1->layout()->setSpacing( 0 ); |
273 | GroupBox1->layout()->setMargin( 0 ); | 270 | GroupBox1->layout()->setMargin( 0 ); |
274 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); | 271 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); |
275 | GroupBox1Layout->setAlignment( Qt::AlignTop ); | 272 | GroupBox1Layout->setAlignment( Qt::AlignTop ); |
276 | GroupBox1Layout->setSpacing( 3 ); | 273 | GroupBox1Layout->setSpacing( 3 ); |
277 | GroupBox1Layout->setMargin( 3 ); | 274 | GroupBox1Layout->setMargin( 3 ); |
278 | |||
279 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); | 275 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); |
280 | _force_depends->setText( tr( "-force-depends" ) ); | 276 | _force_depends->setText( tr( "-force-depends" ) ); |
281 | _force_depends->setAutoResize( TRUE ); | 277 | _force_depends->setAutoResize( TRUE ); |
278 | _force_depends->setChecked(true); | ||
282 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); | 279 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); |
283 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); | 280 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); |
284 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | 281 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
285 | _force_reinstall->setAutoResize( TRUE ); | 282 | _force_reinstall->setAutoResize( TRUE ); |
286 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); | 283 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); |
287 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); | 284 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); |
288 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | 285 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
289 | _force_remove->setAutoResize( TRUE ); | 286 | _force_remove->setAutoResize( TRUE ); |
290 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); | 287 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); |
291 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); | 288 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); |
292 | 289 | ||
293 | // connect( doItButton, SIGNAL( clicked() ), | 290 | // connect( doItButton, SIGNAL( clicked() ), |
294 | // this, SLOT( doIt() ) ); | 291 | // this, SLOT( doIt() ) ); |
295 | // connect( installButton, SIGNAL( clicked() ), | 292 | // connect( installButton, SIGNAL( clicked() ), |
296 | // this, SLOT( install() ) ); | 293 | // this, SLOT( install() ) ); |
297 | // connect( removeButton, SIGNAL( clicked() ), | 294 | // connect( removeButton, SIGNAL( clicked() ), |
298 | // this, SLOT( remove() ) ); | 295 | // this, SLOT( remove() ) ); |
299 | // connect( cancelButton, SIGNAL( clicked() ), | 296 | // connect( cancelButton, SIGNAL( clicked() ), |
300 | // installDialog, SLOT( close() ) ); | 297 | // installDialog, SLOT( close() ) ); |
301 | installDialog->showMaximized(); | 298 | installDialog->showMaximized(); |
302 | if ( installDialog->exec() ) doIt(); | 299 | if ( installDialog->exec() ) doIt(); |
303 | installDialog->close(); | 300 | installDialog->close(); |
304 | out(tr("<b>All done.</b>")); | 301 | out(tr("<b>All done.</b>")); |
305 | } | 302 | } |
306 | 303 | ||
307 | void PmIpkg::doIt() | 304 | void PmIpkg::doIt() |
308 | { | 305 | { |
309 | show( true ); | 306 | show( true ); |
310 | remove(); | 307 | remove(); |
311 | install(); | 308 | install(); |
312 | } | 309 | } |
313 | 310 | ||
314 | 311 | ||
315 | void PmIpkg::remove() | 312 | void PmIpkg::remove() |
316 | { | 313 | { |
317 | if ( to_remove.count() == 0 ) return; | 314 | if ( to_remove.count() == 0 ) return; |
318 | 315 | ||
319 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); | 316 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); |
320 | 317 | ||
321 | QStringList *fileList; | 318 | QStringList *fileList; |
322 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 319 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
323 | { | 320 | { |
324 | if ( it->link() )fileList = getList( it->name(), it->dest() ); | 321 | if ( it->link() )fileList = getList( it->name(), it->dest() ); |
325 | if ( runIpkg("remove " + it->name()) == 0) | 322 | if ( runIpkg("remove " + it->name()) == 0) |
326 | { | 323 | { |
327 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); | 324 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); |
328 | linkOpp = removeLink; | 325 | linkOpp = removeLink; |
329 | if ( it->link() ) | 326 | if ( it->link() ) |
330 | { | 327 | { |
331 | out( "<br>removing links<br>" ); | 328 | out( "<br>removing links<br>" ); |
332 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 329 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
333 | processFileList( fileList, it->dest() ); | 330 | processFileList( fileList, it->dest() ); |
334 | } | 331 | } |
335 | it->processed(); | 332 | it->processed(); |
333 | |||
336 | out("<br><hr>"); | 334 | out("<br><hr>"); |
337 | }else{ | 335 | }else{ |
338 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); | 336 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); |
339 | } | 337 | } |
340 | pvDebug(2,"delete File List"); | 338 | pvDebug(2,"delete File List"); |
341 | if ( it->link() )delete fileList; | 339 | if ( it->link() )delete fileList; |
342 | } | 340 | } |
343 | out("<br>"); | 341 | out("<br>"); |
344 | } | 342 | } |
345 | 343 | ||
346 | 344 | ||
347 | void PmIpkg::install() | 345 | void PmIpkg::install() |
348 | { | 346 | { |
349 | if ( to_install.count() == 0 ) return; | 347 | if ( to_install.count() == 0 ) return; |
350 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 348 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
351 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 349 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
352 | { | 350 | { |
353 | 351 | ||
354 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) | 352 | if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) |
355 | { | 353 | { |
356 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 354 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
357 | linkOpp = createLink; | 355 | linkOpp = createLink; |
358 | if ( it->link() ) | 356 | if ( it->link() ) |
359 | { | 357 | { |
360 | out( "<br>creating links<br>" ); | 358 | out( "<br>creating links<br>" ); |
361 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 359 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
362 | makeLinks( it ); | 360 | makeLinks( it ); |
363 | } | 361 | } |
364 | it->processed(); | 362 | it->processed(); |
365 | out("<br><hr>"); | 363 | out("<br><hr>"); |
366 | }else{ | 364 | }else{ |
367 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); | 365 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); |
368 | } | 366 | } |
369 | } | 367 | } |
370 | out("<br>"); | 368 | out("<br>"); |
371 | } | 369 | } |
372 | 370 | ||
373 | void PmIpkg::createLinks( const QString &dest ) | 371 | void PmIpkg::createLinks( const QString &dest ) |
374 | { | 372 | { |
375 | pvDebug(2,"PmIpkg::createLinks "+dest); | 373 | pvDebug(2,"PmIpkg::createLinks "+dest); |
376 | linkOpp=createLink; | 374 | linkOpp=createLink; |
377 | QString url = settings->getDestinationUrlByName( dest ); | 375 | QString url = settings->getDestinationUrlByName( dest ); |
378 | url = url==""?dest:url; | 376 | url = url==""?dest:url; |
379 | processLinkDir( "/", url ); | 377 | processLinkDir( "/", url ); |
380 | } | 378 | } |
381 | 379 | ||
382 | void PmIpkg::removeLinks( const QString &dest ) | 380 | void PmIpkg::removeLinks( const QString &dest ) |
383 | { | 381 | { |
384 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 382 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
385 | linkOpp=removeLink; | 383 | linkOpp=removeLink; |
386 | QString url = settings->getDestinationUrlByName( dest ); | 384 | QString url = settings->getDestinationUrlByName( dest ); |
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 0625032..2b89023 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,64 +1,66 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
11 | #include "packagelist.h" | 11 | #include "packagelist.h" |
12 | #include "debug.h" | 12 | #include "debug.h" |
13 | 13 | ||
14 | #define createLink 0 | 14 | #define createLink 0 |
15 | #define removeLink 1 | 15 | #define removeLink 1 |
16 | 16 | ||
17 | class Package; | 17 | class Package; |
18 | class PmIpkg : public QObject | 18 | class PmIpkg : public QObject |
19 | { | 19 | { |
20 | Q_OBJECT | 20 | Q_OBJECT |
21 | public: | 21 | public: |
22 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 22 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
23 | ~PmIpkg(); | 23 | ~PmIpkg(); |
24 | 24 | ||
25 | int linkOpp; | 25 | int linkOpp; |
26 | void loadList( PackageList ); | ||
26 | void commit( PackageList ); | 27 | void commit( PackageList ); |
27 | void update(); | 28 | void update(); |
28 | // PackageList* getPackageList(); | 29 | // PackageList* getPackageList(); |
29 | void showButtons(bool b=true); | 30 | void showButtons(bool b=true); |
30 | void show( bool buttons=true ); | 31 | void show( bool buttons=true ); |
31 | 32 | ||
32 | public slots: | 33 | public slots: |
33 | void doIt(); | 34 | void doIt(); |
34 | void install(); | 35 | void install(); |
35 | void remove(); | 36 | void remove(); |
36 | void installFile(const QString &fileName, const QString &dest=""); | 37 | void installFile(const QString &fileName, const QString &dest=""); |
37 | void removeFile(const QString &fileName, const QString &dest=""); | 38 | void removeFile(const QString &fileName, const QString &dest=""); |
38 | void createLinks( const QString &dest ); | 39 | void createLinks( const QString &dest ); |
39 | void removeLinks( const QString &dest ); | 40 | void removeLinks( const QString &dest ); |
40 | 41 | ||
41 | private: | 42 | private: |
43 | int sizecount; | ||
42 | PackageManagerSettings* settings; | 44 | PackageManagerSettings* settings; |
43 | RunWindow *runwindow; | 45 | RunWindow *runwindow; |
44 | QDialog *installDialog; | 46 | QDialog *installDialog; |
45 | QList<Package> to_remove; | 47 | QList<Package> to_remove; |
46 | QList<Package> to_install; | 48 | QList<Package> to_install; |
47 | bool runwindowopen; | 49 | bool runwindowopen; |
48 | QString fileNameToInstall; | 50 | QString fileNameToInstall; |
49 | QCheckBox *_force_reinstall; | 51 | QCheckBox *_force_reinstall; |
50 | QCheckBox *_force_remove; | 52 | QCheckBox *_force_remove; |
51 | QCheckBox *_force_depends; | 53 | QCheckBox *_force_depends; |
52 | void startDialog(); | 54 | void startDialog(); |
53 | void makeLinks(Package*); | 55 | void makeLinks(Package*); |
54 | void linkPackage( QString, QString ); | 56 | void linkPackage( QString, QString ); |
55 | void processLinkDir( QString , QString ); | 57 | void processLinkDir( QString , QString ); |
56 | int runIpkg(const QString& args, const QString& dest="" ); | 58 | int runIpkg(const QString& args, const QString& dest="" ); |
57 | void out( QString ); | 59 | void out( QString ); |
58 | QStringList* getList( QString, QString ); | 60 | QStringList* getList( QString, QString ); |
59 | void processFileList( QStringList*, QString ); | 61 | void processFileList( QStringList*, QString ); |
60 | 62 | ||
61 | 63 | ||
62 | }; | 64 | }; |
63 | 65 | ||
64 | #endif | 66 | #endif |
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index e2072f1..3be4334 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -32,32 +32,36 @@ public slots: | |||
32 | void editServer(int); | 32 | void editServer(int); |
33 | void removeDestination(); | 33 | void removeDestination(); |
34 | void newDestination(); | 34 | void newDestination(); |
35 | void editDestination(int); | 35 | void editDestination(int); |
36 | void linkEnabled(bool); | 36 | void linkEnabled(bool); |
37 | void removeServer(); | 37 | void removeServer(); |
38 | void serverNameChanged(const QString&); | 38 | void serverNameChanged(const QString&); |
39 | void serverUrlChanged(const QString&); | 39 | void serverUrlChanged(const QString&); |
40 | void destNameChanged(const QString&); | 40 | void destNameChanged(const QString&); |
41 | void destUrlChanged(const QString&); | 41 | void destUrlChanged(const QString&); |
42 | void installationSettingChange(int); | 42 | void installationSettingChange(int); |
43 | void newInstallationSetting(); | 43 | void newInstallationSetting(); |
44 | void removeInstallationSetting(); | 44 | void removeInstallationSetting(); |
45 | void renameInstallationSetting(); | 45 | void renameInstallationSetting(); |
46 | 46 | ||
47 | private: | 47 | private: |
48 | QIntDict<QString> serverurlDic; | 48 | QIntDict<QString> serverurlDic; |
49 | QIntDict<QString> destinationurlDic; | 49 | QIntDict<QString> destinationurlDic; |
50 | int ipkg_old; | 50 | int ipkg_old; |
51 | int editedserver; | 51 | int editedserver; |
52 | int editeddestination; | 52 | int editeddestination; |
53 | int currentSetting; | 53 | int currentSetting; |
54 | int installationSettingsCount; | 54 | int installationSettingsCount; |
55 | bool changed; | 55 | bool changed; |
56 | 56 | ||
57 | bool readIpkgConfig(const QString&); | 57 | bool readIpkgConfig(const QString&); |
58 | void writeIpkgConfig(const QString&); | 58 | void writeIpkgConfig(const QString&); |
59 | void writeSettings(); | 59 | void writeSettings(); |
60 | void readSettings(); | 60 | void readSettings(); |
61 | }; | 61 | }; |
62 | 62 | ||
63 | #endif | 63 | #endif |
64 | /** No descriptions */ | ||
65 | void createLinks(); | ||
66 | /** No descriptions */ | ||
67 | void removeLinks(); | ||