-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 05f2f06..8778b85 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,497 +1,497 @@ | |||
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 ) : | 34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
35 | QMainWindow( parent, name, f ) | 35 | QMainWindow( parent, name, f ) |
36 | // packageListServers( QObject(parent), name ), | 36 | // packageListServers( QObject(parent), name ), |
37 | // packageListSearch( parent, name ), | 37 | // packageListSearch( parent, name ), |
38 | // packageListDocLnk( parent, name ) | 38 | // packageListDocLnk( parent, name ) |
39 | { | 39 | { |
40 | setCaption( tr("Package Manager") ); | 40 | setCaption( tr("Package Manager") ); |
41 | settings = new PackageManagerSettings(this,0,TRUE); | 41 | settings = new PackageManagerSettings(this,0,TRUE); |
42 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 42 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
43 | setCentralWidget( listViewPackages ); | 43 | setCentralWidget( listViewPackages ); |
44 | listViewPackages->addList( tr("feeds"), &packageListServers ); | 44 | listViewPackages->addList( tr("feeds"), &packageListServers ); |
45 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | 45 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); |
46 | //listViewPackages->addList( tr("documents"), &packageListDocLnk ); | 46 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); |
47 | ipkg = new PmIpkg( settings, this ); | 47 | ipkg = new PmIpkg( settings, this ); |
48 | packageListServers.setSettings( settings ); | 48 | packageListServers.setSettings( settings ); |
49 | packageListSearch.setSettings( settings ); | 49 | packageListSearch.setSettings( settings ); |
50 | packageListDocLnk.setSettings( settings ); | 50 | packageListDocLnk.setSettings( settings ); |
51 | pvDebug(9,"packageListServers.update"); | 51 | pvDebug(9,"packageListServers.update"); |
52 | packageListServers.update(); | 52 | packageListServers.update(); |
53 | pvDebug(9,"packageListDocLnk.update"); | 53 | pvDebug(9,"packageListDocLnk.update"); |
54 | pvDebug(0,"no UPDATE of DocLnk"); | 54 | pvDebug(0,"no UPDATE of DocLnk"); |
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 *helpMenu = new QPopupMenu( menuBar ); | 86 | QPopupMenu *helpMenu = 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( "Help" ), helpMenu ); | 93 | menuBar->insertItem( tr( "Help" ), helpMenu ); |
94 | 94 | ||
95 | QLabel *spacer; | 95 | QLabel *spacer; |
96 | // spacer = new QLabel( "", toolBar ); | 96 | // spacer = new QLabel( "", toolBar ); |
97 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); | 97 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); |
98 | // toolBar->setStretchableWidget( spacer ); | 98 | // toolBar->setStretchableWidget( spacer ); |
99 | 99 | ||
100 | 100 | ||
101 | runAction = new QAction( tr( "Apply" ), | 101 | runAction = new QAction( tr( "Apply" ), |
102 | Resource::loadPixmap( "oipkg/install" ), | 102 | Resource::loadPixmap( "oipkg/install" ), |
103 | QString::null, 0, this, 0 ); | 103 | QString::null, 0, this, 0 ); |
104 | connect( runAction, SIGNAL( activated() ), | 104 | connect( runAction, SIGNAL( activated() ), |
105 | this, SLOT( runIpkg() ) ); | 105 | this, SLOT( runIpkg() ) ); |
106 | runAction->addTo( toolBar ); | 106 | runAction->addTo( toolBar ); |
107 | runAction->addTo( srvMenu ); | 107 | runAction->addTo( srvMenu ); |
108 | 108 | ||
109 | srvMenu->insertSeparator(); | 109 | srvMenu->insertSeparator(); |
110 | 110 | ||
111 | updateAction = new QAction( tr( "Update" ), | 111 | updateAction = new QAction( tr( "Update" ), |
112 | Resource::loadIconSet( "oipkg/update" ), | 112 | Resource::loadIconSet( "oipkg/update" ), |
113 | QString::null, 0, this, 0 ); | 113 | QString::null, 0, this, 0 ); |
114 | connect( updateAction, SIGNAL( activated() ), | 114 | connect( updateAction, SIGNAL( activated() ), |
115 | this , SLOT( updateList() ) ); | 115 | this , SLOT( updateList() ) ); |
116 | updateAction->addTo( toolBar ); | 116 | updateAction->addTo( toolBar ); |
117 | updateAction->addTo( srvMenu ); | 117 | updateAction->addTo( srvMenu ); |
118 | 118 | ||
119 | QAction *cfgact; | 119 | QAction *cfgact; |
120 | 120 | ||
121 | cfgact = new QAction( tr( "Setups" ), | 121 | cfgact = new QAction( tr( "Setups" ), |
122 | QString::null, 0, this, 0 ); | 122 | QString::null, 0, this, 0 ); |
123 | connect( cfgact, SIGNAL( activated() ), | 123 | connect( cfgact, SIGNAL( activated() ), |
124 | SLOT( showSettings() ) ); | 124 | SLOT( showSettings() ) ); |
125 | cfgact->addTo( cfgMenu ); | 125 | cfgact->addTo( cfgMenu ); |
126 | 126 | ||
127 | cfgact = new QAction( tr( "Servers" ), | 127 | cfgact = new QAction( tr( "Servers" ), |
128 | QString::null, 0, this, 0 ); | 128 | QString::null, 0, this, 0 ); |
129 | connect( cfgact, SIGNAL( activated() ), | 129 | connect( cfgact, SIGNAL( activated() ), |
130 | SLOT( showSettingsSrv() ) ); | 130 | SLOT( showSettingsSrv() ) ); |
131 | cfgact->addTo( cfgMenu ); | 131 | cfgact->addTo( cfgMenu ); |
132 | cfgact = new QAction( tr( "Destinations" ), | 132 | cfgact = new QAction( tr( "Destinations" ), |
133 | QString::null, 0, this, 0 ); | 133 | QString::null, 0, this, 0 ); |
134 | connect( cfgact, SIGNAL( activated() ), | 134 | connect( cfgact, SIGNAL( activated() ), |
135 | SLOT( showSettingsDst() ) ); | 135 | SLOT( showSettingsDst() ) ); |
136 | cfgact->addTo( cfgMenu ); | 136 | cfgact->addTo( cfgMenu ); |
137 | 137 | ||
138 | QAction *a; | 138 | QAction *a; |
139 | 139 | ||
140 | // SECTIONS | 140 | // SECTIONS |
141 | sectionBar = new QPEToolBar( this ); | 141 | sectionBar = new QPEToolBar( this ); |
142 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 142 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
143 | sectionBar->setHorizontalStretchable( true ); | 143 | sectionBar->setHorizontalStretchable( true ); |
144 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 144 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
145 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 145 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
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 | sectionBar->setStretchableWidget( section ); | 159 | sectionBar->setStretchableWidget( section ); |
160 | 160 | ||
161 | //FIND | 161 | //FIND |
162 | findBar = new QPEToolBar(this); | 162 | findBar = new QPEToolBar(this); |
163 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); | 163 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
164 | label = new QLabel( tr("Filter: "), findBar ); | 164 | label = new QLabel( tr("Filter: "), findBar ); |
165 | label->setBackgroundColor( findBar->backgroundColor() ); | 165 | label->setBackgroundColor( findBar->backgroundColor() ); |
166 | findBar->setHorizontalStretchable( TRUE ); | 166 | findBar->setHorizontalStretchable( TRUE ); |
167 | findEdit = new QLineEdit( findBar, "findEdit" ); | 167 | findEdit = new QLineEdit( findBar, "findEdit" ); |
168 | findBar->setStretchableWidget( findEdit ); | 168 | findBar->setStretchableWidget( findEdit ); |
169 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 169 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
170 | this, SLOT( displayList() ) ); | 170 | this, SLOT( displayList() ) ); |
171 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 171 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
172 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 172 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
173 | a->addTo( findBar ); | 173 | a->addTo( findBar ); |
174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
175 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 175 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
176 | a->addTo( findBar ); | 176 | a->addTo( findBar ); |
177 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); | 177 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
178 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 178 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
179 | findAction->setToggleAction( true ); | 179 | findAction->setToggleAction( true ); |
180 | findAction->addTo( viewMenu ); | 180 | findAction->addTo( viewMenu ); |
181 | 181 | ||
182 | //SEARCH | 182 | //SEARCH |
183 | searchBar = new QPEToolBar(this); | 183 | searchBar = new QPEToolBar(this); |
184 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 184 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
185 | label = new QLabel( tr("ipkgfind: "), searchBar ); | 185 | label = new QLabel( tr("ipkgfind: "), searchBar ); |
186 | label->setBackgroundColor( searchBar->backgroundColor() ); | 186 | label->setBackgroundColor( searchBar->backgroundColor() ); |
187 | searchBar->setHorizontalStretchable( TRUE ); | 187 | searchBar->setHorizontalStretchable( TRUE ); |
188 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 188 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
189 | searchBar->setStretchableWidget( searchEdit ); | 189 | searchBar->setStretchableWidget( searchEdit ); |
190 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 190 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
191 | // this, SLOT( displayList() ) ); | 191 | // this, SLOT( displayList() ) ); |
192 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 192 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
193 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | 193 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); |
194 | a->addTo( searchBar ); | 194 | a->addTo( searchBar ); |
195 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 195 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
196 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | 196 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); |
197 | searchCommit->addTo( searchBar ); | 197 | searchCommit->addTo( searchBar ); |
198 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 198 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
199 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | 199 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); |
200 | a->addTo( searchBar ); | 200 | a->addTo( searchBar ); |
201 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | 201 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); |
202 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | 202 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); |
203 | searchAction->setToggleAction( true ); | 203 | searchAction->setToggleAction( true ); |
204 | searchAction->addTo( viewMenu ); | 204 | searchAction->addTo( viewMenu ); |
205 | 205 | ||
206 | //DEST | 206 | //DEST |
207 | destBar = new QPEToolBar(this); | 207 | destBar = new QPEToolBar(this); |
208 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 208 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
209 | label = new QLabel( tr("Destination: "), destBar ); | 209 | label = new QLabel( tr("Destination: "), destBar ); |
210 | label->setBackgroundColor( destBar->backgroundColor() ); | 210 | label->setBackgroundColor( destBar->backgroundColor() ); |
211 | destBar->setHorizontalStretchable( TRUE ); | 211 | destBar->setHorizontalStretchable( TRUE ); |
212 | destination = new QComboBox( false, destBar ); | 212 | destination = new QComboBox( false, destBar ); |
213 | destination->insertStringList( settings->getDestinationNames() ); | 213 | destination->insertStringList( settings->getDestinationNames() ); |
214 | setComboName(destination,settings->getDestinationName()); | 214 | setComboName(destination,settings->getDestinationName()); |
215 | connect( destination, SIGNAL(activated(int)), | 215 | connect( destination, SIGNAL(activated(int)), |
216 | settings, SLOT(activeDestinationChange(int)) ); | 216 | settings, SLOT(activeDestinationChange(int)) ); |
217 | spacer = new QLabel( " ", destBar ); | 217 | spacer = new QLabel( " ", destBar ); |
218 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 218 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
219 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 219 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
220 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 220 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
221 | CheckBoxLink->setChecked( settings->createLinks() ); | 221 | CheckBoxLink->setChecked( settings->createLinks() ); |
222 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 222 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
223 | settings, SLOT(linkEnabled(bool)) ); | 223 | settings, SLOT(linkEnabled(bool)) ); |
224 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 224 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
225 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 225 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
226 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 226 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
227 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 227 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
228 | a->addTo( destBar ); | 228 | a->addTo( destBar ); |
229 | destBar->setStretchableWidget( CheckBoxLink ); | 229 | destBar->setStretchableWidget( CheckBoxLink ); |
230 | destAction->setToggleAction( true ); | 230 | destAction->setToggleAction( true ); |
231 | // destAction->addTo( viewMenu ); | 231 | // destAction->addTo( viewMenu ); |
232 | 232 | ||
233 | // helpMenu | 233 | // helpMenu |
234 | helpMenu->insertSeparator(); | 234 | helpMenu->insertSeparator(); |
235 | a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); | 235 | a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); |
236 | a->addTo( helpMenu ); | 236 | a->addTo( helpMenu ); |
237 | helpMenu->insertSeparator(); | 237 | helpMenu->insertSeparator(); |
238 | a = new QAction( tr( "Install" ), | 238 | a = new QAction( tr( "Install" ), |
239 | Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); | 239 | Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); |
240 | a->addTo( helpMenu ); | 240 | a->addTo( helpMenu ); |
241 | a = new QAction( tr( "Remove" ), | 241 | a = new QAction( tr( "Remove" ), |
242 | Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); | 242 | Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); |
243 | a->addTo( helpMenu ); | 243 | a->addTo( helpMenu ); |
244 | helpMenu->insertSeparator(); | 244 | helpMenu->insertSeparator(); |
245 | a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); | 245 | a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); |
246 | a->addTo( helpMenu ); | 246 | a->addTo( helpMenu ); |
247 | helpMenu->insertSeparator(); | 247 | helpMenu->insertSeparator(); |
248 | a = new QAction( tr( "New version, installed" ), | 248 | a = new QAction( tr( "New version, installed" ), |
249 | Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); | 249 | Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); |
250 | a->addTo( helpMenu ); | 250 | a->addTo( helpMenu ); |
251 | a = new QAction( tr( "New version, not installed" ), | 251 | a = new QAction( tr( "New version, not installed" ), |
252 | Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); | 252 | Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); |
253 | a->addTo( helpMenu ); | 253 | a->addTo( helpMenu ); |
254 | a = new QAction( tr( "Old version, installed" ), | 254 | a = new QAction( tr( "Old version, installed" ), |
255 | Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); | 255 | Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); |
256 | a->addTo( helpMenu ); | 256 | a->addTo( helpMenu ); |
257 | a = new QAction( tr( "Old version, not installed" ), | 257 | a = new QAction( tr( "Old version, not installed" ), |
258 | Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 ); | 258 | Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 ); |
259 | a->addTo( helpMenu ); | 259 | a->addTo( helpMenu ); |
260 | a = new QAction( tr( "Old version, new version installed" ), | 260 | a = new QAction( tr( "Old version, new version installed" ), |
261 | Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 ); | 261 | Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 ); |
262 | a->addTo( helpMenu ); | 262 | a->addTo( helpMenu ); |
263 | a = new QAction( tr( "New version, old version installed" ), | 263 | a = new QAction( tr( "New version, old version installed" ), |
264 | Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 ); | 264 | Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 ); |
265 | a->addTo( helpMenu ); | 265 | a->addTo( helpMenu ); |
266 | //a = new QAction( tr( "" ), | 266 | //a = new QAction( tr( "" ), |
267 | // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 ); | 267 | // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 ); |
268 | // a->addTo( helpMenu ); | 268 | // a->addTo( helpMenu ); |
269 | 269 | ||
270 | // configure the menus | 270 | // configure the menus |
271 | Config cfg( "oipkg", Config::User ); | 271 | Config cfg( "oipkg", Config::User ); |
272 | cfg.setGroup( "gui" ); | 272 | cfg.setGroup( "gui" ); |
273 | 273 | ||
274 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 274 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
275 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 275 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
276 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 276 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
277 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 277 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
278 | } | 278 | } |
279 | 279 | ||
280 | MainWindow::~MainWindow() | 280 | MainWindow::~MainWindow() |
281 | { | 281 | { |
282 | Config cfg( "oipkg", Config::User ); | 282 | Config cfg( "oipkg", Config::User ); |
283 | cfg.setGroup( "gui" ); | 283 | cfg.setGroup( "gui" ); |
284 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 284 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
285 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 285 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
286 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 286 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
287 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 287 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
288 | 288 | ||
289 | } | 289 | } |
290 | 290 | ||
291 | void MainWindow::runIpkg() | 291 | void MainWindow::runIpkg() |
292 | { | 292 | { |
293 | packageListServers.allPackages(); | 293 | packageListServers.allPackages(); |
294 | ipkg->loadList( &packageListSearch ); | 294 | ipkg->loadList( &packageListSearch ); |
295 | //ipkg->loadList( &packageListDocLnk ); | 295 | ipkg->loadList( &packageListDocLnk ); |
296 | ipkg->loadList( &packageListServers ); | 296 | ipkg->loadList( &packageListServers ); |
297 | ipkg->commit(); | 297 | ipkg->commit(); |
298 | ipkg->clearLists(); | 298 | ipkg->clearLists(); |
299 | // ##### If we looked in the list of files, we could send out accurate | 299 | // ##### If we looked in the list of files, we could send out accurate |
300 | // ##### messages. But we don't bother yet, and just do an "all". | 300 | // ##### messages. But we don't bother yet, and just do an "all". |
301 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 301 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
302 | QString lf = QString::null; | 302 | QString lf = QString::null; |
303 | e << lf; | 303 | e << lf; |
304 | displayList(); | 304 | displayList(); |
305 | } | 305 | } |
306 | 306 | ||
307 | void MainWindow::updateList() | 307 | void MainWindow::updateList() |
308 | { | 308 | { |
309 | packageListServers.clear(); | 309 | packageListServers.clear(); |
310 | packageListSearch.clear(); | 310 | packageListSearch.clear(); |
311 | 311 | ||
312 | // packageListDocLnk.clear(); | 312 | packageListDocLnk.clear(); |
313 | ipkg->update(); | 313 | ipkg->update(); |
314 | packageListServers.update(); | 314 | packageListServers.update(); |
315 | packageListSearch.update(); | 315 | packageListSearch.update(); |
316 | // packageListDocLnk.update(); | 316 | packageListDocLnk.update(); |
317 | } | 317 | } |
318 | 318 | ||
319 | void MainWindow::filterList() | 319 | void MainWindow::filterList() |
320 | { | 320 | { |
321 | QString f = ""; | 321 | QString f = ""; |
322 | if ( findAction->isOn() ) f = findEdit->text(); | 322 | if ( findAction->isOn() ) f = findEdit->text(); |
323 | packageListServers.filterPackages( f ); | 323 | packageListServers.filterPackages( f ); |
324 | } | 324 | } |
325 | 325 | ||
326 | void MainWindow::displayList() | 326 | void MainWindow::displayList() |
327 | { | 327 | { |
328 | filterList(); | 328 | filterList(); |
329 | listViewPackages->display(); | 329 | listViewPackages->display(); |
330 | } | 330 | } |
331 | 331 | ||
332 | void MainWindow::sectionChanged() | 332 | void MainWindow::sectionChanged() |
333 | { | 333 | { |
334 | disconnect( section, SIGNAL( activated(int) ), | 334 | disconnect( section, SIGNAL( activated(int) ), |
335 | this, SLOT( sectionChanged() ) ); | 335 | this, SLOT( sectionChanged() ) ); |
336 | disconnect( subsection, SIGNAL(activated(int) ), | 336 | disconnect( subsection, SIGNAL(activated(int) ), |
337 | this, SLOT( subSectionChanged() ) ); | 337 | this, SLOT( subSectionChanged() ) ); |
338 | subsection->clear(); | 338 | subsection->clear(); |
339 | packageListServers.setSection( section->currentText() ); | 339 | packageListServers.setSection( section->currentText() ); |
340 | setSubSections(); | 340 | setSubSections(); |
341 | connect( section, SIGNAL( activated(int) ), | 341 | connect( section, SIGNAL( activated(int) ), |
342 | this, SLOT( sectionChanged() ) ); | 342 | this, SLOT( sectionChanged() ) ); |
343 | connect( subsection, SIGNAL(activated(int) ), | 343 | connect( subsection, SIGNAL(activated(int) ), |
344 | this, SLOT( subSectionChanged() ) ); | 344 | this, SLOT( subSectionChanged() ) ); |
345 | displayList(); | 345 | displayList(); |
346 | } | 346 | } |
347 | 347 | ||
348 | void MainWindow::subSectionChanged() | 348 | void MainWindow::subSectionChanged() |
349 | { | 349 | { |
350 | disconnect( section, SIGNAL( activated(int) ), | 350 | disconnect( section, SIGNAL( activated(int) ), |
351 | this, SLOT( sectionChanged() ) ); | 351 | this, SLOT( sectionChanged() ) ); |
352 | disconnect( subsection, SIGNAL(activated(int) ), | 352 | disconnect( subsection, SIGNAL(activated(int) ), |
353 | this, SLOT( subSectionChanged() ) ); | 353 | this, SLOT( subSectionChanged() ) ); |
354 | packageListServers.setSubSection( subsection->currentText() ); | 354 | packageListServers.setSubSection( subsection->currentText() ); |
355 | connect( section, SIGNAL( activated(int) ), | 355 | connect( section, SIGNAL( activated(int) ), |
356 | this, SLOT( sectionChanged() ) ); | 356 | this, SLOT( sectionChanged() ) ); |
357 | connect( subsection, SIGNAL(activated(int) ), | 357 | connect( subsection, SIGNAL(activated(int) ), |
358 | this, SLOT( subSectionChanged() ) ); | 358 | this, SLOT( subSectionChanged() ) ); |
359 | displayList(); | 359 | displayList(); |
360 | } | 360 | } |
361 | 361 | ||
362 | void MainWindow::setSections() | 362 | void MainWindow::setSections() |
363 | { | 363 | { |
364 | section->clear(); | 364 | section->clear(); |
365 | section->insertStringList( packageListServers.getSections() ); | 365 | section->insertStringList( packageListServers.getSections() ); |
366 | } | 366 | } |
367 | 367 | ||
368 | void MainWindow::setSubSections() | 368 | void MainWindow::setSubSections() |
369 | { | 369 | { |
370 | subsection->clear(); | 370 | subsection->clear(); |
371 | subsection->insertStringList( packageListServers.getSubSections() ); | 371 | subsection->insertStringList( packageListServers.getSubSections() ); |
372 | } | 372 | } |
373 | 373 | ||
374 | 374 | ||
375 | void MainWindow::showSettings() | 375 | void MainWindow::showSettings() |
376 | { | 376 | { |
377 | if ( settings->showDialog( 0 ) ) | 377 | if ( settings->showDialog( 0 ) ) |
378 | updateList(); | 378 | updateList(); |
379 | } | 379 | } |
380 | void MainWindow::showSettingsSrv() | 380 | void MainWindow::showSettingsSrv() |
381 | { | 381 | { |
382 | if ( settings->showDialog( 1 ) ) | 382 | if ( settings->showDialog( 1 ) ) |
383 | updateList(); | 383 | updateList(); |
384 | } | 384 | } |
385 | void MainWindow::showSettingsDst() | 385 | void MainWindow::showSettingsDst() |
386 | { | 386 | { |
387 | if ( settings->showDialog( 2 ) ) | 387 | if ( settings->showDialog( 2 ) ) |
388 | updateList(); | 388 | updateList(); |
389 | } | 389 | } |
390 | 390 | ||
391 | void MainWindow::sectionShow(bool b) | 391 | void MainWindow::sectionShow(bool b) |
392 | { | 392 | { |
393 | if (b) sectionBar->show(); | 393 | if (b) sectionBar->show(); |
394 | else sectionBar->hide(); | 394 | else sectionBar->hide(); |
395 | sectionAction->setOn( b ); | 395 | sectionAction->setOn( b ); |
396 | } | 396 | } |
397 | 397 | ||
398 | void MainWindow::sectionClose() | 398 | void MainWindow::sectionClose() |
399 | { | 399 | { |
400 | sectionAction->setOn( false ); | 400 | sectionAction->setOn( false ); |
401 | } | 401 | } |
402 | 402 | ||
403 | void MainWindow::findShow(bool b) | 403 | void MainWindow::findShow(bool b) |
404 | { | 404 | { |
405 | if (b) findBar->show(); | 405 | if (b) findBar->show(); |
406 | else findBar->hide(); | 406 | else findBar->hide(); |
407 | findAction->setOn( b ); | 407 | findAction->setOn( b ); |
408 | } | 408 | } |
409 | 409 | ||
410 | void MainWindow::findClose() | 410 | void MainWindow::findClose() |
411 | { | 411 | { |
412 | findAction->setOn( false ); | 412 | findAction->setOn( false ); |
413 | } | 413 | } |
414 | 414 | ||
415 | void MainWindow::searchShow(bool b) | 415 | void MainWindow::searchShow(bool b) |
416 | { | 416 | { |
417 | if (b) searchBar->show(); | 417 | if (b) searchBar->show(); |
418 | else searchBar->hide(); | 418 | else searchBar->hide(); |
419 | searchAction->setOn( b ); | 419 | searchAction->setOn( b ); |
420 | } | 420 | } |
421 | 421 | ||
422 | void MainWindow::searchClose() | 422 | void MainWindow::searchClose() |
423 | { | 423 | { |
424 | searchAction->setOn( false ); | 424 | searchAction->setOn( false ); |
425 | } | 425 | } |
426 | 426 | ||
427 | 427 | ||
428 | void MainWindow::destShow(bool b) | 428 | void MainWindow::destShow(bool b) |
429 | { | 429 | { |
430 | if (b) destBar->show(); | 430 | if (b) destBar->show(); |
431 | else destBar->hide(); | 431 | else destBar->hide(); |
432 | destAction->setOn( b ); | 432 | destAction->setOn( b ); |
433 | } | 433 | } |
434 | 434 | ||
435 | void MainWindow::destClose() | 435 | void MainWindow::destClose() |
436 | { | 436 | { |
437 | destAction->setOn( false ); | 437 | destAction->setOn( false ); |
438 | } | 438 | } |
439 | 439 | ||
440 | void MainWindow::setDocument(const QString &fileName) | 440 | void MainWindow::setDocument(const QString &fileName) |
441 | { | 441 | { |
442 | if ( !QFile::exists( fileName ) ) return; | 442 | if ( !QFile::exists( fileName ) ) return; |
443 | ipkg->installFile( fileName ); | 443 | ipkg->installFile( fileName ); |
444 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 444 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
445 | QString lf = QString::null; | 445 | QString lf = QString::null; |
446 | e << lf; | 446 | e << lf; |
447 | } | 447 | } |
448 | 448 | ||
449 | 449 | ||
450 | void MainWindow::makeChannel() | 450 | void MainWindow::makeChannel() |
451 | { | 451 | { |
452 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 452 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
453 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 453 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
454 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 454 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | 458 | ||
459 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 459 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
460 | { | 460 | { |
461 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); | 461 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
462 | if ( msg == "installFile(QString)" ) | 462 | if ( msg == "installFile(QString)" ) |
463 | { | 463 | { |
464 | ipkg->installFile( QString(arg) ); | 464 | ipkg->installFile( QString(arg) ); |
465 | }else if( msg == "removeFile(QString)" ) | 465 | }else if( msg == "removeFile(QString)" ) |
466 | { | 466 | { |
467 | ipkg->removeFile( QString(arg) ); | 467 | ipkg->removeFile( QString(arg) ); |
468 | }else if( msg == "createLinks(QString)" ) | 468 | }else if( msg == "createLinks(QString)" ) |
469 | { | 469 | { |
470 | ipkg->createLinks( QString(arg) ); | 470 | ipkg->createLinks( QString(arg) ); |
471 | }else if( msg == "removeLinks(QString)" ) | 471 | }else if( msg == "removeLinks(QString)" ) |
472 | { | 472 | { |
473 | ipkg->removeLinks( QString(arg) ); | 473 | ipkg->removeLinks( QString(arg) ); |
474 | }else{ | 474 | }else{ |
475 | pvDebug(2,"Huh what do ya want") | 475 | pvDebug(2,"Huh what do ya want") |
476 | } | 476 | } |
477 | } | 477 | } |
478 | 478 | ||
479 | 479 | ||
480 | void MainWindow::createLinks() | 480 | void MainWindow::createLinks() |
481 | { | 481 | { |
482 | pvDebug(2,"creating links..."); | 482 | pvDebug(2,"creating links..."); |
483 | ipkg->createLinks( settings->destinationurl->text() ); | 483 | ipkg->createLinks( settings->destinationurl->text() ); |
484 | } | 484 | } |
485 | 485 | ||
486 | void MainWindow::removeLinks() | 486 | void MainWindow::removeLinks() |
487 | { | 487 | { |
488 | pvDebug(2,"removing links..."); | 488 | pvDebug(2,"removing links..."); |
489 | ipkg->removeLinks( settings->destinationurl->text() ); | 489 | ipkg->removeLinks( settings->destinationurl->text() ); |
490 | } | 490 | } |
491 | 491 | ||
492 | void MainWindow::remotePackageQuery() | 492 | void MainWindow::remotePackageQuery() |
493 | { | 493 | { |
494 | packageListSearch.query( searchEdit->text() ); | 494 | packageListSearch.query( searchEdit->text() ); |
495 | packageListSearch.update(); | 495 | packageListSearch.update(); |
496 | displayList(); | 496 | displayList(); |
497 | } | 497 | } |