author | tille <tille> | 2002-04-29 22:45:35 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-29 22:45:35 (UTC) |
commit | b794af4c50efffe239c94e5a015e90565ff991c3 (patch) (unidiff) | |
tree | dd4e20851eba8052a07396b57388f9216f85ae7f | |
parent | e4d0908ec054b71a9b97e9c35efbd5a697d0b58d (diff) | |
download | opie-b794af4c50efffe239c94e5a015e90565ff991c3.zip opie-b794af4c50efffe239c94e5a015e90565ff991c3.tar.gz opie-b794af4c50efffe239c94e5a015e90565ff991c3.tar.bz2 |
removes links again
21 files changed, 545 insertions, 387 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 3fc84e5..790766c 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,11 +1,9 @@ | |||
1 | * setDocument function | ||
2 | * Settings Class | 1 | * Settings Class |
3 | * tr() ;) | 2 | * tr() ;) |
4 | * Dialog to display ipkg output live | 3 | * Dialog to display ipkg output live |
5 | * parse "to install" and "to remove" from status | 4 | * parse "to install" and "to remove" from status |
6 | * install local file | 5 | * install local file dialog |
7 | * qcop | 6 | * qcop |
8 | * error handling | 7 | * error handling |
9 | * manage links | 8 | * manage links |
10 | * dependency checking | 9 | * dependency checking |
11 | * ipkg options in runwindow \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/debug.h b/noncore/unsupported/oipkg/debug.h index 973d96c..206dea5 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 | ||
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 \t\t(Level: %i)\n",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 c95f482..ca1e5e8 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,258 +1,277 @@ | |||
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/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
11 | #include <qaction.h> | 12 | #include <qaction.h> |
12 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
13 | #include <qpopupmenu.h> | 14 | #include <qpopupmenu.h> |
14 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
15 | #include <qstring.h> | 16 | #include <qstring.h> |
16 | #include <qlabel.h> | 17 | #include <qlabel.h> |
17 | #include <qfile.h> | 18 | #include <qfile.h> |
18 | #include <qlistview.h> | 19 | #include <qlistview.h> |
19 | #include <qtextview.h> | 20 | #include <qtextview.h> |
21 | #include <qcheckbox.h> | ||
20 | #include <qlineedit.h> | 22 | #include <qlineedit.h> |
21 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
22 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
23 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
24 | #include <qlayout.h> | 26 | #include <qlayout.h> |
25 | 27 | ||
26 | #include "pksettingsbase.h" | 28 | #include "pksettingsbase.h" |
29 | #include "utils.h" | ||
27 | #include "packagelistitem.h" | 30 | #include "packagelistitem.h" |
28 | 31 | ||
29 | 32 | ||
30 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 33 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
31 | QMainWindow( parent, name, f ) | 34 | QMainWindow( parent, name, f ) |
32 | { | 35 | { |
36 | setCaption( tr("Package Manager") ); | ||
33 | settings = new PackageManagerSettings(this,0,TRUE); | 37 | settings = new PackageManagerSettings(this,0,TRUE); |
34 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 38 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
35 | ipkg = new PmIpkg( settings, this ); | ||
36 | |||
37 | setCentralWidget( listViewPackages ); | 39 | setCentralWidget( listViewPackages ); |
38 | setCaption( tr("Package Manager") ); | ||
39 | 40 | ||
40 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | 41 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); |
41 | wait = new QMessageBox(this); | 42 | //wait = new QMessageBox(this); |
42 | wait->setText(tr("Please wait")); | 43 | // wait->setText(tr("Please wait")); |
43 | |||
44 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | ||
45 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
46 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | ||
47 | |||
48 | makeMenu(); | ||
49 | |||
50 | connect( section, SIGNAL( activated(int) ), | ||
51 | this, SLOT( sectionChanged() ) ); | ||
52 | connect( subsection, SIGNAL(activated(int) ), | ||
53 | this, SLOT( subSectionChanged() ) ); | ||
54 | |||
55 | ipkg = new PmIpkg( settings, this ); | 44 | ipkg = new PmIpkg( settings, this ); |
56 | packageList.setSettings( settings ); | 45 | packageList.setSettings( settings ); |
57 | getList(); | 46 | packageList.update(); |
58 | setSections(); | 47 | makeMenu(); |
59 | setSubSections(); | 48 | makeChannel(); |
49 | //opie is hardcoded default ;) | ||
50 | for (int i=0;i<section->count();i++) | ||
51 | if (section->text(i)=="opie") | ||
52 | section->setCurrentItem(i); | ||
53 | sectionChanged(); | ||
54 | |||
55 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | ||
56 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | ||
60 | displayList(); | 57 | displayList(); |
61 | } | 58 | } |
62 | 59 | ||
63 | void MainWindow::makeMenu() | 60 | void MainWindow::makeMenu() |
64 | { | 61 | { |
65 | 62 | ||
66 | QPEToolBar *toolBar = new QPEToolBar( this ); | 63 | QPEToolBar *toolBar = new QPEToolBar( this ); |
67 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 64 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
68 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 65 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
69 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 66 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
70 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 67 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
71 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 68 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
72 | 69 | ||
73 | setToolBarsMovable( false ); | 70 | setToolBarsMovable( false ); |
74 | toolBar->setHorizontalStretchable( true ); | 71 | toolBar->setHorizontalStretchable( true ); |
75 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 72 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
76 | menuBar->insertItem( tr( "View" ), viewMenu ); | 73 | menuBar->insertItem( tr( "View" ), viewMenu ); |
77 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 74 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
78 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 75 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
79 | 76 | ||
80 | QLabel *spacer = new QLabel( "", toolBar ); | 77 | QLabel *spacer = new QLabel( "", toolBar ); |
81 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 78 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
82 | toolBar->setStretchableWidget( spacer ); | 79 | toolBar->setStretchableWidget( spacer ); |
83 | 80 | ||
84 | 81 | ||
85 | runAction = new QAction( tr( "Apply" ), | 82 | runAction = new QAction( tr( "Apply" ), |
86 | Resource::loadPixmap( "oipkg/install" ), | 83 | Resource::loadPixmap( "oipkg/install" ), |
87 | QString::null, 0, this, 0 ); | 84 | QString::null, 0, this, 0 ); |
88 | connect( runAction, SIGNAL( activated() ), | 85 | connect( runAction, SIGNAL( activated() ), |
89 | this, SLOT( runIpkg() ) ); | 86 | this, SLOT( runIpkg() ) ); |
90 | runAction->addTo( toolBar ); | 87 | runAction->addTo( toolBar ); |
91 | runAction->addTo( srvMenu ); | 88 | runAction->addTo( srvMenu ); |
92 | 89 | ||
93 | srvMenu->insertSeparator (); | 90 | srvMenu->insertSeparator (); |
94 | 91 | ||
95 | updateAction = new QAction( tr( "Update" ), | 92 | updateAction = new QAction( tr( "Update" ), |
96 | Resource::loadIconSet( "oipkg/update" ), | 93 | Resource::loadIconSet( "oipkg/update" ), |
97 | QString::null, 0, this, 0 ); | 94 | QString::null, 0, this, 0 ); |
98 | connect( updateAction, SIGNAL( activated() ), | 95 | connect( updateAction, SIGNAL( activated() ), |
99 | this , SLOT( updateList() ) ); | 96 | this , SLOT( updateList() ) ); |
100 | updateAction->addTo( toolBar ); | 97 | updateAction->addTo( toolBar ); |
101 | updateAction->addTo( srvMenu ); | 98 | updateAction->addTo( srvMenu ); |
102 | 99 | ||
103 | // would we use for find | 100 | // could we use for find |
104 | // detailsAction = new QAction( tr( "Details" ), | 101 | // detailsAction = new QAction( tr( "Find" ), |
105 | // Resource::loadIconSet( "find" ), | 102 | // Resource::loadIconSet( "find" ), |
106 | // QString::null, 0, this, 0 ); | 103 | // QString::null, 0, this, 0 ); |
107 | // connect( detailsAction, SIGNAL( activated() ), | 104 | // connect( detailsAction, SIGNAL( activated() ), |
108 | // this , SLOT( showDetails() ) ); | 105 | // this , SLOT( showFind() ) ); |
109 | // detailsAction->addTo( toolBar ); | 106 | // detailsAction->addTo( toolBar ); |
110 | // detailsAction->addTo( srvMenu ); | ||
111 | 107 | ||
112 | QAction *cfgact; | 108 | QAction *cfgact; |
113 | 109 | ||
114 | cfgact = new QAction( tr( "Setups" ), | 110 | cfgact = new QAction( tr( "Setups" ), |
115 | // Resource::loadIconSet( "" ), | ||
116 | QString::null, 0, this, 0 ); | 111 | QString::null, 0, this, 0 ); |
117 | connect( cfgact, SIGNAL( activated() ), | 112 | connect( cfgact, SIGNAL( activated() ), |
118 | SLOT( showSettings() ) ); | 113 | SLOT( showSettings() ) ); |
119 | cfgact->addTo( cfgMenu ); | 114 | cfgact->addTo( cfgMenu ); |
120 | 115 | ||
121 | cfgact = new QAction( tr( "Servers" ), | 116 | cfgact = new QAction( tr( "Servers" ), |
122 | // Resource::loadIconSet( "" ), | ||
123 | QString::null, 0, this, 0 ); | 117 | QString::null, 0, this, 0 ); |
124 | connect( cfgact, SIGNAL( activated() ), | 118 | connect( cfgact, SIGNAL( activated() ), |
125 | SLOT( showSettingsSrv() ) ); | 119 | SLOT( showSettingsSrv() ) ); |
126 | cfgact->addTo( cfgMenu ); | 120 | cfgact->addTo( cfgMenu ); |
127 | cfgact = new QAction( tr( "Destinations" ), | 121 | cfgact = new QAction( tr( "Destinations" ), |
128 | //Resource::loadIconSet( "" ), | ||
129 | QString::null, 0, this, 0 ); | 122 | QString::null, 0, this, 0 ); |
130 | connect( cfgact, SIGNAL( activated() ), | 123 | connect( cfgact, SIGNAL( activated() ), |
131 | SLOT( showSettingsDst() ) ); | 124 | SLOT( showSettingsDst() ) ); |
132 | cfgact->addTo( cfgMenu ); | 125 | cfgact->addTo( cfgMenu ); |
133 | 126 | ||
134 | QAction *a; | 127 | QAction *a; |
135 | 128 | ||
136 | sectionBar = new QPEToolBar( this ); | 129 | sectionBar = new QPEToolBar( this ); |
137 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 130 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
138 | sectionBar->setHorizontalStretchable( true ); | 131 | sectionBar->setHorizontalStretchable( true ); |
139 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 132 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
140 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 133 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
141 | sectionBar->setStretchableWidget( label ); | 134 | sectionBar->setStretchableWidget( label ); |
142 | section = new QComboBox( false, sectionBar ); | 135 | section = new QComboBox( false, sectionBar ); |
143 | // section->setBackgroundMode( PaletteBackground ); | ||
144 | label = new QLabel( " / ", sectionBar ); | 136 | label = new QLabel( " / ", sectionBar ); |
145 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 137 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
146 | subsection = new QComboBox( false, sectionBar ); | 138 | subsection = new QComboBox( false, sectionBar ); |
147 | |||
148 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 139 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
149 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 140 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
150 | a->addTo( sectionBar ); | 141 | a->addTo( sectionBar ); |
151 | 142 | ||
143 | setSections(); | ||
144 | setSubSections(); | ||
145 | |||
152 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 146 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
153 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 147 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
154 | sectionAction->setToggleAction( true ); | 148 | sectionAction->setToggleAction( true ); |
155 | sectionAction->setOn( true ); | ||
156 | sectionAction->addTo( viewMenu ); | 149 | sectionAction->addTo( viewMenu ); |
157 | 150 | ||
158 | findBar = new QPEToolBar(this); | 151 | findBar = new QPEToolBar(this); |
159 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); | 152 | addToolBar( findBar, "Search", QMainWindow::Top, TRUE ); |
160 | label = new QLabel( tr("Filter: "), findBar ); | 153 | label = new QLabel( tr("Filter: "), findBar ); |
161 | label->setBackgroundColor( findBar->backgroundColor() ); | 154 | label->setBackgroundColor( findBar->backgroundColor() ); |
162 | findBar->setHorizontalStretchable( TRUE ); | 155 | findBar->setHorizontalStretchable( TRUE ); |
163 | findEdit = new QLineEdit( findBar, "findEdit" ); | 156 | findEdit = new QLineEdit( findBar, "findEdit" ); |
164 | findBar->setStretchableWidget( findEdit ); | 157 | findBar->setStretchableWidget( findEdit ); |
165 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 158 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
166 | this, SLOT( displayList() ) ); | 159 | this, SLOT( displayList() ) ); |
167 | 160 | ||
161 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | ||
162 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | ||
163 | a->addTo( findBar ); | ||
168 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 164 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
169 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 165 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
170 | a->addTo( findBar ); | 166 | a->addTo( findBar ); |
171 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); | 167 | findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 ); |
172 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 168 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
173 | findAction->setToggleAction( true ); | 169 | findAction->setToggleAction( true ); |
174 | findAction->setOn( true ); | ||
175 | findAction->addTo( viewMenu ); | 170 | findAction->addTo( viewMenu ); |
176 | 171 | ||
177 | #ifdef NEW | 172 | destBar = new QPEToolBar(this); |
173 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | ||
174 | label = new QLabel( tr("Destination: "), destBar ); | ||
175 | label->setBackgroundColor( destBar->backgroundColor() ); | ||
176 | destBar->setHorizontalStretchable( TRUE ); | ||
177 | destination = new QComboBox( false, destBar ); | ||
178 | destination->insertStringList( settings->getDestinationNames() ); | ||
179 | setComboName(destination,settings->getDestinationName()); | ||
180 | // connect( destination, SIGNAL(activated(int)), | ||
181 | // SLOT(activeDestinationChange(int)) ); | ||
182 | spacer = new QLabel( " ", destBar ); | ||
183 | spacer->setBackgroundColor( destBar->backgroundColor() ); | ||
184 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | ||
185 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | ||
186 | CheckBoxLink->setChecked( settings->createLinks() ); | ||
187 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), | ||
188 | // settings, SLOT(linkEnabled(bool)) ); | ||
189 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | ||
190 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | ||
191 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | ||
192 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | ||
193 | a->addTo( destBar ); | ||
194 | destBar->setStretchableWidget( CheckBoxLink ); | ||
195 | destAction->setToggleAction( true ); | ||
196 | // destAction->addTo( viewMenu ); | ||
197 | |||
198 | // configure the menus | ||
178 | Config cfg( "oipkg", Config::User ); | 199 | Config cfg( "oipkg", Config::User ); |
179 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 200 | cfg.setGroup( "gui" ); |
180 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | 201 | |
181 | findShow(bool b) | 202 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
182 | sectionShow(bool b) | 203 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
183 | #endif | 204 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
184 | } | 205 | } |
185 | 206 | ||
186 | MainWindow::~MainWindow() | 207 | MainWindow::~MainWindow() |
187 | { | 208 | { |
209 | Config cfg( "oipkg", Config::User ); | ||
210 | cfg.setGroup( "gui" ); | ||
211 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | ||
212 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | ||
213 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | ||
214 | |||
188 | } | 215 | } |
189 | 216 | ||
190 | void MainWindow::runIpkg() | 217 | void MainWindow::runIpkg() |
191 | { | 218 | { |
219 | packageList.allPackages(); | ||
192 | ipkg->commit( packageList ); | 220 | ipkg->commit( packageList ); |
193 | // ##### If we looked in the list of files, we could send out accurate | 221 | // ##### If we looked in the list of files, we could send out accurate |
194 | // ##### messages. But we don't bother yet, and just do an "all". | 222 | // ##### messages. But we don't bother yet, and just do an "all". |
195 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 223 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
196 | QString lf = QString::null; | 224 | QString lf = QString::null; |
197 | e << lf; | 225 | e << lf; |
198 | displayList(); | 226 | displayList(); |
199 | } | 227 | } |
200 | 228 | ||
201 | void MainWindow::updateList() | 229 | void MainWindow::updateList() |
202 | { | 230 | { |
203 | wait->show(); | 231 | //wait->show(); |
204 | QTimer *t = new QTimer( this ); | 232 | QTimer *t = new QTimer( this ); |
205 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 233 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
206 | t->start( 0, false ); | 234 | t->start( 0, false ); |
207 | packageList.clear(); | 235 | packageList.clear(); |
208 | ipkg->update(); | 236 | ipkg->update(); |
209 | getList(); | ||
210 | t->stop(); | ||
211 | wait->hide(); | ||
212 | |||
213 | } | ||
214 | |||
215 | void MainWindow::getList() | ||
216 | { | ||
217 | wait->show(); | ||
218 | packageList.update(); | 237 | packageList.update(); |
219 | displayList(); | 238 | t->stop(); |
220 | wait->hide(); | 239 | // wait->hide(); |
221 | } | 240 | } |
222 | 241 | ||
223 | void MainWindow::filterList() | 242 | void MainWindow::filterList() |
224 | { | 243 | { |
225 | wait->show(); | 244 | //wait->show(); |
226 | QString f = ""; | 245 | QString f = ""; |
227 | if ( findAction->isOn() ) f = findEdit->text(); | 246 | if ( findAction->isOn() ) f = findEdit->text(); |
228 | packageList.filterPackages( f ); | 247 | packageList.filterPackages( f ); |
229 | wait->hide(); | 248 | //wait->hide(); |
230 | } | 249 | } |
231 | 250 | ||
232 | void MainWindow::displayList() | 251 | void MainWindow::displayList() |
233 | { | 252 | { |
234 | wait->hide(); | 253 | //wait->hide(); |
235 | filterList(); | 254 | filterList(); |
236 | listViewPackages->clear(); | 255 | listViewPackages->clear(); |
237 | Package *pack = packageList.first(); | 256 | Package *pack = packageList.first(); |
238 | while( pack ) | 257 | while( pack ) |
239 | { | 258 | { |
240 | if ( pack && (pack->name() != "") ) | 259 | if ( pack && (pack->name() != "") ) |
241 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); | 260 | listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) ); |
242 | pack = packageList.next(); | 261 | pack = packageList.next(); |
243 | } | 262 | } |
244 | } | 263 | } |
245 | 264 | ||
246 | void MainWindow::sectionChanged() | 265 | void MainWindow::sectionChanged() |
247 | { | 266 | { |
248 | disconnect( section, SIGNAL( activated(int) ), | 267 | disconnect( section, SIGNAL( activated(int) ), |
249 | this, SLOT( sectionChanged() ) ); | 268 | this, SLOT( sectionChanged() ) ); |
250 | disconnect( subsection, SIGNAL(activated(int) ), | 269 | disconnect( subsection, SIGNAL(activated(int) ), |
251 | this, SLOT( subSectionChanged() ) ); | 270 | this, SLOT( subSectionChanged() ) ); |
252 | subsection->clear(); | 271 | subsection->clear(); |
253 | packageList.setSection( section->currentText() ); | 272 | packageList.setSection( section->currentText() ); |
254 | setSubSections(); | 273 | setSubSections(); |
255 | connect( section, SIGNAL( activated(int) ), | 274 | connect( section, SIGNAL( activated(int) ), |
256 | this, SLOT( sectionChanged() ) ); | 275 | this, SLOT( sectionChanged() ) ); |
257 | connect( subsection, SIGNAL(activated(int) ), | 276 | connect( subsection, SIGNAL(activated(int) ), |
258 | this, SLOT( subSectionChanged() ) ); | 277 | this, SLOT( subSectionChanged() ) ); |
@@ -305,67 +324,99 @@ void MainWindow::showSettingsDst() | |||
305 | void MainWindow::sectionShow(bool b) | 324 | void MainWindow::sectionShow(bool b) |
306 | { | 325 | { |
307 | if (b) sectionBar->show(); | 326 | if (b) sectionBar->show(); |
308 | else sectionBar->hide(); | 327 | else sectionBar->hide(); |
309 | sectionAction->setOn( b ); | 328 | sectionAction->setOn( b ); |
310 | } | 329 | } |
311 | 330 | ||
312 | void MainWindow::sectionClose() | 331 | void MainWindow::sectionClose() |
313 | { | 332 | { |
314 | sectionAction->setOn( false ); | 333 | sectionAction->setOn( false ); |
315 | } | 334 | } |
316 | 335 | ||
317 | void MainWindow::findShow(bool b) | 336 | void MainWindow::findShow(bool b) |
318 | { | 337 | { |
319 | if (b) findBar->show(); | 338 | if (b) findBar->show(); |
320 | else findBar->hide(); | 339 | else findBar->hide(); |
321 | findAction->setOn( b ); | 340 | findAction->setOn( b ); |
322 | } | 341 | } |
323 | 342 | ||
324 | void MainWindow::findClose() | 343 | void MainWindow::findClose() |
325 | { | 344 | { |
326 | findAction->setOn( false ); | 345 | findAction->setOn( false ); |
327 | } | 346 | } |
328 | 347 | ||
348 | void MainWindow::destShow(bool b) | ||
349 | { | ||
350 | if (b) destBar->show(); | ||
351 | else destBar->hide(); | ||
352 | destAction->setOn( b ); | ||
353 | } | ||
354 | |||
355 | void MainWindow::destClose() | ||
356 | { | ||
357 | destAction->setOn( false ); | ||
358 | } | ||
359 | |||
329 | void MainWindow::rotateUpdateIcon() | 360 | void MainWindow::rotateUpdateIcon() |
330 | { | 361 | { |
331 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 362 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
332 | if ( updateIcon ) | 363 | if ( updateIcon ) |
333 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 364 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
334 | else | 365 | else |
335 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 366 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
336 | updateIcon = !updateIcon; | 367 | updateIcon = !updateIcon; |
337 | } | 368 | } |
338 | 369 | ||
339 | 370 | ||
340 | void MainWindow::setDocument(const QString &fileName) | 371 | void MainWindow::setDocument(const QString &fileName) |
341 | { | 372 | { |
342 | installFile(fileName); | 373 | installFile(fileName); |
343 | // ##### If we looked in the list of files, we could send out accurate | 374 | // ##### If we looked in the list of files, we could send out accurate |
344 | // ##### messages. But we don't bother yet, and just do an "all". | 375 | // ##### messages. But we don't bother yet, and just do an "all". |
345 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 376 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
346 | QString lf = QString::null; | 377 | QString lf = QString::null; |
347 | e << lf; | 378 | e << lf; |
348 | displayList(); | 379 | displayList(); |
349 | } | 380 | } |
350 | 381 | ||
351 | void MainWindow::installFile(const QString &fileName) | 382 | void MainWindow::installFile(const QString &fileName) |
352 | { | 383 | { |
353 | pvDebug(3, "MainWindow::installFile "+fileName); | 384 | pvDebug(3, "MainWindow::installFile "+fileName); |
354 | if ( !QFile::exists( fileName ) ) return; | 385 | if ( !QFile::exists( fileName ) ) return; |
355 | ipkg->installFile( fileName ); | 386 | ipkg->installFile( fileName ); |
356 | // ##### If we looked in the list of files, we could send out accurate | 387 | // ##### If we looked in the list of files, we could send out accurate |
357 | // ##### messages. But we don't bother yet, and just do an "all". | 388 | // ##### messages. But we don't bother yet, and just do an "all". |
358 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 389 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
359 | QString lf = QString::null; | 390 | QString lf = QString::null; |
360 | e << lf; | 391 | e << lf; |
361 | displayList(); | 392 | displayList(); |
362 | } | 393 | } |
363 | 394 | ||
395 | void MainWindow::makeChannel() | ||
396 | { | ||
397 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | ||
398 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | ||
399 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | ||
400 | } | ||
401 | |||
402 | |||
403 | |||
364 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 404 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
365 | { | 405 | { |
366 | pvDebug(3, "QCop "+msg); | 406 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
367 | if ( msg == "installFile(QString)" ) | 407 | if ( msg == "installFile(QString)" ) |
368 | { | 408 | { |
369 | installFile( QString(arg) ); | 409 | ipkg->installFile( QString(arg) ); |
370 | } | 410 | }else if( msg == "removeFile(QString)" ) |
371 | } \ No newline at end of file | 411 | { |
412 | ipkg->removeFile( QString(arg) ); | ||
413 | }else if( msg == "createLinks(QString)" ) | ||
414 | { | ||
415 | ipkg->createLinks( QString(arg) ); | ||
416 | }else if( msg == "removeLinks(QString)" ) | ||
417 | { | ||
418 | ipkg->removeLinks( QString(arg) ); | ||
419 | }else{ | ||
420 | pvDebug(2,"Huh what do ya want") | ||
421 | } | ||
422 | } | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index a713d00..7615b09 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -1,78 +1,84 @@ | |||
1 | #ifndef MAINWINDOW_H | 1 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 2 | #define MAINWINDOW_H |
3 | 3 | ||
4 | #include <qmainwindow.h> | 4 | #include <qmainwindow.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qtimer.h> | 6 | #include <qtimer.h> |
7 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
8 | 8 | ||
9 | #include "packagelist.h" | 9 | #include "packagelist.h" |
10 | #include "pmipkg.h" | 10 | #include "pmipkg.h" |
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | #include "packagelistview.h" | 12 | #include "packagelistview.h" |
13 | 13 | ||
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QPEToolBar; | 15 | class QPEToolBar; |
16 | class QLineEdit; | 16 | class QLineEdit; |
17 | class PackageListItem; | 17 | class PackageListItem; |
18 | class QCopChannel; | 18 | class QCopChannel; |
19 | class QMessageBox; | 19 | class QMessageBox; |
20 | class QCheckBox; | ||
20 | 21 | ||
21 | class MainWindow : public QMainWindow | 22 | class MainWindow : public QMainWindow |
22 | { | 23 | { |
23 | Q_OBJECT | 24 | Q_OBJECT |
24 | 25 | ||
25 | 26 | ||
26 | public: | 27 | public: |
27 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 28 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
28 | ~MainWindow(); | 29 | ~MainWindow(); |
30 | void makeChannel(); | ||
29 | 31 | ||
30 | QCopChannel *channel; | 32 | QCopChannel *channel; |
31 | 33 | ||
32 | protected slots: | 34 | protected slots: |
33 | void runIpkg(); | 35 | void runIpkg(); |
34 | void getList(); | ||
35 | void updateList(); | 36 | void updateList(); |
36 | void displayList(); | 37 | void displayList(); |
37 | void subSectionChanged(); | 38 | void subSectionChanged(); |
38 | void sectionChanged(); | 39 | void sectionChanged(); |
39 | void showSettings(); | 40 | void showSettings(); |
40 | void showSettingsSrv(); | 41 | void showSettingsSrv(); |
41 | void showSettingsDst(); | 42 | void showSettingsDst(); |
42 | 43 | ||
43 | public slots: | 44 | public slots: |
44 | void sectionClose(); | 45 | void sectionClose(); |
45 | void sectionShow(bool); | 46 | void sectionShow(bool); |
46 | void findClose(); | 47 | void findClose(); |
47 | void findShow(bool); | 48 | void findShow(bool); |
49 | void destClose(); | ||
50 | void destShow(bool); | ||
48 | void filterList(); | 51 | void filterList(); |
49 | void receive (const QCString &, const QByteArray &); | 52 | void receive (const QCString &, const QByteArray &); |
50 | void setDocument (const QString &); | 53 | void setDocument (const QString &); |
51 | 54 | ||
52 | private: | 55 | private: |
53 | void makeMenu(); | 56 | void makeMenu(); |
54 | void setSections(); | 57 | void setSections(); |
55 | void setSubSections(); | 58 | void setSubSections(); |
56 | void installFile(const QString &); | 59 | void installFile(const QString &); |
57 | bool updateIcon; | 60 | bool updateIcon; |
58 | 61 | ||
59 | PmIpkg* ipkg; | 62 | PmIpkg* ipkg; |
60 | PackageManagerSettings *settings; | 63 | PackageManagerSettings *settings; |
61 | PackageList packageList; | 64 | PackageList packageList; |
62 | QAction *runAction; | 65 | QAction *runAction; |
63 | QAction *detailsAction; | ||
64 | QAction *updateAction; | 66 | QAction *updateAction; |
65 | QAction *findAction; | 67 | QAction *findAction; |
66 | QAction *sectionAction; | 68 | QAction *sectionAction; |
69 | QAction *destAction; | ||
67 | PackageListView *listViewPackages; | 70 | PackageListView *listViewPackages; |
68 | QPEToolBar *findBar; | 71 | QPEToolBar *findBar; |
69 | QLineEdit *findEdit; | 72 | QLineEdit *findEdit; |
70 | QPEToolBar *sectionBar; | 73 | QPEToolBar *sectionBar; |
71 | QComboBox *section; | 74 | QComboBox *section; |
72 | QComboBox *subsection; | 75 | QComboBox *subsection; |
73 | QMessageBox *wait; | 76 | QPEToolBar *destBar; |
77 | QComboBox *destination; | ||
78 | QCheckBox* CheckBoxLink; | ||
79 | // QMessageBox *wait; | ||
74 | private slots: | 80 | private slots: |
75 | void rotateUpdateIcon(); | 81 | void rotateUpdateIcon(); |
76 | }; | 82 | }; |
77 | 83 | ||
78 | #endif | 84 | #endif |
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 1f7a70d..c5d3b3d 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro | |||
@@ -1,26 +1,28 @@ | |||
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 | packagelistitem.h \ | 9 | packagelistitem.h \ |
9 | packagelist.h \ | 10 | packagelist.h \ |
10 | packagelistview.h \ | 11 | packagelistview.h \ |
11 | package.h | 12 | package.h |
12 | SOURCES = main.cpp \ | 13 | SOURCES = main.cpp \ |
13 | mainwindow.cpp \ | 14 | mainwindow.cpp \ |
15 | utils.cpp \ | ||
14 | packagelistview.cpp \ | 16 | packagelistview.cpp \ |
15 | pksettings.cpp \ | 17 | pksettings.cpp \ |
16 | pmipkg.cpp \ | 18 | pmipkg.cpp \ |
17 | packagelistitem.cpp \ | 19 | packagelistitem.cpp \ |
18 | packagelist.cpp \ | 20 | packagelist.cpp \ |
19 | package.cpp | 21 | package.cpp |
20 | INCLUDEPATH += $(OPIEDIR)/include | 22 | INCLUDEPATH += $(OPIEDIR)/include |
21 | DEPENDPATH+= $(OPIEDIR)/ioclude | 23 | DEPENDPATH+= $(OPIEDIR)/ioclude |
22 | LIBS += -lqpe | 24 | LIBS += -lqpe |
23 | INTERFACES= runwindow.ui \ | 25 | INTERFACES= runwindow.ui \ |
24 | pksettingsbase.ui | 26 | pksettingsbase.ui |
25 | TARGET = oipkg | 27 | TARGET = oipkg |
26 | 28 | ||
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 5f0e5fa..0499e19 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,38 +1,38 @@ | |||
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 | _status = ""; | 31 | _status = ""; |
32 | _dest = settings->getDestinationName(); | 32 | _dest = settings->getDestinationName(); |
33 | _link = settings->createLinks(); | 33 | _link = settings->createLinks(); |
34 | } | 34 | } |
35 | 35 | ||
36 | Package::Package( QStringList pack, PackageManagerSettings *s ) | 36 | Package::Package( QStringList pack, PackageManagerSettings *s ) |
37 | { | 37 | { |
38 | init(s); | 38 | init(s); |
@@ -40,140 +40,147 @@ Package::Package( QStringList pack, PackageManagerSettings *s ) | |||
40 | } | 40 | } |
41 | 41 | ||
42 | Package::Package( QString n, PackageManagerSettings *s ) | 42 | Package::Package( QString n, PackageManagerSettings *s ) |
43 | { | 43 | { |
44 | init(s); | 44 | init(s); |
45 | if ( !QFile::exists( n ) ) | 45 | if ( !QFile::exists( n ) ) |
46 | { | 46 | { |
47 | _name = QString( n ); | 47 | _name = QString( n ); |
48 | }else{ | 48 | }else{ |
49 | parseIpkgFile( n ); | 49 | parseIpkgFile( n ); |
50 | _toProcess = true; | 50 | _toProcess = true; |
51 | _packageName = QString( n ); | 51 | _packageName = QString( n ); |
52 | } | 52 | } |
53 | } | 53 | } |
54 | 54 | ||
55 | Package::Package( Package *pi ) | 55 | Package::Package( Package *pi ) |
56 | { | 56 | { |
57 | init(pi->settings); | 57 | init(pi->settings); |
58 | copyValues( pi ); | 58 | copyValues( pi ); |
59 | } | 59 | } |
60 | 60 | ||
61 | 61 | ||
62 | void Package::setValue( QString n, QString t ) | 62 | void Package::setValue( QString n, QString t ) |
63 | { | 63 | { |
64 | if ( n == "Status" && installed() ) return; | ||
65 | if ( n == "Package" ) | 64 | if ( n == "Package" ) |
66 | { | 65 | { |
67 | _name = QString( t ); | 66 | _name = QString( t ); |
68 | } | 67 | }else if ( n == "Installed-Size" ) |
69 | if ( n == "Installed-Size" ) | 68 | { |
70 | { | ||
71 | _size = t; | 69 | _size = t; |
72 | } | 70 | }else if ( n == "Priority") |
73 | if ( n == "Priority") | 71 | { |
74 | { | ||
75 | 72 | ||
76 | } | 73 | }else if ( n == "Section") |
77 | if ( n == "Section") | 74 | { |
78 | { | ||
79 | setSection( t ); | 75 | setSection( t ); |
80 | } | 76 | }else if ( n == "Maintainer") |
81 | if ( n == "Maintainer") | 77 | { |
82 | { | ||
83 | 78 | ||
84 | } | 79 | }else if ( n == "Architecture") |
85 | if ( n == "Architecture") | 80 | { |
86 | { | ||
87 | 81 | ||
88 | } | 82 | }else if ( n == "Version") |
89 | if ( n == "Version") | 83 | { |
90 | { | ||
91 | 84 | ||
92 | } | 85 | }else if ( n == "Pre-Depends") |
93 | if ( n == "Pre-Depends") | 86 | { |
94 | { | ||
95 | 87 | ||
96 | } | 88 | }else if ( n == "Depends") |
97 | if ( n == "Depends") | 89 | { |
98 | { | ||
99 | 90 | ||
100 | }else if ( n == "Filename") | 91 | }else if ( n == "Filename") |
101 | { | 92 | { |
102 | 93 | ||
103 | }else if ( n == "Size") | 94 | }else if ( n == "Size") |
104 | { | 95 | { |
105 | 96 | ||
106 | }else if ( n == "MD5Sum") | 97 | }else if ( n == "MD5Sum") |
107 | { | 98 | { |
108 | 99 | ||
109 | } | 100 | } |
110 | if ( n == "Description") | 101 | if ( n == "Description") |
111 | { | 102 | { |
112 | setDesc( t ); | 103 | setDesc( t ); |
113 | } | 104 | } |
114 | if ( n == "Status") | 105 | if ( n == "Status") |
115 | { | 106 | { |
116 | if ( installed() ) return; | 107 | if ( installed() ) return; |
117 | _status = t; | 108 | _status = t; |
118 | } | 109 | } |
119 | if ( t == "Essential") | 110 | if ( t == "Essential") |
120 | { | 111 | { |
121 | 112 | ||
122 | } | 113 | } |
123 | }; | 114 | }; |
124 | 115 | ||
125 | QString Package::name() | 116 | QString Package::name() |
126 | { | 117 | { |
127 | return _name; | 118 | return _name; |
128 | } | 119 | } |
129 | 120 | ||
130 | bool Package::installed() | 121 | bool Package::installed() |
131 | { | 122 | { |
132 | return _status.contains("installed"); | 123 | return _status.contains("installed"); |
133 | } | 124 | } |
134 | 125 | ||
135 | void Package::setDesc( QString s ) | 126 | void Package::setDesc( QString s ) |
136 | { | 127 | { |
137 | _desc = s; | 128 | _desc = s; |
138 | _shortDesc = s.left( s.find("\n") ); | 129 | _shortDesc = s.left( s.find("\n") ); |
139 | } | 130 | } |
140 | 131 | ||
141 | QString Package::desc() | 132 | QString Package::desc() |
142 | { | 133 | { |
143 | return _desc; | 134 | return _desc; |
144 | } | 135 | } |
145 | 136 | ||
146 | QString Package::shortDesc() | 137 | QString Package::shortDesc() |
147 | { | 138 | { |
148 | return _shortDesc; | 139 | return _shortDesc; |
149 | } | 140 | } |
150 | 141 | ||
151 | QString Package::size() | 142 | QString Package::size() |
152 | { | 143 | { |
153 | return _size; | 144 | return _size; |
154 | } | 145 | } |
155 | 146 | ||
147 | QString Package::sizeUnits() | ||
148 | { | ||
149 | int i = _size.toInt(); | ||
150 | int c = 0; | ||
151 | QString ret; | ||
152 | QStringList unit; | ||
153 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) | ||
154 | while (i > 1) | ||
155 | { | ||
156 | ret=QString::number(i)+" "+unit[c]; | ||
157 | c++; | ||
158 | i /= 1024; | ||
159 | } | ||
160 | return ret; | ||
161 | } | ||
162 | |||
156 | bool Package::toProcess() | 163 | bool Package::toProcess() |
157 | { | 164 | { |
158 | return _toProcess; | 165 | return _toProcess; |
159 | } | 166 | } |
160 | 167 | ||
161 | bool Package::toRemove() | 168 | bool Package::toRemove() |
162 | { | 169 | { |
163 | if ( _toProcess && installed() ) return true; | 170 | if ( _toProcess && installed() ) return true; |
164 | else return false; | 171 | else return false; |
165 | } | 172 | } |
166 | 173 | ||
167 | bool Package::toInstall() | 174 | bool Package::toInstall() |
168 | { | 175 | { |
169 | if ( _toProcess && !installed() ) return true; | 176 | if ( _toProcess && !installed() ) return true; |
170 | else return false; | 177 | else return false; |
171 | } | 178 | } |
172 | 179 | ||
173 | void Package::toggleProcess() | 180 | void Package::toggleProcess() |
174 | { | 181 | { |
175 | _toProcess = ! _toProcess; | 182 | _toProcess = ! _toProcess; |
176 | } | 183 | } |
177 | 184 | ||
178 | 185 | ||
179 | 186 | ||
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 31b0010..49bb3bf 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -1,70 +1,70 @@ | |||
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 | bool installed(); | 27 | bool installed(); |
28 | 28 | ||
29 | void setDesc( QString ); | 29 | void setDesc( QString ); |
30 | QString shortDesc(); | 30 | QString shortDesc(); |
31 | QString desc(); | 31 | QString desc(); |
32 | QString size(); | 32 | QString size(); |
33 | QString sizeUnits(); | ||
33 | void setSection( QString ); | 34 | void setSection( QString ); |
34 | QString section(); | 35 | QString section(); |
35 | QString subSection(); | 36 | QString subSection(); |
36 | QString details(); | 37 | QString details(); |
37 | bool toProcess(); | 38 | bool toProcess(); |
38 | bool toInstall(); | 39 | bool toInstall(); |
39 | bool toRemove(); | 40 | bool toRemove(); |
40 | void processed(); | 41 | void processed(); |
41 | QString dest(); | 42 | QString dest(); |
42 | void setDest( QString d ); | 43 | void setDest( QString d ); |
43 | void setOn(); | 44 | void setOn(); |
44 | bool link(); | 45 | bool link(); |
45 | void setLink(bool); | 46 | void setLink(bool); |
46 | void parseIpkgFile( QString );; | 47 | void parseIpkgFile( QString );; |
47 | public slots: | 48 | public slots: |
48 | /** No descriptions */ | ||
49 | QString getPackageName(); | 49 | QString getPackageName(); |
50 | void toggleProcess(); | 50 | void toggleProcess(); |
51 | 51 | ||
52 | private: | 52 | private: |
53 | PackageManagerSettings *settings; | 53 | PackageManagerSettings *settings; |
54 | QString _packageName; | 54 | QString _packageName; |
55 | QString _name; | 55 | QString _name; |
56 | bool _toProcess; | 56 | bool _toProcess; |
57 | bool _link; | 57 | bool _link; |
58 | QString _status; | 58 | QString _status; |
59 | QString _size; | 59 | QString _size; |
60 | QString _section; | 60 | QString _section; |
61 | QString _subsection; | 61 | QString _subsection; |
62 | QString _shortDesc; | 62 | QString _shortDesc; |
63 | QString _desc; | 63 | QString _desc; |
64 | QString _dest; | 64 | QString _dest; |
65 | void parsePackage( QStringList ); | 65 | void parsePackage( QStringList ); |
66 | void init(PackageManagerSettings *); | 66 | void init(PackageManagerSettings *); |
67 | }; | 67 | }; |
68 | 68 | ||
69 | 69 | ||
70 | #endif | 70 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 149ba35..0c7c928 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,72 +1,57 @@ | |||
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 | package = pi; | 16 | package = pi; |
17 | settings = s; | 17 | settings = s; |
18 | setExpandable( true ); | 18 | setExpandable( true ); |
19 | QCheckListItem *item; | 19 | QCheckListItem *item; |
20 | #ifndef NEWLAYOUT | 20 | nameItem = new QCheckListItem( this, "" ); |
21 | item = new QCheckListItem( this, QObject::tr("Name") ); | ||
22 | item->setText(1,pi->name()); | ||
23 | item = new QCheckListItem( this, QObject::tr("Description") ); | ||
24 | item->setText(1,pi->desc()+"\ntest multi\nline"); | ||
25 | item = new QCheckListItem( this, QObject::tr("Size") ); | ||
26 | item->setText(1,pi->size()); | ||
27 | item = new QCheckListItem( this, QObject::tr("Destination") ); | ||
28 | item->setText(1,pi->getDest()); | ||
29 | #endif | ||
30 | #ifdef NEWLAYOUT | ||
31 | item = new QCheckListItem( this, QObject::tr("Name: ")+pi->name() ); | ||
32 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); | 21 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); |
33 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | 22 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); |
34 | destItem = new QCheckListItem( this, "" ); | 23 | destItem = new QCheckListItem( this, "" ); |
35 | linkItem = new QCheckListItem( this, "" ); | 24 | linkItem = new QCheckListItem( this, "" ); |
36 | displayDetails(); | 25 | displayDetails(); |
37 | #endif | ||
38 | 26 | ||
39 | if (!pm_uninstalled) { | 27 | if (!pm_uninstalled) |
28 | { | ||
40 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 29 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
41 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 30 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
42 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 31 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
43 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 32 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
44 | } | 33 | } |
45 | #ifndef NEWLAYOUT | ||
46 | setText(1, package->shortDesc() ); | ||
47 | setText(2, package->size() ); | ||
48 | #endif | ||
49 | } | 34 | } |
50 | 35 | ||
51 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 36 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
52 | int column, int width, int alignment ) | 37 | int column, int width, int alignment ) |
53 | { | 38 | { |
54 | if ( !p ) | 39 | if ( !p ) |
55 | return; | 40 | return; |
56 | 41 | ||
57 | p->fillRect( 0, 0, width, height(), | 42 | p->fillRect( 0, 0, width, height(), |
58 | isSelected()? cg.highlight() : cg.base() ); | 43 | isSelected()? cg.highlight() : cg.base() ); |
59 | 44 | ||
60 | if ( column != 0 ) { | 45 | if ( column != 0 ) { |
61 | // The rest is text | 46 | // The rest is text |
62 | QListViewItem::paintCell( p, cg, column, width, alignment ); | 47 | QListViewItem::paintCell( p, cg, column, width, alignment ); |
63 | return; | 48 | return; |
64 | } | 49 | } |
65 | 50 | ||
66 | QListView *lv = listView(); | 51 | QListView *lv = listView(); |
67 | if ( !lv ) | 52 | if ( !lv ) |
68 | return; | 53 | return; |
69 | int marg = lv->itemMargin(); | 54 | int marg = lv->itemMargin(); |
70 | int r = marg; | 55 | int r = marg; |
71 | 56 | ||
72 | QPixmap pm = statePixmap(); | 57 | QPixmap pm = statePixmap(); |
@@ -99,41 +84,39 @@ QPixmap PackageListItem::statePixmap() const | |||
99 | return *pm_install; | 84 | return *pm_install; |
100 | else | 85 | else |
101 | return *pm_uninstall; | 86 | return *pm_uninstall; |
102 | } | 87 | } |
103 | } | 88 | } |
104 | 89 | ||
105 | QString PackageListItem::key( int column, bool ascending ) const | 90 | QString PackageListItem::key( int column, bool ascending ) const |
106 | { | 91 | { |
107 | if ( column == 2 ) { | 92 | if ( column == 2 ) { |
108 | QString t = text(2); | 93 | QString t = text(2); |
109 | double bytes=t.toDouble(); | 94 | double bytes=t.toDouble(); |
110 | if ( t.contains('M') ) bytes*=1024*1024; | 95 | if ( t.contains('M') ) bytes*=1024*1024; |
111 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; | 96 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; |
112 | if ( !ascending ) bytes=999999999-bytes; | 97 | if ( !ascending ) bytes=999999999-bytes; |
113 | return QString().sprintf("%09d",(int)bytes); | 98 | return QString().sprintf("%09d",(int)bytes); |
114 | } else { | 99 | } else { |
115 | return QListViewItem::key(column,ascending); | 100 | return QListViewItem::key(column,ascending); |
116 | } | 101 | } |
117 | } | 102 | } |
118 | 103 | ||
119 | void PackageListItem::setOn( bool b ) | 104 | void PackageListItem::setOn( bool b ) |
120 | { | 105 | { |
121 | QCheckListItem::setOn( b ); | 106 | QCheckListItem::setOn( b ); |
122 | package->toggleProcess(); | 107 | package->toggleProcess(); |
123 | // if ( b ) | ||
124 | // { | ||
125 | // if ((package->dest()).isEmpty) | ||
126 | // package->setDest( settings->getDestinationName() ); | ||
127 | // }else{ | ||
128 | // package->setDest( QObject::tr("not installed")); | ||
129 | // } | ||
130 | package->setLink( settings->createLinks() ); | 108 | package->setLink( settings->createLinks() ); |
131 | displayDetails(); | 109 | displayDetails(); |
132 | } | 110 | } |
133 | 111 | ||
134 | void PackageListItem::displayDetails() | 112 | void PackageListItem::displayDetails() |
135 | { | 113 | { |
114 | QString sod = " ("+package->sizeUnits(); | ||
115 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); | ||
116 | sod += ")"; | ||
117 | setText(0, package->name()+sod ); | ||
118 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); | ||
136 | linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); | 119 | linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) ); |
137 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); | 120 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); |
138 | repaint(); | 121 | repaint(); |
139 | } | 122 | } |
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index f695432..54d9f9e 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h | |||
@@ -6,32 +6,33 @@ | |||
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(QListView*, Package*, PackageManagerSettings*); | 18 | PackageListItem(QListView*, Package*, PackageManagerSettings*); |
19 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); | 19 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); |
20 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); | 20 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); |
21 | QPixmap statePixmap() const; | 21 | QPixmap statePixmap() const; |
22 | QString key( int, bool ) const; | 22 | QString key( int, bool ) const; |
23 | Package* getPackage() { return package; } ; | 23 | Package* getPackage() { return package; } ; |
24 | QString getName() { return package->name(); } ; | 24 | QString getName() { return package->name(); } ; |
25 | bool isInstalled(){ return package->installed(); }; | 25 | bool isInstalled(){ return package->installed(); }; |
26 | virtual void setOn ( bool ); | 26 | virtual void setOn ( bool ); |
27 | void displayDetails(); | 27 | void displayDetails(); |
28 | 28 | ||
29 | private: | 29 | private: |
30 | QCheckListItem *nameItem; | ||
30 | QCheckListItem *destItem; | 31 | QCheckListItem *destItem; |
31 | QCheckListItem *linkItem; | 32 | QCheckListItem *linkItem; |
32 | PackageManagerSettings *settings; | 33 | PackageManagerSettings *settings; |
33 | Package *package; | 34 | Package *package; |
34 | }; | 35 | }; |
35 | 36 | ||
36 | 37 | ||
37 | #endif | 38 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 693ea6a..2915ac6 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -31,61 +31,77 @@ PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettin | |||
31 | destsMenu = new QPopupMenu( popupMenu ); | 31 | destsMenu = new QPopupMenu( popupMenu ); |
32 | popupTimer = new QTimer( this ); | 32 | popupTimer = new QTimer( this ); |
33 | setSelectionMode(QListView::NoSelection); | 33 | setSelectionMode(QListView::NoSelection); |
34 | addColumn( tr("Package") ); | 34 | addColumn( tr("Package") ); |
35 | setRootIsDecorated( true ); | 35 | setRootIsDecorated( true ); |
36 | 36 | ||
37 | connect( popupTimer, SIGNAL(timeout()), | 37 | connect( popupTimer, SIGNAL(timeout()), |
38 | this, SLOT(showPopup()) ); | 38 | this, SLOT(showPopup()) ); |
39 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 39 | connect( this, SIGNAL( pressed( QListViewItem* ) ), |
40 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 40 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
41 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 41 | connect( this, SIGNAL( clicked( QListViewItem* ) ), |
42 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 42 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
43 | 43 | ||
44 | } | 44 | } |
45 | 45 | ||
46 | //PackageListView::~PackageListView() | 46 | //PackageListView::~PackageListView() |
47 | //{ | 47 | //{ |
48 | //} | 48 | //} |
49 | 49 | ||
50 | void PackageListView::setCurrent( QListViewItem* p ) | 50 | void PackageListView::setCurrent( QListViewItem* p ) |
51 | { | 51 | { |
52 | if ( !p ) return; | 52 | if ( !p ) return; |
53 | activePackageListItem = (PackageListItem*)p; | 53 | activePackageListItem = (PackageListItem*)p; |
54 | activePackage = activePackageListItem->getPackage(); | 54 | activePackage = activePackageListItem->getPackage(); |
55 | pvDebug(5, "start timer"); | 55 | if (!activePackage) return; |
56 | popupTimer->start( 750, true ); | 56 | popupTimer->start( 750, true ); |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | void PackageListView::showPopup() | 60 | void PackageListView::showPopup() |
61 | { | 61 | { |
62 | popupMenu->clear(); | 62 | popupMenu->clear(); |
63 | destsMenu->clear(); | 63 | destsMenu->clear(); |
64 | 64 | ||
65 | QAction *popupAction; | 65 | QAction *popupAction; |
66 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | 66 | if ( !activePackage->installed() ) |
67 | QStringList dests = settings->getDestinationNames(); | 67 | { |
68 | for (uint i = 0; i < dests.count(); i++ ) | 68 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); |
69 | { | 69 | QStringList dests = settings->getDestinationNames(); |
70 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 70 | QString ad = settings->getDestinationName(); |
71 | popupAction->addTo( destsMenu ); | 71 | for (uint i = 0; i < dests.count(); i++ ) |
72 | } | 72 | { |
73 | connect( destsMenu, SIGNAL( activated( int ) ), | 73 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
74 | this, SLOT( changePackageDest( int ) ) ); | 74 | popupAction->addTo( destsMenu ); |
75 | if ( dests[i] == ad && activePackage->toInstall() ) | ||
76 | { | ||
77 | popupAction->setToggleAction( true ); | ||
78 | popupAction->setOn(true); | ||
79 | }; | ||
80 | } | ||
81 | connect( destsMenu, SIGNAL( activated( int ) ), | ||
82 | this, SLOT( changePackageDest( int ) ) ); | ||
83 | }else{ | ||
84 | // popupActcat setOn( activePackage->toProcess() ); | ||
85 | } | ||
75 | popupMenu->popup( QCursor::pos() ); | 86 | popupMenu->popup( QCursor::pos() ); |
76 | } | 87 | } |
77 | 88 | ||
78 | void PackageListView::stopTimer( QListViewItem* ) | 89 | void PackageListView::stopTimer( QListViewItem* ) |
79 | { | 90 | { |
80 | pvDebug( 5, "stop timer" ); | ||
81 | popupTimer->stop(); | 91 | popupTimer->stop(); |
82 | } | 92 | } |
83 | 93 | ||
84 | 94 | ||
85 | void PackageListView::changePackageDest( int i ) | 95 | void PackageListView::changePackageDest( int i ) |
86 | { | 96 | { |
87 | activePackage->setDest( destsMenu->text(i) ); | 97 | activePackage->setDest( destsMenu->text(i) ); |
88 | activePackage->setOn(); | 98 | activePackage->setOn(); |
89 | activePackage->setLink( settings->createLinks() ); | 99 | activePackage->setLink( settings->createLinks() ); |
90 | activePackageListItem->displayDetails(); | 100 | activePackageListItem->displayDetails(); |
91 | } | 101 | } |
102 | |||
103 | void PackageListView::toggleProcess() | ||
104 | { | ||
105 | activePackage->toggleProcess() ; | ||
106 | activePackageListItem->displayDetails(); | ||
107 | } | ||
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index 15e200b..a3db0d0 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h | |||
@@ -27,27 +27,29 @@ | |||
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 | }; | 53 | }; |
52 | 54 | ||
53 | #endif | 55 | #endif |
diff --git a/noncore/unsupported/oipkg/pkdesc.ui b/noncore/unsupported/oipkg/pkdesc.ui deleted file mode 100644 index 494d3d6..0000000 --- a/noncore/unsupported/oipkg/pkdesc.ui +++ b/dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PackageDetails</class> | ||
3 | <widget> | ||
4 | <class>QDialog</class> | ||
5 | <property stdset="1"> | ||
6 | <name>name</name> | ||
7 | <cstring>Form7</cstring> | ||
8 | </property> | ||
9 | <property stdset="1"> | ||
10 | <name>geometry</name> | ||
11 | <rect> | ||
12 | <x>0</x> | ||
13 | <y>0</y> | ||
14 | <width>221</width> | ||
15 | <height>291</height> | ||
16 | </rect> | ||
17 | </property> | ||
18 | <property stdset="1"> | ||
19 | <name>caption</name> | ||
20 | <string>(pkgname)</string> | ||
21 | </property> | ||
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>6</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>3</number> | ||
36 | </property> | ||
37 | <widget> | ||
38 | <class>QTextView</class> | ||
39 | <property stdset="1"> | ||
40 | <name>name</name> | ||
41 | <cstring>description</cstring> | ||
42 | </property> | ||
43 | </widget> | ||
44 | <widget> | ||
45 | <class>QLayoutWidget</class> | ||
46 | <property stdset="1"> | ||
47 | <name>name</name> | ||
48 | <cstring>Layout4</cstring> | ||
49 | </property> | ||
50 | <hbox> | ||
51 | <property stdset="1"> | ||
52 | <name>margin</name> | ||
53 | <number>0</number> | ||
54 | </property> | ||
55 | <property stdset="1"> | ||
56 | <name>spacing</name> | ||
57 | <number>6</number> | ||
58 | </property> | ||
59 | <widget> | ||
60 | <class>QToolButton</class> | ||
61 | <property stdset="1"> | ||
62 | <name>name</name> | ||
63 | <cstring>install</cstring> | ||
64 | </property> | ||
65 | <property stdset="1"> | ||
66 | <name>text</name> | ||
67 | <string>Install</string> | ||
68 | </property> | ||
69 | </widget> | ||
70 | <widget> | ||
71 | <class>QToolButton</class> | ||
72 | <property stdset="1"> | ||
73 | <name>name</name> | ||
74 | <cstring>remove</cstring> | ||
75 | </property> | ||
76 | <property stdset="1"> | ||
77 | <name>text</name> | ||
78 | <string>Remove</string> | ||
79 | </property> | ||
80 | </widget> | ||
81 | <widget> | ||
82 | <class>QToolButton</class> | ||
83 | <property stdset="1"> | ||
84 | <name>name</name> | ||
85 | <cstring>ignore</cstring> | ||
86 | </property> | ||
87 | <property stdset="1"> | ||
88 | <name>text</name> | ||
89 | <string>Ignore</string> | ||
90 | </property> | ||
91 | </widget> | ||
92 | </hbox> | ||
93 | </widget> | ||
94 | </vbox> | ||
95 | </widget> | ||
96 | </UI> | ||
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index be01837..6c8dc2a 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -10,210 +10,224 @@ | |||
10 | 10 | ||
11 | #include <qprogressbar.h> | 11 | #include <qprogressbar.h> |
12 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
13 | #include <qdict.h> | 13 | #include <qdict.h> |
14 | #include <qfile.h> | 14 | #include <qfile.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
17 | #include <qlistview.h> | 17 | #include <qlistview.h> |
18 | #include <qlistbox.h> | 18 | #include <qlistbox.h> |
19 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qpainter.h> | 21 | #include <qpainter.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qregexp.h> | 23 | #include <qregexp.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | #include <qtextview.h> | 27 | #include <qtextview.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include "debug.h" | 33 | #include "debug.h" |
34 | //#include "utils.h" | ||
34 | 35 | ||
35 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) | 36 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) |
36 | : PackageManagerSettingsBase( parent, name, fl ) | 37 | : PackageManagerSettingsBase( parent, name, fl ) |
37 | { | 38 | { |
38 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); | 39 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); |
39 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); | 40 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); |
40 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 41 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
41 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); | 42 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); |
42 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); | 43 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); |
43 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 44 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
44 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), | 45 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), |
45 | // activeLinkDestination, SLOT(setEnabled(bool)) ); | 46 | // activeLinkDestination, SLOT(setEnabled(bool)) ); |
46 | 47 | ||
47 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); | 48 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); |
48 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); | 49 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); |
49 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); | 50 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); |
50 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); | 51 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); |
51 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); | 52 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); |
52 | servername->setEnabled(FALSE); | 53 | servername->setEnabled(FALSE); |
53 | serverurl->setEnabled(FALSE); | 54 | serverurl->setEnabled(FALSE); |
54 | serverurlDic.setAutoDelete(TRUE); | 55 | serverurlDic.setAutoDelete(TRUE); |
55 | destinationname->setEnabled(FALSE); | 56 | destinationname->setEnabled(FALSE); |
56 | destinationurl->setEnabled(FALSE); | 57 | destinationurl->setEnabled(FALSE); |
57 | destinationurlDic.setAutoDelete(TRUE); | 58 | destinationurlDic.setAutoDelete(TRUE); |
58 | readSettings(); | 59 | readSettings(); |
60 | activeLinkDestination->hide(); | ||
59 | } | 61 | } |
60 | 62 | ||
61 | PackageManagerSettings::~PackageManagerSettings() | 63 | PackageManagerSettings::~PackageManagerSettings() |
62 | { | 64 | { |
63 | } | 65 | } |
64 | 66 | ||
65 | 67 | ||
66 | void PackageManagerSettings::newServer() | 68 | void PackageManagerSettings::newServer() |
67 | { | 69 | { |
68 | int i = servers->count(); | 70 | int i = servers->count(); |
69 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { | 71 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { |
70 | serverurlDic.insert(i,new QString("http://")); | 72 | serverurlDic.insert(i,new QString("http://")); |
71 | servers->insertItem(tr("New")); | 73 | servers->insertItem(tr("New")); |
72 | activeServers->insertItem(tr("New")); | 74 | activeServers->insertItem(tr("New")); |
73 | } else { | 75 | } else { |
74 | // allows one-level undo | 76 | // allows one-level undo |
75 | serverurlDic.insert(i,new QString(serverurl->text())); | 77 | serverurlDic.insert(i,new QString(serverurl->text())); |
76 | servers->insertItem(servername->text()); | 78 | servers->insertItem(servername->text()); |
77 | activeServers->insertItem(servername->text()); | 79 | activeServers->insertItem(servername->text()); |
78 | } | 80 | } |
81 | changed = true; | ||
79 | servers->setSelected(i,TRUE); | 82 | servers->setSelected(i,TRUE); |
80 | editServer(i); | 83 | editServer(i); |
84 | changed = true; | ||
81 | } | 85 | } |
82 | 86 | ||
83 | void PackageManagerSettings::newDestination() | 87 | void PackageManagerSettings::newDestination() |
84 | { | 88 | { |
85 | int i = destinations->count(); | 89 | int i = destinations->count(); |
86 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { | 90 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { |
87 | destinationurlDic.insert(i,new QString("/")); | 91 | destinationurlDic.insert(i,new QString("/")); |
88 | destinations->insertItem(tr("New")); | 92 | destinations->insertItem(tr("New")); |
89 | activeDestination->insertItem(tr("New")); | 93 | activeDestination->insertItem(tr("New")); |
90 | activeLinkDestination->insertItem(tr("New")); | 94 | activeLinkDestination->insertItem(tr("New")); |
91 | } else { | 95 | } else { |
92 | // allows one-level undo | 96 | // allows one-level undo |
93 | destinationurlDic.insert(i,new QString(destinationurl->text())); | 97 | destinationurlDic.insert(i,new QString(destinationurl->text())); |
94 | destinations->insertItem(destinationname->text()); | 98 | destinations->insertItem(destinationname->text()); |
95 | activeDestination->insertItem(destinationname->text()); | 99 | activeDestination->insertItem(destinationname->text()); |
96 | activeLinkDestination->insertItem(destinationname->text()); | 100 | activeLinkDestination->insertItem(destinationname->text()); |
97 | } | 101 | } |
98 | destinations->setSelected(i,TRUE); | 102 | destinations->setSelected(i,TRUE); |
99 | editDestination(i); | 103 | editDestination(i); |
104 | changed = true; | ||
100 | } | 105 | } |
101 | 106 | ||
102 | 107 | ||
103 | void PackageManagerSettings::editServer(int i) | 108 | void PackageManagerSettings::editServer(int i) |
104 | { | 109 | { |
105 | if ( servername->isEnabled() ) { | 110 | if ( servername->isEnabled() ) { |
106 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 111 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
107 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 112 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
108 | } else { | 113 | } else { |
109 | servername->setEnabled(TRUE); | 114 | servername->setEnabled(TRUE); |
110 | serverurl->setEnabled(TRUE); | 115 | serverurl->setEnabled(TRUE); |
111 | } | 116 | } |
112 | 117 | ||
113 | servername->setText( servers->text(i) ); | 118 | servername->setText( servers->text(i) ); |
114 | serverurl->setText( *serverurlDic[i] ); | 119 | serverurl->setText( *serverurlDic[i] ); |
115 | 120 | ||
116 | editedserver = i; | 121 | editedserver = i; |
117 | 122 | ||
118 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 123 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
119 | 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; | ||
120 | } | 126 | } |
121 | 127 | ||
122 | 128 | ||
123 | void PackageManagerSettings::editDestination(int i) | 129 | void PackageManagerSettings::editDestination(int i) |
124 | { | 130 | { |
125 | if ( destinationname->isEnabled() ) { | 131 | if ( destinationname->isEnabled() ) { |
126 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 132 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
127 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 133 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
128 | } else { | 134 | } else { |
129 | destinationname->setEnabled(TRUE); | 135 | destinationname->setEnabled(TRUE); |
130 | destinationurl->setEnabled(TRUE); | 136 | destinationurl->setEnabled(TRUE); |
131 | } | 137 | } |
132 | 138 | ||
133 | destinationname->setText( destinations->text(i) ); | 139 | destinationname->setText( destinations->text(i) ); |
134 | destinationurl->setText( *destinationurlDic[i] ); | 140 | destinationurl->setText( *destinationurlDic[i] ); |
135 | 141 | ||
136 | editeddestination = i; | 142 | editeddestination = i; |
137 | 143 | ||
138 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 144 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
139 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 145 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
146 | changed = true; | ||
140 | } | 147 | } |
141 | 148 | ||
142 | void PackageManagerSettings::removeServer() | 149 | void PackageManagerSettings::removeServer() |
143 | { | 150 | { |
144 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 151 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
145 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 152 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
146 | servername->setText(servers->text(editedserver)); | 153 | servername->setText(servers->text(editedserver)); |
147 | serverurl->setText(*serverurlDic[editedserver]); | 154 | serverurl->setText(*serverurlDic[editedserver]); |
148 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 155 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
149 | servers->removeItem(editedserver); | 156 | servers->removeItem(editedserver); |
150 | activeServers->removeItem(editedserver); | 157 | activeServers->removeItem(editedserver); |
151 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 158 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
152 | servername->setEnabled(FALSE); | 159 | servername->setEnabled(FALSE); |
153 | serverurl->setEnabled(FALSE); | 160 | serverurl->setEnabled(FALSE); |
161 | changed = true; | ||
154 | } | 162 | } |
155 | 163 | ||
156 | void PackageManagerSettings::removeDestination() | 164 | void PackageManagerSettings::removeDestination() |
157 | { | 165 | { |
158 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 166 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
159 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 167 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
160 | destinationname->setText(destinations->text(editedserver)); | 168 | destinationname->setText(destinations->text(editedserver)); |
161 | destinationurl->setText(*destinationurlDic[editedserver]); | 169 | destinationurl->setText(*destinationurlDic[editedserver]); |
162 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 170 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
163 | destinations->removeItem(editeddestination); | 171 | destinations->removeItem(editeddestination); |
164 | activeDestination->removeItem(editeddestination); | 172 | activeDestination->removeItem(editeddestination); |
165 | activeLinkDestination->removeItem(editeddestination); | 173 | activeLinkDestination->removeItem(editeddestination); |
166 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 174 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
167 | destinationname->setEnabled(FALSE); | 175 | destinationname->setEnabled(FALSE); |
168 | destinationurl->setEnabled(FALSE); | 176 | destinationurl->setEnabled(FALSE); |
177 | changed = true; | ||
169 | } | 178 | } |
170 | 179 | ||
171 | void PackageManagerSettings::serverNameChanged(const QString& t) | 180 | void PackageManagerSettings::serverNameChanged(const QString& t) |
172 | { | 181 | { |
173 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 182 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
174 | servers->changeItem( t, editedserver ); | 183 | servers->changeItem( t, editedserver ); |
175 | activeServers->changeItem( t, editedserver ); | 184 | activeServers->changeItem( t, editedserver ); |
185 | changed = true; | ||
176 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 186 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
187 | changed = true; | ||
177 | } | 188 | } |
178 | 189 | ||
179 | void PackageManagerSettings::destNameChanged(const QString& t) | 190 | void PackageManagerSettings::destNameChanged(const QString& t) |
180 | { | 191 | { |
181 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 192 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
182 | destinations->changeItem( t, editeddestination ); | 193 | destinations->changeItem( t, editeddestination ); |
183 | activeDestination->changeItem( t, editeddestination ); | 194 | activeDestination->changeItem( t, editeddestination ); |
184 | activeLinkDestination->changeItem( t, editeddestination ); | 195 | activeLinkDestination->changeItem( t, editeddestination ); |
185 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 196 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
197 | changed = true; | ||
186 | } | 198 | } |
187 | 199 | ||
188 | void PackageManagerSettings::serverUrlChanged(const QString& t) | 200 | void PackageManagerSettings::serverUrlChanged(const QString& t) |
189 | { | 201 | { |
190 | serverurlDic.replace(editedserver, new QString(t)); | 202 | serverurlDic.replace(editedserver, new QString(t)); |
203 | changed = true; | ||
191 | } | 204 | } |
192 | 205 | ||
193 | void PackageManagerSettings::destUrlChanged(const QString& t) | 206 | void PackageManagerSettings::destUrlChanged(const QString& t) |
194 | { | 207 | { |
195 | destinationurlDic.replace(editeddestination, new QString(t)); | 208 | destinationurlDic.replace(editeddestination, new QString(t)); |
209 | changed = true; | ||
196 | } | 210 | } |
197 | 211 | ||
198 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) | 212 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) |
199 | { | 213 | { |
200 | QFile conf(conffile); | 214 | QFile conf(conffile); |
201 | if ( ! conf.open(IO_WriteOnly) ) return; | 215 | if ( ! conf.open(IO_WriteOnly) ) return; |
202 | QTextStream s(&conf); | 216 | QTextStream s(&conf); |
203 | s << "# Written by qpie Package Manager\n"; | 217 | s << "# Written by qpie Package Manager\n"; |
204 | for (int i=0; i<(int)activeServers->count(); i++) | 218 | for (int i=0; i<(int)activeServers->count(); i++) |
205 | { | 219 | { |
206 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); | 220 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); |
207 | if ( !activeServers->isSelected(i) ) | 221 | if ( !activeServers->isSelected(i) ) |
208 | s << "#"; | 222 | s << "#"; |
209 | s << "src " << activeServers->text(i) << " " << url << "\n"; | 223 | s << "src " << activeServers->text(i) << " " << url << "\n"; |
210 | } | 224 | } |
211 | for (int i=0; i<(int)destinations->count(); i++) | 225 | for (int i=0; i<(int)destinations->count(); i++) |
212 | { | 226 | { |
213 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); | 227 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); |
214 | s << "dest " << destinations->text(i) << " " << url << "\n"; | 228 | s << "dest " << destinations->text(i) << " " << url << "\n"; |
215 | } | 229 | } |
216 | conf.close(); | 230 | conf.close(); |
217 | } | 231 | } |
218 | 232 | ||
219 | 233 | ||
@@ -244,115 +258,114 @@ void PackageManagerSettings::removeInstallationSetting() | |||
244 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); | 258 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); |
245 | cfg.clearGroup(); | 259 | cfg.clearGroup(); |
246 | installationSettingsCount--; | 260 | installationSettingsCount--; |
247 | changed = true; | 261 | changed = true; |
248 | settingName->setEditable( false ); | 262 | settingName->setEditable( false ); |
249 | } | 263 | } |
250 | 264 | ||
251 | /** | 265 | /** |
252 | * write to confgile | 266 | * write to confgile |
253 | */ | 267 | */ |
254 | void PackageManagerSettings::newInstallationSetting() | 268 | void PackageManagerSettings::newInstallationSetting() |
255 | { | 269 | { |
256 | installationSettingsCount++; | 270 | installationSettingsCount++; |
257 | settingName->insertItem( "New", installationSettingsCount ); | 271 | settingName->insertItem( "New", installationSettingsCount ); |
258 | settingName->setCurrentItem( installationSettingsCount ); | 272 | settingName->setCurrentItem( installationSettingsCount ); |
259 | settingName->setEditable( true ); | 273 | settingName->setEditable( true ); |
260 | changed = true; | 274 | changed = true; |
261 | } | 275 | } |
262 | 276 | ||
263 | void PackageManagerSettings::installationSettingChange(int cs) | 277 | void PackageManagerSettings::installationSettingChange(int cs) |
264 | { | 278 | { |
265 | writeCurrentInstallationSetting(); | 279 | writeCurrentInstallationSetting(); |
266 | currentSetting = cs; | 280 | currentSetting = cs; |
267 | readInstallationSetting( cs ); | 281 | readInstallationSetting( cs ); |
282 | changed = true; | ||
268 | } | 283 | } |
269 | 284 | ||
270 | void PackageManagerSettings::writeInstallationSettings() | 285 | void PackageManagerSettings::writeInstallationSettings() |
271 | { | 286 | { |
272 | if ( ! changed ) return ; | ||
273 | { | 287 | { |
274 | Config cfg( "oipkg", Config::User ); | 288 | Config cfg( "oipkg", Config::User ); |
275 | cfg.setGroup( "Settings" ); | 289 | cfg.setGroup( "Settings" ); |
276 | cfg.writeEntry( "count", installationSettingsCount ); | 290 | cfg.writeEntry( "count", installationSettingsCount ); |
277 | cfg.writeEntry( "current", currentSetting ); | 291 | cfg.writeEntry( "current", currentSetting ); |
278 | } | 292 | } |
279 | writeCurrentInstallationSetting(); | 293 | writeCurrentInstallationSetting(); |
280 | } | 294 | } |
281 | 295 | ||
282 | 296 | ||
283 | void PackageManagerSettings::readInstallationSetting(int setting) | 297 | void PackageManagerSettings::readInstallationSetting(int setting) |
284 | { | 298 | { |
285 | if ( setting < 0 ) return; | 299 | if ( setting < 0 ) return; |
286 | Config cfg( "oipkg", Config::User ); | 300 | Config cfg( "oipkg", Config::User ); |
287 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 301 | cfg.setGroup( "Setting_" + QString::number( setting ) ); |
288 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | 302 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); |
289 | QString dest = cfg.readEntry( "dest" ); | 303 | QString dest = cfg.readEntry( "dest" ); |
290 | QString linkdest = cfg.readEntry( "linkdest" ); | 304 | QString linkdest = cfg.readEntry( "linkdest" ); |
291 | pvDebug(3, "dest="+dest); | 305 | pvDebug(3, "dest="+dest); |
292 | pvDebug(3, "linkdest="+linkdest); | 306 | pvDebug(3, "linkdest="+linkdest); |
293 | |||
294 | for ( int i = 0; i < activeDestination->count(); i++) | 307 | for ( int i = 0; i < activeDestination->count(); i++) |
295 | { | 308 | { |
296 | if ( activeDestination->text( i ) == dest ) | 309 | if ( activeDestination->text( i ) == dest ) |
297 | activeDestination->setCurrentItem( i ); | 310 | activeDestination->setCurrentItem( i ); |
298 | if ( activeLinkDestination->text( i ) == linkdest ) | 311 | if ( activeLinkDestination->text( i ) == linkdest ) |
299 | activeLinkDestination->setCurrentItem( i ); | 312 | activeLinkDestination->setCurrentItem( i ); |
300 | } | 313 | } |
301 | } | 314 | } |
302 | 315 | ||
303 | void PackageManagerSettings::writeCurrentInstallationSetting() | 316 | void PackageManagerSettings::writeCurrentInstallationSetting() |
304 | { | 317 | { |
305 | Config cfg( "oipkg", Config::User ); | 318 | Config cfg( "oipkg", Config::User ); |
306 | changed = false; | ||
307 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); | 319 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); |
308 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); | 320 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); |
309 | cfg.writeEntry( "dest", getDestinationName() ); | 321 | cfg.writeEntry( "dest", getDestinationName() ); |
310 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); | 322 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); |
311 | QStringList sers = getActiveServers(); | 323 | QStringList sers = getActiveServers(); |
312 | int srvc = 0; | 324 | int srvc = 0; |
313 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { | 325 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { |
314 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); | 326 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); |
315 | } | 327 | } |
316 | cfg.writeEntry( "server_count", srvc ); | 328 | cfg.writeEntry( "server_count", srvc ); |
317 | } | 329 | } |
318 | 330 | ||
319 | void PackageManagerSettings::renameInstallationSetting() | 331 | void PackageManagerSettings::renameInstallationSetting() |
320 | { | 332 | { |
321 | settingName->setEditable( true ); | 333 | settingName->setEditable( true ); |
322 | changed = true; | 334 | changed = true; |
323 | } | 335 | } |
324 | 336 | ||
325 | void PackageManagerSettings::installationSettingSetName(const QString &name) | 337 | void PackageManagerSettings::installationSettingSetName(const QString &name) |
326 | { | 338 | { |
327 | settingName->changeItem( name, settingName->currentItem() ); | 339 | settingName->changeItem( name, settingName->currentItem() ); |
328 | changed = true; | 340 | changed = true; |
329 | } | 341 | } |
330 | 342 | ||
331 | 343 | ||
332 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) | 344 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) |
333 | { | 345 | { |
334 | QFile conf(conffile); | 346 | QFile conf(conffile); |
347 | changed = false; | ||
335 | if ( conf.open(IO_ReadOnly) ) { | 348 | if ( conf.open(IO_ReadOnly) ) { |
336 | QTextStream s(&conf); | 349 | QTextStream s(&conf); |
337 | servers->clear(); | 350 | servers->clear(); |
338 | activeServers->clear(); | 351 | activeServers->clear(); |
339 | activeDestination->clear(); | 352 | activeDestination->clear(); |
340 | activeLinkDestination->clear(); | 353 | activeLinkDestination->clear(); |
341 | serverurlDic.clear(); | 354 | serverurlDic.clear(); |
342 | destinationurlDic.clear(); | 355 | destinationurlDic.clear(); |
343 | ipkg_old=0; | 356 | ipkg_old=0; |
344 | int currentserver=0; | 357 | int currentserver=0; |
345 | while ( !s.atEnd() ) { | 358 | while ( !s.atEnd() ) { |
346 | QString l = s.readLine(); | 359 | QString l = s.readLine(); |
347 | QStringList token = QStringList::split(' ', l); | 360 | QStringList token = QStringList::split(' ', l); |
348 | if ( token[0] == "src" || token[0] == "#src" ) { | 361 | if ( token[0] == "src" || token[0] == "#src" ) { |
349 | currentserver=servers->count(); | 362 | currentserver=servers->count(); |
350 | serverurlDic.insert(servers->count(),new QString(token[2])); | 363 | serverurlDic.insert(servers->count(),new QString(token[2])); |
351 | int a = token[0] == "src" ? 1 : 0; | 364 | int a = token[0] == "src" ? 1 : 0; |
352 | int i = servers->count(); | 365 | int i = servers->count(); |
353 | servers->insertItem(token[1]); | 366 | servers->insertItem(token[1]); |
354 | activeServers->insertItem( token[1] ); | 367 | activeServers->insertItem( token[1] ); |
355 | activeServers->setSelected(i,a); | 368 | activeServers->setSelected(i,a); |
356 | } else if ( token[0] == "dest" ) { | 369 | } else if ( token[0] == "dest" ) { |
357 | currentserver=destinations->count(); | 370 | currentserver=destinations->count(); |
358 | destinationurlDic.insert(destinations->count(),new QString(token[2])); | 371 | destinationurlDic.insert(destinations->count(),new QString(token[2])); |
@@ -403,109 +416,127 @@ bool PackageManagerSettings::readIpkgConfig(const QString& conffile) | |||
403 | } | 416 | } |
404 | } | 417 | } |
405 | if ( ipkg_old ) { | 418 | if ( ipkg_old ) { |
406 | servers->setSelectionMode(QListBox::Single); | 419 | servers->setSelectionMode(QListBox::Single); |
407 | servers->setSelected(currentserver,TRUE); | 420 | servers->setSelected(currentserver,TRUE); |
408 | } | 421 | } |
409 | return TRUE; | 422 | return TRUE; |
410 | } else { | 423 | } else { |
411 | return FALSE; | 424 | return FALSE; |
412 | } | 425 | } |
413 | } | 426 | } |
414 | 427 | ||
415 | 428 | ||
416 | /** | 429 | /** |
417 | * read from config file(s) | 430 | * read from config file(s) |
418 | */ | 431 | */ |
419 | void PackageManagerSettings::readSettings() | 432 | void PackageManagerSettings::readSettings() |
420 | { | 433 | { |
421 | readIpkgConfig("/etc/ipkg.conf"); | 434 | readIpkgConfig("/etc/ipkg.conf"); |
422 | readInstallationSettings(); | 435 | readInstallationSettings(); |
423 | } | 436 | } |
424 | 437 | ||
425 | void PackageManagerSettings::writeSettings() | 438 | void PackageManagerSettings::writeSettings() |
426 | { | 439 | { |
427 | writeIpkgConfig("/etc/ipkg.conf"); | 440 | if ( changed ) writeIpkgConfig("/etc/ipkg.conf"); |
428 | writeInstallationSettings(); | 441 | writeInstallationSettings(); |
429 | } | 442 | } |
430 | /** shows the setting dialog */ | 443 | /** shows the setting dialog */ |
431 | bool PackageManagerSettings::showDialog( int i ) | 444 | bool PackageManagerSettings::showDialog( int i ) |
432 | { | 445 | { |
433 | TabWidget->setCurrentPage( i ); | 446 | TabWidget->setCurrentPage( i ); |
434 | showMaximized(); | 447 | showMaximized(); |
435 | bool ret = exec(); | 448 | bool ret = exec(); |
436 | if ( ret ) writeSettings(); | 449 | if ( ret ) writeSettings(); |
437 | else readSettings(); | 450 | else readSettings(); |
438 | return ret; | 451 | return (changed && ret); |
439 | } | 452 | } |
440 | /** Returns the installation destination */ | 453 | /** Returns the installation destination */ |
441 | QString PackageManagerSettings::getDestinationName() | 454 | QString PackageManagerSettings::getDestinationName() |
442 | { | 455 | { |
443 | return activeDestination->currentText(); | 456 | return activeDestination->currentText(); |
444 | } | 457 | } |
445 | /** Returns the link destination */ | 458 | /** Returns the link destination */ |
446 | QString PackageManagerSettings::getLinkDestinationName() | 459 | QString PackageManagerSettings::getLinkDestinationName() |
447 | { | 460 | { |
448 | return activeLinkDestination->currentText(); | 461 | return activeLinkDestination->currentText(); |
449 | } | 462 | } |
450 | /** Returns the URL of the active destination */ | 463 | /** Returns the URL of the active destination */ |
451 | QString PackageManagerSettings::getDestinationUrl() | 464 | QString PackageManagerSettings::getDestinationUrl() |
452 | { | 465 | { |
453 | int dnr = activeDestination->currentItem(); | 466 | int dnr = activeDestination->currentItem(); |
454 | return *destinationurlDic.find(dnr); | 467 | return *destinationurlDic.find(dnr); |
455 | } | 468 | } |
456 | /** Should oipkg create links form install destination to link destination */ | 469 | /** Should oipkg create links form install destination to link destination */ |
457 | bool PackageManagerSettings::createLinks() | 470 | bool PackageManagerSettings::createLinks() |
458 | { | 471 | { |
459 | return CheckBoxLink->isChecked(); | 472 | return CheckBoxLink->isChecked(); |
460 | } | 473 | } |
461 | /** get the servers that are active */ | 474 | /** get the servers that are active */ |
462 | QStringList PackageManagerSettings::getActiveServers() | 475 | QStringList PackageManagerSettings::getActiveServers() |
463 | { | 476 | { |
464 | QStringList sl; | 477 | QStringList sl; |
465 | for (int i=0; i<(int)activeServers->count(); i++) | 478 | for (int i=0; i<(int)activeServers->count(); i++) |
466 | { | 479 | { |
467 | if ( activeServers->isSelected(i) ) | 480 | if ( activeServers->isSelected(i) ) |
468 | sl += activeServers->text(i); | 481 | sl += activeServers->text(i); |
469 | } | 482 | } |
470 | return sl; | 483 | return sl; |
471 | } | 484 | } |
485 | QStringList PackageManagerSettings::getServers() | ||
486 | { | ||
487 | QStringList sl; | ||
488 | for (int i=0; i<(int)activeServers->count(); i++) | ||
489 | { | ||
490 | sl += activeServers->text(i); | ||
491 | } | ||
492 | return sl; | ||
493 | } | ||
472 | 494 | ||
473 | /** returns the destination listed in ipkg.conf */ | 495 | /** returns the destination listed in ipkg.conf */ |
474 | QStringList PackageManagerSettings::getDestinationUrls() | 496 | QStringList PackageManagerSettings::getDestinationUrls() |
475 | { | 497 | { |
476 | QStringList sl; | 498 | QStringList sl; |
477 | for (int i=0; i<(int)destinations->count(); i++) | 499 | for (int i=0; i<(int)destinations->count(); i++) |
478 | { | 500 | { |
479 | sl += *destinationurlDic[i]; | 501 | sl += *destinationurlDic[i]; |
480 | } | 502 | } |
481 | return sl; | 503 | return sl; |
482 | } | 504 | } |
483 | 505 | ||
484 | /** returns the destination listed in ipkg.conf */ | 506 | /** returns the destination listed in ipkg.conf */ |
485 | QString PackageManagerSettings::getDestinationUrlByName(QString n) | 507 | QString PackageManagerSettings::getDestinationUrlByName(QString n) |
486 | { | 508 | { |
487 | QStringList sl; | 509 | QStringList sl; |
488 | for (int i=0; i<(int)destinations->count(); i++) | 510 | for (int i=0; i<(int)destinations->count(); i++) |
489 | { | 511 | { |
490 | if ( n == destinations->text(i)) return*destinationurlDic[i]; | 512 | if ( n == destinations->text(i)) return*destinationurlDic[i]; |
491 | } | 513 | } |
492 | return ""; | 514 | return ""; |
493 | } | 515 | } |
494 | 516 | ||
495 | /** returns the destination listed in ipkg.conf */ | 517 | /** returns the destination listed in ipkg.conf */ |
496 | QStringList PackageManagerSettings::getDestinationNames() | 518 | QStringList PackageManagerSettings::getDestinationNames() |
497 | { | 519 | { |
498 | QStringList sl; | 520 | QStringList sl; |
499 | for (int i=0; i<(int)destinations->count(); i++) | 521 | for (int i=0; i<(int)destinations->count(); i++) |
500 | { | 522 | { |
501 | sl += destinations->text(i); | 523 | sl += destinations->text(i); |
502 | } | 524 | } |
503 | return sl; | 525 | return sl; |
504 | } | 526 | } |
505 | 527 | ||
506 | 528 | ||
507 | void PackageManagerSettings::linkEnabled( bool b ) | 529 | void PackageManagerSettings::linkEnabled( bool b ) |
508 | { | 530 | { |
509 | changed = true; | ||
510 | activeLinkDestination->setEnabled( b ); | 531 | activeLinkDestination->setEnabled( b ); |
511 | } | 532 | } |
533 | |||
534 | void PackageManagerSettings::activeServerChanged() | ||
535 | { | ||
536 | changed = true; | ||
537 | } | ||
538 | |||
539 | QComboBox* PackageManagerSettings::getDestCombo() | ||
540 | { | ||
541 | return new QComboBox(activeDestination); | ||
542 | } | ||
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index 11ba55c..fbb3b99 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h | |||
@@ -1,64 +1,68 @@ | |||
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 <qintdict.h> | 5 | #include <qintdict.h> |
6 | 6 | ||
7 | 7 | ||
8 | class PackageManagerSettings : private PackageManagerSettingsBase | 8 | class PackageManagerSettings : private PackageManagerSettingsBase |
9 | { | 9 | { |
10 | // Q_OBJECT | 10 | // Q_OBJECT |
11 | public: | 11 | public: |
12 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 12 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
13 | ~PackageManagerSettings(); | 13 | ~PackageManagerSettings(); |
14 | 14 | ||
15 | bool showDialog( int ) ; | 15 | bool showDialog( int ) ; |
16 | QString getDestinationUrl(); | 16 | QString getDestinationUrl(); |
17 | QString getDestinationName(); | 17 | QString getDestinationName(); |
18 | QString getLinkDestinationName(); | 18 | QString getLinkDestinationName(); |
19 | bool createLinks(); | 19 | bool createLinks(); |
20 | QStringList getServers(); | ||
20 | QStringList getActiveServers(); | 21 | QStringList getActiveServers(); |
21 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
22 | QStringList getDestinationNames(); | 23 | QStringList getDestinationNames(); |
23 | QString getDestinationUrlByName(QString); | 24 | QString getDestinationUrlByName(QString); |
25 | /** No descriptions */ | ||
26 | QComboBox* getDestCombo(); | ||
24 | 27 | ||
25 | private: | 28 | private: |
26 | QIntDict<QString> serverurlDic; | 29 | QIntDict<QString> serverurlDic; |
27 | QIntDict<QString> destinationurlDic; | 30 | QIntDict<QString> destinationurlDic; |
28 | int ipkg_old; | 31 | int ipkg_old; |
29 | int editedserver; | 32 | int editedserver; |
30 | int editeddestination; | 33 | int editeddestination; |
31 | int currentSetting; | 34 | int currentSetting; |
32 | int installationSettingsCount; | 35 | int installationSettingsCount; |
33 | bool changed; | 36 | bool changed; |
34 | 37 | ||
35 | bool readIpkgConfig(const QString&); | 38 | bool readIpkgConfig(const QString&); |
36 | void writeIpkgConfig(const QString&); | 39 | void writeIpkgConfig(const QString&); |
37 | void writeSettings(); | 40 | void writeSettings(); |
38 | void readSettings(); | 41 | void readSettings(); |
39 | 42 | ||
40 | public slots: | 43 | public slots: |
41 | void writeInstallationSettings(); | 44 | void writeInstallationSettings(); |
42 | void readInstallationSettings(); | 45 | void readInstallationSettings(); |
43 | void writeCurrentInstallationSetting(); | 46 | void writeCurrentInstallationSetting(); |
44 | void readInstallationSetting(int); | 47 | void readInstallationSetting(int); |
45 | void installationSettingSetName(const QString &); | 48 | void installationSettingSetName(const QString &); |
46 | 49 | ||
47 | void newServer(); | 50 | void newServer(); |
48 | void editServer(int); | 51 | void editServer(int); |
49 | void removeDestination(); | 52 | void removeDestination(); |
50 | void newDestination(); | 53 | void newDestination(); |
51 | void editDestination(int); | 54 | void editDestination(int); |
52 | void linkEnabled(bool); | 55 | void linkEnabled(bool); |
53 | void removeServer(); | 56 | void removeServer(); |
54 | void serverNameChanged(const QString&); | 57 | void serverNameChanged(const QString&); |
55 | void serverUrlChanged(const QString&); | 58 | void serverUrlChanged(const QString&); |
56 | void destNameChanged(const QString&); | 59 | void destNameChanged(const QString&); |
57 | void destUrlChanged(const QString&); | 60 | void destUrlChanged(const QString&); |
58 | void installationSettingChange(int); | 61 | void installationSettingChange(int); |
59 | void newInstallationSetting(); | 62 | void newInstallationSetting(); |
60 | void removeInstallationSetting(); | 63 | void removeInstallationSetting(); |
61 | void renameInstallationSetting(); | 64 | void renameInstallationSetting(); |
65 | void activeServerChanged(); | ||
62 | }; | 66 | }; |
63 | 67 | ||
64 | #endif | 68 | #endif |
diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui index 196a89f..fd6d208 100644 --- a/noncore/unsupported/oipkg/pksettingsbase.ui +++ b/noncore/unsupported/oipkg/pksettingsbase.ui | |||
@@ -1,38 +1,38 @@ | |||
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>349</width> | 14 | <width>345</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> |
@@ -155,49 +155,49 @@ | |||
155 | </widget> | 155 | </widget> |
156 | <widget row="6" column="0" > | 156 | <widget row="6" column="0" > |
157 | <class>QLayoutWidget</class> | 157 | <class>QLayoutWidget</class> |
158 | <property stdset="1"> | 158 | <property stdset="1"> |
159 | <name>name</name> | 159 | <name>name</name> |
160 | <cstring>Layout9</cstring> | 160 | <cstring>Layout9</cstring> |
161 | </property> | 161 | </property> |
162 | <hbox> | 162 | <hbox> |
163 | <property stdset="1"> | 163 | <property stdset="1"> |
164 | <name>margin</name> | 164 | <name>margin</name> |
165 | <number>0</number> | 165 | <number>0</number> |
166 | </property> | 166 | </property> |
167 | <property stdset="1"> | 167 | <property stdset="1"> |
168 | <name>spacing</name> | 168 | <name>spacing</name> |
169 | <number>6</number> | 169 | <number>6</number> |
170 | </property> | 170 | </property> |
171 | <widget> | 171 | <widget> |
172 | <class>QCheckBox</class> | 172 | <class>QCheckBox</class> |
173 | <property stdset="1"> | 173 | <property stdset="1"> |
174 | <name>name</name> | 174 | <name>name</name> |
175 | <cstring>CheckBoxLink</cstring> | 175 | <cstring>CheckBoxLink</cstring> |
176 | </property> | 176 | </property> |
177 | <property stdset="1"> | 177 | <property stdset="1"> |
178 | <name>text</name> | 178 | <name>text</name> |
179 | <string>Link Destination: root</string> | 179 | <string>Link to root destination</string> |
180 | </property> | 180 | </property> |
181 | </widget> | 181 | </widget> |
182 | <widget> | 182 | <widget> |
183 | <class>QComboBox</class> | 183 | <class>QComboBox</class> |
184 | <property stdset="1"> | 184 | <property stdset="1"> |
185 | <name>name</name> | 185 | <name>name</name> |
186 | <cstring>activeLinkDestination</cstring> | 186 | <cstring>activeLinkDestination</cstring> |
187 | </property> | 187 | </property> |
188 | <property stdset="1"> | 188 | <property stdset="1"> |
189 | <name>enabled</name> | 189 | <name>enabled</name> |
190 | <bool>false</bool> | 190 | <bool>false</bool> |
191 | </property> | 191 | </property> |
192 | </widget> | 192 | </widget> |
193 | </hbox> | 193 | </hbox> |
194 | </widget> | 194 | </widget> |
195 | <widget row="3" column="0" > | 195 | <widget row="3" column="0" > |
196 | <class>QLayoutWidget</class> | 196 | <class>QLayoutWidget</class> |
197 | <property stdset="1"> | 197 | <property stdset="1"> |
198 | <name>name</name> | 198 | <name>name</name> |
199 | <cstring>Layout13</cstring> | 199 | <cstring>Layout13</cstring> |
200 | </property> | 200 | </property> |
201 | <hbox> | 201 | <hbox> |
202 | <property stdset="1"> | 202 | <property stdset="1"> |
203 | <name>margin</name> | 203 | <name>margin</name> |
@@ -697,42 +697,61 @@ | |||
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 | </grid> | 715 | </grid> |
716 | </widget> | 716 | </widget> |
717 | </widget> | 717 | </widget> |
718 | </grid> | 718 | </grid> |
719 | </widget> | 719 | </widget> |
720 | <connections> | 720 | <connections> |
721 | <connection> | ||
722 | <sender>activeServers</sender> | ||
723 | <signal>pressed(QListBoxItem*)</signal> | ||
724 | <receiver>Form4</receiver> | ||
725 | <slot>activeServerChanged()</slot> | ||
726 | </connection> | ||
727 | <connection> | ||
728 | <sender>activeServers</sender> | ||
729 | <signal>selectionChanged(QListBoxItem*)</signal> | ||
730 | <receiver>Form4</receiver> | ||
731 | <slot>activeServerChanged()</slot> | ||
732 | </connection> | ||
733 | <connection> | ||
734 | <sender>activeServers</sender> | ||
735 | <signal>pressed(QListBoxItem*)</signal> | ||
736 | <receiver>Form4</receiver> | ||
737 | <slot>activeServerChanged()</slot> | ||
738 | </connection> | ||
721 | <slot access="public">destNameChanged(const QString&)</slot> | 739 | <slot access="public">destNameChanged(const QString&)</slot> |
722 | <slot access="public">destUrlChanged(const QString&)</slot> | 740 | <slot access="public">destUrlChanged(const QString&)</slot> |
723 | <slot access="public">editDestination(int)</slot> | 741 | <slot access="public">editDestination(int)</slot> |
724 | <slot access="public">editServer(int)</slot> | 742 | <slot access="public">editServer(int)</slot> |
725 | <slot access="public">installationSettingChange(int)</slot> | 743 | <slot access="public">installationSettingChange(int)</slot> |
726 | <slot access="public">installationSettingSetName(const QString &)</slot> | 744 | <slot access="public">installationSettingSetName(const QString &)</slot> |
727 | <slot access="public">linkEnabled(bool)</slot> | 745 | <slot access="public">linkEnabled(bool)</slot> |
728 | <slot access="public">newDestination()</slot> | 746 | <slot access="public">newDestination()</slot> |
729 | <slot access="public">newInstallationSetting()</slot> | 747 | <slot access="public">newInstallationSetting()</slot> |
730 | <slot access="public">newServer()</slot> | 748 | <slot access="public">newServer()</slot> |
749 | <slot access="public">activeServerChanged()</slot> | ||
731 | <slot access="public">removeDestination()</slot> | 750 | <slot access="public">removeDestination()</slot> |
732 | <slot access="public">removeInstallationSetting()</slot> | 751 | <slot access="public">removeInstallationSetting()</slot> |
733 | <slot access="public">removeServer()</slot> | 752 | <slot access="public">removeServer()</slot> |
734 | <slot access="public">renameInstallationSetting()</slot> | 753 | <slot access="public">renameInstallationSetting()</slot> |
735 | <slot access="public">serverNameChanged(const QString&)</slot> | 754 | <slot access="public">serverNameChanged(const QString&)</slot> |
736 | <slot access="public">serverUrlChanged(const QString&)</slot> | 755 | <slot access="public">serverUrlChanged(const QString&)</slot> |
737 | </connections> | 756 | </connections> |
738 | </UI> | 757 | </UI> |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index ecc97b2..9f6429a 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,388 +1,460 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 2 | #include "pksettings.h" |
3 | #include "package.h" | 3 | #include "package.h" |
4 | #include "packagelistitem.h" | 4 | #include "packagelistitem.h" |
5 | 5 | ||
6 | #include <qpe/process.h> | 6 | #include <qpe/process.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
9 | #include <qpe/stringutil.h> | 9 | #include <qpe/stringutil.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qgroupbox.h> | ||
12 | #include <qmultilineedit.h> | 13 | #include <qmultilineedit.h> |
13 | #include <qstring.h> | 14 | #include <qstring.h> |
14 | #include <qcheckbox.h> | 15 | #include <qcheckbox.h> |
15 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
16 | #include <qtextview.h> | 17 | #include <qtextview.h> |
17 | 18 | ||
18 | #include <qprogressbar.h> | 19 | #include <qprogressbar.h> |
19 | #include <qpushbutton.h> | 20 | #include <qpushbutton.h> |
20 | #include <qlayout.h> | 21 | #include <qlayout.h> |
21 | 22 | ||
22 | #include <stdlib.h> | 23 | #include <stdlib.h> |
23 | #include <unistd.h> | 24 | #include <unistd.h> |
24 | 25 | ||
25 | #include "mainwindow.h" | 26 | #include "mainwindow.h" |
26 | 27 | ||
27 | 28 | ||
28 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
29 | : QObject ( p ) | 30 | : QObject ( p ) |
30 | { | 31 | { |
31 | settings = s; | 32 | settings = s; |
32 | runwindowopen = false; | 33 | runwindowopen = false; |
33 | runwindow = new RunWindow( p, name, true, f ); | 34 | runwindow = new RunWindow( p, name, true, f ); |
34 | } | 35 | } |
35 | 36 | ||
36 | PmIpkg::~PmIpkg() | 37 | PmIpkg::~PmIpkg() |
37 | { | 38 | { |
38 | } | 39 | } |
39 | 40 | ||
40 | //#define PROC | 41 | //#define PROC |
41 | #define SYSTEM | 42 | #define SYSTEM |
42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | 43 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
43 | { | 44 | { |
44 | pvDebug(2,"PmIpkg::runIpkg "+args); | 45 | pvDebug(2,"PmIpkg::runIpkg "+args); |
45 | 46 | ||
46 | #ifdef PROC | 47 | #ifdef PROC |
47 | QStringList cmd = "/usr/bin/ipkg "; | 48 | QStringList cmd = "/usr/bin/ipkg "; |
48 | #endif | 49 | #endif |
49 | #ifdef SYSTEM | 50 | #ifdef SYSTEM |
50 | QString cmd = "/usr/bin/ipkg "; | 51 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | 52 | #endif |
52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 53 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
53 | if ( dest == "" ) | 54 | if ( dest == "" ) |
54 | cmd += " -dest "+settings->getDestinationName(); | 55 | cmd += " -dest "+settings->getDestinationName(); |
55 | else | 56 | else |
56 | cmd += " -dest "+ dest; | 57 | cmd += " -dest "+ dest; |
57 | 58 | ||
58 | cmd += " -force-defaults "; | 59 | cmd += " -force-defaults "; |
59 | 60 | ||
60 | // if (runwindow->forcedepends->isChecked()) | 61 | if (_force_depends) |
61 | // cmd += " -force-depends "; | 62 | { |
63 | if (_force_depends->isChecked()) | ||
64 | cmd += " -force-depends "; | ||
65 | if (_force_reinstall->isChecked()) | ||
66 | cmd += " -force-reinstall "; | ||
67 | if (_force_remove->isChecked()) | ||
68 | cmd += " -force-removal-of-essential-packages "; | ||
69 | } | ||
62 | 70 | ||
63 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 71 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
64 | cmd += args; | 72 | cmd += args; |
65 | int r = 0; | 73 | int r = 0; |
66 | #ifdef PROC | 74 | #ifdef PROC |
67 | QString o = "start"; | 75 | QString o = "start"; |
68 | Process *ipkg = new Process( "ls");//cmd ); | 76 | Process *ipkg = new Process( "ls");//cmd ); |
69 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | 77 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); |
70 | QString description; | 78 | QString description; |
71 | ipkg->exec("",o); | 79 | ipkg->exec("",o); |
72 | // out( o ); | 80 | // out( o ); |
73 | #endif | 81 | #endif |
74 | #ifdef SYSTEM | 82 | #ifdef SYSTEM |
75 | out( "running:<br>\n"+cmd+"<br>\n" ); | 83 | out( "running:<br>\n"+cmd+"<br>\n" ); |
76 | QString redirect = "/tmp/oipkg.pipe"; | 84 | QString redirect = "/tmp/oipkg.pipe"; |
77 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 85 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
78 | pvDebug(2, "running >"+cmd+"<"); | 86 | pvDebug(2, "running >"+cmd+"<"); |
79 | r = system(cmd.latin1()); | 87 | r = system(cmd.latin1()); |
80 | QFile f( redirect ); | 88 | QFile f( redirect ); |
81 | QString line; | 89 | QString line; |
82 | QString oldLine; | 90 | QString oldLine; |
83 | while ( ! f.open(IO_ReadOnly) ) {}; | 91 | while ( ! f.open(IO_ReadOnly) ) {}; |
84 | // { | ||
85 | QTextStream t( &f ); | 92 | QTextStream t( &f ); |
86 | // QString fp; | ||
87 | while ( !t.eof() ) | 93 | while ( !t.eof() ) |
88 | { | 94 | { |
89 | line = t.readLine(); | 95 | line = t.readLine(); |
90 | if ( line != oldLine ) | 96 | if ( line != oldLine ) |
91 | { | 97 | { |
92 | out( line +"<br>" ); | 98 | out( line +"<br>" ); |
93 | oldLine = line; | 99 | oldLine = line; |
94 | } | 100 | } |
95 | } | 101 | } |
96 | // } | ||
97 | f.close(); | 102 | f.close(); |
98 | out( "Finished!<br>"); | 103 | out( "Finished!<br>"); |
99 | #endif | 104 | #endif |
100 | 105 | ||
101 | return r; | 106 | return r; |
102 | } | 107 | } |
103 | 108 | ||
104 | void PmIpkg::makeLinks(Package *pack) | 109 | void PmIpkg::makeLinks(Package *pack) |
105 | { | 110 | { |
106 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 111 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
107 | QString dest = settings->getDestinationUrlByName( pack->dest() ); | 112 | linkPackage( pack->name(), pack->dest() ); |
108 | if (dest == "/" ) return; | 113 | } |
114 | |||
115 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | ||
116 | { | ||
117 | QString dest = settings->getDestinationUrlByName( d ); | ||
118 | dest = dest==""?d:dest; | ||
119 | if (dest == "/" ) return 0; | ||
109 | { | 120 | { |
110 | Config cfg( "oipkg", Config::User ); | 121 | Config cfg( "oipkg", Config::User ); |
111 | cfg.setGroup( "Common" ); | 122 | cfg.setGroup( "Common" ); |
112 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 123 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
113 | } | 124 | } |
114 | QString fn = dest+"/"+statusDir+"/info/"+pack->name()+".list"; | 125 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
115 | linkPackage( fn, dest ); | 126 | QFile f( packFileName ); |
116 | } | 127 | if ( ! f.open(IO_ReadOnly) ) |
117 | |||
118 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
119 | { | ||
120 | QFile f( packFileName ); | ||
121 | if ( ! f.open(IO_ReadOnly) ) | ||
122 | { | 128 | { |
129 | pvDebug(1," Panik! Could not open"); | ||
123 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); | 130 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
124 | return; | 131 | return (QStringList*)0; |
125 | }; | 132 | } |
126 | out( "<br>creating links<br>" ); | 133 | QStringList *fileList = new QStringList(); |
127 | out("for package "+packFileName+" in "+dest+"<br>"); | ||
128 | QTextStream t( &f ); | 134 | QTextStream t( &f ); |
129 | QString fp; | ||
130 | while ( !t.eof() ) | 135 | while ( !t.eof() ) |
131 | { | 136 | { |
132 | fp = t.readLine(); | 137 | *fileList += t.readLine(); |
133 | processLinkDir( fp, dest ); | ||
134 | } | 138 | } |
135 | f.close(); | 139 | return fileList; |
136 | } | 140 | } |
137 | 141 | ||
142 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | ||
143 | { | ||
144 | QStringList *fileList = getList( packFileName, dest ); | ||
145 | processFileList( fileList, dest ); | ||
146 | delete fileList; | ||
147 | } | ||
148 | |||
149 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | ||
150 | { | ||
151 | if (!fileList) return; | ||
152 | for (uint i=0; i < fileList->count(); i++) | ||
153 | { | ||
154 | QString dest = settings->getDestinationUrlByName( d ); | ||
155 | dest = dest==""?d:dest; | ||
156 | processLinkDir( (*fileList)[i], dest ); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | |||
138 | void PmIpkg::processLinkDir( QString file, QString dest ) | 161 | void PmIpkg::processLinkDir( QString file, QString dest ) |
139 | { | 162 | { |
140 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); | 163 | pvDebug( 7,"PmIpkg::processLinkDir "+file+" to "+ dest); |
141 | if ( dest == "???" ) return; | 164 | if (linkOpp==createLink) pvDebug( 2,"opp: createLink"); |
165 | if (linkOpp==removeLink) pvDebug( 2,"opp:removeLink"); | ||
166 | if ( dest == "???" || dest == "" ) return; | ||
142 | QString destFile = file; | 167 | QString destFile = file; |
143 | file = dest+"/"+file; | 168 | file = dest+"/"+file; |
144 | if (file == dest) return; | 169 | if (file == dest) return; |
145 | QFileInfo fileInfo( file ); | 170 | QFileInfo fileInfo( file ); |
146 | if ( fileInfo.isDir() ) | 171 | if ( fileInfo.isDir() ) |
147 | { | 172 | { |
148 | QDir destDir( destFile ); | 173 | QDir destDir( destFile ); |
149 | destDir.mkdir( destFile, true ); | 174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
150 | QDir d( file ); | 175 | QDir d( file ); |
151 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 176 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
152 | const QFileInfoList *list = d.entryInfoList(); | 177 | const QFileInfoList *list = d.entryInfoList(); |
153 | QFileInfoListIterator it( *list ); | 178 | QFileInfoListIterator it( *list ); |
154 | QFileInfo *fi; | 179 | QFileInfo *fi; |
155 | while ( (fi=it.current()) ) | 180 | while ( (fi=it.current()) ) |
156 | { | 181 | { |
157 | // out( "<b>"+fi->absFilePath()+"</b>" ); | 182 | pvDebug(4, "process dir "+fi->absFilePath()); |
158 | processLinkDir( fi->absFilePath(), dest ); | 183 | processLinkDir( fi->absFilePath(), dest ); |
159 | ++it; | 184 | ++it; |
160 | } | 185 | } |
186 | // if (linkOpp==removeLink) | ||
187 | // { | ||
188 | // pvDebug(2,"remove destDir "+ destFile ); | ||
189 | // destDir.remove( destFile, true ); | ||
190 | // } | ||
161 | } else | 191 | } else |
162 | if ( fileInfo.isFile() ) | 192 | if ( fileInfo.isFile() ) |
163 | { | 193 | { |
164 | const char *instFile = strdup( (file).ascii() ); | 194 | const char *instFile = strdup( (file).ascii() ); |
165 | const char *linkFile = strdup( (destFile).ascii()); | 195 | const char *linkFile = strdup( (destFile).ascii()); |
166 | // out( "linking: "+file+" -> "+destFile ); | 196 | if( linkOpp==createLink ) |
167 | qDebug( "linking: %s -> %s", instFile, linkFile ); | 197 | { |
168 | symlink( instFile, linkFile ); | 198 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
199 | symlink( instFile, linkFile ); | ||
200 | } | ||
201 | } else { | ||
202 | const char *linkFile = strdup( (destFile).ascii()); | ||
203 | if( linkOpp==removeLink ) | ||
204 | { | ||
205 | pvDebug(4,"removing "+destFile+" no "+file); | ||
206 | QFileInfo toRemoveLink( destFile ); | ||
207 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | ||
208 | unlink( linkFile ); | ||
209 | } | ||
169 | } | 210 | } |
170 | } | 211 | } |
171 | 212 | ||
172 | void PmIpkg::commit( PackageList pl ) | 213 | void PmIpkg::commit( PackageList pl ) |
173 | { | 214 | { |
174 | int sizecount = 0; | 215 | int sizecount = 0; |
175 | to_install.clear(); | 216 | to_install.clear(); |
176 | to_remove.clear(); | 217 | to_remove.clear(); |
177 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | 218 | QString rem="<b>"+tr("To remove:")+"</b><br>\n"; |
178 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; | 219 | QString inst="<b>"+tr("To install:")+"</b><br>\n"; |
179 | pl.allPackages(); | ||
180 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 220 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
181 | { | 221 | { |
182 | if ( pack && (pack->name() != "") && pack) | 222 | if ( pack && (pack->name() != "") && pack) |
183 | { | 223 | { |
184 | if ( pack->toInstall() ) | 224 | if ( pack->toInstall() ) |
185 | { | 225 | { |
186 | to_install.append( pack ); | 226 | to_install.append( pack ); |
187 | sizecount += pack->size().toInt(); | 227 | sizecount += pack->size().toInt(); |
188 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; | 228 | inst += pack->name()+"\t("+tr("on ")+pack->dest()+")<br>"; |
189 | } | 229 | } |
190 | if ( pack->toRemove() ) | 230 | if ( pack->toRemove() ) |
191 | { | 231 | { |
192 | to_remove.append( pack ); | 232 | to_remove.append( pack ); |
193 | sizecount += 1; | 233 | sizecount += 1; |
194 | rem += pack->name()+"<br>"; | 234 | rem += pack->name()+"<br>"; |
195 | } | 235 | } |
196 | } | 236 | } |
197 | } | 237 | } |
198 | 238 | ||
199 | startDialog(); | 239 | startDialog(); |
200 | 240 | ||
201 | } | 241 | } |
202 | 242 | ||
203 | void PmIpkg::startDialog() | 243 | void PmIpkg::startDialog() |
204 | { | 244 | { |
205 | installDialog = new QDialog(0,0,true); | 245 | installDialog = new QDialog(0,0,true); |
206 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 246 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); |
207 | RunWindowLayout->setSpacing( 2 ); | 247 | RunWindowLayout->setSpacing( 2 ); |
208 | RunWindowLayout->setMargin( 2 ); | 248 | RunWindowLayout->setMargin( 2 ); |
209 | 249 | ||
210 | QHBoxLayout *buttons = new QHBoxLayout; | ||
211 | buttons->setSpacing( 6 ); | ||
212 | buttons->setMargin( 0 ); | ||
213 | |||
214 | PackageListView *plv = new PackageListView(installDialog, "install",settings); | 250 | PackageListView *plv = new PackageListView(installDialog, "install",settings); |
251 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); | ||
215 | RunWindowLayout->addWidget( plv, 1, 0 ); | 252 | RunWindowLayout->addWidget( plv, 1, 0 ); |
253 | QCheckListItem *toRemoveItem; | ||
254 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); | ||
255 | toRemoveItem->setOpen( true ); | ||
216 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 256 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
217 | { | 257 | { |
218 | plv->insertItem( new PackageListItem(plv, it,settings) ); | 258 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); |
219 | } | 259 | } |
260 | QCheckListItem *toInstallItem; | ||
261 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); | ||
262 | toInstallItem->setOpen( true ); | ||
220 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 263 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
221 | { | 264 | { |
222 | plv->insertItem( new PackageListItem(plv, it,settings) ); | 265 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); |
223 | } | 266 | } |
224 | QPushButton *doItButton = new QPushButton( installDialog, "doItButton" ); | 267 | |
225 | doItButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, doItButton->sizePolicy().hasHeightForWidth() ) ); | 268 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); |
226 | QFont doItButton_font( doItButton->font() ); | 269 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().hasHeightForWidth() ) ); |
227 | doItButton_font.setPointSize( 8 ); | 270 | GroupBox1->setTitle( tr( "Ipkg options" ) ); |
228 | doItButton->setFont( doItButton_font ); | 271 | GroupBox1->setColumnLayout(0, Qt::Vertical ); |
229 | doItButton->setText( tr( "Do all " ) ); | 272 | GroupBox1->layout()->setSpacing( 0 ); |
230 | doItButton->setAutoResize( FALSE ); | 273 | GroupBox1->layout()->setMargin( 0 ); |
231 | buttons->addWidget( doItButton ); | 274 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); |
232 | 275 | GroupBox1Layout->setAlignment( Qt::AlignTop ); | |
233 | QPushButton *installButton = new QPushButton( installDialog, "installButton" ); | 276 | GroupBox1Layout->setSpacing( 3 ); |
234 | QFont installButton_font( installButton->font() ); | 277 | GroupBox1Layout->setMargin( 3 ); |
235 | installButton_font.setPointSize( 8 ); | 278 | |
236 | installButton->setFont( installButton_font ); | 279 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); |
237 | installButton->setText( tr( "Install" ) ); | 280 | _force_depends->setText( tr( "-force-depends" ) ); |
238 | installButton->setAutoResize( TRUE ); | 281 | _force_depends->setAutoResize( TRUE ); |
239 | buttons->addWidget( installButton ); | 282 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); |
240 | 283 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); | |
241 | QPushButton *removeButton = new QPushButton( installDialog, "removeButton" ); | 284 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
242 | QFont removeButton_font( removeButton->font() ); | 285 | _force_reinstall->setAutoResize( TRUE ); |
243 | removeButton_font.setPointSize( 7 ); | 286 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); |
244 | removeButton->setFont( removeButton_font ); | 287 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); |
245 | removeButton->setText( tr( "Remove" ) ); | 288 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
246 | removeButton->setAutoResize( TRUE ); | 289 | _force_remove->setAutoResize( TRUE ); |
247 | buttons->addWidget( removeButton ); | 290 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); |
248 | 291 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); | |
249 | QPushButton *cancelButton = new QPushButton( installDialog, "cancelButton" ); | 292 | |
250 | QFont cancelButton_font( cancelButton->font() ); | 293 | // connect( doItButton, SIGNAL( clicked() ), |
251 | cancelButton_font.setPointSize( 8 ); | 294 | // this, SLOT( doIt() ) ); |
252 | cancelButton->setFont( cancelButton_font ); | 295 | // connect( installButton, SIGNAL( clicked() ), |
253 | cancelButton->setText( tr( "Cancel" ) ); | 296 | // this, SLOT( install() ) ); |
254 | cancelButton->setAutoResize( TRUE ); | 297 | // connect( removeButton, SIGNAL( clicked() ), |
255 | buttons->addWidget( cancelButton ); | 298 | // this, SLOT( remove() ) ); |
256 | 299 | // connect( cancelButton, SIGNAL( clicked() ), | |
257 | RunWindowLayout->addLayout( buttons, 3, 0 ); | 300 | // installDialog, SLOT( close() ) ); |
258 | |||
259 | connect( doItButton, SIGNAL( clicked() ), | ||
260 | this, SLOT( doIt() ) ); | ||
261 | connect( installButton, SIGNAL( clicked() ), | ||
262 | this, SLOT( install() ) ); | ||
263 | connect( removeButton, SIGNAL( clicked() ), | ||
264 | this, SLOT( remove() ) ); | ||
265 | connect( cancelButton, SIGNAL( clicked() ), | ||
266 | installDialog, SLOT( close() ) ); | ||
267 | installDialog->showMaximized(); | 301 | installDialog->showMaximized(); |
268 | if ( installDialog->exec() ) doIt(); | 302 | if ( installDialog->exec() ) doIt(); |
269 | installDialog->close(); | 303 | installDialog->close(); |
304 | out(tr("<b>All done.</b>")); | ||
270 | } | 305 | } |
271 | 306 | ||
272 | void PmIpkg::doIt() | 307 | void PmIpkg::doIt() |
273 | { | 308 | { |
309 | show( true ); | ||
274 | remove(); | 310 | remove(); |
275 | install(); | 311 | install(); |
276 | } | 312 | } |
277 | 313 | ||
278 | 314 | ||
279 | void PmIpkg::remove() | 315 | void PmIpkg::remove() |
280 | { | 316 | { |
281 | if ( to_remove.count() == 0 ) return; | 317 | if ( to_remove.count() == 0 ) return; |
282 | installDialog->close(); | ||
283 | show( true ); | ||
284 | 318 | ||
285 | out("<hr><hr><b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br>"); | 319 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); |
286 | 320 | ||
321 | QStringList *fileList; | ||
287 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 322 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
288 | { | 323 | { |
324 | if ( it->link() )fileList = getList( it->name(), it->dest() ); | ||
289 | if ( runIpkg("remove " + it->name()) == 0) | 325 | if ( runIpkg("remove " + it->name()) == 0) |
290 | { | 326 | { |
291 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 327 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); |
292 | it->processed(); | 328 | linkOpp = removeLink; |
293 | runwindow->progress->setProgress( 1 ); | 329 | if ( it->link() ) |
330 | { | ||
331 | out( "<br>removing links<br>" ); | ||
332 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | ||
333 | processFileList( fileList, it->dest() ); | ||
334 | } | ||
335 | it->processed(); | ||
336 | out("<br><hr>"); | ||
294 | }else{ | 337 | }else{ |
295 | out("<b>"+tr("Error while removing")+"</b>"+it->name()); | 338 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); |
296 | } | 339 | } |
340 | pvDebug(2,"delete File List"); | ||
341 | if ( it->link() )delete fileList; | ||
297 | } | 342 | } |
343 | out("<br>"); | ||
298 | } | 344 | } |
299 | 345 | ||
300 | 346 | ||
301 | void PmIpkg::install() | 347 | void PmIpkg::install() |
302 | { | 348 | { |
303 | if ( to_install.count() == 0 ) return; | 349 | if ( to_install.count() == 0 ) return; |
304 | installDialog->close(); | 350 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
305 | show( true ); | ||
306 | out("<hr><hr><b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | ||
307 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 351 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
308 | { | 352 | { |
309 | 353 | ||
310 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) | 354 | if ( runIpkg("install " + it->getPackageName(), it->dest() ) == 0 ) |
311 | { | 355 | { |
312 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 356 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
357 | linkOpp = createLink; | ||
313 | if ( it->link() ) | 358 | if ( it->link() ) |
359 | { | ||
360 | out( "<br>creating links<br>" ); | ||
361 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | ||
314 | makeLinks( it ); | 362 | makeLinks( it ); |
363 | } | ||
315 | it->processed(); | 364 | it->processed(); |
365 | out("<br><hr>"); | ||
316 | }else{ | 366 | }else{ |
317 | out("<b>"+tr("Error while installing")+"</b>"+it->name()); | 367 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); |
318 | } | 368 | } |
319 | } | 369 | } |
370 | out("<br>"); | ||
320 | } | 371 | } |
321 | 372 | ||
322 | void PmIpkg::linkDestination( const QString msg, const QByteArray dest ) | 373 | void PmIpkg::createLinks( const QString &dest ) |
323 | { | 374 | { |
324 | qDebug("msg="+msg+" -- "+QString(dest) ); | 375 | pvDebug(2,"PmIpkg::createLinks "+dest); |
325 | // QDir d( src ); | 376 | linkOpp=createLink; |
326 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 377 | QString url = settings->getDestinationUrlByName( dest ); |
327 | //// if (! d.exists() ) return; | 378 | url = url==""?dest:url; |
328 | // const QFileInfoList *list = d.entryInfoList(); | 379 | processLinkDir( "/", url ); |
329 | // QFileInfoListIterator it( *list ); | 380 | } |
330 | // QFileInfo *fi; | 381 | |
331 | // while ( (fi=it.current()) ) { | 382 | void PmIpkg::removeLinks( const QString &dest ) |
332 | // processLinkDir( fi->absFilePath(), dest ); | 383 | { |
333 | // ++it; | 384 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
334 | // } | 385 | linkOpp=removeLink; |
386 | QString url = settings->getDestinationUrlByName( dest ); | ||
387 | url = url==""?dest:url; | ||
388 | processLinkDir( "/", url ); | ||
335 | } | 389 | } |
336 | 390 | ||
337 | void PmIpkg::update() | 391 | void PmIpkg::update() |
338 | { | 392 | { |
339 | show( false ); | 393 | show( false ); |
340 | runIpkg( "update" ); | 394 | runIpkg( "update" ); |
341 | runwindow->close(); | 395 | runwindow->close(); |
342 | } | 396 | } |
343 | 397 | ||
344 | void PmIpkg::out( QString o ) | 398 | void PmIpkg::out( QString o ) |
345 | { | 399 | { |
346 | runwindow->outPut->setText( runwindow->outPut->text()+o ); | 400 | runwindow->outPut->append(o); |
401 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); | ||
402 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); | ||
347 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 403 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
348 | } | 404 | } |
349 | 405 | ||
350 | 406 | ||
351 | void PmIpkg::showButtons(bool b) | 407 | void PmIpkg::showButtons(bool b) |
352 | { | 408 | { |
353 | if ( b ) | 409 | if ( b ) |
354 | { | 410 | { |
355 | runwindow->cancelButton->hide(); | 411 | runwindow->cancelButton->hide(); |
356 | runwindow->doItButton->hide(); | 412 | runwindow->doItButton->hide(); |
357 | runwindow->removeButton->hide(); | 413 | runwindow->removeButton->hide(); |
358 | runwindow->installButton->hide(); | 414 | runwindow->installButton->hide(); |
359 | }else{ | 415 | }else{ |
360 | runwindow->cancelButton->show(); | 416 | runwindow->cancelButton->show(); |
361 | runwindow->doItButton->show(); | 417 | runwindow->doItButton->show(); |
362 | runwindow->removeButton->show(); | 418 | runwindow->removeButton->show(); |
363 | runwindow->installButton->show(); | 419 | runwindow->installButton->show(); |
364 | 420 | ||
365 | } | 421 | } |
366 | } | 422 | } |
367 | 423 | ||
368 | void PmIpkg::show(bool b) | 424 | void PmIpkg::show(bool b) |
369 | { | 425 | { |
370 | if (!runwindow->isVisible()) | 426 | if (!runwindow->isVisible()) |
371 | runwindow->showMaximized(); | 427 | runwindow->showMaximized(); |
372 | showButtons(b); | 428 | showButtons(b); |
373 | if ( !b ) | 429 | if ( !b ) |
374 | runwindow->progress->hide(); | 430 | runwindow->progress->hide(); |
375 | else | 431 | else |
376 | runwindow->progress->show(); | 432 | runwindow->progress->show(); |
377 | } | 433 | } |
378 | 434 | ||
379 | void PmIpkg::installFile(const QString &fileName) | 435 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
380 | { | 436 | { |
381 | 437 | ||
382 | to_install.clear(); | 438 | to_install.clear(); |
383 | to_remove.clear(); | 439 | to_remove.clear(); |
384 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 440 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
385 | to_install.append( new Package(fileName,settings) ); | 441 | Package *p = new Package(fileName,settings); |
442 | if ( dest!="") p->setDest( dest ); | ||
443 | to_install.append( p ); | ||
444 | startDialog(); | ||
445 | delete p; | ||
446 | } | ||
447 | |||
448 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | ||
449 | { | ||
450 | |||
451 | to_install.clear(); | ||
452 | to_remove.clear(); | ||
453 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | ||
454 | Package *p = new Package(fileName,settings); | ||
455 | if ( dest!="") p->setDest( dest ); | ||
456 | to_remove.append( p ); | ||
386 | startDialog(); | 457 | startDialog(); |
458 | delete p; | ||
387 | } | 459 | } |
388 | 460 | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index c5e6255..0625032 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,52 +1,64 @@ | |||
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 | ||
15 | #define removeLink 1 | ||
16 | |||
14 | class Package; | 17 | class Package; |
15 | class PmIpkg : public QObject | 18 | class PmIpkg : public QObject |
16 | { | 19 | { |
17 | Q_OBJECT | 20 | Q_OBJECT |
18 | public: | 21 | public: |
19 | 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 ); |
20 | ~PmIpkg(); | 23 | ~PmIpkg(); |
21 | 24 | ||
25 | int linkOpp; | ||
22 | void commit( PackageList ); | 26 | void commit( PackageList ); |
23 | void update(); | 27 | void update(); |
24 | PackageList* getPackageList(); | 28 | // PackageList* getPackageList(); |
25 | void showButtons(bool b=true); | 29 | void showButtons(bool b=true); |
26 | void show( bool buttons=true ); | 30 | void show( bool buttons=true ); |
27 | 31 | ||
32 | public slots: | ||
33 | void doIt(); | ||
34 | void install(); | ||
35 | void remove(); | ||
36 | void installFile(const QString &fileName, const QString &dest=""); | ||
37 | void removeFile(const QString &fileName, const QString &dest=""); | ||
38 | void createLinks( const QString &dest ); | ||
39 | void removeLinks( const QString &dest ); | ||
40 | |||
28 | private: | 41 | private: |
29 | PackageManagerSettings* settings; | 42 | PackageManagerSettings* settings; |
30 | RunWindow *runwindow; | 43 | RunWindow *runwindow; |
31 | QDialog *installDialog; | 44 | QDialog *installDialog; |
32 | QList<Package> to_remove; | 45 | QList<Package> to_remove; |
33 | QList<Package> to_install; | 46 | QList<Package> to_install; |
34 | bool runwindowopen; | 47 | bool runwindowopen; |
35 | QString fileNameToInstall; | 48 | QString fileNameToInstall; |
36 | 49 | QCheckBox *_force_reinstall; | |
50 | QCheckBox *_force_remove; | ||
51 | QCheckBox *_force_depends; | ||
37 | void startDialog(); | 52 | void startDialog(); |
38 | void makeLinks(Package*); | 53 | void makeLinks(Package*); |
39 | void linkPackage( QString, QString ); | 54 | void linkPackage( QString, QString ); |
40 | void processLinkDir( QString, QString ); | 55 | void processLinkDir( QString , QString ); |
41 | int runIpkg(const QString& args, const QString& dest="" ); | 56 | int runIpkg(const QString& args, const QString& dest="" ); |
42 | void out( QString ); | 57 | void out( QString ); |
58 | QStringList* getList( QString, QString ); | ||
59 | void processFileList( QStringList*, QString ); | ||
60 | |||
43 | 61 | ||
44 | public slots: | ||
45 | void doIt(); | ||
46 | void install(); | ||
47 | void remove(); | ||
48 | void installFile(const QString &fileName); | ||
49 | void linkDestination( const QString, const QByteArray ); | ||
50 | }; | 62 | }; |
51 | 63 | ||
52 | #endif | 64 | #endif |
diff --git a/noncore/unsupported/oipkg/settings.cpp b/noncore/unsupported/oipkg/settings.cpp index 2b324be..8f91995 100644 --- a/noncore/unsupported/oipkg/settings.cpp +++ b/noncore/unsupported/oipkg/settings.cpp | |||
@@ -413,24 +413,29 @@ QStringList PackageManagerSettings::getActiveServers() | |||
413 | QStringList sl; | 413 | QStringList sl; |
414 | for (int i=0; i<(int)activeServers->count(); i++) | 414 | for (int i=0; i<(int)activeServers->count(); i++) |
415 | { | 415 | { |
416 | if ( activeServers->isSelected(i) ) | 416 | if ( activeServers->isSelected(i) ) |
417 | sl += activeServers->text(i); | 417 | sl += activeServers->text(i); |
418 | } | 418 | } |
419 | return sl; | 419 | return sl; |
420 | } | 420 | } |
421 | 421 | ||
422 | /** returns the destination listed in ipkg.conf */ | 422 | /** returns the destination listed in ipkg.conf */ |
423 | QStringList PackageManagerSettings::getDestinationUrls() | 423 | QStringList PackageManagerSettings::getDestinationUrls() |
424 | { | 424 | { |
425 | QStringList sl; | 425 | QStringList sl; |
426 | for (int i=0; i<(int)destinations->count(); i++) | 426 | for (int i=0; i<(int)destinations->count(); i++) |
427 | { | 427 | { |
428 | sl += *destinationurlDic[i]; | 428 | sl += *destinationurlDic[i]; |
429 | } | 429 | } |
430 | return sl; | 430 | return sl; |
431 | } | 431 | } |
432 | 432 | ||
433 | void PackageManagerSettings::linkEnabled( bool b ) | 433 | void PackageManagerSettings::linkEnabled( bool b ) |
434 | { | 434 | { |
435 | activeLinkDestination->setEnabled( b ); | 435 | activeLinkDestination->setEnabled( b ); |
436 | } | 436 | } |
437 | |||
438 | void PackageManagerSettings::activeDestinationChange(int i) | ||
439 | { | ||
440 | activeLinkDestination->setCurrentItem( i ); | ||
441 | } \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index cf6e614..e2072f1 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -1,63 +1,63 @@ | |||
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 <qintdict.h> | 5 | #include <qintdict.h> |
6 | 6 | ||
7 | 7 | ||
8 | class PackageManagerSettings : public PackageManagerSettingsBase | 8 | class PackageManagerSettings : public PackageManagerSettingsBase |
9 | //class PackageManagerSettings : private PackageManagerSettingsBase | 9 | //class PackageManagerSettings : private PackageManagerSettingsBase |
10 | { | 10 | { |
11 | // Q_OBJECT | 11 | // Q_OBJECT |
12 | public: | 12 | public: |
13 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 13 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
14 | ~PackageManagerSettings(); | 14 | ~PackageManagerSettings(); |
15 | 15 | ||
16 | bool showDialog( int ) ; | 16 | bool showDialog( int ) ; |
17 | QString getDestinationUrl(); | 17 | QString getDestinationUrl(); |
18 | QString getDestinationName(); | 18 | QString getDestinationName(); |
19 | QString getLinkDestinationName(); | 19 | QString getLinkDestinationName(); |
20 | bool createLinks(); | 20 | bool createLinks(); |
21 | QStringList getActiveServers(); | 21 | QStringList getActiveServers(); |
22 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
23 | 23 | ||
24 | private: | ||
25 | QIntDict<QString> serverurlDic; | ||
26 | QIntDict<QString> destinationurlDic; | ||
27 | int ipkg_old; | ||
28 | int editedserver; | ||
29 | int editeddestination; | ||
30 | int currentSetting; | ||
31 | int installationSettingsCount; | ||
32 | bool changed; | ||
33 | |||
34 | bool readIpkgConfig(const QString&); | ||
35 | void writeIpkgConfig(const QString&); | ||
36 | void writeSettings(); | ||
37 | void readSettings(); | ||
38 | |||
39 | public slots: | 24 | public slots: |
40 | void writeInstallationSettings(); | 25 | void writeInstallationSettings(); |
41 | void readInstallationSettings(); | 26 | void readInstallationSettings(); |
42 | void writeCurrentInstallationSetting(); | 27 | void writeCurrentInstallationSetting(); |
43 | void readInstallationSetting(int); | 28 | void readInstallationSetting(int); |
44 | void installationSettingSetName(const QString &); | 29 | void installationSettingSetName(const QString &); |
45 | 30 | void activeDestinationChange(int) | |
46 | void newServer(); | 31 | void newServer(); |
47 | void editServer(int); | 32 | void editServer(int); |
48 | void removeDestination(); | 33 | void removeDestination(); |
49 | void newDestination(); | 34 | void newDestination(); |
50 | void editDestination(int); | 35 | void editDestination(int); |
51 | void linkEnabled(bool); | 36 | void linkEnabled(bool); |
52 | void removeServer(); | 37 | void removeServer(); |
53 | void serverNameChanged(const QString&); | 38 | void serverNameChanged(const QString&); |
54 | void serverUrlChanged(const QString&); | 39 | void serverUrlChanged(const QString&); |
55 | void destNameChanged(const QString&); | 40 | void destNameChanged(const QString&); |
56 | void destUrlChanged(const QString&); | 41 | void destUrlChanged(const QString&); |
57 | void installationSettingChange(int); | 42 | void installationSettingChange(int); |
58 | void newInstallationSetting(); | 43 | void newInstallationSetting(); |
59 | void removeInstallationSetting(); | 44 | void removeInstallationSetting(); |
60 | void renameInstallationSetting(); | 45 | void renameInstallationSetting(); |
46 | |||
47 | private: | ||
48 | QIntDict<QString> serverurlDic; | ||
49 | QIntDict<QString> destinationurlDic; | ||
50 | int ipkg_old; | ||
51 | int editedserver; | ||
52 | int editeddestination; | ||
53 | int currentSetting; | ||
54 | int installationSettingsCount; | ||
55 | bool changed; | ||
56 | |||
57 | bool readIpkgConfig(const QString&); | ||
58 | void writeIpkgConfig(const QString&); | ||
59 | void writeSettings(); | ||
60 | void readSettings(); | ||
61 | }; | 61 | }; |
62 | 62 | ||
63 | #endif | 63 | #endif |
diff --git a/noncore/unsupported/oipkg/utils.cpp b/noncore/unsupported/oipkg/utils.cpp new file mode 100644 index 0000000..13b17fb --- a/dev/null +++ b/noncore/unsupported/oipkg/utils.cpp | |||
@@ -0,0 +1,27 @@ | |||
1 | /*************************************************************************** | ||
2 | utils.cpp - description | ||
3 | ------------------- | ||
4 | begin : Sun Apr 28 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 <qcombobox.h> | ||
19 | #include <qstring.h> | ||
20 | #include "utils.h" | ||
21 | |||
22 | void setComboName( QComboBox* combo, QString s) | ||
23 | { | ||
24 | for ( int i = 0; i < combo->count(); i++) | ||
25 | if ( combo->text( i ) == s ) | ||
26 | combo->setCurrentItem( i ); | ||
27 | } \ No newline at end of file | ||
diff --git a/noncore/unsupported/oipkg/utils.h b/noncore/unsupported/oipkg/utils.h new file mode 100644 index 0000000..bb033c5 --- a/dev/null +++ b/noncore/unsupported/oipkg/utils.h | |||
@@ -0,0 +1,18 @@ | |||
1 | /*************************************************************************** | ||
2 | utils.h - description | ||
3 | ------------------- | ||
4 | begin : Sun Apr 28 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 | void setComboName( QComboBox*, QString ); \ No newline at end of file | ||