author | tille <tille> | 2002-05-04 17:12:04 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-04 17:12:04 (UTC) |
commit | d510e5a69762c8452b9d7b3d8122bc9fa85ed8b3 (patch) (unidiff) | |
tree | 28b9871643caac8c975008677a2a058a62e8f201 | |
parent | 4fe6b62e42697c68cd54ac3954ffc536e6f2c0f7 (diff) | |
download | opie-d510e5a69762c8452b9d7b3d8122bc9fa85ed8b3.zip opie-d510e5a69762c8452b9d7b3d8122bc9fa85ed8b3.tar.gz opie-d510e5a69762c8452b9d7b3d8122bc9fa85ed8b3.tar.bz2 |
popen thanks to ljp
but still does not work from the launcher
but only from the command line
-rw-r--r-- | noncore/unsupported/oipkg/main.cpp | 6 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 153 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/runwindow.ui | 118 |
5 files changed, 80 insertions, 206 deletions
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp index d98bcaa..bb3d1db 100644 --- a/noncore/unsupported/oipkg/main.cpp +++ b/noncore/unsupported/oipkg/main.cpp | |||
@@ -1,24 +1,24 @@ | |||
1 | 1 | ||
2 | #include "mainwindow.h" | 2 | #include "mainwindow.h" |
3 | 3 | ||
4 | #include <qpe/qpeapplication.h> | 4 | #include <qpe/qpeapplication.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | #include <qmessagebox.h> | 6 | //#include <qmessagebox.h> |
7 | int debugLevel; | 7 | int debugLevel; |
8 | 8 | ||
9 | int main( int argc, char ** argv ) | 9 | int main( int argc, char ** argv ) |
10 | { | 10 | { |
11 | 11 | ||
12 | debugLevel = 2; | 12 | debugLevel = 2; |
13 | if (argc > 1) | 13 | if (argc > 1) |
14 | { | 14 | { |
15 | debugLevel = QString ( argv[1] ).toInt(); | 15 | debugLevel = QString ( argv[1] ).toInt(); |
16 | qDebug("setting debug level to %i",debugLevel); | 16 | qDebug("setting debug level to %i",debugLevel); |
17 | } | 17 | } |
18 | QPEApplication a( argc, argv ); | 18 | QPEApplication a( argc, argv ); |
19 | MainWindow mw; | 19 | MainWindow mw; |
20 | if (argc > 2) | 20 | // if (argc > 2) |
21 | QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); | 21 | // QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); |
22 | a.showMainDocumentWidget( &mw ); | 22 | a.showMainDocumentWidget( &mw ); |
23 | return a.exec(); | 23 | return a.exec(); |
24 | } | 24 | } |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 55f915d..2fa91e3 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,492 +1,492 @@ | |||
1 | // adadpted form qpe/qipkg | 1 | // adadpted form qpe/qipkg |
2 | 2 | ||
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | 5 | ||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | #include <qpe/qpetoolbar.h> | 10 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 11 | #include <qpe/qcopenvelope_qws.h> |
12 | #include <qaction.h> | 12 | #include <qaction.h> |
13 | #include <qmessagebox.h> | 13 | #include <qmessagebox.h> |
14 | #include <qpopupmenu.h> | 14 | #include <qpopupmenu.h> |
15 | #include <qtoolbutton.h> | 15 | #include <qtoolbutton.h> |
16 | #include <qstring.h> | 16 | #include <qstring.h> |
17 | #include <qlabel.h> | 17 | #include <qlabel.h> |
18 | #include <qfile.h> | 18 | #include <qfile.h> |
19 | #include <qlistview.h> | 19 | #include <qlistview.h> |
20 | #include <qtextview.h> | 20 | #include <qtextview.h> |
21 | #include <qcheckbox.h> | 21 | #include <qcheckbox.h> |
22 | #include <qlineedit.h> | 22 | #include <qlineedit.h> |
23 | #include <qtabwidget.h> | 23 | #include <qtabwidget.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | 28 | ||
29 | #include "pksettingsbase.h" | 29 | #include "pksettingsbase.h" |
30 | #include "utils.h" | 30 | #include "utils.h" |
31 | #include "packagelistitem.h" | 31 | #include "packagelistitem.h" |
32 | 32 | ||
33 | 33 | ||
34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : |
35 | QMainWindow( parent, name, f ) | 35 | QMainWindow( parent, name, f ) |
36 | { | 36 | { |
37 | setCaption( tr("Package Manager") ); | 37 | setCaption( tr("Package Manager") ); |
38 | settings = new PackageManagerSettings(this,0,TRUE); | 38 | settings = new PackageManagerSettings(this,0,TRUE); |
39 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 39 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
40 | setCentralWidget( listViewPackages ); | 40 | setCentralWidget( listViewPackages ); |
41 | listViewPackages->addList( tr("feeds"), &packageListServers ); | 41 | listViewPackages->addList( tr("feeds"), &packageListServers ); |
42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | 42 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); |
43 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); | 43 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); |
44 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); | 44 | //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); |
45 | //wait = new QMessageBox(this); | 45 | //wait = new QMessageBox(this); |
46 | // wait->setText(tr("Please wait")); | 46 | // wait->setText(tr("Please wait")); |
47 | ipkg = new PmIpkg( settings, this ); | 47 | ipkg = new PmIpkg( settings, this ); |
48 | // settings->setIpkg( ipkg ); | 48 | // settings->setIpkg( ipkg ); |
49 | packageListServers.setSettings( settings ); | 49 | packageListServers.setSettings( settings ); |
50 | packageListSearch.setSettings( settings ); | 50 | packageListSearch.setSettings( settings ); |
51 | packageListDocLnk.setSettings( settings ); | 51 | packageListDocLnk.setSettings( settings ); |
52 | pvDebug(9,"packageListServers.update"); | 52 | pvDebug(9,"packageListServers.update"); |
53 | packageListServers.update(); | 53 | packageListServers.update(); |
54 | pvDebug(9,"packageListDocLnk.update"); | 54 | pvDebug(9,"packageListDocLnk.update"); |
55 | packageListDocLnk.update(); | 55 | packageListDocLnk.update(); |
56 | pvDebug(9,"makeMenu"); | 56 | pvDebug(9,"makeMenu"); |
57 | makeMenu(); | 57 | makeMenu(); |
58 | makeChannel(); | 58 | makeChannel(); |
59 | //opie is hardcoded default ;) | 59 | //opie is hardcoded default ;) |
60 | pvDebug(9,"section->setCurrentItem"); | 60 | pvDebug(9,"section->setCurrentItem"); |
61 | for (int i=0;i<section->count();i++) | 61 | for (int i=0;i<section->count();i++) |
62 | if (section->text(i)=="opie") | 62 | if (section->text(i)=="opie") |
63 | section->setCurrentItem(i); | 63 | section->setCurrentItem(i); |
64 | sectionChanged(); | 64 | sectionChanged(); |
65 | 65 | ||
66 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 66 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
67 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 67 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
68 | 68 | ||
69 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 69 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
70 | SLOT(removeLinks()) ); | 70 | SLOT(removeLinks()) ); |
71 | connect( settings->createLinksButton, SIGNAL( clicked()), | 71 | connect( settings->createLinksButton, SIGNAL( clicked()), |
72 | SLOT(createLinks()) ); | 72 | SLOT(createLinks()) ); |
73 | 73 | ||
74 | pvDebug(9,"displayList"); | 74 | pvDebug(9,"displayList"); |
75 | displayList(); | 75 | displayList(); |
76 | } | 76 | } |
77 | 77 | ||
78 | void MainWindow::makeMenu() | 78 | void MainWindow::makeMenu() |
79 | { | 79 | { |
80 | 80 | ||
81 | QPEToolBar *toolBar = new QPEToolBar( this ); | 81 | QPEToolBar *toolBar = new QPEToolBar( this ); |
82 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 82 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
83 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 83 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
84 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 84 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
85 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 85 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
86 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 86 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
87 | 87 | ||
88 | setToolBarsMovable( false ); | 88 | setToolBarsMovable( false ); |
89 | toolBar->setHorizontalStretchable( true ); | 89 | toolBar->setHorizontalStretchable( true ); |
90 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 90 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
91 | menuBar->insertItem( tr( "View" ), viewMenu ); | 91 | menuBar->insertItem( tr( "View" ), viewMenu ); |
92 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 92 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
93 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 93 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
94 | 94 | ||
95 | QLabel *spacer = new QLabel( "", toolBar ); | 95 | QLabel *spacer = new QLabel( "", toolBar ); |
96 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 96 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); |
97 | toolBar->setStretchableWidget( spacer ); | 97 | // toolBar->setStretchableWidget( spacer ); |
98 | 98 | ||
99 | 99 | ||
100 | runAction = new QAction( tr( "Apply" ), | 100 | runAction = new QAction( tr( "Apply" ), |
101 | Resource::loadPixmap( "oipkg/install" ), | 101 | Resource::loadPixmap( "oipkg/install" ), |
102 | QString::null, 0, this, 0 ); | 102 | QString::null, 0, this, 0 ); |
103 | connect( runAction, SIGNAL( activated() ), | 103 | connect( runAction, SIGNAL( activated() ), |
104 | this, SLOT( runIpkg() ) ); | 104 | this, SLOT( runIpkg() ) ); |
105 | runAction->addTo( toolBar ); | 105 | runAction->addTo( toolBar ); |
106 | runAction->addTo( srvMenu ); | 106 | runAction->addTo( srvMenu ); |
107 | 107 | ||
108 | srvMenu->insertSeparator (); | 108 | srvMenu->insertSeparator (); |
109 | 109 | ||
110 | updateAction = new QAction( tr( "Update" ), | 110 | updateAction = new QAction( tr( "Update" ), |
111 | Resource::loadIconSet( "oipkg/update" ), | 111 | Resource::loadIconSet( "oipkg/update" ), |
112 | QString::null, 0, this, 0 ); | 112 | QString::null, 0, this, 0 ); |
113 | connect( updateAction, SIGNAL( activated() ), | 113 | connect( updateAction, SIGNAL( activated() ), |
114 | this , SLOT( updateList() ) ); | 114 | this , SLOT( updateList() ) ); |
115 | updateAction->addTo( toolBar ); | 115 | updateAction->addTo( toolBar ); |
116 | updateAction->addTo( srvMenu ); | 116 | updateAction->addTo( srvMenu ); |
117 | 117 | ||
118 | QAction *cfgact; | 118 | QAction *cfgact; |
119 | 119 | ||
120 | cfgact = new QAction( tr( "Setups" ), | 120 | cfgact = new QAction( tr( "Setups" ), |
121 | QString::null, 0, this, 0 ); | 121 | QString::null, 0, this, 0 ); |
122 | connect( cfgact, SIGNAL( activated() ), | 122 | connect( cfgact, SIGNAL( activated() ), |
123 | SLOT( showSettings() ) ); | 123 | SLOT( showSettings() ) ); |
124 | cfgact->addTo( cfgMenu ); | 124 | cfgact->addTo( cfgMenu ); |
125 | 125 | ||
126 | cfgact = new QAction( tr( "Servers" ), | 126 | cfgact = new QAction( tr( "Servers" ), |
127 | QString::null, 0, this, 0 ); | 127 | QString::null, 0, this, 0 ); |
128 | connect( cfgact, SIGNAL( activated() ), | 128 | connect( cfgact, SIGNAL( activated() ), |
129 | SLOT( showSettingsSrv() ) ); | 129 | SLOT( showSettingsSrv() ) ); |
130 | cfgact->addTo( cfgMenu ); | 130 | cfgact->addTo( cfgMenu ); |
131 | cfgact = new QAction( tr( "Destinations" ), | 131 | cfgact = new QAction( tr( "Destinations" ), |
132 | QString::null, 0, this, 0 ); | 132 | QString::null, 0, this, 0 ); |
133 | connect( cfgact, SIGNAL( activated() ), | 133 | connect( cfgact, SIGNAL( activated() ), |
134 | SLOT( showSettingsDst() ) ); | 134 | SLOT( showSettingsDst() ) ); |
135 | cfgact->addTo( cfgMenu ); | 135 | cfgact->addTo( cfgMenu ); |
136 | 136 | ||
137 | QAction *a; | 137 | QAction *a; |
138 | 138 | ||
139 | // SECTIONS | 139 | // SECTIONS |
140 | sectionBar = new QPEToolBar( this ); | 140 | sectionBar = new QPEToolBar( this ); |
141 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 141 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
142 | sectionBar->setHorizontalStretchable( true ); | 142 | sectionBar->setHorizontalStretchable( true ); |
143 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 143 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
144 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 144 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
145 | sectionBar->setStretchableWidget( label ); | 145 | sectionBar->setStretchableWidget( label ); |
146 | section = new QComboBox( false, sectionBar ); | 146 | section = new QComboBox( false, sectionBar ); |
147 | label = new QLabel( " / ", sectionBar ); | 147 | label = new QLabel( " / ", sectionBar ); |
148 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 148 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
149 | subsection = new QComboBox( false, sectionBar ); | 149 | subsection = new QComboBox( false, sectionBar ); |
150 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 150 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
151 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 151 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
152 | a->addTo( sectionBar ); | 152 | a->addTo( sectionBar ); |
153 | setSections(); | 153 | setSections(); |
154 | setSubSections(); | 154 | setSubSections(); |
155 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 155 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
156 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 156 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
157 | sectionAction->setToggleAction( true ); | 157 | sectionAction->setToggleAction( true ); |
158 | sectionAction->addTo( viewMenu ); | 158 | sectionAction->addTo( viewMenu ); |
159 | 159 | ||
160 | //FIND | 160 | //FIND |
161 | findBar = new QPEToolBar(this); | 161 | findBar = new QPEToolBar(this); |
162 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); | 162 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
163 | label = new QLabel( tr("Filter: "), findBar ); | 163 | label = new QLabel( tr("Filter: "), findBar ); |
164 | label->setBackgroundColor( findBar->backgroundColor() ); | 164 | label->setBackgroundColor( findBar->backgroundColor() ); |
165 | findBar->setHorizontalStretchable( TRUE ); | 165 | findBar->setHorizontalStretchable( TRUE ); |
166 | findEdit = new QLineEdit( findBar, "findEdit" ); | 166 | findEdit = new QLineEdit( findBar, "findEdit" ); |
167 | findBar->setStretchableWidget( findEdit ); | 167 | findBar->setStretchableWidget( findEdit ); |
168 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 168 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
169 | this, SLOT( displayList() ) ); | 169 | this, SLOT( displayList() ) ); |
170 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 170 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
171 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 171 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
172 | a->addTo( findBar ); | 172 | a->addTo( findBar ); |
173 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 173 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
174 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 174 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
175 | a->addTo( findBar ); | 175 | a->addTo( findBar ); |
176 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); | 176 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
177 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 177 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
178 | findAction->setToggleAction( true ); | 178 | findAction->setToggleAction( true ); |
179 | findAction->addTo( viewMenu ); | 179 | findAction->addTo( viewMenu ); |
180 | 180 | ||
181 | //SEARCH | 181 | //SEARCH |
182 | searchBar = new QPEToolBar(this); | 182 | searchBar = new QPEToolBar(this); |
183 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 183 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
184 | label = new QLabel( tr("ipkgfind: "), searchBar ); | 184 | label = new QLabel( tr("ipkgfind: "), searchBar ); |
185 | label->setBackgroundColor( searchBar->backgroundColor() ); | 185 | label->setBackgroundColor( searchBar->backgroundColor() ); |
186 | searchBar->setHorizontalStretchable( TRUE ); | 186 | searchBar->setHorizontalStretchable( TRUE ); |
187 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 187 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
188 | searchBar->setStretchableWidget( searchEdit ); | 188 | searchBar->setStretchableWidget( searchEdit ); |
189 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 189 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
190 | // this, SLOT( displayList() ) ); | 190 | // this, SLOT( displayList() ) ); |
191 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 191 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
192 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | 192 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); |
193 | a->addTo( searchBar ); | 193 | a->addTo( searchBar ); |
194 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 194 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
195 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | 195 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); |
196 | searchCommit->addTo( searchBar ); | 196 | searchCommit->addTo( searchBar ); |
197 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 197 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
198 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | 198 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); |
199 | a->addTo( searchBar ); | 199 | a->addTo( searchBar ); |
200 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | 200 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); |
201 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | 201 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); |
202 | searchAction->setToggleAction( true ); | 202 | searchAction->setToggleAction( true ); |
203 | searchAction->addTo( viewMenu ); | 203 | searchAction->addTo( viewMenu ); |
204 | 204 | ||
205 | //DEST | 205 | //DEST |
206 | destBar = new QPEToolBar(this); | 206 | destBar = new QPEToolBar(this); |
207 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 207 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
208 | label = new QLabel( tr("Destination: "), destBar ); | 208 | label = new QLabel( tr("Destination: "), destBar ); |
209 | label->setBackgroundColor( destBar->backgroundColor() ); | 209 | label->setBackgroundColor( destBar->backgroundColor() ); |
210 | destBar->setHorizontalStretchable( TRUE ); | 210 | destBar->setHorizontalStretchable( TRUE ); |
211 | destination = new QComboBox( false, destBar ); | 211 | destination = new QComboBox( false, destBar ); |
212 | destination->insertStringList( settings->getDestinationNames() ); | 212 | destination->insertStringList( settings->getDestinationNames() ); |
213 | setComboName(destination,settings->getDestinationName()); | 213 | setComboName(destination,settings->getDestinationName()); |
214 | connect( destination, SIGNAL(activated(int)), | 214 | connect( destination, SIGNAL(activated(int)), |
215 | settings, SLOT(activeDestinationChange(int)) ); | 215 | settings, SLOT(activeDestinationChange(int)) ); |
216 | spacer = new QLabel( " ", destBar ); | 216 | spacer = new QLabel( " ", destBar ); |
217 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 217 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
218 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 218 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
219 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 219 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
220 | CheckBoxLink->setChecked( settings->createLinks() ); | 220 | CheckBoxLink->setChecked( settings->createLinks() ); |
221 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 221 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
222 | settings, SLOT(linkEnabled(bool)) ); | 222 | settings, SLOT(linkEnabled(bool)) ); |
223 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 223 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
224 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 224 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
225 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 225 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
226 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 226 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
227 | a->addTo( destBar ); | 227 | a->addTo( destBar ); |
228 | destBar->setStretchableWidget( CheckBoxLink ); | 228 | destBar->setStretchableWidget( CheckBoxLink ); |
229 | destAction->setToggleAction( true ); | 229 | destAction->setToggleAction( true ); |
230 | // destAction->addTo( viewMenu ); | 230 | // destAction->addTo( viewMenu ); |
231 | 231 | ||
232 | // configure the menus | 232 | // configure the menus |
233 | Config cfg( "oipkg", Config::User ); | 233 | Config cfg( "oipkg", Config::User ); |
234 | cfg.setGroup( "gui" ); | 234 | cfg.setGroup( "gui" ); |
235 | 235 | ||
236 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 236 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
237 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 237 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
238 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 238 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
239 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 239 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
240 | } | 240 | } |
241 | 241 | ||
242 | MainWindow::~MainWindow() | 242 | MainWindow::~MainWindow() |
243 | { | 243 | { |
244 | Config cfg( "oipkg", Config::User ); | 244 | Config cfg( "oipkg", Config::User ); |
245 | cfg.setGroup( "gui" ); | 245 | cfg.setGroup( "gui" ); |
246 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 246 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
247 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 247 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
248 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 248 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
249 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 249 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
250 | 250 | ||
251 | } | 251 | } |
252 | 252 | ||
253 | void MainWindow::runIpkg() | 253 | void MainWindow::runIpkg() |
254 | { | 254 | { |
255 | packageListServers.allPackages(); | 255 | packageListServers.allPackages(); |
256 | ipkg->loadList( &packageListSearch ); | 256 | ipkg->loadList( &packageListSearch ); |
257 | ipkg->loadList( &packageListDocLnk ); | 257 | ipkg->loadList( &packageListDocLnk ); |
258 | ipkg->loadList( &packageListServers ); | 258 | ipkg->loadList( &packageListServers ); |
259 | ipkg->commit(); | 259 | ipkg->commit(); |
260 | // ##### If we looked in the list of files, we could send out accurate | 260 | // ##### If we looked in the list of files, we could send out accurate |
261 | // ##### messages. But we don't bother yet, and just do an "all". | 261 | // ##### messages. But we don't bother yet, and just do an "all". |
262 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 262 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
263 | QString lf = QString::null; | 263 | QString lf = QString::null; |
264 | e << lf; | 264 | e << lf; |
265 | displayList(); | 265 | displayList(); |
266 | } | 266 | } |
267 | 267 | ||
268 | void MainWindow::updateList() | 268 | void MainWindow::updateList() |
269 | { | 269 | { |
270 | //wait->show(); | 270 | //wait->show(); |
271 | QTimer *t = new QTimer( this ); | 271 | QTimer *t = new QTimer( this ); |
272 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 272 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
273 | t->start( 0, false ); | 273 | t->start( 0, false ); |
274 | packageListServers.clear(); | 274 | packageListServers.clear(); |
275 | packageListSearch.clear(); | 275 | packageListSearch.clear(); |
276 | packageListDocLnk.clear(); | 276 | packageListDocLnk.clear(); |
277 | ipkg->update(); | 277 | ipkg->update(); |
278 | packageListServers.update(); | 278 | packageListServers.update(); |
279 | packageListSearch.update(); | 279 | packageListSearch.update(); |
280 | packageListDocLnk.update(); | 280 | packageListDocLnk.update(); |
281 | t->stop(); | 281 | t->stop(); |
282 | // wait->hide(); | 282 | // wait->hide(); |
283 | } | 283 | } |
284 | 284 | ||
285 | void MainWindow::filterList() | 285 | void MainWindow::filterList() |
286 | { | 286 | { |
287 | //wait->show(); | 287 | //wait->show(); |
288 | QString f = ""; | 288 | QString f = ""; |
289 | if ( findAction->isOn() ) f = findEdit->text(); | 289 | if ( findAction->isOn() ) f = findEdit->text(); |
290 | packageListServers.filterPackages( f ); | 290 | packageListServers.filterPackages( f ); |
291 | //wait->hide(); | 291 | //wait->hide(); |
292 | } | 292 | } |
293 | 293 | ||
294 | void MainWindow::displayList() | 294 | void MainWindow::displayList() |
295 | { | 295 | { |
296 | //wait->hide(); | 296 | //wait->hide(); |
297 | filterList(); | 297 | filterList(); |
298 | listViewPackages->display(); | 298 | listViewPackages->display(); |
299 | } | 299 | } |
300 | 300 | ||
301 | void MainWindow::sectionChanged() | 301 | void MainWindow::sectionChanged() |
302 | { | 302 | { |
303 | disconnect( section, SIGNAL( activated(int) ), | 303 | disconnect( section, SIGNAL( activated(int) ), |
304 | this, SLOT( sectionChanged() ) ); | 304 | this, SLOT( sectionChanged() ) ); |
305 | disconnect( subsection, SIGNAL(activated(int) ), | 305 | disconnect( subsection, SIGNAL(activated(int) ), |
306 | this, SLOT( subSectionChanged() ) ); | 306 | this, SLOT( subSectionChanged() ) ); |
307 | subsection->clear(); | 307 | subsection->clear(); |
308 | packageListServers.setSection( section->currentText() ); | 308 | packageListServers.setSection( section->currentText() ); |
309 | setSubSections(); | 309 | setSubSections(); |
310 | connect( section, SIGNAL( activated(int) ), | 310 | connect( section, SIGNAL( activated(int) ), |
311 | this, SLOT( sectionChanged() ) ); | 311 | this, SLOT( sectionChanged() ) ); |
312 | connect( subsection, SIGNAL(activated(int) ), | 312 | connect( subsection, SIGNAL(activated(int) ), |
313 | this, SLOT( subSectionChanged() ) ); | 313 | this, SLOT( subSectionChanged() ) ); |
314 | displayList(); | 314 | displayList(); |
315 | } | 315 | } |
316 | 316 | ||
317 | void MainWindow::subSectionChanged() | 317 | void MainWindow::subSectionChanged() |
318 | { | 318 | { |
319 | disconnect( section, SIGNAL( activated(int) ), | 319 | disconnect( section, SIGNAL( activated(int) ), |
320 | this, SLOT( sectionChanged() ) ); | 320 | this, SLOT( sectionChanged() ) ); |
321 | disconnect( subsection, SIGNAL(activated(int) ), | 321 | disconnect( subsection, SIGNAL(activated(int) ), |
322 | this, SLOT( subSectionChanged() ) ); | 322 | this, SLOT( subSectionChanged() ) ); |
323 | packageListServers.setSubSection( subsection->currentText() ); | 323 | packageListServers.setSubSection( subsection->currentText() ); |
324 | connect( section, SIGNAL( activated(int) ), | 324 | connect( section, SIGNAL( activated(int) ), |
325 | this, SLOT( sectionChanged() ) ); | 325 | this, SLOT( sectionChanged() ) ); |
326 | connect( subsection, SIGNAL(activated(int) ), | 326 | connect( subsection, SIGNAL(activated(int) ), |
327 | this, SLOT( subSectionChanged() ) ); | 327 | this, SLOT( subSectionChanged() ) ); |
328 | displayList(); | 328 | displayList(); |
329 | } | 329 | } |
330 | 330 | ||
331 | void MainWindow::setSections() | 331 | void MainWindow::setSections() |
332 | { | 332 | { |
333 | section->clear(); | 333 | section->clear(); |
334 | section->insertStringList( packageListServers.getSections() ); | 334 | section->insertStringList( packageListServers.getSections() ); |
335 | } | 335 | } |
336 | 336 | ||
337 | void MainWindow::setSubSections() | 337 | void MainWindow::setSubSections() |
338 | { | 338 | { |
339 | subsection->clear(); | 339 | subsection->clear(); |
340 | subsection->insertStringList( packageListServers.getSubSections() ); | 340 | subsection->insertStringList( packageListServers.getSubSections() ); |
341 | } | 341 | } |
342 | 342 | ||
343 | 343 | ||
344 | void MainWindow::showSettings() | 344 | void MainWindow::showSettings() |
345 | { | 345 | { |
346 | if ( settings->showDialog( 0 ) ) | 346 | if ( settings->showDialog( 0 ) ) |
347 | updateList(); | 347 | updateList(); |
348 | } | 348 | } |
349 | void MainWindow::showSettingsSrv() | 349 | void MainWindow::showSettingsSrv() |
350 | { | 350 | { |
351 | if ( settings->showDialog( 1 ) ) | 351 | if ( settings->showDialog( 1 ) ) |
352 | updateList(); | 352 | updateList(); |
353 | } | 353 | } |
354 | void MainWindow::showSettingsDst() | 354 | void MainWindow::showSettingsDst() |
355 | { | 355 | { |
356 | if ( settings->showDialog( 2 ) ) | 356 | if ( settings->showDialog( 2 ) ) |
357 | updateList(); | 357 | updateList(); |
358 | } | 358 | } |
359 | 359 | ||
360 | void MainWindow::sectionShow(bool b) | 360 | void MainWindow::sectionShow(bool b) |
361 | { | 361 | { |
362 | if (b) sectionBar->show(); | 362 | if (b) sectionBar->show(); |
363 | else sectionBar->hide(); | 363 | else sectionBar->hide(); |
364 | sectionAction->setOn( b ); | 364 | sectionAction->setOn( b ); |
365 | } | 365 | } |
366 | 366 | ||
367 | void MainWindow::sectionClose() | 367 | void MainWindow::sectionClose() |
368 | { | 368 | { |
369 | sectionAction->setOn( false ); | 369 | sectionAction->setOn( false ); |
370 | } | 370 | } |
371 | 371 | ||
372 | void MainWindow::findShow(bool b) | 372 | void MainWindow::findShow(bool b) |
373 | { | 373 | { |
374 | if (b) findBar->show(); | 374 | if (b) findBar->show(); |
375 | else findBar->hide(); | 375 | else findBar->hide(); |
376 | findAction->setOn( b ); | 376 | findAction->setOn( b ); |
377 | } | 377 | } |
378 | 378 | ||
379 | void MainWindow::findClose() | 379 | void MainWindow::findClose() |
380 | { | 380 | { |
381 | findAction->setOn( false ); | 381 | findAction->setOn( false ); |
382 | } | 382 | } |
383 | 383 | ||
384 | void MainWindow::searchShow(bool b) | 384 | void MainWindow::searchShow(bool b) |
385 | { | 385 | { |
386 | if (b) searchBar->show(); | 386 | if (b) searchBar->show(); |
387 | else searchBar->hide(); | 387 | else searchBar->hide(); |
388 | searchAction->setOn( b ); | 388 | searchAction->setOn( b ); |
389 | } | 389 | } |
390 | 390 | ||
391 | void MainWindow::searchClose() | 391 | void MainWindow::searchClose() |
392 | { | 392 | { |
393 | searchAction->setOn( false ); | 393 | searchAction->setOn( false ); |
394 | } | 394 | } |
395 | 395 | ||
396 | 396 | ||
397 | void MainWindow::destShow(bool b) | 397 | void MainWindow::destShow(bool b) |
398 | { | 398 | { |
399 | if (b) destBar->show(); | 399 | if (b) destBar->show(); |
400 | else destBar->hide(); | 400 | else destBar->hide(); |
401 | destAction->setOn( b ); | 401 | destAction->setOn( b ); |
402 | } | 402 | } |
403 | 403 | ||
404 | void MainWindow::destClose() | 404 | void MainWindow::destClose() |
405 | { | 405 | { |
406 | destAction->setOn( false ); | 406 | destAction->setOn( false ); |
407 | } | 407 | } |
408 | 408 | ||
409 | void MainWindow::rotateUpdateIcon() | 409 | void MainWindow::rotateUpdateIcon() |
410 | { | 410 | { |
411 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 411 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
412 | if ( updateIcon ) | 412 | if ( updateIcon ) |
413 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 413 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
414 | else | 414 | else |
415 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 415 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
416 | updateIcon = !updateIcon; | 416 | updateIcon = !updateIcon; |
417 | } | 417 | } |
418 | 418 | ||
419 | 419 | ||
420 | void MainWindow::setDocument(const QString &fileName) | 420 | void MainWindow::setDocument(const QString &fileName) |
421 | { | 421 | { |
422 | installFile(fileName); | 422 | installFile(fileName); |
423 | // ##### If we looked in the list of files, we could send out accurate | 423 | // ##### If we looked in the list of files, we could send out accurate |
424 | // ##### messages. But we don't bother yet, and just do an "all". | 424 | // ##### messages. But we don't bother yet, and just do an "all". |
425 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 425 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
426 | QString lf = QString::null; | 426 | QString lf = QString::null; |
427 | e << lf; | 427 | e << lf; |
428 | // displayList(); | 428 | // displayList(); |
429 | exit; | 429 | exit; |
430 | } | 430 | } |
431 | 431 | ||
432 | void MainWindow::installFile(const QString &fileName) | 432 | void MainWindow::installFile(const QString &fileName) |
433 | { | 433 | { |
434 | pvDebug(3, "MainWindow::installFile "+fileName); | 434 | pvDebug(3, "MainWindow::installFile "+fileName); |
435 | if ( !QFile::exists( fileName ) ) return; | 435 | if ( !QFile::exists( fileName ) ) return; |
436 | ipkg->installFile( fileName ); | 436 | ipkg->installFile( fileName ); |
437 | // ##### If we looked in the list of files, we could send out accurate | 437 | // ##### If we looked in the list of files, we could send out accurate |
438 | // ##### messages. But we don't bother yet, and just do an "all". | 438 | // ##### messages. But we don't bother yet, and just do an "all". |
439 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 439 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
440 | QString lf = QString::null; | 440 | QString lf = QString::null; |
441 | e << lf; | 441 | e << lf; |
442 | displayList(); | 442 | displayList(); |
443 | } | 443 | } |
444 | 444 | ||
445 | void MainWindow::makeChannel() | 445 | void MainWindow::makeChannel() |
446 | { | 446 | { |
447 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 447 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
448 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 448 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
449 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 449 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
450 | } | 450 | } |
451 | 451 | ||
452 | 452 | ||
453 | 453 | ||
454 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 454 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
455 | { | 455 | { |
456 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); | 456 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
457 | if ( msg == "installFile(QString)" ) | 457 | if ( msg == "installFile(QString)" ) |
458 | { | 458 | { |
459 | ipkg->installFile( QString(arg) ); | 459 | ipkg->installFile( QString(arg) ); |
460 | }else if( msg == "removeFile(QString)" ) | 460 | }else if( msg == "removeFile(QString)" ) |
461 | { | 461 | { |
462 | ipkg->removeFile( QString(arg) ); | 462 | ipkg->removeFile( QString(arg) ); |
463 | }else if( msg == "createLinks(QString)" ) | 463 | }else if( msg == "createLinks(QString)" ) |
464 | { | 464 | { |
465 | ipkg->createLinks( QString(arg) ); | 465 | ipkg->createLinks( QString(arg) ); |
466 | }else if( msg == "removeLinks(QString)" ) | 466 | }else if( msg == "removeLinks(QString)" ) |
467 | { | 467 | { |
468 | ipkg->removeLinks( QString(arg) ); | 468 | ipkg->removeLinks( QString(arg) ); |
469 | }else{ | 469 | }else{ |
470 | pvDebug(2,"Huh what do ya want") | 470 | pvDebug(2,"Huh what do ya want") |
471 | } | 471 | } |
472 | } | 472 | } |
473 | 473 | ||
474 | 474 | ||
475 | void MainWindow::createLinks() | 475 | void MainWindow::createLinks() |
476 | { | 476 | { |
477 | pvDebug(2,"creating links..."); | 477 | pvDebug(2,"creating links..."); |
478 | ipkg->createLinks( settings->destinationurl->text() ); | 478 | ipkg->createLinks( settings->destinationurl->text() ); |
479 | } | 479 | } |
480 | 480 | ||
481 | void MainWindow::removeLinks() | 481 | void MainWindow::removeLinks() |
482 | { | 482 | { |
483 | pvDebug(2,"removing links..."); | 483 | pvDebug(2,"removing links..."); |
484 | ipkg->removeLinks( settings->destinationurl->text() ); | 484 | ipkg->removeLinks( settings->destinationurl->text() ); |
485 | } | 485 | } |
486 | 486 | ||
487 | void MainWindow::remotePackageQuery() | 487 | void MainWindow::remotePackageQuery() |
488 | { | 488 | { |
489 | packageListSearch.query( searchEdit->text() ); | 489 | packageListSearch.query( searchEdit->text() ); |
490 | packageListSearch.update(); | 490 | packageListSearch.update(); |
491 | displayList(); | 491 | displayList(); |
492 | } | 492 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 5996e63..75f93cf 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,409 +1,388 @@ | |||
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 <qpe/qpeapplication.h> | ||
10 | #include <qdir.h> | 11 | #include <qdir.h> |
11 | #include <qfile.h> | 12 | #include <qfile.h> |
12 | #include <qgroupbox.h> | 13 | #include <qgroupbox.h> |
13 | #include <qmultilineedit.h> | 14 | #include <qmultilineedit.h> |
14 | #include <qstring.h> | 15 | #include <qstring.h> |
15 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
16 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
17 | #include <qtextview.h> | 18 | #include <qtextview.h> |
18 | 19 | ||
19 | #include <qprogressbar.h> | 20 | #include <qprogressbar.h> |
20 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
21 | #include <qlayout.h> | 22 | #include <qlayout.h> |
22 | 23 | ||
23 | #include <stdlib.h> | 24 | #include <stdlib.h> |
24 | #include <unistd.h> | 25 | #include <unistd.h> |
25 | 26 | ||
26 | #include "mainwindow.h" | 27 | #include "mainwindow.h" |
27 | 28 | ||
28 | 29 | ||
29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
30 | : QObject ( p ) | 31 | : QObject ( p ) |
31 | { | 32 | { |
32 | settings = s; | 33 | settings = s; |
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 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
41 | #define SYSTEM | ||
42 | #define QT_QPROCESS_DEBUG | ||
43 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | ||
44 | { | 42 | { |
45 | pvDebug(2,"PmIpkg::runIpkg "+args); | 43 | bool ret=false; |
46 | QDir::setCurrent("/tmp"); | 44 | QDir::setCurrent("/tmp"); |
47 | #ifdef PROC | ||
48 | QString cmd; | ||
49 | #endif | ||
50 | #ifdef SYSTEM | ||
51 | QString cmd = "/usr/bin/ipkg "; | 45 | QString cmd = "/usr/bin/ipkg "; |
52 | #endif | ||
53 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
54 | if ( dest == "" ) | 47 | if ( dest == "" ) |
55 | cmd += " -dest "+settings->getDestinationName(); | 48 | cmd += " -dest "+settings->getDestinationName(); |
56 | else | 49 | else |
57 | cmd += " -dest "+ dest; | 50 | cmd += " -dest "+ dest; |
58 | 51 | ||
59 | cmd += " -force-defaults "; | 52 | cmd += " -force-defaults "; |
60 | 53 | ||
61 | if (installDialog->_force_depends) | 54 | if (installDialog->_force_depends) |
62 | { | 55 | { |
63 | if (installDialog->_force_depends->isChecked()) | 56 | if (installDialog->_force_depends->isChecked()) |
64 | cmd += " -force-depends "; | 57 | cmd += " -force-depends "; |
65 | if (installDialog->_force_reinstall->isChecked()) | 58 | if (installDialog->_force_reinstall->isChecked()) |
66 | cmd += " -force-reinstall "; | 59 | cmd += " -force-reinstall "; |
67 | if (installDialog->_force_remove->isChecked()) | 60 | if (installDialog->_force_remove->isChecked()) |
68 | cmd += " -force-removal-of-essential-packages "; | 61 | cmd += " -force-removal-of-essential-packages "; |
69 | } | 62 | } |
70 | 63 | ||
71 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 64 | out( "Starting to "+ args+"\n"); |
72 | cmd += args; | 65 | cmd += args; |
73 | int r = 0; | 66 | out( "running:\n"+cmd+"\n" ); |
74 | #ifdef PROC | 67 | pvDebug(2,"running:"+cmd); |
75 | QString o = "start"; | 68 | qApp->processEvents(); |
76 | Process *ipkg = new Process(QStringList() << "ipkg" << cmd ); | 69 | FILE *fp; |
77 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | 70 | char line[130]; |
78 | QString description; | 71 | QString lineStr, lineStrOld; |
79 | r = ipkg->exec("",o); | 72 | sleep(1); |
80 | out( o ); | 73 | cmd +=" 2>&1"; |
81 | #endif | 74 | fp = popen( (const char *) cmd, "r"); |
82 | #ifdef SYSTEM | 75 | if ( !fp ) { |
83 | out( "running:<br>\n"+cmd+"<br>\n" ); | 76 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
84 | QString redirect = "/tmp/oipkg.pipe"; | 77 | pclose(fp); |
85 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 78 | out("\nError while executing "+ cmd+"\n\n"); |
86 | pvDebug(2, "running >"+cmd+"<"); | 79 | return false; |
87 | r = system(cmd.latin1()); | 80 | } else { |
88 | QFile f( redirect ); | 81 | while ( fgets( line, sizeof line, fp)) { |
89 | QString line; | 82 | lineStr = line; |
90 | QString oldLine; | 83 | lineStr=lineStr.left(lineStr.length()-1); |
91 | while ( ! f.open(IO_ReadOnly) ) {}; | 84 | //Configuring opie-oipkg...Done |
92 | QTextStream t( &f ); | 85 | if (lineStr.contains("Done")) |
93 | while ( !t.eof() ) | 86 | ret = true; |
94 | { | 87 | if (lineStr!=lineStrOld) |
95 | line = t.readLine(); | 88 | out(lineStr); |
96 | if ( line != oldLine ) | 89 | lineStrOld = lineStr; |
97 | { | 90 | } |
98 | out( line +"<br>" ); | 91 | pclose(fp); |
99 | oldLine = line; | 92 | } |
100 | } | 93 | //out( "Finished!"); |
101 | } | 94 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
102 | f.close(); | 95 | return ret; |
103 | out( "Finished!<br>"); | ||
104 | #endif | ||
105 | |||
106 | return r; | ||
107 | } | 96 | } |
108 | 97 | ||
109 | void PmIpkg::makeLinks(Package *pack) | 98 | void PmIpkg::makeLinks(Package *pack) |
110 | { | 99 | { |
111 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 100 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
112 | linkPackage( pack->name(), pack->dest() ); | 101 | linkPackage( pack->name(), pack->dest() ); |
113 | } | 102 | } |
114 | 103 | ||
115 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 104 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
116 | { | 105 | { |
117 | QString dest = settings->getDestinationUrlByName( d ); | 106 | QString dest = settings->getDestinationUrlByName( d ); |
118 | dest = dest==""?d:dest; | 107 | dest = dest==""?d:dest; |
119 | if (dest == "/" ) return 0; | 108 | if (dest == "/" ) return 0; |
120 | { | 109 | { |
121 | Config cfg( "oipkg", Config::User ); | 110 | Config cfg( "oipkg", Config::User ); |
122 | cfg.setGroup( "Common" ); | 111 | cfg.setGroup( "Common" ); |
123 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 112 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
124 | } | 113 | } |
125 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 114 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
126 | QFile f( packFileName ); | 115 | QFile f( packFileName ); |
127 | if ( ! f.open(IO_ReadOnly) ) | 116 | if ( ! f.open(IO_ReadOnly) ) |
128 | { | 117 | { |
129 | pvDebug(1," Panik! Could not open"); | 118 | pvDebug(1," Panik! Could not open"); |
130 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); | 119 | out( "Panik!\n Could not open:\n"+packFileName ); |
131 | return (QStringList*)0; | 120 | return (QStringList*)0; |
132 | } | 121 | } |
133 | QStringList *fileList = new QStringList(); | 122 | QStringList *fileList = new QStringList(); |
134 | QTextStream t( &f ); | 123 | QTextStream t( &f ); |
135 | while ( !t.eof() ) | 124 | while ( !t.eof() ) |
136 | { | 125 | { |
137 | *fileList += t.readLine(); | 126 | *fileList += t.readLine(); |
138 | } | 127 | } |
139 | return fileList; | 128 | return fileList; |
140 | } | 129 | } |
141 | 130 | ||
142 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 131 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
143 | { | 132 | { |
144 | QStringList *fileList = getList( packFileName, dest ); | 133 | QStringList *fileList = getList( packFileName, dest ); |
145 | processFileList( fileList, dest ); | 134 | processFileList( fileList, dest ); |
146 | delete fileList; | 135 | delete fileList; |
147 | } | 136 | } |
148 | 137 | ||
149 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 138 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
150 | { | 139 | { |
151 | if (!fileList) return; | 140 | if (!fileList) return; |
152 | for (uint i=0; i < fileList->count(); i++) | 141 | for (uint i=0; i < fileList->count(); i++) |
153 | { | 142 | { |
154 | QString dest = settings->getDestinationUrlByName( d ); | 143 | QString dest = settings->getDestinationUrlByName( d ); |
155 | dest = dest==""?d:dest; | 144 | dest = dest==""?d:dest; |
156 | processLinkDir( (*fileList)[i], dest ); | 145 | processLinkDir( (*fileList)[i], dest ); |
157 | } | 146 | } |
158 | } | 147 | } |
159 | 148 | ||
160 | 149 | ||
161 | void PmIpkg::processLinkDir( QString file, QString dest ) | 150 | void PmIpkg::processLinkDir( QString file, QString dest ) |
162 | { | 151 | { |
163 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 152 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
164 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 153 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
165 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 154 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
166 | if ( dest == "???" || dest == "" ) return; | 155 | if ( dest == "???" || dest == "" ) return; |
167 | QString destFile = file; | 156 | QString destFile = file; |
168 | file = dest+"/"+file; | 157 | file = dest+"/"+file; |
169 | if (file == dest) return; | 158 | if (file == dest) return; |
170 | QFileInfo fileInfo( file ); | 159 | QFileInfo fileInfo( file ); |
171 | if ( fileInfo.isDir() ) | 160 | if ( fileInfo.isDir() ) |
172 | { | 161 | { |
173 | pvDebug(4, "process dir "+file); | 162 | pvDebug(4, "process dir "+file); |
174 | QDir destDir( destFile ); | 163 | QDir destDir( destFile ); |
175 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 164 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
176 | QDir d( file ); | 165 | QDir d( file ); |
177 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 166 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
178 | const QFileInfoList *list = d.entryInfoList(); | 167 | const QFileInfoList *list = d.entryInfoList(); |
179 | QFileInfoListIterator it( *list ); | 168 | QFileInfoListIterator it( *list ); |
180 | QFileInfo *fi; | 169 | QFileInfo *fi; |
181 | while ( (fi=it.current()) ) | 170 | while ( (fi=it.current()) ) |
182 | { | 171 | { |
183 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | 172 | pvDebug(4, "processLinkDir "+fi->absFilePath()); |
184 | processLinkDir( fi->absFilePath(), dest ); | 173 | processLinkDir( fi->absFilePath(), dest ); |
185 | ++it; | 174 | ++it; |
186 | } | 175 | } |
187 | } else | 176 | } else |
188 | if ( fileInfo.isFile() ) | 177 | if ( fileInfo.isFile() ) |
189 | { | 178 | { |
190 | const char *instFile = strdup( (file).ascii() ); | 179 | const char *instFile = strdup( (file).ascii() ); |
191 | const char *linkFile = strdup( (destFile).ascii()); | 180 | const char *linkFile = strdup( (destFile).ascii()); |
192 | if( linkOpp==createLink ) | 181 | if( linkOpp==createLink ) |
193 | { | 182 | { |
194 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 183 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
195 | symlink( instFile, linkFile ); | 184 | symlink( instFile, linkFile ); |
196 | } | 185 | } |
197 | } else { | 186 | } else { |
198 | const char *linkFile = strdup( (destFile).ascii()); | 187 | const char *linkFile = strdup( (destFile).ascii()); |
199 | if( linkOpp==removeLink ) | 188 | if( linkOpp==removeLink ) |
200 | { | 189 | { |
201 | QFileInfo toRemoveLink( destFile ); | 190 | QFileInfo toRemoveLink( destFile ); |
202 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 191 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
203 | { | 192 | { |
204 | pvDebug(4,"removing "+destFile+" no "+file); | 193 | pvDebug(4,"removing "+destFile+" no "+file); |
205 | unlink( linkFile ); | 194 | unlink( linkFile ); |
206 | } | 195 | } |
207 | } | 196 | } |
208 | } | 197 | } |
209 | } | 198 | } |
210 | 199 | ||
211 | void PmIpkg::loadList( PackageList *pl ) | 200 | void PmIpkg::loadList( PackageList *pl ) |
212 | { | 201 | { |
213 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) | 202 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) |
214 | { | 203 | { |
215 | if ( pack && (pack->name() != "") && pack) | 204 | if ( pack && (pack->name() != "") && pack) |
216 | { | 205 | { |
217 | if ( pack->toInstall() ) | 206 | if ( pack->toInstall() ) |
218 | to_install.append( pack ); | 207 | to_install.append( pack ); |
219 | if ( pack->toRemove() ) | 208 | if ( pack->toRemove() ) |
220 | to_remove.append( pack ); | 209 | to_remove.append( pack ); |
221 | } | 210 | } |
222 | } | 211 | } |
223 | } | 212 | } |
224 | 213 | ||
225 | void PmIpkg::commit() | 214 | void PmIpkg::commit() |
226 | { | 215 | { |
227 | int sizecount = 0; | 216 | int sizecount = 0; |
228 | installDialog = new InstallDialog(settings,0,0,true); | 217 | installDialog = new InstallDialog(settings,0,0,true); |
229 | QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); | 218 | QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); |
230 | QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); | 219 | QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); |
231 | toRemoveItem->setOpen( true ); | 220 | toRemoveItem->setOpen( true ); |
232 | toInstallItem->setOpen( true ); | 221 | toInstallItem->setOpen( true ); |
233 | for (uint i=0; i < to_remove.count(); i++) | 222 | for (uint i=0; i < to_remove.count(); i++) |
234 | { | 223 | { |
235 | sizecount += 1; | 224 | sizecount += 1; |
236 | toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 225 | toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
237 | } | 226 | } |
238 | for (uint i=0; i < to_install.count(); i++) | 227 | for (uint i=0; i < to_install.count(); i++) |
239 | { | 228 | { |
240 | sizecount += to_install.at(i)->size().toInt(); | 229 | sizecount += to_install.at(i)->size().toInt(); |
241 | toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 230 | toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
242 | } | 231 | } |
243 | runwindow->progress->setTotalSteps(sizecount); | 232 | runwindow->progress->setTotalSteps(sizecount); |
244 | qDebug("Install size %i",sizecount); | 233 | qDebug("Install size %i",sizecount); |
245 | installDialog->showMaximized(); | 234 | installDialog->showMaximized(); |
235 | installDialog->show(); | ||
246 | if ( installDialog->exec() ) doIt(); | 236 | if ( installDialog->exec() ) doIt(); |
247 | installDialog->close(); | 237 | installDialog->close(); |
248 | runwindow->showMaximized(); | 238 | runwindow->showMaximized(); |
249 | out(tr("<b>All done.</b>")); | 239 | runwindow->show(); |
240 | out(tr("\nAll done.")); | ||
250 | } | 241 | } |
251 | 242 | ||
252 | void PmIpkg::doIt() | 243 | void PmIpkg::doIt() |
253 | { | 244 | { |
254 | show( true ); | 245 | runwindow->progress->setProgress(0); |
246 | show(); | ||
255 | remove(); | 247 | remove(); |
256 | install(); | 248 | install(); |
257 | } | 249 | } |
258 | 250 | ||
259 | 251 | ||
260 | void PmIpkg::remove() | 252 | void PmIpkg::remove() |
261 | { | 253 | { |
262 | if ( to_remove.count() == 0 ) return; | 254 | if ( to_remove.count() == 0 ) return; |
263 | 255 | ||
264 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); | 256 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
265 | 257 | ||
266 | QStringList *fileList; | 258 | QStringList *fileList; |
267 | for (uint i=0; i < to_remove.count(); i++) | 259 | for (uint i=0; i < to_remove.count(); i++) |
268 | { | 260 | { |
269 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 261 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
270 | if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() ) == 0) | 262 | if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() )) |
271 | { | 263 | { |
272 | runwindow->progress->setProgress( 1 ); | 264 | runwindow->progress->setProgress( 1 ); |
273 | linkOpp = removeLink; | 265 | linkOpp = removeLink; |
274 | if ( to_remove.at(i)->link() ) | 266 | if ( to_remove.at(i)->link() ) |
275 | { | 267 | { |
276 | out( "<br>removing links<br>" ); | 268 | out( "\nremoving links\n" ); |
277 | out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"<br>" ); | 269 | out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" ); |
278 | processFileList( fileList, to_remove.at(i)->dest() ); | 270 | processFileList( fileList, to_remove.at(i)->dest() ); |
279 | } | 271 | } |
280 | to_remove.at(i)->processed(); | 272 | to_remove.at(i)->processed(); |
281 | to_remove.take( i ); | 273 | to_remove.take( i ); |
282 | out("<br><hr>"); | 274 | out("\n\n"); |
283 | }else{ | 275 | }else{ |
284 | out("<b>"+tr("Error while removing")+"</b><hr>"+to_remove.at(i)->name()); | 276 | out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); |
285 | } | 277 | } |
286 | if ( to_remove.at(i)->link() )delete fileList; | 278 | if ( to_remove.at(i)->link() )delete fileList; |
287 | } | 279 | } |
288 | to_remove.clear(); | 280 | to_remove.clear(); |
289 | out("<br>"); | 281 | out("\n"); |
290 | } | 282 | } |
291 | 283 | ||
292 | 284 | ||
293 | void PmIpkg::install() | 285 | void PmIpkg::install() |
294 | { | 286 | { |
295 | if ( to_install.count() == 0 ) return; | 287 | if ( to_install.count() == 0 ) return; |
296 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 288 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
297 | for (uint i=0; i < to_install.count(); i++) | 289 | for (uint i=0; i < to_install.count(); i++) |
298 | { | 290 | { |
299 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 ) | 291 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
300 | { | 292 | { |
301 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 293 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
302 | linkOpp = createLink; | 294 | linkOpp = createLink; |
303 | if ( to_install.at(i)->link() ) | 295 | if ( to_install.at(i)->link() ) |
304 | { | 296 | { |
305 | out( "<br>creating links<br>" ); | 297 | out( "\ncreating links\n" ); |
306 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" ); | 298 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"\n" ); |
307 | makeLinks( to_install.at(i) ); | 299 | makeLinks( to_install.at(i) ); |
308 | } | 300 | } |
309 | to_install.at(i)->processed(); | 301 | to_install.at(i)->processed(); |
310 | to_install.take( i ); | 302 | to_install.take( i ); |
311 | out("<br><hr>"); | 303 | out("\n\n"); |
312 | }else{ | 304 | }else{ |
313 | out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name()); | 305 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); |
314 | } | 306 | } |
315 | } | 307 | } |
316 | out("<br>"); | 308 | out("\n"); |
317 | to_install.clear(); | 309 | to_install.clear(); |
318 | } | 310 | } |
319 | 311 | ||
320 | void PmIpkg::createLinks( const QString &dest ) | 312 | void PmIpkg::createLinks( const QString &dest ) |
321 | { | 313 | { |
322 | pvDebug(2,"PmIpkg::createLinks "+dest); | 314 | pvDebug(2,"PmIpkg::createLinks "+dest); |
323 | linkOpp=createLink; | 315 | linkOpp=createLink; |
324 | QString url = settings->getDestinationUrlByName( dest ); | 316 | QString url = settings->getDestinationUrlByName( dest ); |
325 | url = url==""?dest:url; | 317 | url = url==""?dest:url; |
326 | processLinkDir( "/opt", url ); | 318 | processLinkDir( "/opt", url ); |
327 | processLinkDir( "/usr", url ); | 319 | processLinkDir( "/usr", url ); |
328 | } | 320 | } |
329 | 321 | ||
330 | void PmIpkg::removeLinks( const QString &dest ) | 322 | void PmIpkg::removeLinks( const QString &dest ) |
331 | { | 323 | { |
332 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 324 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
333 | linkOpp=removeLink; | 325 | linkOpp=removeLink; |
334 | QString url = settings->getDestinationUrlByName( dest ); | 326 | QString url = settings->getDestinationUrlByName( dest ); |
335 | url = url==""?dest:url; | 327 | url = url==""?dest:url; |
336 | processLinkDir( "/opt", url ); | 328 | processLinkDir( "/opt", url ); |
337 | processLinkDir( "/usr", url ); | 329 | processLinkDir( "/usr", url ); |
338 | } | 330 | } |
339 | 331 | ||
340 | void PmIpkg::update() | 332 | void PmIpkg::update() |
341 | { | 333 | { |
342 | show( false ); | 334 | show(); |
343 | runIpkg( "update" ); | 335 | runIpkg( "update" ); |
344 | runwindow->close(); | 336 | runwindow->close(); |
345 | } | 337 | } |
346 | 338 | ||
347 | void PmIpkg::out( QString o ) | 339 | void PmIpkg::out( QString o ) |
348 | { | 340 | { |
349 | runwindow->outPut->append(o); | 341 | runwindow->outPut->append(o); |
350 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); | 342 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); |
351 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); | ||
352 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | ||
353 | } | 343 | } |
354 | 344 | ||
355 | 345 | ||
356 | void PmIpkg::showButtons(bool b) | ||
357 | { | ||
358 | if ( b ) | ||
359 | { | ||
360 | runwindow->cancelButton->hide(); | ||
361 | runwindow->doItButton->hide(); | ||
362 | runwindow->removeButton->hide(); | ||
363 | runwindow->installButton->hide(); | ||
364 | }else{ | ||
365 | runwindow->cancelButton->show(); | ||
366 | runwindow->doItButton->show(); | ||
367 | runwindow->removeButton->show(); | ||
368 | runwindow->installButton->show(); | ||
369 | 346 | ||
370 | } | ||
371 | } | ||
372 | 347 | ||
373 | void PmIpkg::show(bool b) | 348 | void PmIpkg::show() |
374 | { | 349 | { |
375 | if (!runwindow->isVisible()) | 350 | if (!runwindow->isVisible()) |
351 | { | ||
376 | runwindow->showMaximized(); | 352 | runwindow->showMaximized(); |
377 | showButtons(b); | 353 | runwindow->show(); |
378 | if ( !b ) | 354 | } |
379 | runwindow->progress->hide(); | 355 | runwindow->outPut->setText(""); |
380 | else | 356 | //showButtons(b); |
381 | runwindow->progress->show(); | 357 | //if ( !b ) |
358 | // runwindow->progress->hide(); | ||
359 | // else | ||
360 | // runwindow->progress->show(); | ||
382 | } | 361 | } |
383 | 362 | ||
384 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 363 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
385 | { | 364 | { |
386 | 365 | ||
387 | to_install.clear(); | 366 | to_install.clear(); |
388 | to_remove.clear(); | 367 | to_remove.clear(); |
389 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 368 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
390 | Package *p = new Package(fileName,settings); | 369 | Package *p = new Package(fileName,settings); |
391 | if ( dest!="") p->setDest( dest ); | 370 | if ( dest!="") p->setDest( dest ); |
392 | to_install.append( p ); | 371 | to_install.append( p ); |
393 | commit(); | 372 | commit(); |
394 | delete p; | 373 | delete p; |
395 | } | 374 | } |
396 | 375 | ||
397 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 376 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
398 | { | 377 | { |
399 | 378 | ||
400 | to_install.clear(); | 379 | to_install.clear(); |
401 | to_remove.clear(); | 380 | to_remove.clear(); |
402 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 381 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
403 | Package *p = new Package(fileName,settings); | 382 | Package *p = new Package(fileName,settings); |
404 | if ( dest!="") p->setDest( dest ); | 383 | if ( dest!="") p->setDest( dest ); |
405 | to_remove.append( p ); | 384 | to_remove.append( p ); |
406 | commit(); | 385 | commit(); |
407 | delete p; | 386 | delete p; |
408 | } | 387 | } |
409 | 388 | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 7bc62f1..f8ac39a 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,64 +1,63 @@ | |||
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 "installdialog.h" | 12 | #include "installdialog.h" |
13 | #include "debug.h" | 13 | #include "debug.h" |
14 | 14 | ||
15 | #define createLink 0 | 15 | #define createLink 0 |
16 | #define removeLink 1 | 16 | #define removeLink 1 |
17 | 17 | ||
18 | class Package; | 18 | class Package; |
19 | class PmIpkg : public QObject | 19 | class PmIpkg : public QObject |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | public: | 22 | public: |
23 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 23 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
24 | ~PmIpkg(); | 24 | ~PmIpkg(); |
25 | 25 | ||
26 | int linkOpp; | 26 | int linkOpp; |
27 | void loadList( PackageList* ); | 27 | void loadList( PackageList* ); |
28 | void commit(); | 28 | void commit(); |
29 | void update(); | 29 | void update(); |
30 | void showButtons(bool b=true); | 30 | void show(); |
31 | void show( bool buttons=true ); | ||
32 | 31 | ||
33 | public slots: | 32 | public slots: |
34 | void doIt(); | 33 | void doIt(); |
35 | void install(); | 34 | void install(); |
36 | void remove(); | 35 | void remove(); |
37 | void installFile(const QString &fileName, const QString &dest=""); | 36 | void installFile(const QString &fileName, const QString &dest=""); |
38 | void removeFile(const QString &fileName, const QString &dest=""); | 37 | void removeFile(const QString &fileName, const QString &dest=""); |
39 | void createLinks( const QString &dest ); | 38 | void createLinks( const QString &dest ); |
40 | void removeLinks( const QString &dest ); | 39 | void removeLinks( const QString &dest ); |
41 | 40 | ||
42 | private: | 41 | private: |
43 | PackageManagerSettings* settings; | 42 | PackageManagerSettings* settings; |
44 | RunWindow *runwindow; | 43 | RunWindow *runwindow; |
45 | InstallDialog *installDialog; | 44 | InstallDialog *installDialog; |
46 | QList<Package> to_remove; | 45 | QList<Package> to_remove; |
47 | QList<Package> to_install; | 46 | QList<Package> to_install; |
48 | QString fileNameToInstall; | 47 | QString fileNameToInstall; |
49 | QCheckBox *_force_reinstall; | 48 | QCheckBox *_force_reinstall; |
50 | QCheckBox *_force_remove; | 49 | QCheckBox *_force_remove; |
51 | QCheckBox *_force_depends; | 50 | QCheckBox *_force_depends; |
52 | void startDialog(); | 51 | void startDialog(); |
53 | void makeLinks(Package*); | 52 | void makeLinks(Package*); |
54 | void linkPackage( QString, QString ); | 53 | void linkPackage( QString, QString ); |
55 | void processLinkDir( QString , QString ); | 54 | void processLinkDir( QString , QString ); |
56 | int runIpkg(const QString& args, const QString& dest="" ); | 55 | bool runIpkg(const QString& args, const QString& dest="" ); |
57 | void out( QString ); | 56 | void out( QString ); |
58 | QStringList* getList( QString, QString ); | 57 | QStringList* getList( QString, QString ); |
59 | void processFileList( QStringList*, QString ); | 58 | void processFileList( QStringList*, QString ); |
60 | 59 | ||
61 | 60 | ||
62 | }; | 61 | }; |
63 | 62 | ||
64 | #endif | 63 | #endif |
diff --git a/noncore/unsupported/oipkg/runwindow.ui b/noncore/unsupported/oipkg/runwindow.ui index 8582ce8..839e151 100644 --- a/noncore/unsupported/oipkg/runwindow.ui +++ b/noncore/unsupported/oipkg/runwindow.ui | |||
@@ -1,171 +1,67 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>RunWindow</class> | 2 | <class>RunWindow</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>RunWindow</cstring> | 7 | <cstring>RunWindow</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>344</width> | 14 | <width>340</width> |
15 | <height>442</height> | 15 | <height>442</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>running...</string> | 20 | <string>running...</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>2</number> | 31 | <number>2</number> |
32 | </property> | 32 | </property> |
33 | <property stdset="1"> | 33 | <property stdset="1"> |
34 | <name>spacing</name> | 34 | <name>spacing</name> |
35 | <number>2</number> | 35 | <number>2</number> |
36 | </property> | 36 | </property> |
37 | <widget row="0" column="0" > | 37 | <widget row="0" column="0" > |
38 | <class>QProgressBar</class> | 38 | <class>QProgressBar</class> |
39 | <property stdset="1"> | 39 | <property stdset="1"> |
40 | <name>name</name> | 40 | <name>name</name> |
41 | <cstring>progress</cstring> | 41 | <cstring>progress</cstring> |
42 | </property> | 42 | </property> |
43 | <property stdset="1"> | 43 | <property stdset="1"> |
44 | <name>progress</name> | 44 | <name>progress</name> |
45 | <number>0</number> | 45 | <number>0</number> |
46 | </property> | 46 | </property> |
47 | </widget> | 47 | </widget> |
48 | <widget row="3" column="0" > | ||
49 | <class>QLayoutWidget</class> | ||
50 | <property stdset="1"> | ||
51 | <name>name</name> | ||
52 | <cstring>buttons</cstring> | ||
53 | </property> | ||
54 | <hbox> | ||
55 | <property stdset="1"> | ||
56 | <name>margin</name> | ||
57 | <number>0</number> | ||
58 | </property> | ||
59 | <property stdset="1"> | ||
60 | <name>spacing</name> | ||
61 | <number>6</number> | ||
62 | </property> | ||
63 | <widget> | ||
64 | <class>QPushButton</class> | ||
65 | <property stdset="1"> | ||
66 | <name>name</name> | ||
67 | <cstring>doItButton</cstring> | ||
68 | </property> | ||
69 | <property stdset="1"> | ||
70 | <name>sizePolicy</name> | ||
71 | <sizepolicy> | ||
72 | <hsizetype>0</hsizetype> | ||
73 | <vsizetype>0</vsizetype> | ||
74 | </sizepolicy> | ||
75 | </property> | ||
76 | <property stdset="1"> | ||
77 | <name>font</name> | ||
78 | <font> | ||
79 | <pointsize>8</pointsize> | ||
80 | </font> | ||
81 | </property> | ||
82 | <property stdset="1"> | ||
83 | <name>text</name> | ||
84 | <string>Do all </string> | ||
85 | </property> | ||
86 | <property stdset="1"> | ||
87 | <name>autoResize</name> | ||
88 | <bool>false</bool> | ||
89 | </property> | ||
90 | </widget> | ||
91 | <widget> | ||
92 | <class>QPushButton</class> | ||
93 | <property stdset="1"> | ||
94 | <name>name</name> | ||
95 | <cstring>installButton</cstring> | ||
96 | </property> | ||
97 | <property stdset="1"> | ||
98 | <name>font</name> | ||
99 | <font> | ||
100 | <pointsize>8</pointsize> | ||
101 | </font> | ||
102 | </property> | ||
103 | <property stdset="1"> | ||
104 | <name>text</name> | ||
105 | <string>Install</string> | ||
106 | </property> | ||
107 | <property stdset="1"> | ||
108 | <name>autoResize</name> | ||
109 | <bool>true</bool> | ||
110 | </property> | ||
111 | </widget> | ||
112 | <widget> | ||
113 | <class>QPushButton</class> | ||
114 | <property stdset="1"> | ||
115 | <name>name</name> | ||
116 | <cstring>removeButton</cstring> | ||
117 | </property> | ||
118 | <property stdset="1"> | ||
119 | <name>font</name> | ||
120 | <font> | ||
121 | <pointsize>7</pointsize> | ||
122 | </font> | ||
123 | </property> | ||
124 | <property stdset="1"> | ||
125 | <name>text</name> | ||
126 | <string>Remove</string> | ||
127 | </property> | ||
128 | <property stdset="1"> | ||
129 | <name>autoResize</name> | ||
130 | <bool>true</bool> | ||
131 | </property> | ||
132 | </widget> | ||
133 | <widget> | ||
134 | <class>QPushButton</class> | ||
135 | <property stdset="1"> | ||
136 | <name>name</name> | ||
137 | <cstring>cancelButton</cstring> | ||
138 | </property> | ||
139 | <property stdset="1"> | ||
140 | <name>font</name> | ||
141 | <font> | ||
142 | <pointsize>8</pointsize> | ||
143 | </font> | ||
144 | </property> | ||
145 | <property stdset="1"> | ||
146 | <name>text</name> | ||
147 | <string>Cancel</string> | ||
148 | </property> | ||
149 | <property stdset="1"> | ||
150 | <name>autoResize</name> | ||
151 | <bool>true</bool> | ||
152 | </property> | ||
153 | </widget> | ||
154 | </hbox> | ||
155 | </widget> | ||
156 | <widget row="1" column="0" > | 48 | <widget row="1" column="0" > |
157 | <class>QTextView</class> | 49 | <class>QMultiLineEdit</class> |
158 | <property stdset="1"> | 50 | <property stdset="1"> |
159 | <name>name</name> | 51 | <name>name</name> |
160 | <cstring>outPut</cstring> | 52 | <cstring>outPut</cstring> |
161 | </property> | 53 | </property> |
162 | <property stdset="1"> | 54 | <property stdset="1"> |
163 | <name>font</name> | 55 | <name>font</name> |
164 | <font> | 56 | <font> |
165 | <pointsize>6</pointsize> | 57 | <pointsize>8</pointsize> |
166 | </font> | 58 | </font> |
167 | </property> | 59 | </property> |
60 | <property stdset="1"> | ||
61 | <name>wordWrap</name> | ||
62 | <enum>WidgetWidth</enum> | ||
63 | </property> | ||
168 | </widget> | 64 | </widget> |
169 | </grid> | 65 | </grid> |
170 | </widget> | 66 | </widget> |
171 | </UI> | 67 | </UI> |