-rw-r--r-- | noncore/unsupported/oipkg/TODO | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.cpp | 104 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.h | 46 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistremote.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 11 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 96 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 7 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/settings.h | 1 |
11 files changed, 202 insertions, 75 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index 1aa9e6b..b1ae6e3 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,14 +1,14 @@ | |||
1 | * Settings Class | 1 | * Settings Class |
2 | * tr() ;) | 2 | * tr() ;) |
3 | * Dialog to display ipkg output live | 3 | * Dialog to display ipkg output live |
4 | * parse "to install" and "to remove" from status | 4 | * parse "to install" and "to remove" from status |
5 | * install local file dialog | 5 | * install local file dialog |
6 | * qcop | 6 | * qcop |
7 | * error handling | 7 | * error handling |
8 | * manage links | 8 | * manage links |
9 | * dependency checking | 9 | * dependency checking |
10 | * create dest if it does not exist | 10 | * create dest if it does not exist |
11 | * allow reinstalling | 11 | * allow reinstalling |
12 | * different types of filters and searches | 12 | * different types of filters and searches |
13 | i.e. name, desc, files etc | 13 | i.e. name, desc, files etc |
14 | * get packages from doclnk \ No newline at end of file | 14 | * mark packages from doclnk and ipkgfind installed if installed \ No newline at end of file |
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp new file mode 100644 index 0000000..72f436a --- a/dev/null +++ b/noncore/unsupported/oipkg/installdialog.cpp | |||
@@ -0,0 +1,104 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'installdialog.ui' | ||
3 | ** | ||
4 | ** Created: Thu May 2 22:19:02 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "installdialog.h" | ||
10 | |||
11 | #include <qcheckbox.h> | ||
12 | #include <qgroupbox.h> | ||
13 | #include <qheader.h> | ||
14 | #include <qlistview.h> | ||
15 | #include <qpushbutton.h> | ||
16 | #include <qlayout.h> | ||
17 | #include <qvariant.h> | ||
18 | #include <qtooltip.h> | ||
19 | #include <qwhatsthis.h> | ||
20 | |||
21 | |||
22 | InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
23 | : QDialog( parent, name, modal, fl ) | ||
24 | { | ||
25 | settings = s; | ||
26 | if ( !name ) | ||
27 | setName( "InstallDialog" ); | ||
28 | resize( 223, 269 ); | ||
29 | setCaption( tr( "Install" ) ); | ||
30 | InstallDialogLayout = new QGridLayout( this ); | ||
31 | InstallDialogLayout->setSpacing( 2 ); | ||
32 | InstallDialogLayout->setMargin( 2 ); | ||
33 | |||
34 | ListViewPackages = new PackageListView( this,"listViewPackages",settings ); | ||
35 | |||
36 | InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); | ||
37 | |||
38 | GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); | ||
39 | GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); | ||
40 | GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); | ||
41 | GroupBoxOptions->layout()->setSpacing( 0 ); | ||
42 | GroupBoxOptions->layout()->setMargin( 0 ); | ||
43 | GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); | ||
44 | GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); | ||
45 | GroupBoxOptionsLayout->setSpacing( 2 ); | ||
46 | GroupBoxOptionsLayout->setMargin( 2 ); | ||
47 | |||
48 | _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); | ||
49 | QFont _force_depends_font( _force_depends->font() ); | ||
50 | _force_depends_font.setPointSize( 8 ); | ||
51 | _force_depends->setFont( _force_depends_font ); | ||
52 | _force_depends->setText( tr( "-force-depends" ) ); | ||
53 | //_force_depends->setChecked( true ); | ||
54 | |||
55 | GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); | ||
56 | |||
57 | _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); | ||
58 | QFont _force_reinstall_font( _force_reinstall->font() ); | ||
59 | _force_reinstall_font.setPointSize( 8 ); | ||
60 | _force_reinstall->setFont( _force_reinstall_font ); | ||
61 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | ||
62 | |||
63 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); | ||
64 | |||
65 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); | ||
66 | QFont _force_remove_font( _force_remove->font() ); | ||
67 | _force_remove_font.setPointSize( 8 ); | ||
68 | _force_remove->setFont( _force_remove_font ); | ||
69 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | ||
70 | |||
71 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); | ||
72 | |||
73 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); | ||
74 | } | ||
75 | |||
76 | /* | ||
77 | * Destroys the object and frees any allocated resources | ||
78 | */ | ||
79 | InstallDialog::~InstallDialog() | ||
80 | { | ||
81 | // no need to delete child widgets, Qt does it all for us | ||
82 | } | ||
83 | |||
84 | /* | ||
85 | * Main event handler. Reimplemented to handle application | ||
86 | * font changes | ||
87 | */ | ||
88 | bool InstallDialog::event( QEvent* ev ) | ||
89 | { | ||
90 | bool ret = QDialog::event( ev ); | ||
91 | if ( ev->type() == QEvent::ApplicationFontChange ) { | ||
92 | QFont _force_depends_font( _force_depends->font() ); | ||
93 | _force_depends_font.setPointSize( 8 ); | ||
94 | _force_depends->setFont( _force_depends_font ); | ||
95 | QFont _force_reinstall_font( _force_reinstall->font() ); | ||
96 | _force_reinstall_font.setPointSize( 8 ); | ||
97 | _force_reinstall->setFont( _force_reinstall_font ); | ||
98 | QFont _force_remove_font( _force_remove->font() ); | ||
99 | _force_remove_font.setPointSize( 8 ); | ||
100 | _force_remove->setFont( _force_remove_font ); | ||
101 | } | ||
102 | return ret; | ||
103 | } | ||
104 | |||
diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h new file mode 100644 index 0000000..f2164ac --- a/dev/null +++ b/noncore/unsupported/oipkg/installdialog.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'installdialog.ui' | ||
3 | ** | ||
4 | ** Created: Thu May 2 22:19:01 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef INSTALLDIALOG_H | ||
10 | #define INSTALLDIALOG_H | ||
11 | |||
12 | #include "pksettings.h" | ||
13 | #include "packagelistview.h" | ||
14 | #include <qvariant.h> | ||
15 | #include <qdialog.h> | ||
16 | class QVBoxLayout; | ||
17 | class QHBoxLayout; | ||
18 | class QGridLayout; | ||
19 | class QCheckBox; | ||
20 | class QGroupBox; | ||
21 | class QListView; | ||
22 | class QListViewItem; | ||
23 | |||
24 | class InstallDialog : public QDialog | ||
25 | { | ||
26 | Q_OBJECT | ||
27 | |||
28 | public: | ||
29 | InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
30 | ~InstallDialog(); | ||
31 | |||
32 | PackageListView* ListViewPackages; | ||
33 | QGroupBox* GroupBoxOptions; | ||
34 | QCheckBox* _force_depends; | ||
35 | QCheckBox* _force_reinstall; | ||
36 | QCheckBox* _force_remove; | ||
37 | |||
38 | protected: | ||
39 | QGridLayout* InstallDialogLayout; | ||
40 | QGridLayout* GroupBoxOptionsLayout; | ||
41 | bool event( QEvent* ); | ||
42 | private: | ||
43 | PackageManagerSettings* settings; | ||
44 | }; | ||
45 | |||
46 | #endif // INSTALLDIALOG_H | ||
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index b668660..259a789 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,484 +1,487 @@ | |||
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 | packageListServers.update(); | 52 | packageListServers.update(); |
53 | packageListDocLnk.update(); | 53 | packageListDocLnk.update(); |
54 | makeMenu(); | 54 | makeMenu(); |
55 | makeChannel(); | 55 | makeChannel(); |
56 | //opie is hardcoded default ;) | 56 | //opie is hardcoded default ;) |
57 | for (int i=0;i<section->count();i++) | 57 | for (int i=0;i<section->count();i++) |
58 | if (section->text(i)=="opie") | 58 | if (section->text(i)=="opie") |
59 | section->setCurrentItem(i); | 59 | section->setCurrentItem(i); |
60 | sectionChanged(); | 60 | sectionChanged(); |
61 | 61 | ||
62 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 62 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
63 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 63 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
64 | 64 | ||
65 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 65 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
66 | SLOT(removeLinks()) ); | 66 | SLOT(removeLinks()) ); |
67 | connect( settings->createLinksButton, SIGNAL( clicked()), | 67 | connect( settings->createLinksButton, SIGNAL( clicked()), |
68 | SLOT(createLinks()) ); | 68 | SLOT(createLinks()) ); |
69 | 69 | ||
70 | displayList(); | 70 | displayList(); |
71 | } | 71 | } |
72 | 72 | ||
73 | void MainWindow::makeMenu() | 73 | void MainWindow::makeMenu() |
74 | { | 74 | { |
75 | 75 | ||
76 | QPEToolBar *toolBar = new QPEToolBar( this ); | 76 | QPEToolBar *toolBar = new QPEToolBar( this ); |
77 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 77 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
78 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 78 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
79 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 79 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
80 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 80 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
81 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); | 81 | // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); |
82 | 82 | ||
83 | setToolBarsMovable( false ); | 83 | setToolBarsMovable( false ); |
84 | toolBar->setHorizontalStretchable( true ); | 84 | toolBar->setHorizontalStretchable( true ); |
85 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 85 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
86 | menuBar->insertItem( tr( "View" ), viewMenu ); | 86 | menuBar->insertItem( tr( "View" ), viewMenu ); |
87 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 87 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
88 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); | 88 | // menuBar->insertItem( tr( "Sections" ), sectMenu ); |
89 | 89 | ||
90 | QLabel *spacer = new QLabel( "", toolBar ); | 90 | QLabel *spacer = new QLabel( "", toolBar ); |
91 | spacer->setBackgroundColor( toolBar->backgroundColor() ); | 91 | spacer->setBackgroundColor( toolBar->backgroundColor() ); |
92 | toolBar->setStretchableWidget( spacer ); | 92 | toolBar->setStretchableWidget( spacer ); |
93 | 93 | ||
94 | 94 | ||
95 | runAction = new QAction( tr( "Apply" ), | 95 | runAction = new QAction( tr( "Apply" ), |
96 | Resource::loadPixmap( "oipkg/install" ), | 96 | Resource::loadPixmap( "oipkg/install" ), |
97 | QString::null, 0, this, 0 ); | 97 | QString::null, 0, this, 0 ); |
98 | connect( runAction, SIGNAL( activated() ), | 98 | connect( runAction, SIGNAL( activated() ), |
99 | this, SLOT( runIpkg() ) ); | 99 | this, SLOT( runIpkg() ) ); |
100 | runAction->addTo( toolBar ); | 100 | runAction->addTo( toolBar ); |
101 | runAction->addTo( srvMenu ); | 101 | runAction->addTo( srvMenu ); |
102 | 102 | ||
103 | srvMenu->insertSeparator (); | 103 | srvMenu->insertSeparator (); |
104 | 104 | ||
105 | updateAction = new QAction( tr( "Update" ), | 105 | updateAction = new QAction( tr( "Update" ), |
106 | Resource::loadIconSet( "oipkg/update" ), | 106 | Resource::loadIconSet( "oipkg/update" ), |
107 | QString::null, 0, this, 0 ); | 107 | QString::null, 0, this, 0 ); |
108 | connect( updateAction, SIGNAL( activated() ), | 108 | connect( updateAction, SIGNAL( activated() ), |
109 | this , SLOT( updateList() ) ); | 109 | this , SLOT( updateList() ) ); |
110 | updateAction->addTo( toolBar ); | 110 | updateAction->addTo( toolBar ); |
111 | updateAction->addTo( srvMenu ); | 111 | updateAction->addTo( srvMenu ); |
112 | 112 | ||
113 | QAction *cfgact; | 113 | QAction *cfgact; |
114 | 114 | ||
115 | cfgact = new QAction( tr( "Setups" ), | 115 | cfgact = new QAction( tr( "Setups" ), |
116 | QString::null, 0, this, 0 ); | 116 | QString::null, 0, this, 0 ); |
117 | connect( cfgact, SIGNAL( activated() ), | 117 | connect( cfgact, SIGNAL( activated() ), |
118 | SLOT( showSettings() ) ); | 118 | SLOT( showSettings() ) ); |
119 | cfgact->addTo( cfgMenu ); | 119 | cfgact->addTo( cfgMenu ); |
120 | 120 | ||
121 | cfgact = new QAction( tr( "Servers" ), | 121 | cfgact = new QAction( tr( "Servers" ), |
122 | QString::null, 0, this, 0 ); | 122 | QString::null, 0, this, 0 ); |
123 | connect( cfgact, SIGNAL( activated() ), | 123 | connect( cfgact, SIGNAL( activated() ), |
124 | SLOT( showSettingsSrv() ) ); | 124 | SLOT( showSettingsSrv() ) ); |
125 | cfgact->addTo( cfgMenu ); | 125 | cfgact->addTo( cfgMenu ); |
126 | cfgact = new QAction( tr( "Destinations" ), | 126 | cfgact = new QAction( tr( "Destinations" ), |
127 | QString::null, 0, this, 0 ); | 127 | QString::null, 0, this, 0 ); |
128 | connect( cfgact, SIGNAL( activated() ), | 128 | connect( cfgact, SIGNAL( activated() ), |
129 | SLOT( showSettingsDst() ) ); | 129 | SLOT( showSettingsDst() ) ); |
130 | cfgact->addTo( cfgMenu ); | 130 | cfgact->addTo( cfgMenu ); |
131 | 131 | ||
132 | QAction *a; | 132 | QAction *a; |
133 | 133 | ||
134 | // SECTIONS | 134 | // SECTIONS |
135 | sectionBar = new QPEToolBar( this ); | 135 | sectionBar = new QPEToolBar( this ); |
136 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 136 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
137 | sectionBar->setHorizontalStretchable( true ); | 137 | sectionBar->setHorizontalStretchable( true ); |
138 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 138 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
139 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 139 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
140 | sectionBar->setStretchableWidget( label ); | 140 | sectionBar->setStretchableWidget( label ); |
141 | section = new QComboBox( false, sectionBar ); | 141 | section = new QComboBox( false, sectionBar ); |
142 | label = new QLabel( " / ", sectionBar ); | 142 | label = new QLabel( " / ", sectionBar ); |
143 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 143 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
144 | subsection = new QComboBox( false, sectionBar ); | 144 | subsection = new QComboBox( false, sectionBar ); |
145 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 145 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
146 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 146 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
147 | a->addTo( sectionBar ); | 147 | a->addTo( sectionBar ); |
148 | setSections(); | 148 | setSections(); |
149 | setSubSections(); | 149 | setSubSections(); |
150 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 150 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
151 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 151 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
152 | sectionAction->setToggleAction( true ); | 152 | sectionAction->setToggleAction( true ); |
153 | sectionAction->addTo( viewMenu ); | 153 | sectionAction->addTo( viewMenu ); |
154 | 154 | ||
155 | //FIND | 155 | //FIND |
156 | findBar = new QPEToolBar(this); | 156 | findBar = new QPEToolBar(this); |
157 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); | 157 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
158 | label = new QLabel( tr("Filter: "), findBar ); | 158 | label = new QLabel( tr("Filter: "), findBar ); |
159 | label->setBackgroundColor( findBar->backgroundColor() ); | 159 | label->setBackgroundColor( findBar->backgroundColor() ); |
160 | findBar->setHorizontalStretchable( TRUE ); | 160 | findBar->setHorizontalStretchable( TRUE ); |
161 | findEdit = new QLineEdit( findBar, "findEdit" ); | 161 | findEdit = new QLineEdit( findBar, "findEdit" ); |
162 | findBar->setStretchableWidget( findEdit ); | 162 | findBar->setStretchableWidget( findEdit ); |
163 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 163 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
164 | this, SLOT( displayList() ) ); | 164 | this, SLOT( displayList() ) ); |
165 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 165 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
166 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 166 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
167 | a->addTo( findBar ); | 167 | a->addTo( findBar ); |
168 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 168 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
169 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 169 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
170 | a->addTo( findBar ); | 170 | a->addTo( findBar ); |
171 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); | 171 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
172 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 172 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
173 | findAction->setToggleAction( true ); | 173 | findAction->setToggleAction( true ); |
174 | findAction->addTo( viewMenu ); | 174 | findAction->addTo( viewMenu ); |
175 | 175 | ||
176 | //SEARCH | 176 | //SEARCH |
177 | searchBar = new QPEToolBar(this); | 177 | searchBar = new QPEToolBar(this); |
178 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 178 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
179 | label = new QLabel( tr("ipkgfind: "), searchBar ); | 179 | label = new QLabel( tr("ipkgfind: "), searchBar ); |
180 | label->setBackgroundColor( searchBar->backgroundColor() ); | 180 | label->setBackgroundColor( searchBar->backgroundColor() ); |
181 | searchBar->setHorizontalStretchable( TRUE ); | 181 | searchBar->setHorizontalStretchable( TRUE ); |
182 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 182 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
183 | searchBar->setStretchableWidget( searchEdit ); | 183 | searchBar->setStretchableWidget( searchEdit ); |
184 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 184 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
185 | // this, SLOT( displayList() ) ); | 185 | // this, SLOT( displayList() ) ); |
186 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 186 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
187 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | 187 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); |
188 | a->addTo( searchBar ); | 188 | a->addTo( searchBar ); |
189 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 189 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
190 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | 190 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); |
191 | searchCommit->addTo( searchBar ); | 191 | searchCommit->addTo( searchBar ); |
192 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 192 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
193 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | 193 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); |
194 | a->addTo( searchBar ); | 194 | a->addTo( searchBar ); |
195 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | 195 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); |
196 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | 196 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); |
197 | searchAction->setToggleAction( true ); | 197 | searchAction->setToggleAction( true ); |
198 | searchAction->addTo( viewMenu ); | 198 | searchAction->addTo( viewMenu ); |
199 | 199 | ||
200 | //DEST | 200 | //DEST |
201 | destBar = new QPEToolBar(this); | 201 | destBar = new QPEToolBar(this); |
202 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 202 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
203 | label = new QLabel( tr("Destination: "), destBar ); | 203 | label = new QLabel( tr("Destination: "), destBar ); |
204 | label->setBackgroundColor( destBar->backgroundColor() ); | 204 | label->setBackgroundColor( destBar->backgroundColor() ); |
205 | destBar->setHorizontalStretchable( TRUE ); | 205 | destBar->setHorizontalStretchable( TRUE ); |
206 | destination = new QComboBox( false, destBar ); | 206 | destination = new QComboBox( false, destBar ); |
207 | destination->insertStringList( settings->getDestinationNames() ); | 207 | destination->insertStringList( settings->getDestinationNames() ); |
208 | setComboName(destination,settings->getDestinationName()); | 208 | setComboName(destination,settings->getDestinationName()); |
209 | connect( destination, SIGNAL(activated(int)), | 209 | connect( destination, SIGNAL(activated(int)), |
210 | settings, SLOT(activeDestinationChange(int)) ); | 210 | settings, SLOT(activeDestinationChange(int)) ); |
211 | spacer = new QLabel( " ", destBar ); | 211 | spacer = new QLabel( " ", destBar ); |
212 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 212 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
213 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 213 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
214 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 214 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
215 | CheckBoxLink->setChecked( settings->createLinks() ); | 215 | CheckBoxLink->setChecked( settings->createLinks() ); |
216 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 216 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
217 | settings, SLOT(linkEnabled(bool)) ); | 217 | settings, SLOT(linkEnabled(bool)) ); |
218 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 218 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
219 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 219 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
220 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 220 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
221 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 221 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
222 | a->addTo( destBar ); | 222 | a->addTo( destBar ); |
223 | destBar->setStretchableWidget( CheckBoxLink ); | 223 | destBar->setStretchableWidget( CheckBoxLink ); |
224 | destAction->setToggleAction( true ); | 224 | destAction->setToggleAction( true ); |
225 | // destAction->addTo( viewMenu ); | 225 | // destAction->addTo( viewMenu ); |
226 | 226 | ||
227 | // configure the menus | 227 | // configure the menus |
228 | Config cfg( "oipkg", Config::User ); | 228 | Config cfg( "oipkg", Config::User ); |
229 | cfg.setGroup( "gui" ); | 229 | cfg.setGroup( "gui" ); |
230 | 230 | ||
231 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 231 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
232 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 232 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
233 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 233 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
234 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 234 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
235 | } | 235 | } |
236 | 236 | ||
237 | MainWindow::~MainWindow() | 237 | MainWindow::~MainWindow() |
238 | { | 238 | { |
239 | pvDebug(7,"MainWindow::~MainWindow "); | ||
239 | Config cfg( "oipkg", Config::User ); | 240 | Config cfg( "oipkg", Config::User ); |
240 | cfg.setGroup( "gui" ); | 241 | cfg.setGroup( "gui" ); |
241 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 242 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
242 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 243 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
243 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 244 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
244 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 245 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
246 | pvDebug(7,"MainWindow::~MainWindow "); | ||
245 | 247 | ||
246 | } | 248 | } |
247 | 249 | ||
248 | void MainWindow::runIpkg() | 250 | void MainWindow::runIpkg() |
249 | { | 251 | { |
250 | packageListServers.allPackages(); | 252 | packageListServers.allPackages(); |
251 | ipkg->loadList( packageListSearch ); | 253 | ipkg->loadList( packageListSearch ); |
252 | ipkg->loadList( packageListDocLnk ); | 254 | ipkg->loadList( packageListDocLnk ); |
253 | ipkg->commit( packageListServers ); | 255 | ipkg->loadList( packageListServers ); |
256 | ipkg->commit(); | ||
254 | // ##### If we looked in the list of files, we could send out accurate | 257 | // ##### If we looked in the list of files, we could send out accurate |
255 | // ##### messages. But we don't bother yet, and just do an "all". | 258 | // ##### messages. But we don't bother yet, and just do an "all". |
256 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 259 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
257 | QString lf = QString::null; | 260 | QString lf = QString::null; |
258 | e << lf; | 261 | e << lf; |
259 | displayList(); | 262 | displayList(); |
260 | } | 263 | } |
261 | 264 | ||
262 | void MainWindow::updateList() | 265 | void MainWindow::updateList() |
263 | { | 266 | { |
264 | //wait->show(); | 267 | //wait->show(); |
265 | QTimer *t = new QTimer( this ); | 268 | QTimer *t = new QTimer( this ); |
266 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); | 269 | connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) ); |
267 | t->start( 0, false ); | 270 | t->start( 0, false ); |
268 | packageListServers.clear(); | 271 | packageListServers.clear(); |
269 | packageListSearch.clear(); | 272 | packageListSearch.clear(); |
270 | packageListDocLnk.clear(); | 273 | packageListDocLnk.clear(); |
271 | ipkg->update(); | 274 | ipkg->update(); |
272 | packageListServers.update(); | 275 | packageListServers.update(); |
273 | packageListSearch.update(); | 276 | packageListSearch.update(); |
274 | packageListDocLnk.update(); | 277 | packageListDocLnk.update(); |
275 | t->stop(); | 278 | t->stop(); |
276 | // wait->hide(); | 279 | // wait->hide(); |
277 | } | 280 | } |
278 | 281 | ||
279 | void MainWindow::filterList() | 282 | void MainWindow::filterList() |
280 | { | 283 | { |
281 | //wait->show(); | 284 | //wait->show(); |
282 | QString f = ""; | 285 | QString f = ""; |
283 | if ( findAction->isOn() ) f = findEdit->text(); | 286 | if ( findAction->isOn() ) f = findEdit->text(); |
284 | packageListServers.filterPackages( f ); | 287 | packageListServers.filterPackages( f ); |
285 | //wait->hide(); | 288 | //wait->hide(); |
286 | } | 289 | } |
287 | 290 | ||
288 | void MainWindow::displayList() | 291 | void MainWindow::displayList() |
289 | { | 292 | { |
290 | //wait->hide(); | 293 | //wait->hide(); |
291 | filterList(); | 294 | filterList(); |
292 | listViewPackages->display(); | 295 | listViewPackages->display(); |
293 | } | 296 | } |
294 | 297 | ||
295 | void MainWindow::sectionChanged() | 298 | void MainWindow::sectionChanged() |
296 | { | 299 | { |
297 | disconnect( section, SIGNAL( activated(int) ), | 300 | disconnect( section, SIGNAL( activated(int) ), |
298 | this, SLOT( sectionChanged() ) ); | 301 | this, SLOT( sectionChanged() ) ); |
299 | disconnect( subsection, SIGNAL(activated(int) ), | 302 | disconnect( subsection, SIGNAL(activated(int) ), |
300 | this, SLOT( subSectionChanged() ) ); | 303 | this, SLOT( subSectionChanged() ) ); |
301 | subsection->clear(); | 304 | subsection->clear(); |
302 | packageListServers.setSection( section->currentText() ); | 305 | packageListServers.setSection( section->currentText() ); |
303 | setSubSections(); | 306 | setSubSections(); |
304 | connect( section, SIGNAL( activated(int) ), | 307 | connect( section, SIGNAL( activated(int) ), |
305 | this, SLOT( sectionChanged() ) ); | 308 | this, SLOT( sectionChanged() ) ); |
306 | connect( subsection, SIGNAL(activated(int) ), | 309 | connect( subsection, SIGNAL(activated(int) ), |
307 | this, SLOT( subSectionChanged() ) ); | 310 | this, SLOT( subSectionChanged() ) ); |
308 | displayList(); | 311 | displayList(); |
309 | } | 312 | } |
310 | 313 | ||
311 | void MainWindow::subSectionChanged() | 314 | void MainWindow::subSectionChanged() |
312 | { | 315 | { |
313 | disconnect( section, SIGNAL( activated(int) ), | 316 | disconnect( section, SIGNAL( activated(int) ), |
314 | this, SLOT( sectionChanged() ) ); | 317 | this, SLOT( sectionChanged() ) ); |
315 | disconnect( subsection, SIGNAL(activated(int) ), | 318 | disconnect( subsection, SIGNAL(activated(int) ), |
316 | this, SLOT( subSectionChanged() ) ); | 319 | this, SLOT( subSectionChanged() ) ); |
317 | packageListServers.setSubSection( subsection->currentText() ); | 320 | packageListServers.setSubSection( subsection->currentText() ); |
318 | connect( section, SIGNAL( activated(int) ), | 321 | connect( section, SIGNAL( activated(int) ), |
319 | this, SLOT( sectionChanged() ) ); | 322 | this, SLOT( sectionChanged() ) ); |
320 | connect( subsection, SIGNAL(activated(int) ), | 323 | connect( subsection, SIGNAL(activated(int) ), |
321 | this, SLOT( subSectionChanged() ) ); | 324 | this, SLOT( subSectionChanged() ) ); |
322 | displayList(); | 325 | displayList(); |
323 | } | 326 | } |
324 | 327 | ||
325 | void MainWindow::setSections() | 328 | void MainWindow::setSections() |
326 | { | 329 | { |
327 | section->clear(); | 330 | section->clear(); |
328 | section->insertStringList( packageListServers.getSections() ); | 331 | section->insertStringList( packageListServers.getSections() ); |
329 | } | 332 | } |
330 | 333 | ||
331 | void MainWindow::setSubSections() | 334 | void MainWindow::setSubSections() |
332 | { | 335 | { |
333 | subsection->clear(); | 336 | subsection->clear(); |
334 | subsection->insertStringList( packageListServers.getSubSections() ); | 337 | subsection->insertStringList( packageListServers.getSubSections() ); |
335 | } | 338 | } |
336 | 339 | ||
337 | 340 | ||
338 | void MainWindow::showSettings() | 341 | void MainWindow::showSettings() |
339 | { | 342 | { |
340 | if ( settings->showDialog( 0 ) ) | 343 | if ( settings->showDialog( 0 ) ) |
341 | updateList(); | 344 | updateList(); |
342 | } | 345 | } |
343 | void MainWindow::showSettingsSrv() | 346 | void MainWindow::showSettingsSrv() |
344 | { | 347 | { |
345 | if ( settings->showDialog( 1 ) ) | 348 | if ( settings->showDialog( 1 ) ) |
346 | updateList(); | 349 | updateList(); |
347 | } | 350 | } |
348 | void MainWindow::showSettingsDst() | 351 | void MainWindow::showSettingsDst() |
349 | { | 352 | { |
350 | if ( settings->showDialog( 2 ) ) | 353 | if ( settings->showDialog( 2 ) ) |
351 | updateList(); | 354 | updateList(); |
352 | } | 355 | } |
353 | 356 | ||
354 | void MainWindow::sectionShow(bool b) | 357 | void MainWindow::sectionShow(bool b) |
355 | { | 358 | { |
356 | if (b) sectionBar->show(); | 359 | if (b) sectionBar->show(); |
357 | else sectionBar->hide(); | 360 | else sectionBar->hide(); |
358 | sectionAction->setOn( b ); | 361 | sectionAction->setOn( b ); |
359 | } | 362 | } |
360 | 363 | ||
361 | void MainWindow::sectionClose() | 364 | void MainWindow::sectionClose() |
362 | { | 365 | { |
363 | sectionAction->setOn( false ); | 366 | sectionAction->setOn( false ); |
364 | } | 367 | } |
365 | 368 | ||
366 | void MainWindow::findShow(bool b) | 369 | void MainWindow::findShow(bool b) |
367 | { | 370 | { |
368 | if (b) findBar->show(); | 371 | if (b) findBar->show(); |
369 | else findBar->hide(); | 372 | else findBar->hide(); |
370 | findAction->setOn( b ); | 373 | findAction->setOn( b ); |
371 | } | 374 | } |
372 | 375 | ||
373 | void MainWindow::findClose() | 376 | void MainWindow::findClose() |
374 | { | 377 | { |
375 | findAction->setOn( false ); | 378 | findAction->setOn( false ); |
376 | } | 379 | } |
377 | 380 | ||
378 | void MainWindow::searchShow(bool b) | 381 | void MainWindow::searchShow(bool b) |
379 | { | 382 | { |
380 | if (b) searchBar->show(); | 383 | if (b) searchBar->show(); |
381 | else searchBar->hide(); | 384 | else searchBar->hide(); |
382 | searchAction->setOn( b ); | 385 | searchAction->setOn( b ); |
383 | } | 386 | } |
384 | 387 | ||
385 | void MainWindow::searchClose() | 388 | void MainWindow::searchClose() |
386 | { | 389 | { |
387 | searchAction->setOn( false ); | 390 | searchAction->setOn( false ); |
388 | } | 391 | } |
389 | 392 | ||
390 | 393 | ||
391 | void MainWindow::destShow(bool b) | 394 | void MainWindow::destShow(bool b) |
392 | { | 395 | { |
393 | if (b) destBar->show(); | 396 | if (b) destBar->show(); |
394 | else destBar->hide(); | 397 | else destBar->hide(); |
395 | destAction->setOn( b ); | 398 | destAction->setOn( b ); |
396 | } | 399 | } |
397 | 400 | ||
398 | void MainWindow::destClose() | 401 | void MainWindow::destClose() |
399 | { | 402 | { |
400 | destAction->setOn( false ); | 403 | destAction->setOn( false ); |
401 | } | 404 | } |
402 | 405 | ||
403 | void MainWindow::rotateUpdateIcon() | 406 | void MainWindow::rotateUpdateIcon() |
404 | { | 407 | { |
405 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 408 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
406 | if ( updateIcon ) | 409 | if ( updateIcon ) |
407 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 410 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
408 | else | 411 | else |
409 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 412 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
410 | updateIcon = !updateIcon; | 413 | updateIcon = !updateIcon; |
411 | } | 414 | } |
412 | 415 | ||
413 | 416 | ||
414 | void MainWindow::setDocument(const QString &fileName) | 417 | void MainWindow::setDocument(const QString &fileName) |
415 | { | 418 | { |
416 | installFile(fileName); | 419 | installFile(fileName); |
417 | // ##### If we looked in the list of files, we could send out accurate | 420 | // ##### If we looked in the list of files, we could send out accurate |
418 | // ##### messages. But we don't bother yet, and just do an "all". | 421 | // ##### messages. But we don't bother yet, and just do an "all". |
419 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 422 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
420 | QString lf = QString::null; | 423 | QString lf = QString::null; |
421 | e << lf; | 424 | e << lf; |
422 | displayList(); | 425 | displayList(); |
423 | } | 426 | } |
424 | 427 | ||
425 | void MainWindow::installFile(const QString &fileName) | 428 | void MainWindow::installFile(const QString &fileName) |
426 | { | 429 | { |
427 | pvDebug(3, "MainWindow::installFile "+fileName); | 430 | pvDebug(3, "MainWindow::installFile "+fileName); |
428 | if ( !QFile::exists( fileName ) ) return; | 431 | if ( !QFile::exists( fileName ) ) return; |
429 | ipkg->installFile( fileName ); | 432 | ipkg->installFile( fileName ); |
430 | // ##### If we looked in the list of files, we could send out accurate | 433 | // ##### If we looked in the list of files, we could send out accurate |
431 | // ##### messages. But we don't bother yet, and just do an "all". | 434 | // ##### messages. But we don't bother yet, and just do an "all". |
432 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 435 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
433 | QString lf = QString::null; | 436 | QString lf = QString::null; |
434 | e << lf; | 437 | e << lf; |
435 | displayList(); | 438 | displayList(); |
436 | } | 439 | } |
437 | 440 | ||
438 | void MainWindow::makeChannel() | 441 | void MainWindow::makeChannel() |
439 | { | 442 | { |
440 | channel = new QCopChannel( "QPE/Application/oipkg", this ); | 443 | channel = new QCopChannel( "QPE/Application/oipkg", this ); |
441 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 444 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
442 | this, SLOT(receive(const QCString&, const QByteArray&)) ); | 445 | this, SLOT(receive(const QCString&, const QByteArray&)) ); |
443 | } | 446 | } |
444 | 447 | ||
445 | 448 | ||
446 | 449 | ||
447 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) | 450 | void MainWindow::receive(const QCString &msg, const QByteArray &arg) |
448 | { | 451 | { |
449 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); | 452 | pvDebug(3, "QCop "+msg+" "+QCString(arg)); |
450 | if ( msg == "installFile(QString)" ) | 453 | if ( msg == "installFile(QString)" ) |
451 | { | 454 | { |
452 | ipkg->installFile( QString(arg) ); | 455 | ipkg->installFile( QString(arg) ); |
453 | }else if( msg == "removeFile(QString)" ) | 456 | }else if( msg == "removeFile(QString)" ) |
454 | { | 457 | { |
455 | ipkg->removeFile( QString(arg) ); | 458 | ipkg->removeFile( QString(arg) ); |
456 | }else if( msg == "createLinks(QString)" ) | 459 | }else if( msg == "createLinks(QString)" ) |
457 | { | 460 | { |
458 | ipkg->createLinks( QString(arg) ); | 461 | ipkg->createLinks( QString(arg) ); |
459 | }else if( msg == "removeLinks(QString)" ) | 462 | }else if( msg == "removeLinks(QString)" ) |
460 | { | 463 | { |
461 | ipkg->removeLinks( QString(arg) ); | 464 | ipkg->removeLinks( QString(arg) ); |
462 | }else{ | 465 | }else{ |
463 | pvDebug(2,"Huh what do ya want") | 466 | pvDebug(2,"Huh what do ya want") |
464 | } | 467 | } |
465 | } | 468 | } |
466 | 469 | ||
467 | 470 | ||
468 | void MainWindow::createLinks() | 471 | void MainWindow::createLinks() |
469 | { | 472 | { |
470 | pvDebug(2,"creating links..."); | 473 | pvDebug(2,"creating links..."); |
471 | ipkg->createLinks( settings->destinationurl->text() ); | 474 | ipkg->createLinks( settings->destinationurl->text() ); |
472 | } | 475 | } |
473 | 476 | ||
474 | void MainWindow::removeLinks() | 477 | void MainWindow::removeLinks() |
475 | { | 478 | { |
476 | pvDebug(2,"removing links..."); | 479 | pvDebug(2,"removing links..."); |
477 | ipkg->removeLinks( settings->destinationurl->text() ); | 480 | ipkg->removeLinks( settings->destinationurl->text() ); |
478 | } | 481 | } |
479 | 482 | ||
480 | void MainWindow::remotePackageQuery() | 483 | void MainWindow::remotePackageQuery() |
481 | { | 484 | { |
482 | packageListSearch.query( searchEdit->text() ); | 485 | packageListSearch.query( searchEdit->text() ); |
483 | displayList(); | 486 | displayList(); |
484 | } | 487 | } |
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro index 6ee1963..9e2f5f8 100644 --- a/noncore/unsupported/oipkg/oipkg.pro +++ b/noncore/unsupported/oipkg/oipkg.pro | |||
@@ -1,34 +1,36 @@ | |||
1 | DESTDIR = $(OPIEDIR)/bin | 1 | DESTDIR = $(OPIEDIR)/bin |
2 | TEMPLATE= app | 2 | TEMPLATE= app |
3 | #CONFIG = qt warn_on release | 3 | #CONFIG = qt warn_on release |
4 | CONFIG = qt warn_on debug | 4 | CONFIG = qt warn_on debug |
5 | HEADERS = mainwindow.h \ | 5 | HEADERS = mainwindow.h \ |
6 | pksettings.h \ | 6 | pksettings.h \ |
7 | pmipkg.h \ | 7 | pmipkg.h \ |
8 | packagelistdoclnk.h \ | 8 | packagelistdoclnk.h \ |
9 | installdialog.h \ | ||
9 | utils.h \ | 10 | utils.h \ |
10 | packagelistitem.h \ | 11 | packagelistitem.h \ |
11 | packagelistremote.h \ | 12 | packagelistremote.h \ |
12 | packagelist.h \ | 13 | packagelist.h \ |
13 | packagelistlocal.h \ | 14 | packagelistlocal.h \ |
14 | packagelistview.h \ | 15 | packagelistview.h \ |
15 | package.h | 16 | package.h |
16 | SOURCES = main.cpp \ | 17 | SOURCES = main.cpp \ |
17 | mainwindow.cpp \ | 18 | mainwindow.cpp \ |
18 | utils.cpp \ | 19 | utils.cpp \ |
19 | packagelistdoclnk.cpp \ | 20 | packagelistdoclnk.cpp \ |
20 | packagelistview.cpp \ | 21 | packagelistview.cpp \ |
22 | installdialog.cpp \ | ||
21 | packagelistremote.cpp \ | 23 | packagelistremote.cpp \ |
22 | packagelistlocal.cpp \ | 24 | packagelistlocal.cpp \ |
23 | pksettings.cpp \ | 25 | pksettings.cpp \ |
24 | pmipkg.cpp \ | 26 | pmipkg.cpp \ |
25 | packagelistitem.cpp \ | 27 | packagelistitem.cpp \ |
26 | packagelist.cpp \ | 28 | packagelist.cpp \ |
27 | package.cpp | 29 | package.cpp |
28 | INCLUDEPATH += $(OPIEDIR)/include | 30 | INCLUDEPATH += $(OPIEDIR)/include |
29 | DEPENDPATH+= $(OPIEDIR)/ioclude | 31 | DEPENDPATH+= $(OPIEDIR)/ioclude |
30 | LIBS += -lqpe | 32 | LIBS += -lqpe |
31 | INTERFACES= runwindow.ui \ | 33 | INTERFACES= runwindow.ui \ |
32 | pksettingsbase.ui | 34 | pksettingsbase.ui |
33 | TARGET = oipkg | 35 | TARGET = oipkg |
34 | 36 | ||
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp index 1ec7292..3c6ede7 100644 --- a/noncore/unsupported/oipkg/packagelistremote.cpp +++ b/noncore/unsupported/oipkg/packagelistremote.cpp | |||
@@ -1,47 +1,47 @@ | |||
1 | 1 | ||
2 | #include "packagelistremote.h" | 2 | #include "packagelistremote.h" |
3 | 3 | ||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | #include <unistd.h> | 6 | #include <unistd.h> |
7 | 7 | ||
8 | PackageListRemote::PackageListRemote(PackageManagerSettings* s) | 8 | PackageListRemote::PackageListRemote(PackageManagerSettings* s) |
9 | : PackageList(s) | 9 | : PackageList(s) |
10 | { | 10 | { |
11 | PackageListRemote(); | 11 | PackageListRemote(); |
12 | } | 12 | } |
13 | 13 | ||
14 | PackageListRemote::PackageListRemote() | 14 | PackageListRemote::PackageListRemote() |
15 | : PackageList() | 15 | : PackageList() |
16 | { | 16 | { |
17 | } | 17 | } |
18 | 18 | ||
19 | PackageListRemote::~PackageListRemote() | 19 | PackageListRemote::~PackageListRemote() |
20 | { | 20 | { |
21 | } | 21 | } |
22 | 22 | ||
23 | void PackageListRemote::query(QString s) | 23 | void PackageListRemote::query(QString s) |
24 | { | 24 | { |
25 | searchString = s; | 25 | searchString = s; |
26 | } | 26 | } |
27 | 27 | ||
28 | void PackageListRemote::update() | 28 | void PackageListRemote::update() |
29 | { | 29 | { |
30 | pvDebug(2,"PackageListRemote::update"); | 30 | pvDebug(2,"PackageListRemote::update"); |
31 | int r=0; | 31 | int r=0; |
32 | QString cmd = "wget"; | 32 | QString cmd = "wget"; |
33 | QString redirect = "/tmp/oipkg.query"; | 33 | QString redirect = "/tmp/oipkg.query"; |
34 | 34 | ||
35 | // use file for output | 35 | // use file for output |
36 | cmd += " --output-document="+redirect; | 36 | cmd += " --output-document="+redirect; |
37 | //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= | 37 | //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= |
38 | QString server="http://ipkgfind.handhelds.org/"; | 38 | QString server="http://ipkgfind.handhelds.org/"; |
39 | cmd += " \""+server+"/packages.phtml"; | 39 | cmd += " \""+server+"/packages.phtml"; |
40 | cmd += "?format=pda&searchtype=package§ion="; | 40 | cmd += "?format=pda&searchtype=package§ion="; |
41 | cmd += "&query="+searchString; | 41 | cmd += "&query="+searchString; |
42 | cmd += "\""; | 42 | cmd += "\""; |
43 | 43 | ||
44 | pvDebug(2,"search :"+cmd); | 44 | pvDebug(4,"search :"+cmd); |
45 | r = system(cmd.latin1()); | 45 | r = system(cmd.latin1()); |
46 | readFileEntries( redirect ); | 46 | readFileEntries( redirect ); |
47 | } | 47 | } |
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 7e2ef10..24c7beb 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp | |||
@@ -1,564 +1,567 @@ | |||
1 | #include "pksettings.h" | 1 | #include "pksettings.h" |
2 | 2 | ||
3 | #include <qpe/process.h> | 3 | #include <qpe/process.h> |
4 | #include <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | #include <qpe/stringutil.h> | 5 | #include <qpe/stringutil.h> |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | #include <qpe/qcopenvelope_qws.h> | 7 | #include <qpe/qcopenvelope_qws.h> |
8 | #include <qpe/applnk.h> | 8 | #include <qpe/applnk.h> |
9 | #include <qpe/config.h> | 9 | #include <qpe/config.h> |
10 | 10 | ||
11 | #include <qprogressbar.h> | 11 | #include <qprogressbar.h> |
12 | #include <qcombobox.h> | 12 | #include <qcombobox.h> |
13 | #include <qdict.h> | 13 | #include <qdict.h> |
14 | #include <qfile.h> | 14 | #include <qfile.h> |
15 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
16 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
17 | #include <qlistview.h> | 17 | #include <qlistview.h> |
18 | #include <qlistbox.h> | 18 | #include <qlistbox.h> |
19 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
20 | #include <qmessagebox.h> | 20 | #include <qmessagebox.h> |
21 | #include <qpainter.h> | 21 | #include <qpainter.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qregexp.h> | 23 | #include <qregexp.h> |
24 | #include <qstring.h> | 24 | #include <qstring.h> |
25 | #include <qobject.h> | 25 | #include <qobject.h> |
26 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
27 | #include <qtextview.h> | 27 | #include <qtextview.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qtabwidget.h> | 29 | #include <qtabwidget.h> |
30 | 30 | ||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include "debug.h" | 33 | #include "debug.h" |
34 | //#include "utils.h" | 34 | //#include "utils.h" |
35 | 35 | ||
36 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) | 36 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) |
37 | : PackageManagerSettingsBase( parent, name, fl ) | 37 | : PackageManagerSettingsBase( parent, name, fl ) |
38 | { | 38 | { |
39 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); | 39 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); |
40 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); | 40 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); |
41 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 41 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
42 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); | 42 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); |
43 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); | 43 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); |
44 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 44 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
45 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), | 45 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), |
46 | // activeLinkDestination, SLOT(setEnabled(bool)) ); | 46 | // activeLinkDestination, SLOT(setEnabled(bool)) ); |
47 | 47 | ||
48 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); | 48 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); |
49 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); | 49 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); |
50 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); | 50 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); |
51 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); | 51 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); |
52 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); | 52 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); |
53 | servername->setEnabled(FALSE); | 53 | servername->setEnabled(FALSE); |
54 | serverurl->setEnabled(FALSE); | 54 | serverurl->setEnabled(FALSE); |
55 | serverurlDic.setAutoDelete(TRUE); | 55 | serverurlDic.setAutoDelete(TRUE); |
56 | destinationname->setEnabled(FALSE); | 56 | destinationname->setEnabled(FALSE); |
57 | destinationurl->setEnabled(FALSE); | 57 | destinationurl->setEnabled(FALSE); |
58 | destinationurlDic.setAutoDelete(TRUE); | 58 | destinationurlDic.setAutoDelete(TRUE); |
59 | readSettings(); | 59 | readSettings(); |
60 | activeLinkDestination->hide(); | 60 | activeLinkDestination->hide(); |
61 | serverChanged = false; | ||
61 | } | 62 | } |
62 | 63 | ||
63 | PackageManagerSettings::~PackageManagerSettings() | 64 | PackageManagerSettings::~PackageManagerSettings() |
64 | { | 65 | { |
65 | } | 66 | } |
66 | 67 | ||
67 | 68 | ||
68 | void PackageManagerSettings::newServer() | 69 | void PackageManagerSettings::newServer() |
69 | { | 70 | { |
70 | int i = servers->count(); | 71 | int i = servers->count(); |
71 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { | 72 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { |
72 | serverurlDic.insert(i,new QString("http://")); | 73 | serverurlDic.insert(i,new QString("http://")); |
73 | servers->insertItem(tr("New")); | 74 | servers->insertItem(tr("New")); |
74 | activeServers->insertItem(tr("New")); | 75 | activeServers->insertItem(tr("New")); |
75 | } else { | 76 | } else { |
76 | // allows one-level undo | 77 | // allows one-level undo |
77 | serverurlDic.insert(i,new QString(serverurl->text())); | 78 | serverurlDic.insert(i,new QString(serverurl->text())); |
78 | servers->insertItem(servername->text()); | 79 | servers->insertItem(servername->text()); |
79 | activeServers->insertItem(servername->text()); | 80 | activeServers->insertItem(servername->text()); |
80 | } | 81 | } |
81 | changed = true; | 82 | changed = true; |
82 | servers->setSelected(i,TRUE); | 83 | servers->setSelected(i,TRUE); |
83 | editServer(i); | 84 | editServer(i); |
84 | changed = true; | 85 | changed = true; |
85 | } | 86 | } |
86 | 87 | ||
87 | void PackageManagerSettings::newDestination() | 88 | void PackageManagerSettings::newDestination() |
88 | { | 89 | { |
89 | int i = destinations->count(); | 90 | int i = destinations->count(); |
90 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { | 91 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { |
91 | destinationurlDic.insert(i,new QString("/")); | 92 | destinationurlDic.insert(i,new QString("/")); |
92 | destinations->insertItem(tr("New")); | 93 | destinations->insertItem(tr("New")); |
93 | activeDestination->insertItem(tr("New")); | 94 | activeDestination->insertItem(tr("New")); |
94 | activeLinkDestination->insertItem(tr("New")); | 95 | activeLinkDestination->insertItem(tr("New")); |
95 | } else { | 96 | } else { |
96 | // allows one-level undo | 97 | // allows one-level undo |
97 | destinationurlDic.insert(i,new QString(destinationurl->text())); | 98 | destinationurlDic.insert(i,new QString(destinationurl->text())); |
98 | destinations->insertItem(destinationname->text()); | 99 | destinations->insertItem(destinationname->text()); |
99 | activeDestination->insertItem(destinationname->text()); | 100 | activeDestination->insertItem(destinationname->text()); |
100 | activeLinkDestination->insertItem(destinationname->text()); | 101 | activeLinkDestination->insertItem(destinationname->text()); |
101 | } | 102 | } |
102 | destinations->setSelected(i,TRUE); | 103 | destinations->setSelected(i,TRUE); |
103 | editDestination(i); | 104 | editDestination(i); |
104 | changed = true; | 105 | changed = true; |
105 | } | 106 | } |
106 | 107 | ||
107 | 108 | ||
108 | void PackageManagerSettings::editServer(int i) | 109 | void PackageManagerSettings::editServer(int i) |
109 | { | 110 | { |
110 | if ( servername->isEnabled() ) { | 111 | if ( servername->isEnabled() ) { |
111 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 112 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
112 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 113 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
113 | } else { | 114 | } else { |
114 | servername->setEnabled(TRUE); | 115 | servername->setEnabled(TRUE); |
115 | serverurl->setEnabled(TRUE); | 116 | serverurl->setEnabled(TRUE); |
116 | } | 117 | } |
117 | 118 | ||
118 | servername->setText( servers->text(i) ); | 119 | servername->setText( servers->text(i) ); |
119 | serverurl->setText( *serverurlDic[i] ); | 120 | serverurl->setText( *serverurlDic[i] ); |
120 | 121 | ||
121 | editedserver = i; | 122 | editedserver = i; |
122 | 123 | serverChanged = true; | |
123 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 124 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
124 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 125 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
125 | changed = true; | 126 | changed = true; |
126 | } | 127 | } |
127 | 128 | ||
128 | 129 | ||
129 | void PackageManagerSettings::editDestination(int i) | 130 | void PackageManagerSettings::editDestination(int i) |
130 | { | 131 | { |
131 | if ( destinationname->isEnabled() ) { | 132 | if ( destinationname->isEnabled() ) { |
132 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 133 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
133 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 134 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
134 | } else { | 135 | } else { |
135 | destinationname->setEnabled(TRUE); | 136 | destinationname->setEnabled(TRUE); |
136 | destinationurl->setEnabled(TRUE); | 137 | destinationurl->setEnabled(TRUE); |
137 | createLinksButton->setEnabled(TRUE); | 138 | //since it does not work anyway |
138 | removeLinksButton->setEnabled(TRUE); | 139 | // createLinksButton->setEnabled(TRUE); |
140 | // removeLinksButton->setEnabled(TRUE); | ||
139 | } | 141 | } |
140 | 142 | ||
141 | destinationname->setText( destinations->text(i) ); | 143 | destinationname->setText( destinations->text(i) ); |
142 | destinationurl->setText( *destinationurlDic[i] ); | 144 | destinationurl->setText( *destinationurlDic[i] ); |
143 | 145 | ||
144 | editeddestination = i; | 146 | editeddestination = i; |
145 | 147 | ||
146 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 148 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
147 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 149 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
148 | changed = true; | 150 | changed = true; |
149 | } | 151 | } |
150 | 152 | ||
151 | void PackageManagerSettings::removeServer() | 153 | void PackageManagerSettings::removeServer() |
152 | { | 154 | { |
153 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 155 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
154 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 156 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
155 | servername->setText(servers->text(editedserver)); | 157 | servername->setText(servers->text(editedserver)); |
156 | serverurl->setText(*serverurlDic[editedserver]); | 158 | serverurl->setText(*serverurlDic[editedserver]); |
157 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 159 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
158 | servers->removeItem(editedserver); | 160 | servers->removeItem(editedserver); |
159 | activeServers->removeItem(editedserver); | 161 | activeServers->removeItem(editedserver); |
160 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 162 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
161 | servername->setEnabled(FALSE); | 163 | servername->setEnabled(FALSE); |
162 | serverurl->setEnabled(FALSE); | 164 | serverurl->setEnabled(FALSE); |
163 | changed = true; | 165 | changed = true; |
164 | } | 166 | } |
165 | 167 | ||
166 | void PackageManagerSettings::removeDestination() | 168 | void PackageManagerSettings::removeDestination() |
167 | { | 169 | { |
168 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 170 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
169 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 171 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
170 | destinationname->setText(destinations->text(editedserver)); | 172 | destinationname->setText(destinations->text(editedserver)); |
171 | destinationurl->setText(*destinationurlDic[editedserver]); | 173 | destinationurl->setText(*destinationurlDic[editedserver]); |
172 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 174 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
173 | destinations->removeItem(editeddestination); | 175 | destinations->removeItem(editeddestination); |
174 | activeDestination->removeItem(editeddestination); | 176 | activeDestination->removeItem(editeddestination); |
175 | activeLinkDestination->removeItem(editeddestination); | 177 | activeLinkDestination->removeItem(editeddestination); |
176 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 178 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
177 | destinationname->setEnabled(FALSE); | 179 | destinationname->setEnabled(FALSE); |
178 | destinationurl->setEnabled(FALSE); | 180 | destinationurl->setEnabled(FALSE); |
179 | changed = true; | 181 | changed = true; |
180 | } | 182 | } |
181 | 183 | ||
182 | void PackageManagerSettings::serverNameChanged(const QString& t) | 184 | void PackageManagerSettings::serverNameChanged(const QString& t) |
183 | { | 185 | { |
184 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 186 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
185 | servers->changeItem( t, editedserver ); | 187 | servers->changeItem( t, editedserver ); |
186 | activeServers->changeItem( t, editedserver ); | 188 | activeServers->changeItem( t, editedserver ); |
187 | changed = true; | ||
188 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 189 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
189 | changed = true; | 190 | changed = true; |
191 | serverChanged = true; | ||
190 | } | 192 | } |
191 | 193 | ||
192 | void PackageManagerSettings::destNameChanged(const QString& t) | 194 | void PackageManagerSettings::destNameChanged(const QString& t) |
193 | { | 195 | { |
194 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 196 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
195 | destinations->changeItem( t, editeddestination ); | 197 | destinations->changeItem( t, editeddestination ); |
196 | activeDestination->changeItem( t, editeddestination ); | 198 | activeDestination->changeItem( t, editeddestination ); |
197 | activeLinkDestination->changeItem( t, editeddestination ); | 199 | activeLinkDestination->changeItem( t, editeddestination ); |
198 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 200 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
199 | changed = true; | 201 | changed = true; |
200 | } | 202 | } |
201 | 203 | ||
202 | void PackageManagerSettings::serverUrlChanged(const QString& t) | 204 | void PackageManagerSettings::serverUrlChanged(const QString& t) |
203 | { | 205 | { |
204 | serverurlDic.replace(editedserver, new QString(t)); | 206 | serverurlDic.replace(editedserver, new QString(t)); |
205 | changed = true; | 207 | changed = true; |
208 | serverChanged = true; | ||
206 | } | 209 | } |
207 | 210 | ||
208 | void PackageManagerSettings::destUrlChanged(const QString& t) | 211 | void PackageManagerSettings::destUrlChanged(const QString& t) |
209 | { | 212 | { |
210 | destinationurlDic.replace(editeddestination, new QString(t)); | 213 | destinationurlDic.replace(editeddestination, new QString(t)); |
211 | changed = true; | 214 | changed = true; |
212 | } | 215 | } |
213 | 216 | ||
214 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) | 217 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) |
215 | { | 218 | { |
216 | QFile conf(conffile); | 219 | QFile conf(conffile); |
217 | if ( ! conf.open(IO_WriteOnly) ) return; | 220 | if ( ! conf.open(IO_WriteOnly) ) return; |
218 | QTextStream s(&conf); | 221 | QTextStream s(&conf); |
219 | s << "# Written by qpie Package Manager\n"; | 222 | s << "# Written by qpie Package Manager\n"; |
220 | for (int i=0; i<(int)activeServers->count(); i++) | 223 | for (int i=0; i<(int)activeServers->count(); i++) |
221 | { | 224 | { |
222 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); | 225 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); |
223 | if ( !activeServers->isSelected(i) ) | 226 | if ( !activeServers->isSelected(i) ) |
224 | s << "#"; | 227 | s << "#"; |
225 | s << "src " << activeServers->text(i) << " " << url << "\n"; | 228 | s << "src " << activeServers->text(i) << " " << url << "\n"; |
226 | } | 229 | } |
227 | for (int i=0; i<(int)destinations->count(); i++) | 230 | for (int i=0; i<(int)destinations->count(); i++) |
228 | { | 231 | { |
229 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); | 232 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); |
230 | s << "dest " << destinations->text(i) << " " << url << "\n"; | 233 | s << "dest " << destinations->text(i) << " " << url << "\n"; |
231 | } | 234 | } |
232 | conf.close(); | 235 | conf.close(); |
233 | } | 236 | } |
234 | 237 | ||
235 | 238 | ||
236 | void PackageManagerSettings::readInstallationSettings() | 239 | void PackageManagerSettings::readInstallationSettings() |
237 | { | 240 | { |
238 | Config cfg( "oipkg", Config::User ); | 241 | Config cfg( "oipkg", Config::User ); |
239 | cfg.setGroup( "Settings" ); | 242 | cfg.setGroup( "Settings" ); |
240 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); | 243 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); |
241 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 | 244 | currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 |
242 | 245 | ||
243 | for (int i = 0; i < installationSettingsCount; i++) | 246 | for (int i = 0; i < installationSettingsCount; i++) |
244 | { | 247 | { |
245 | cfg.setGroup( "Setting_" + QString::number(i) ); | 248 | cfg.setGroup( "Setting_" + QString::number(i) ); |
246 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); | 249 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); |
247 | }; | 250 | }; |
248 | readInstallationSetting( currentSetting ); | 251 | readInstallationSetting( currentSetting ); |
249 | } | 252 | } |
250 | 253 | ||
251 | 254 | ||
252 | 255 | ||
253 | /** | 256 | /** |
254 | * remove from conf file | 257 | * remove from conf file |
255 | */ | 258 | */ |
256 | void PackageManagerSettings::removeInstallationSetting() | 259 | void PackageManagerSettings::removeInstallationSetting() |
257 | { | 260 | { |
258 | settingName->removeItem( settingName->currentItem() ); | 261 | settingName->removeItem( settingName->currentItem() ); |
259 | Config cfg( "oipkg", Config::User ); | 262 | Config cfg( "oipkg", Config::User ); |
260 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); | 263 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); |
261 | cfg.clearGroup(); | 264 | cfg.clearGroup(); |
262 | installationSettingsCount--; | 265 | installationSettingsCount--; |
263 | changed = true; | 266 | changed = true; |
264 | settingName->setEditable( false ); | 267 | settingName->setEditable( false ); |
265 | } | 268 | } |
266 | 269 | ||
267 | /** | 270 | /** |
268 | * write to confgile | 271 | * write to confgile |
269 | */ | 272 | */ |
270 | void PackageManagerSettings::newInstallationSetting() | 273 | void PackageManagerSettings::newInstallationSetting() |
271 | { | 274 | { |
272 | installationSettingsCount++; | 275 | installationSettingsCount++; |
273 | settingName->insertItem( "New", installationSettingsCount ); | 276 | settingName->insertItem( "New", installationSettingsCount ); |
274 | settingName->setCurrentItem( installationSettingsCount ); | 277 | settingName->setCurrentItem( installationSettingsCount ); |
275 | settingName->setEditable( true ); | 278 | settingName->setEditable( true ); |
276 | changed = true; | 279 | changed = true; |
277 | } | 280 | } |
278 | 281 | ||
279 | void PackageManagerSettings::installationSettingChange(int cs) | 282 | void PackageManagerSettings::installationSettingChange(int cs) |
280 | { | 283 | { |
281 | writeCurrentInstallationSetting(); | 284 | writeCurrentInstallationSetting(); |
282 | currentSetting = cs; | 285 | currentSetting = cs; |
283 | readInstallationSetting( cs ); | 286 | readInstallationSetting( cs ); |
284 | changed = true; | 287 | changed = true; |
285 | } | 288 | } |
286 | 289 | ||
287 | void PackageManagerSettings::writeInstallationSettings() | 290 | void PackageManagerSettings::writeInstallationSettings() |
288 | { | 291 | { |
289 | { | 292 | { |
290 | Config cfg( "oipkg", Config::User ); | 293 | Config cfg( "oipkg", Config::User ); |
291 | cfg.setGroup( "Settings" ); | 294 | cfg.setGroup( "Settings" ); |
292 | cfg.writeEntry( "count", installationSettingsCount ); | 295 | cfg.writeEntry( "count", installationSettingsCount ); |
293 | cfg.writeEntry( "current", currentSetting ); | 296 | cfg.writeEntry( "current", currentSetting ); |
294 | } | 297 | } |
295 | writeCurrentInstallationSetting(); | 298 | writeCurrentInstallationSetting(); |
296 | } | 299 | } |
297 | 300 | ||
298 | 301 | ||
299 | void PackageManagerSettings::readInstallationSetting(int setting) | 302 | void PackageManagerSettings::readInstallationSetting(int setting) |
300 | { | 303 | { |
301 | if ( setting < 0 ) return; | 304 | if ( setting < 0 ) return; |
302 | Config cfg( "oipkg", Config::User ); | 305 | Config cfg( "oipkg", Config::User ); |
303 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 306 | cfg.setGroup( "Setting_" + QString::number( setting ) ); |
304 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); | 307 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); |
305 | QString dest = cfg.readEntry( "dest" ); | 308 | QString dest = cfg.readEntry( "dest" ); |
306 | QString linkdest = cfg.readEntry( "linkdest" ); | 309 | QString linkdest = cfg.readEntry( "linkdest" ); |
307 | pvDebug(3, "dest="+dest); | 310 | pvDebug(3, "dest="+dest); |
308 | pvDebug(3, "linkdest="+linkdest); | 311 | pvDebug(3, "linkdest="+linkdest); |
309 | for ( int i = 0; i < activeDestination->count(); i++) | 312 | for ( int i = 0; i < activeDestination->count(); i++) |
310 | { | 313 | { |
311 | if ( activeDestination->text( i ) == dest ) | 314 | if ( activeDestination->text( i ) == dest ) |
312 | activeDestination->setCurrentItem( i ); | 315 | activeDestination->setCurrentItem( i ); |
313 | if ( activeLinkDestination->text( i ) == linkdest ) | 316 | if ( activeLinkDestination->text( i ) == linkdest ) |
314 | activeLinkDestination->setCurrentItem( i ); | 317 | activeLinkDestination->setCurrentItem( i ); |
315 | } | 318 | } |
316 | } | 319 | } |
317 | 320 | ||
318 | void PackageManagerSettings::writeCurrentInstallationSetting() | 321 | void PackageManagerSettings::writeCurrentInstallationSetting() |
319 | { | 322 | { |
320 | Config cfg( "oipkg", Config::User ); | 323 | Config cfg( "oipkg", Config::User ); |
321 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); | 324 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); |
322 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); | 325 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); |
323 | cfg.writeEntry( "dest", getDestinationName() ); | 326 | cfg.writeEntry( "dest", getDestinationName() ); |
324 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); | 327 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); |
325 | QStringList sers = getActiveServers(); | 328 | QStringList sers = getActiveServers(); |
326 | int srvc = 0; | 329 | int srvc = 0; |
327 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { | 330 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { |
328 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); | 331 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); |
329 | } | 332 | } |
330 | cfg.writeEntry( "server_count", srvc ); | 333 | cfg.writeEntry( "server_count", srvc ); |
331 | } | 334 | } |
332 | 335 | ||
333 | void PackageManagerSettings::renameInstallationSetting() | 336 | void PackageManagerSettings::renameInstallationSetting() |
334 | { | 337 | { |
335 | settingName->setEditable( true ); | 338 | settingName->setEditable( true ); |
336 | changed = true; | 339 | changed = true; |
337 | } | 340 | } |
338 | 341 | ||
339 | void PackageManagerSettings::installationSettingSetName(const QString &name) | 342 | void PackageManagerSettings::installationSettingSetName(const QString &name) |
340 | { | 343 | { |
341 | settingName->changeItem( name, settingName->currentItem() ); | 344 | settingName->changeItem( name, settingName->currentItem() ); |
342 | changed = true; | 345 | changed = true; |
343 | } | 346 | } |
344 | 347 | ||
345 | 348 | ||
346 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) | 349 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) |
347 | { | 350 | { |
348 | QFile conf(conffile); | 351 | QFile conf(conffile); |
349 | changed = false; | 352 | changed = false; |
350 | if ( conf.open(IO_ReadOnly) ) { | 353 | if ( conf.open(IO_ReadOnly) ) { |
351 | QTextStream s(&conf); | 354 | QTextStream s(&conf); |
352 | servers->clear(); | 355 | servers->clear(); |
353 | activeServers->clear(); | 356 | activeServers->clear(); |
354 | activeDestination->clear(); | 357 | activeDestination->clear(); |
355 | activeLinkDestination->clear(); | 358 | activeLinkDestination->clear(); |
356 | serverurlDic.clear(); | 359 | serverurlDic.clear(); |
357 | destinationurlDic.clear(); | 360 | destinationurlDic.clear(); |
358 | ipkg_old=0; | 361 | ipkg_old=0; |
359 | int currentserver=0; | 362 | int currentserver=0; |
360 | while ( !s.atEnd() ) { | 363 | while ( !s.atEnd() ) { |
361 | QString l = s.readLine(); | 364 | QString l = s.readLine(); |
362 | QStringList token = QStringList::split(' ', l); | 365 | QStringList token = QStringList::split(' ', l); |
363 | if ( token[0] == "src" || token[0] == "#src" ) { | 366 | if ( token[0] == "src" || token[0] == "#src" ) { |
364 | currentserver=servers->count(); | 367 | currentserver=servers->count(); |
365 | serverurlDic.insert(servers->count(),new QString(token[2])); | 368 | serverurlDic.insert(servers->count(),new QString(token[2])); |
366 | int a = token[0] == "src" ? 1 : 0; | 369 | int a = token[0] == "src" ? 1 : 0; |
367 | int i = servers->count(); | 370 | int i = servers->count(); |
368 | servers->insertItem(token[1]); | 371 | servers->insertItem(token[1]); |
369 | activeServers->insertItem( token[1] ); | 372 | activeServers->insertItem( token[1] ); |
370 | activeServers->setSelected(i,a); | 373 | activeServers->setSelected(i,a); |
371 | } else if ( token[0] == "dest" ) { | 374 | } else if ( token[0] == "dest" ) { |
372 | currentserver=destinations->count(); | 375 | currentserver=destinations->count(); |
373 | destinationurlDic.insert(destinations->count(),new QString(token[2])); | 376 | destinationurlDic.insert(destinations->count(),new QString(token[2])); |
374 | destinations->insertItem(token[1]); | 377 | destinations->insertItem(token[1]); |
375 | activeDestination->insertItem( token[1] ); | 378 | activeDestination->insertItem( token[1] ); |
376 | activeLinkDestination->insertItem( token[1] ); | 379 | activeLinkDestination->insertItem( token[1] ); |
377 | 380 | ||
378 | } else if ( token[0] == "option" ) { | 381 | } else if ( token[0] == "option" ) { |
379 | // ### somehow need to use the settings from netsetup | 382 | // ### somehow need to use the settings from netsetup |
380 | // if ( token[1] == "http_proxy" ) | 383 | // if ( token[1] == "http_proxy" ) |
381 | // http->setText(token[2]); | 384 | // http->setText(token[2]); |
382 | // else if ( token[1] == "ftp_proxy" ) | 385 | // else if ( token[1] == "ftp_proxy" ) |
383 | // ftp->setText(token[2]); | 386 | // ftp->setText(token[2]); |
384 | // else if ( token[1] == "proxy_username" ) | 387 | // else if ( token[1] == "proxy_username" ) |
385 | // username->setText(token[2]); | 388 | // username->setText(token[2]); |
386 | // else if ( token[1] == "proxy_password" ) | 389 | // else if ( token[1] == "proxy_password" ) |
387 | // password->setText(token[2]); | 390 | // password->setText(token[2]); |
388 | } else { | 391 | } else { |
389 | // Old style? | 392 | // Old style? |
390 | int eq = l.find('='); | 393 | int eq = l.find('='); |
391 | if ( eq >= 0 ) { | 394 | if ( eq >= 0 ) { |
392 | QString v = l.mid(eq+1).stripWhiteSpace(); | 395 | QString v = l.mid(eq+1).stripWhiteSpace(); |
393 | if ( v[0] == '"' || v[0] == '\'' ) { | 396 | if ( v[0] == '"' || v[0] == '\'' ) { |
394 | int cl=v.find(v[0],1); | 397 | int cl=v.find(v[0],1); |
395 | if ( cl >= 0 ) | 398 | if ( cl >= 0 ) |
396 | v = v.mid(1,cl-1); | 399 | v = v.mid(1,cl-1); |
397 | } | 400 | } |
398 | if ( l.left(12) == "IPKG_SOURCE=" ) { | 401 | if ( l.left(12) == "IPKG_SOURCE=" ) { |
399 | ipkg_old=1; | 402 | ipkg_old=1; |
400 | currentserver=servers->count(); | 403 | currentserver=servers->count(); |
401 | serverurlDic.insert(servers->count(),new QString(v)); | 404 | serverurlDic.insert(servers->count(),new QString(v)); |
402 | servers->insertItem(v); | 405 | servers->insertItem(v); |
403 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { | 406 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { |
404 | serverurlDic.insert(servers->count(),new QString(v)); | 407 | serverurlDic.insert(servers->count(),new QString(v)); |
405 | servers->insertItem(v); | 408 | servers->insertItem(v); |
406 | } else if ( l.left(10) == "IPKG_ROOT=" ) { | 409 | } else if ( l.left(10) == "IPKG_ROOT=" ) { |
407 | // ### no UI | 410 | // ### no UI |
408 | // } else if ( l.left(20) == "IPKG_PROXY_USERNAME=" ) { | 411 | // } else if ( l.left(20) == "IPKG_PROXY_USERNAME=" ) { |
409 | // username->setText(v); | 412 | // username->setText(v); |
410 | // } else if ( l.left(20) == "IPKG_PROXY_PASSWORD=" ) { | 413 | // } else if ( l.left(20) == "IPKG_PROXY_PASSWORD=" ) { |
411 | // password->setText(v); | 414 | // password->setText(v); |
412 | // } else if ( l.left(16) == "IPKG_PROXY_HTTP=" ) { | 415 | // } else if ( l.left(16) == "IPKG_PROXY_HTTP=" ) { |
413 | // http->setText(v); | 416 | // http->setText(v); |
414 | // } else if ( l.left(16) == "IPKG_PROXY_FTP=" ) { | 417 | // } else if ( l.left(16) == "IPKG_PROXY_FTP=" ) { |
415 | // ftp->setText(v); | 418 | // ftp->setText(v); |
416 | } | 419 | } |
417 | } | 420 | } |
418 | } | 421 | } |
419 | } | 422 | } |
420 | if ( ipkg_old ) { | 423 | if ( ipkg_old ) { |
421 | servers->setSelectionMode(QListBox::Single); | 424 | servers->setSelectionMode(QListBox::Single); |
422 | servers->setSelected(currentserver,TRUE); | 425 | servers->setSelected(currentserver,TRUE); |
423 | } | 426 | } |
424 | return TRUE; | 427 | return TRUE; |
425 | } else { | 428 | } else { |
426 | return FALSE; | 429 | return FALSE; |
427 | } | 430 | } |
428 | } | 431 | } |
429 | 432 | ||
430 | 433 | ||
431 | /** | 434 | /** |
432 | * read from config file(s) | 435 | * read from config file(s) |
433 | */ | 436 | */ |
434 | void PackageManagerSettings::readSettings() | 437 | void PackageManagerSettings::readSettings() |
435 | { | 438 | { |
436 | readIpkgConfig("/etc/ipkg.conf"); | 439 | readIpkgConfig("/etc/ipkg.conf"); |
437 | readInstallationSettings(); | 440 | readInstallationSettings(); |
438 | } | 441 | } |
439 | 442 | ||
440 | void PackageManagerSettings::writeSettings() | 443 | void PackageManagerSettings::writeSettings() |
441 | { | 444 | { |
442 | if ( changed ) writeIpkgConfig("/etc/ipkg.conf"); | 445 | if ( changed ) writeIpkgConfig("/etc/ipkg.conf"); |
443 | writeInstallationSettings(); | 446 | writeInstallationSettings(); |
444 | } | 447 | } |
445 | /** shows the setting dialog */ | 448 | /** shows the setting dialog */ |
446 | bool PackageManagerSettings::showDialog( int i ) | 449 | bool PackageManagerSettings::showDialog( int i ) |
447 | { | 450 | { |
448 | TabWidget->setCurrentPage( i ); | 451 | TabWidget->setCurrentPage( i ); |
449 | showMaximized(); | 452 | showMaximized(); |
450 | bool ret = exec(); | 453 | bool ret = exec(); |
451 | if ( ret ) writeSettings(); | 454 | if ( ret ) writeSettings(); |
452 | else readSettings(); | 455 | else readSettings(); |
453 | return (changed && ret); | 456 | return (changed && ret); |
454 | } | 457 | } |
455 | /** Returns the installation destination */ | 458 | /** Returns the installation destination */ |
456 | QString PackageManagerSettings::getDestinationName() | 459 | QString PackageManagerSettings::getDestinationName() |
457 | { | 460 | { |
458 | return activeDestination->currentText(); | 461 | return activeDestination->currentText(); |
459 | } | 462 | } |
460 | /** Returns the link destination */ | 463 | /** Returns the link destination */ |
461 | QString PackageManagerSettings::getLinkDestinationName() | 464 | QString PackageManagerSettings::getLinkDestinationName() |
462 | { | 465 | { |
463 | return activeLinkDestination->currentText(); | 466 | return activeLinkDestination->currentText(); |
464 | } | 467 | } |
465 | /** Returns the URL of the active destination */ | 468 | /** Returns the URL of the active destination */ |
466 | QString PackageManagerSettings::getDestinationUrl() | 469 | QString PackageManagerSettings::getDestinationUrl() |
467 | { | 470 | { |
468 | int dnr = activeDestination->currentItem(); | 471 | int dnr = activeDestination->currentItem(); |
469 | return *destinationurlDic.find(dnr); | 472 | return *destinationurlDic.find(dnr); |
470 | } | 473 | } |
471 | /** Should oipkg create links form install destination to link destination */ | 474 | /** Should oipkg create links form install destination to link destination */ |
472 | bool PackageManagerSettings::createLinks() | 475 | bool PackageManagerSettings::createLinks() |
473 | { | 476 | { |
474 | return CheckBoxLink->isChecked(); | 477 | return CheckBoxLink->isChecked(); |
475 | } | 478 | } |
476 | /** get the servers that are active */ | 479 | /** get the servers that are active */ |
477 | QStringList PackageManagerSettings::getActiveServers() | 480 | QStringList PackageManagerSettings::getActiveServers() |
478 | { | 481 | { |
479 | QStringList sl; | 482 | QStringList sl; |
480 | for (int i=0; i<(int)activeServers->count(); i++) | 483 | for (int i=0; i<(int)activeServers->count(); i++) |
481 | { | 484 | { |
482 | if ( activeServers->isSelected(i) ) | 485 | if ( activeServers->isSelected(i) ) |
483 | sl += activeServers->text(i); | 486 | sl += activeServers->text(i); |
484 | } | 487 | } |
485 | return sl; | 488 | return sl; |
486 | } | 489 | } |
487 | QStringList PackageManagerSettings::getServers() | 490 | QStringList PackageManagerSettings::getServers() |
488 | { | 491 | { |
489 | QStringList sl; | 492 | QStringList sl; |
490 | for (int i=0; i<(int)activeServers->count(); i++) | 493 | for (int i=0; i<(int)activeServers->count(); i++) |
491 | { | 494 | { |
492 | sl += activeServers->text(i); | 495 | sl += activeServers->text(i); |
493 | } | 496 | } |
494 | return sl; | 497 | return sl; |
495 | } | 498 | } |
496 | 499 | ||
497 | /** returns the destination listed in ipkg.conf */ | 500 | /** returns the destination listed in ipkg.conf */ |
498 | QStringList PackageManagerSettings::getDestinationUrls() | 501 | QStringList PackageManagerSettings::getDestinationUrls() |
499 | { | 502 | { |
500 | QStringList sl; | 503 | QStringList sl; |
501 | for (int i=0; i<(int)destinations->count(); i++) | 504 | for (int i=0; i<(int)destinations->count(); i++) |
502 | { | 505 | { |
503 | sl += *destinationurlDic[i]; | 506 | sl += *destinationurlDic[i]; |
504 | } | 507 | } |
505 | return sl; | 508 | return sl; |
506 | } | 509 | } |
507 | 510 | ||
508 | /** returns the destination listed in ipkg.conf */ | 511 | /** returns the destination listed in ipkg.conf */ |
509 | QString PackageManagerSettings::getDestinationUrlByName(QString n) | 512 | QString PackageManagerSettings::getDestinationUrlByName(QString n) |
510 | { | 513 | { |
511 | QStringList sl; | 514 | QStringList sl; |
512 | for (int i=0; i<(int)destinations->count(); i++) | 515 | for (int i=0; i<(int)destinations->count(); i++) |
513 | { | 516 | { |
514 | if ( n == destinations->text(i)) return*destinationurlDic[i]; | 517 | if ( n == destinations->text(i)) return*destinationurlDic[i]; |
515 | } | 518 | } |
516 | return ""; | 519 | return ""; |
517 | } | 520 | } |
518 | 521 | ||
519 | /** returns the destination listed in ipkg.conf */ | 522 | /** returns the destination listed in ipkg.conf */ |
520 | QStringList PackageManagerSettings::getDestinationNames() | 523 | QStringList PackageManagerSettings::getDestinationNames() |
521 | { | 524 | { |
522 | QStringList sl; | 525 | QStringList sl; |
523 | for (int i=0; i<(int)destinations->count(); i++) | 526 | for (int i=0; i<(int)destinations->count(); i++) |
524 | { | 527 | { |
525 | sl += destinations->text(i); | 528 | sl += destinations->text(i); |
526 | } | 529 | } |
527 | return sl; | 530 | return sl; |
528 | } | 531 | } |
529 | 532 | ||
530 | 533 | ||
531 | void PackageManagerSettings::linkEnabled( bool b ) | 534 | void PackageManagerSettings::linkEnabled( bool b ) |
532 | { | 535 | { |
533 | pvDebug(2,"PackageManagerSettings::linkEnabled "+QString(b?"yes":"no")); | 536 | pvDebug(2,"PackageManagerSettings::linkEnabled "+QString(b?"yes":"no")); |
534 | activeLinkDestination->setEnabled( b ); | 537 | activeLinkDestination->setEnabled( b ); |
535 | } | 538 | } |
536 | 539 | ||
537 | void PackageManagerSettings::activeServerChanged() | 540 | void PackageManagerSettings::activeServerChanged() |
538 | { | 541 | { |
539 | changed = true; | 542 | changed = true; |
540 | } | 543 | } |
541 | 544 | ||
542 | QComboBox* PackageManagerSettings::getDestCombo() | 545 | QComboBox* PackageManagerSettings::getDestCombo() |
543 | { | 546 | { |
544 | return new QComboBox(activeDestination); | 547 | return new QComboBox(activeDestination); |
545 | } | 548 | } |
546 | 549 | ||
547 | void PackageManagerSettings::createLinksToDest() | 550 | void PackageManagerSettings::createLinksToDest() |
548 | { | 551 | { |
549 | pvDebug(2,"creating links..."); | 552 | pvDebug(2,"creating links..."); |
550 | // emit doCreateLinks( destinationurl->text() ); | 553 | // emit doCreateLinks( destinationurl->text() ); |
551 | //ipkg->createLinks( destinationurl ); | 554 | //ipkg->createLinks( destinationurl ); |
552 | } | 555 | } |
553 | 556 | ||
554 | void PackageManagerSettings::removeLinksToDest() | 557 | void PackageManagerSettings::removeLinksToDest() |
555 | { | 558 | { |
556 | pvDebug(2,"removing links..."); | 559 | pvDebug(2,"removing links..."); |
557 | // emit doRemoveLinks( destinationurl->text() ); | 560 | // emit doRemoveLinks( destinationurl->text() ); |
558 | //ipkg->removeLinks( destinationurl ); | 561 | //ipkg->removeLinks( destinationurl ); |
559 | } | 562 | } |
560 | 563 | ||
561 | //void PackageManagerSettings::setIpkg( PmIpkg* i ) | 564 | //void PackageManagerSettings::setIpkg( PmIpkg* i ) |
562 | //{ | 565 | //{ |
563 | //ipkg = i; | 566 | //ipkg = i; |
564 | //} | 567 | //} |
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index 1632d4a..dcc1e3a 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h | |||
@@ -1,74 +1,75 @@ | |||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 1 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 2 | #define PACKAGEMANAGERSETTINGS_H |
3 | 3 | ||
4 | #include "pksettingsbase.h" | 4 | #include "pksettingsbase.h" |
5 | //#include "pmipkg.h" | 5 | //#include "pmipkg.h" |
6 | #include <qintdict.h> | 6 | #include <qintdict.h> |
7 | #include <qobject.h> | 7 | #include <qobject.h> |
8 | 8 | ||
9 | 9 | ||
10 | class PackageManagerSettings : public PackageManagerSettingsBase | 10 | class PackageManagerSettings : public PackageManagerSettingsBase |
11 | { | 11 | { |
12 | // Q_OBJECT | 12 | // Q_OBJECT |
13 | public: | 13 | public: |
14 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 14 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
15 | ~PackageManagerSettings(); | 15 | ~PackageManagerSettings(); |
16 | 16 | ||
17 | bool showDialog( int ) ; | 17 | bool showDialog( int ) ; |
18 | QString getDestinationUrl(); | 18 | QString getDestinationUrl(); |
19 | QString getDestinationName(); | 19 | QString getDestinationName(); |
20 | QString getLinkDestinationName(); | 20 | QString getLinkDestinationName(); |
21 | bool createLinks(); | 21 | bool createLinks(); |
22 | QStringList getServers(); | 22 | QStringList getServers(); |
23 | QStringList getActiveServers(); | 23 | QStringList getActiveServers(); |
24 | QStringList getDestinationUrls(); | 24 | QStringList getDestinationUrls(); |
25 | QStringList getDestinationNames(); | 25 | QStringList getDestinationNames(); |
26 | QString getDestinationUrlByName(QString); | 26 | QString getDestinationUrlByName(QString); |
27 | QComboBox* getDestCombo(); | 27 | QComboBox* getDestCombo(); |
28 | // void setIpkg( PmIpkg* ); | 28 | // void setIpkg( PmIpkg* ); |
29 | 29 | ||
30 | public slots: | 30 | public slots: |
31 | void writeInstallationSettings(); | 31 | void writeInstallationSettings(); |
32 | void readInstallationSettings(); | 32 | void readInstallationSettings(); |
33 | void writeCurrentInstallationSetting(); | 33 | void writeCurrentInstallationSetting(); |
34 | void readInstallationSetting(int); | 34 | void readInstallationSetting(int); |
35 | void installationSettingSetName(const QString &); | 35 | void installationSettingSetName(const QString &); |
36 | void removeLinksToDest(); | 36 | void removeLinksToDest(); |
37 | void createLinksToDest(); | 37 | void createLinksToDest(); |
38 | void newServer(); | 38 | void newServer(); |
39 | void editServer(int); | 39 | void editServer(int); |
40 | void removeDestination(); | 40 | void removeDestination(); |
41 | void newDestination(); | 41 | void newDestination(); |
42 | void editDestination(int); | 42 | void editDestination(int); |
43 | void linkEnabled(bool); | 43 | void linkEnabled(bool); |
44 | void removeServer(); | 44 | void removeServer(); |
45 | void serverNameChanged(const QString&); | 45 | void serverNameChanged(const QString&); |
46 | void serverUrlChanged(const QString&); | 46 | void serverUrlChanged(const QString&); |
47 | void destNameChanged(const QString&); | 47 | void destNameChanged(const QString&); |
48 | void destUrlChanged(const QString&); | 48 | void destUrlChanged(const QString&); |
49 | void installationSettingChange(int); | 49 | void installationSettingChange(int); |
50 | void newInstallationSetting(); | 50 | void newInstallationSetting(); |
51 | void removeInstallationSetting(); | 51 | void removeInstallationSetting(); |
52 | void renameInstallationSetting(); | 52 | void renameInstallationSetting(); |
53 | void activeServerChanged(); | 53 | void activeServerChanged(); |
54 | signals: | 54 | signals: |
55 | // void doCreateLinks( QString dest ); | 55 | // void doCreateLinks( QString dest ); |
56 | // void doRemoveLinks( QString dest ); | 56 | // void doRemoveLinks( QString dest ); |
57 | 57 | ||
58 | private: | 58 | private: |
59 | QIntDict<QString> serverurlDic; | 59 | QIntDict<QString> serverurlDic; |
60 | QIntDict<QString> destinationurlDic; | 60 | QIntDict<QString> destinationurlDic; |
61 | int ipkg_old; | 61 | int ipkg_old; |
62 | int editedserver; | 62 | int editedserver; |
63 | int editeddestination; | 63 | int editeddestination; |
64 | int currentSetting; | 64 | int currentSetting; |
65 | int installationSettingsCount; | 65 | int installationSettingsCount; |
66 | bool changed; | 66 | bool changed; |
67 | bool serverChanged; | ||
67 | 68 | ||
68 | bool readIpkgConfig(const QString&); | 69 | bool readIpkgConfig(const QString&); |
69 | void writeIpkgConfig(const QString&); | 70 | void writeIpkgConfig(const QString&); |
70 | void writeSettings(); | 71 | void writeSettings(); |
71 | void readSettings(); | 72 | void readSettings(); |
72 | }; | 73 | }; |
73 | 74 | ||
74 | #endif | 75 | #endif |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index be9d6da..fd8279b 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,449 +1,417 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 2 | #include "pksettings.h" |
3 | #include "package.h" | 3 | #include "package.h" |
4 | #include "packagelistitem.h" | 4 | #include "packagelistitem.h" |
5 | 5 | ||
6 | #include <qpe/process.h> | 6 | #include <qpe/process.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
9 | #include <qpe/stringutil.h> | 9 | #include <qpe/stringutil.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qgroupbox.h> | 12 | #include <qgroupbox.h> |
13 | #include <qmultilineedit.h> | 13 | #include <qmultilineedit.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qcheckbox.h> | 15 | #include <qcheckbox.h> |
16 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #include <qtextview.h> | 17 | #include <qtextview.h> |
18 | 18 | ||
19 | #include <qprogressbar.h> | 19 | #include <qprogressbar.h> |
20 | #include <qpushbutton.h> | 20 | #include <qpushbutton.h> |
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | 22 | ||
23 | #include <stdlib.h> | 23 | #include <stdlib.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | 25 | ||
26 | #include "mainwindow.h" | 26 | #include "mainwindow.h" |
27 | 27 | ||
28 | 28 | ||
29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 29 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
30 | : QObject ( p ) | 30 | : QObject ( p ) |
31 | { | 31 | { |
32 | settings = s; | 32 | settings = s; |
33 | runwindow = new RunWindow( p, name, true, f ); | 33 | runwindow = new RunWindow( p, name, true, f ); |
34 | } | 34 | } |
35 | 35 | ||
36 | PmIpkg::~PmIpkg() | 36 | PmIpkg::~PmIpkg() |
37 | { | 37 | { |
38 | } | 38 | } |
39 | 39 | ||
40 | //#define PROC | 40 | //#define PROC |
41 | #define SYSTEM | 41 | #define SYSTEM |
42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | 42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
43 | { | 43 | { |
44 | pvDebug(2,"PmIpkg::runIpkg "+args); | 44 | pvDebug(2,"PmIpkg::runIpkg "+args); |
45 | 45 | ||
46 | #ifdef PROC | 46 | #ifdef PROC |
47 | QStringList cmd = "/usr/bin/ipkg "; | 47 | QStringList cmd = "/usr/bin/ipkg "; |
48 | #endif | 48 | #endif |
49 | #ifdef SYSTEM | 49 | #ifdef SYSTEM |
50 | QString cmd = "/usr/bin/ipkg "; | 50 | QString cmd = "/usr/bin/ipkg "; |
51 | #endif | 51 | #endif |
52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 52 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
53 | if ( dest == "" ) | 53 | if ( dest == "" ) |
54 | cmd += " -dest "+settings->getDestinationName(); | 54 | cmd += " -dest "+settings->getDestinationName(); |
55 | else | 55 | else |
56 | cmd += " -dest "+ dest; | 56 | cmd += " -dest "+ dest; |
57 | 57 | ||
58 | cmd += " -force-defaults "; | 58 | cmd += " -force-defaults "; |
59 | 59 | ||
60 | if (_force_depends) | 60 | if (installDialog->_force_depends) |
61 | { | 61 | { |
62 | if (_force_depends->isChecked()) | 62 | if (installDialog->_force_depends->isChecked()) |
63 | cmd += " -force-depends "; | 63 | cmd += " -force-depends "; |
64 | if (_force_reinstall->isChecked()) | 64 | if (installDialog->_force_reinstall->isChecked()) |
65 | cmd += " -force-reinstall "; | 65 | cmd += " -force-reinstall "; |
66 | if (_force_remove->isChecked()) | 66 | if (installDialog->_force_remove->isChecked()) |
67 | cmd += " -force-removal-of-essential-packages "; | 67 | cmd += " -force-removal-of-essential-packages "; |
68 | } | 68 | } |
69 | 69 | ||
70 | out( "<hr><br>Starting to "+ args+"<br>\n"); | 70 | out( "<hr><br>Starting to "+ args+"<br>\n"); |
71 | cmd += args; | 71 | cmd += args; |
72 | int r = 0; | 72 | int r = 0; |
73 | #ifdef PROC | 73 | #ifdef PROC |
74 | QString o = "start"; | 74 | QString o = "start"; |
75 | Process *ipkg = new Process( cmd ); | 75 | Process *ipkg = new Process( cmd ); |
76 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); | 76 | out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); |
77 | QString description; | 77 | QString description; |
78 | ipkg->exec("",o); | 78 | ipkg->exec("",o); |
79 | // out( o ); | 79 | // out( o ); |
80 | #endif | 80 | #endif |
81 | #ifdef SYSTEM | 81 | #ifdef SYSTEM |
82 | out( "running:<br>\n"+cmd+"<br>\n" ); | 82 | out( "running:<br>\n"+cmd+"<br>\n" ); |
83 | QString redirect = "/tmp/oipkg.pipe"; | 83 | QString redirect = "/tmp/oipkg.pipe"; |
84 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; | 84 | cmd += " 2>&1 | tee "+redirect+" 2>&1"; |
85 | pvDebug(2, "running >"+cmd+"<"); | 85 | pvDebug(2, "running >"+cmd+"<"); |
86 | r = system(cmd.latin1()); | 86 | r = system(cmd.latin1()); |
87 | QFile f( redirect ); | 87 | QFile f( redirect ); |
88 | QString line; | 88 | QString line; |
89 | QString oldLine; | 89 | QString oldLine; |
90 | while ( ! f.open(IO_ReadOnly) ) {}; | 90 | while ( ! f.open(IO_ReadOnly) ) {}; |
91 | QTextStream t( &f ); | 91 | QTextStream t( &f ); |
92 | while ( !t.eof() ) | 92 | while ( !t.eof() ) |
93 | { | 93 | { |
94 | line = t.readLine(); | 94 | line = t.readLine(); |
95 | if ( line != oldLine ) | 95 | if ( line != oldLine ) |
96 | { | 96 | { |
97 | out( line +"<br>" ); | 97 | out( line +"<br>" ); |
98 | oldLine = line; | 98 | oldLine = line; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | f.close(); | 101 | f.close(); |
102 | out( "Finished!<br>"); | 102 | out( "Finished!<br>"); |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | return r; | 105 | return r; |
106 | } | 106 | } |
107 | 107 | ||
108 | void PmIpkg::makeLinks(Package *pack) | 108 | void PmIpkg::makeLinks(Package *pack) |
109 | { | 109 | { |
110 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 110 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
111 | linkPackage( pack->name(), pack->dest() ); | 111 | linkPackage( pack->name(), pack->dest() ); |
112 | } | 112 | } |
113 | 113 | ||
114 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 114 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
115 | { | 115 | { |
116 | QString dest = settings->getDestinationUrlByName( d ); | 116 | QString dest = settings->getDestinationUrlByName( d ); |
117 | dest = dest==""?d:dest; | 117 | dest = dest==""?d:dest; |
118 | if (dest == "/" ) return 0; | 118 | if (dest == "/" ) return 0; |
119 | { | 119 | { |
120 | Config cfg( "oipkg", Config::User ); | 120 | Config cfg( "oipkg", Config::User ); |
121 | cfg.setGroup( "Common" ); | 121 | cfg.setGroup( "Common" ); |
122 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 122 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
123 | } | 123 | } |
124 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 124 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
125 | QFile f( packFileName ); | 125 | QFile f( packFileName ); |
126 | if ( ! f.open(IO_ReadOnly) ) | 126 | if ( ! f.open(IO_ReadOnly) ) |
127 | { | 127 | { |
128 | pvDebug(1," Panik! Could not open"); | 128 | pvDebug(1," Panik! Could not open"); |
129 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); | 129 | out( "<b>Panik!</b> Could not open:<br>"+packFileName ); |
130 | return (QStringList*)0; | 130 | return (QStringList*)0; |
131 | } | 131 | } |
132 | QStringList *fileList = new QStringList(); | 132 | QStringList *fileList = new QStringList(); |
133 | QTextStream t( &f ); | 133 | QTextStream t( &f ); |
134 | while ( !t.eof() ) | 134 | while ( !t.eof() ) |
135 | { | 135 | { |
136 | *fileList += t.readLine(); | 136 | *fileList += t.readLine(); |
137 | } | 137 | } |
138 | return fileList; | 138 | return fileList; |
139 | } | 139 | } |
140 | 140 | ||
141 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 141 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
142 | { | 142 | { |
143 | QStringList *fileList = getList( packFileName, dest ); | 143 | QStringList *fileList = getList( packFileName, dest ); |
144 | processFileList( fileList, dest ); | 144 | processFileList( fileList, dest ); |
145 | delete fileList; | 145 | delete fileList; |
146 | } | 146 | } |
147 | 147 | ||
148 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 148 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
149 | { | 149 | { |
150 | if (!fileList) return; | 150 | if (!fileList) return; |
151 | for (uint i=0; i < fileList->count(); i++) | 151 | for (uint i=0; i < fileList->count(); i++) |
152 | { | 152 | { |
153 | QString dest = settings->getDestinationUrlByName( d ); | 153 | QString dest = settings->getDestinationUrlByName( d ); |
154 | dest = dest==""?d:dest; | 154 | dest = dest==""?d:dest; |
155 | processLinkDir( (*fileList)[i], dest ); | 155 | processLinkDir( (*fileList)[i], dest ); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | void PmIpkg::processLinkDir( QString file, QString dest ) | 160 | void PmIpkg::processLinkDir( QString file, QString dest ) |
161 | { | 161 | { |
162 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 162 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
163 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 163 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
164 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 164 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
165 | if ( dest == "???" || dest == "" ) return; | 165 | if ( dest == "???" || dest == "" ) return; |
166 | QString destFile = file; | 166 | QString destFile = file; |
167 | file = dest+"/"+file; | 167 | file = dest+"/"+file; |
168 | if (file == dest) return; | 168 | if (file == dest) return; |
169 | QFileInfo fileInfo( file ); | 169 | QFileInfo fileInfo( file ); |
170 | if ( fileInfo.isDir() ) | 170 | if ( fileInfo.isDir() ) |
171 | { | 171 | { |
172 | pvDebug(4, "process dir "+file); | 172 | pvDebug(4, "process dir "+file); |
173 | QDir destDir( destFile ); | 173 | QDir destDir( destFile ); |
174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 174 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
175 | QDir d( file ); | 175 | QDir d( file ); |
176 | d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 176 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
177 | const QFileInfoList *list = d.entryInfoList(); | 177 | const QFileInfoList *list = d.entryInfoList(); |
178 | QFileInfoListIterator it( *list ); | 178 | QFileInfoListIterator it( *list ); |
179 | QFileInfo *fi; | 179 | QFileInfo *fi; |
180 | qDebug( "while %i",list->count()); | ||
180 | while ( (fi=it.current()) ) | 181 | while ( (fi=it.current()) ) |
181 | { | 182 | { |
183 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | ||
182 | processLinkDir( fi->absFilePath(), dest ); | 184 | processLinkDir( fi->absFilePath(), dest ); |
183 | ++it; | 185 | ++it; |
184 | } | 186 | } |
185 | // if (linkOpp==removeLink) | ||
186 | // { | ||
187 | // pvDebug(2,"remove destDir "+ destFile ); | ||
188 | // destDir.remove( destFile, true ); | ||
189 | // } | ||
190 | } else | 187 | } else |
191 | if ( fileInfo.isFile() ) | 188 | if ( fileInfo.isFile() ) |
192 | { | 189 | { |
193 | const char *instFile = strdup( (file).ascii() ); | 190 | const char *instFile = strdup( (file).ascii() ); |
194 | const char *linkFile = strdup( (destFile).ascii()); | 191 | const char *linkFile = strdup( (destFile).ascii()); |
195 | if( linkOpp==createLink ) | 192 | if( linkOpp==createLink ) |
196 | { | 193 | { |
197 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 194 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
198 | symlink( instFile, linkFile ); | 195 | symlink( instFile, linkFile ); |
199 | } | 196 | } |
200 | } else { | 197 | } else { |
201 | const char *linkFile = strdup( (destFile).ascii()); | 198 | const char *linkFile = strdup( (destFile).ascii()); |
202 | if( linkOpp==removeLink ) | 199 | if( linkOpp==removeLink ) |
203 | { | 200 | { |
204 | pvDebug(4,"removing "+destFile+" no "+file); | ||
205 | QFileInfo toRemoveLink( destFile ); | 201 | QFileInfo toRemoveLink( destFile ); |
206 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 202 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
203 | { | ||
204 | pvDebug(4,"removing "+destFile+" no "+file); | ||
207 | unlink( linkFile ); | 205 | unlink( linkFile ); |
206 | } | ||
208 | } | 207 | } |
209 | } | 208 | } |
210 | } | 209 | } |
211 | 210 | ||
212 | void PmIpkg::loadList( PackageList pl ) | 211 | void PmIpkg::loadList( PackageList pl ) |
213 | { | 212 | { |
214 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) | 213 | for( Package *pack = pl.first();pack ; (pack = pl.next()) ) |
215 | { | 214 | { |
216 | if ( pack && (pack->name() != "") && pack) | 215 | if ( pack && (pack->name() != "") && pack) |
217 | { | 216 | { |
218 | if ( pack->toInstall() ) | 217 | if ( pack->toInstall() ) |
219 | to_install.append( pack ); | 218 | to_install.append( pack ); |
220 | if ( pack->toRemove() ) | 219 | if ( pack->toRemove() ) |
221 | to_remove.append( pack ); | 220 | to_remove.append( pack ); |
222 | } | 221 | } |
223 | } | 222 | } |
224 | } | 223 | } |
225 | 224 | ||
226 | void PmIpkg::commit( PackageList pl ) | 225 | void PmIpkg::commit() |
227 | { | 226 | { |
228 | int sizecount = 0; | 227 | int sizecount = 0; |
229 | // QString rem="<b>"+tr("To remove:")+"</b><br>\n"; | ||
230 | // QString inst="<b>"+tr("To install:")+"</b><br>\n"; | ||
231 | loadList(pl); | ||
232 | for (uint i=0; i < to_remove.count(); i++) | 228 | for (uint i=0; i < to_remove.count(); i++) |
233 | sizecount += 1; | 229 | sizecount += 1; |
234 | for (uint i=0; i < to_install.count(); i++) | 230 | for (uint i=0; i < to_install.count(); i++) |
235 | sizecount += to_install.at(i)->size().toInt(); | 231 | sizecount += to_install.at(i)->size().toInt(); |
236 | runwindow->progress->setTotalSteps(sizecount); | 232 | runwindow->progress->setTotalSteps(sizecount); |
237 | startDialog(); | 233 | startDialog(); |
238 | } | 234 | } |
239 | 235 | ||
240 | void PmIpkg::startDialog() | 236 | void PmIpkg::startDialog() |
241 | { | 237 | { |
242 | installDialog = new QDialog(0,0,true); | 238 | installDialog = new InstallDialog(settings,0,0,true); |
243 | QGridLayout *RunWindowLayout = new QGridLayout( installDialog ); | 239 | QCheckListItem *toRemoveItem; |
244 | RunWindowLayout->setSpacing( 2 ); | 240 | toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); |
245 | RunWindowLayout->setMargin( 2 ); | 241 | toRemoveItem->setOpen( true ); |
246 | 242 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | |
247 | PackageListView *plv = new PackageListView(installDialog, "install",settings); | 243 | { |
248 | plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) ); | 244 | toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); |
249 | RunWindowLayout->addWidget( plv, 1, 0 ); | 245 | } |
250 | QCheckListItem *toRemoveItem; | 246 | QCheckListItem *toInstallItem; |
251 | toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") ); | 247 | toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); |
252 | toRemoveItem->setOpen( true ); | 248 | toInstallItem->setOpen( true ); |
253 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 249 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
254 | { | 250 | { |
255 | toRemoveItem->insertItem( new PackageListItem(plv, it,settings) ); | 251 | toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) ); |
256 | } | 252 | } |
257 | QCheckListItem *toInstallItem; | ||
258 | toInstallItem = new QCheckListItem( plv, QObject::tr("To install") ); | ||
259 | toInstallItem->setOpen( true ); | ||
260 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | ||
261 | { | ||
262 | toInstallItem->insertItem( new PackageListItem(plv, it,settings) ); | ||
263 | } | ||
264 | |||
265 | QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" ); | ||
266 | GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) ); | ||
267 | GroupBox1->setTitle( tr( "Ipkg options" ) ); | ||
268 | GroupBox1->setColumnLayout(0, Qt::Vertical ); | ||
269 | GroupBox1->layout()->setSpacing( 0 ); | ||
270 | GroupBox1->layout()->setMargin( 0 ); | ||
271 | QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); | ||
272 | GroupBox1Layout->setAlignment( Qt::AlignTop ); | ||
273 | GroupBox1Layout->setSpacing( 3 ); | ||
274 | GroupBox1Layout->setMargin( 3 ); | ||
275 | _force_depends = new QCheckBox( GroupBox1, "_force_depends" ); | ||
276 | _force_depends->setText( tr( "-force-depends" ) ); | ||
277 | _force_depends->setAutoResize( TRUE ); | ||
278 | _force_depends->setChecked(true); | ||
279 | GroupBox1Layout->addWidget( _force_depends, 0, 0 ); | ||
280 | _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" ); | ||
281 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | ||
282 | _force_reinstall->setAutoResize( TRUE ); | ||
283 | GroupBox1Layout->addWidget( _force_reinstall, 1, 0 ); | ||
284 | _force_remove = new QCheckBox( GroupBox1, "_force_remove" ); | ||
285 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | ||
286 | _force_remove->setAutoResize( TRUE ); | ||
287 | GroupBox1Layout->addWidget( _force_remove, 1, 0 ); | ||
288 | RunWindowLayout->addWidget( GroupBox1 , 3, 0 ); | ||
289 | installDialog->showMaximized(); | 253 | installDialog->showMaximized(); |
290 | if ( installDialog->exec() ) doIt(); | 254 | if ( installDialog->exec() ) doIt(); |
291 | installDialog->close(); | 255 | installDialog->close(); |
292 | out(tr("<b>All done.</b>")); | 256 | out(tr("<b>All done.</b>")); |
257 | to_install.clear(); | ||
293 | } | 258 | } |
294 | 259 | ||
295 | void PmIpkg::doIt() | 260 | void PmIpkg::doIt() |
296 | { | 261 | { |
297 | show( true ); | 262 | show( true ); |
298 | remove(); | 263 | remove(); |
299 | install(); | 264 | install(); |
300 | } | 265 | } |
301 | 266 | ||
302 | 267 | ||
303 | void PmIpkg::remove() | 268 | void PmIpkg::remove() |
304 | { | 269 | { |
305 | if ( to_remove.count() == 0 ) return; | 270 | if ( to_remove.count() == 0 ) return; |
306 | 271 | ||
307 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); | 272 | out("<b>"+tr("Removing")+"<br>"+tr("please wait")+"</b><br><hr>"); |
308 | 273 | ||
309 | QStringList *fileList; | 274 | QStringList *fileList; |
310 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) | 275 | for (Package *it=to_remove.first(); it != 0; it=to_remove.next() ) |
311 | { | 276 | { |
312 | if ( it->link() )fileList = getList( it->name(), it->dest() ); | 277 | if ( it->link() )fileList = getList( it->name(), it->dest() ); |
313 | if ( runIpkg("remove " + it->name(), it->dest() ) == 0) | 278 | if ( runIpkg("remove " + it->name(), it->dest() ) == 0) |
314 | { | 279 | { |
315 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); | 280 | runwindow->progress->setProgress( 1 + runwindow->progress->progress() ); |
316 | linkOpp = removeLink; | 281 | linkOpp = removeLink; |
317 | if ( it->link() ) | 282 | if ( it->link() ) |
318 | { | 283 | { |
319 | out( "<br>removing links<br>" ); | 284 | out( "<br>removing links<br>" ); |
320 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 285 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
321 | processFileList( fileList, it->dest() ); | 286 | processFileList( fileList, it->dest() ); |
322 | } | 287 | } |
323 | it->processed(); | 288 | it->processed(); |
324 | // to_install.take( it ); | 289 | // to_install.take( it ); |
325 | out("<br><hr>"); | 290 | out("<br><hr>"); |
326 | }else{ | 291 | }else{ |
327 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); | 292 | out("<b>"+tr("Error while removing")+"</b><hr>"+it->name()); |
328 | } | 293 | } |
329 | if ( it->link() )delete fileList; | 294 | if ( it->link() )delete fileList; |
330 | } | 295 | } |
331 | out("<br>"); | 296 | out("<br>"); |
332 | } | 297 | } |
333 | 298 | ||
334 | 299 | ||
335 | void PmIpkg::install() | 300 | void PmIpkg::install() |
336 | { | 301 | { |
337 | if ( to_install.count() == 0 ) return; | 302 | if ( to_install.count() == 0 ) return; |
338 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); | 303 | out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); |
339 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) | 304 | for (Package *it=to_install.first(); it != 0; it=to_install.next() ) |
340 | { | 305 | { |
341 | 306 | ||
342 | if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) | 307 | if ( runIpkg("install " + it->installName(), it->dest() ) == 0 ) |
343 | { | 308 | { |
344 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); | 309 | runwindow->progress->setProgress( it->size().toInt() + runwindow->progress->progress()); |
345 | linkOpp = createLink; | 310 | linkOpp = createLink; |
346 | if ( it->link() ) | 311 | if ( it->link() ) |
347 | { | 312 | { |
348 | out( "<br>creating links<br>" ); | 313 | out( "<br>creating links<br>" ); |
349 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); | 314 | out( "for package "+it->name()+" in "+it->dest()+"<br>" ); |
350 | makeLinks( it ); | 315 | makeLinks( it ); |
351 | } | 316 | } |
352 | it->processed(); | 317 | it->processed(); |
353 | // to_install.take( it->name() ); | 318 | // to_install.take( it->name() ); |
354 | out("<br><hr>"); | 319 | out("<br><hr>"); |
355 | }else{ | 320 | }else{ |
356 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); | 321 | out("<b>"+tr("Error while installing")+"</b><hr>"+it->name()); |
357 | } | 322 | } |
358 | } | 323 | } |
359 | out("<br>"); | 324 | out("<br>"); |
325 | to_install.clear(); | ||
360 | } | 326 | } |
361 | 327 | ||
362 | void PmIpkg::createLinks( const QString &dest ) | 328 | void PmIpkg::createLinks( const QString &dest ) |
363 | { | 329 | { |
364 | pvDebug(2,"PmIpkg::createLinks "+dest); | 330 | pvDebug(2,"PmIpkg::createLinks "+dest); |
365 | linkOpp=createLink; | 331 | linkOpp=createLink; |
366 | QString url = settings->getDestinationUrlByName( dest ); | 332 | QString url = settings->getDestinationUrlByName( dest ); |
367 | url = url==""?dest:url; | 333 | url = url==""?dest:url; |
368 | processLinkDir( "/", url ); | 334 | processLinkDir( "/opt", url ); |
335 | processLinkDir( "/usr", url ); | ||
369 | } | 336 | } |
370 | 337 | ||
371 | void PmIpkg::removeLinks( const QString &dest ) | 338 | void PmIpkg::removeLinks( const QString &dest ) |
372 | { | 339 | { |
373 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 340 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
374 | linkOpp=removeLink; | 341 | linkOpp=removeLink; |
375 | QString url = settings->getDestinationUrlByName( dest ); | 342 | QString url = settings->getDestinationUrlByName( dest ); |
376 | url = url==""?dest:url; | 343 | url = url==""?dest:url; |
377 | processLinkDir( "/", url ); | 344 | processLinkDir( "/opt", url ); |
345 | processLinkDir( "/usr", url ); | ||
378 | } | 346 | } |
379 | 347 | ||
380 | void PmIpkg::update() | 348 | void PmIpkg::update() |
381 | { | 349 | { |
382 | show( false ); | 350 | show( false ); |
383 | runIpkg( "update" ); | 351 | runIpkg( "update" ); |
384 | runwindow->close(); | 352 | runwindow->close(); |
385 | } | 353 | } |
386 | 354 | ||
387 | void PmIpkg::out( QString o ) | 355 | void PmIpkg::out( QString o ) |
388 | { | 356 | { |
389 | runwindow->outPut->append(o); | 357 | runwindow->outPut->append(o); |
390 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); | 358 | //runwindow->outPut->setCursorPosition(0, runwindow->outPut->contentsHeight()); |
391 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); | 359 | //runwindow->outPut->setText( runwindow->outPut->text()+o ); |
392 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); | 360 | runwindow->outPut->setContentsPos(0, runwindow->outPut->contentsHeight()); |
393 | } | 361 | } |
394 | 362 | ||
395 | 363 | ||
396 | void PmIpkg::showButtons(bool b) | 364 | void PmIpkg::showButtons(bool b) |
397 | { | 365 | { |
398 | if ( b ) | 366 | if ( b ) |
399 | { | 367 | { |
400 | runwindow->cancelButton->hide(); | 368 | runwindow->cancelButton->hide(); |
401 | runwindow->doItButton->hide(); | 369 | runwindow->doItButton->hide(); |
402 | runwindow->removeButton->hide(); | 370 | runwindow->removeButton->hide(); |
403 | runwindow->installButton->hide(); | 371 | runwindow->installButton->hide(); |
404 | }else{ | 372 | }else{ |
405 | runwindow->cancelButton->show(); | 373 | runwindow->cancelButton->show(); |
406 | runwindow->doItButton->show(); | 374 | runwindow->doItButton->show(); |
407 | runwindow->removeButton->show(); | 375 | runwindow->removeButton->show(); |
408 | runwindow->installButton->show(); | 376 | runwindow->installButton->show(); |
409 | 377 | ||
410 | } | 378 | } |
411 | } | 379 | } |
412 | 380 | ||
413 | void PmIpkg::show(bool b) | 381 | void PmIpkg::show(bool b) |
414 | { | 382 | { |
415 | if (!runwindow->isVisible()) | 383 | if (!runwindow->isVisible()) |
416 | runwindow->showMaximized(); | 384 | runwindow->showMaximized(); |
417 | showButtons(b); | 385 | showButtons(b); |
418 | if ( !b ) | 386 | if ( !b ) |
419 | runwindow->progress->hide(); | 387 | runwindow->progress->hide(); |
420 | else | 388 | else |
421 | runwindow->progress->show(); | 389 | runwindow->progress->show(); |
422 | } | 390 | } |
423 | 391 | ||
424 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 392 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
425 | { | 393 | { |
426 | 394 | ||
427 | to_install.clear(); | 395 | to_install.clear(); |
428 | to_remove.clear(); | 396 | to_remove.clear(); |
429 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 397 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
430 | Package *p = new Package(fileName,settings); | 398 | Package *p = new Package(fileName,settings); |
431 | if ( dest!="") p->setDest( dest ); | 399 | if ( dest!="") p->setDest( dest ); |
432 | to_install.append( p ); | 400 | to_install.append( p ); |
433 | startDialog(); | 401 | startDialog(); |
434 | delete p; | 402 | delete p; |
435 | } | 403 | } |
436 | 404 | ||
437 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 405 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
438 | { | 406 | { |
439 | 407 | ||
440 | to_install.clear(); | 408 | to_install.clear(); |
441 | to_remove.clear(); | 409 | to_remove.clear(); |
442 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 410 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
443 | Package *p = new Package(fileName,settings); | 411 | Package *p = new Package(fileName,settings); |
444 | if ( dest!="") p->setDest( dest ); | 412 | if ( dest!="") p->setDest( dest ); |
445 | to_remove.append( p ); | 413 | to_remove.append( p ); |
446 | startDialog(); | 414 | startDialog(); |
447 | delete p; | 415 | delete p; |
448 | } | 416 | } |
449 | 417 | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 3799969..d2490e8 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,65 +1,64 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
11 | #include "packagelist.h" | 11 | #include "packagelist.h" |
12 | #include "installdialog.h" | ||
12 | #include "debug.h" | 13 | #include "debug.h" |
13 | 14 | ||
14 | #define createLink 0 | 15 | #define createLink 0 |
15 | #define removeLink 1 | 16 | #define removeLink 1 |
16 | 17 | ||
17 | class Package; | 18 | class Package; |
18 | class PmIpkg : public QObject | 19 | class PmIpkg : public QObject |
19 | { | 20 | { |
20 | Q_OBJECT | 21 | Q_OBJECT |
21 | public: | 22 | public: |
22 | 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 ); |
23 | ~PmIpkg(); | 24 | ~PmIpkg(); |
24 | 25 | ||
25 | int linkOpp; | 26 | int linkOpp; |
26 | void loadList( PackageList ); | 27 | void loadList( PackageList ); |
27 | void commit( PackageList ); | 28 | void commit(); |
28 | void update(); | 29 | void update(); |
29 | void showButtons(bool b=true); | 30 | void showButtons(bool b=true); |
30 | void show( bool buttons=true ); | 31 | void show( bool buttons=true ); |
31 | 32 | ||
32 | public slots: | 33 | public slots: |
33 | void doIt(); | 34 | void doIt(); |
34 | void install(); | 35 | void install(); |
35 | void remove(); | 36 | void remove(); |
36 | void installFile(const QString &fileName, const QString &dest=""); | 37 | void installFile(const QString &fileName, const QString &dest=""); |
37 | void removeFile(const QString &fileName, const QString &dest=""); | 38 | void removeFile(const QString &fileName, const QString &dest=""); |
38 | void createLinks( const QString &dest ); | 39 | void createLinks( const QString &dest ); |
39 | void removeLinks( const QString &dest ); | 40 | void removeLinks( const QString &dest ); |
40 | 41 | ||
41 | private: | 42 | private: |
42 | //int sizecount; | ||
43 | PackageManagerSettings* settings; | 43 | PackageManagerSettings* settings; |
44 | RunWindow *runwindow; | 44 | RunWindow *runwindow; |
45 | QDialog *installDialog; | 45 | InstallDialog *installDialog; |
46 | QList<Package> to_remove; | 46 | QList<Package> to_remove; |
47 | QList<Package> to_install; | 47 | QList<Package> to_install; |
48 | // bool runwindowopen; | ||
49 | QString fileNameToInstall; | 48 | QString fileNameToInstall; |
50 | QCheckBox *_force_reinstall; | 49 | QCheckBox *_force_reinstall; |
51 | QCheckBox *_force_remove; | 50 | QCheckBox *_force_remove; |
52 | QCheckBox *_force_depends; | 51 | QCheckBox *_force_depends; |
53 | void startDialog(); | 52 | void startDialog(); |
54 | void makeLinks(Package*); | 53 | void makeLinks(Package*); |
55 | void linkPackage( QString, QString ); | 54 | void linkPackage( QString, QString ); |
56 | void processLinkDir( QString , QString ); | 55 | void processLinkDir( QString , QString ); |
57 | int runIpkg(const QString& args, const QString& dest="" ); | 56 | int runIpkg(const QString& args, const QString& dest="" ); |
58 | void out( QString ); | 57 | void out( QString ); |
59 | QStringList* getList( QString, QString ); | 58 | QStringList* getList( QString, QString ); |
60 | void processFileList( QStringList*, QString ); | 59 | void processFileList( QStringList*, QString ); |
61 | 60 | ||
62 | 61 | ||
63 | }; | 62 | }; |
64 | 63 | ||
65 | #endif | 64 | #endif |
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index bab7a4f..f01cb69 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -1,66 +1,67 @@ | |||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 1 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 2 | #define PACKAGEMANAGERSETTINGS_H |
3 | 3 | ||
4 | #include "pksettingsbase.h" | 4 | #include "pksettingsbase.h" |
5 | #include <qintdict.h> | 5 | #include <qintdict.h> |
6 | 6 | ||
7 | 7 | ||
8 | class PackageManagerSettings : public PackageManagerSettingsBase | 8 | class PackageManagerSettings : public PackageManagerSettingsBase |
9 | //class PackageManagerSettings : private PackageManagerSettingsBase | 9 | //class PackageManagerSettings : private PackageManagerSettingsBase |
10 | { | 10 | { |
11 | // Q_OBJECT | 11 | // Q_OBJECT |
12 | public: | 12 | public: |
13 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 13 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
14 | ~PackageManagerSettings(); | 14 | ~PackageManagerSettings(); |
15 | 15 | ||
16 | bool showDialog( int ) ; | 16 | bool showDialog( int ) ; |
17 | QString getDestinationUrl(); | 17 | QString getDestinationUrl(); |
18 | QString getDestinationName(); | 18 | QString getDestinationName(); |
19 | QString getLinkDestinationName(); | 19 | QString getLinkDestinationName(); |
20 | bool createLinks(); | 20 | bool createLinks(); |
21 | QStringList getActiveServers(); | 21 | QStringList getActiveServers(); |
22 | QStringList getDestinationUrls(); | 22 | QStringList getDestinationUrls(); |
23 | 23 | ||
24 | public slots: /** No descriptions */ | 24 | public slots: /** No descriptions */ |
25 | void createLinks(); | 25 | void createLinks(); |
26 | void removeLinks(); | 26 | void removeLinks(); |
27 | void writeInstallationSettings(); | 27 | void writeInstallationSettings(); |
28 | void readInstallationSettings(); | 28 | void readInstallationSettings(); |
29 | void writeCurrentInstallationSetting(); | 29 | void writeCurrentInstallationSetting(); |
30 | void readInstallationSetting(int); | 30 | void readInstallationSetting(int); |
31 | void installationSettingSetName(const QString &); | 31 | void installationSettingSetName(const QString &); |
32 | void activeDestinationChange(int) | 32 | void activeDestinationChange(int) |
33 | void newServer(); | 33 | void newServer(); |
34 | void editServer(int); | 34 | void editServer(int); |
35 | void removeDestination(); | 35 | void removeDestination(); |
36 | void newDestination(); | 36 | void newDestination(); |
37 | void editDestination(int); | 37 | void editDestination(int); |
38 | void linkEnabled(bool); | 38 | void linkEnabled(bool); |
39 | void removeServer(); | 39 | void removeServer(); |
40 | void serverNameChanged(const QString&); | 40 | void serverNameChanged(const QString&); |
41 | void serverUrlChanged(const QString&); | 41 | void serverUrlChanged(const QString&); |
42 | void destNameChanged(const QString&); | 42 | void destNameChanged(const QString&); |
43 | void destUrlChanged(const QString&); | 43 | void destUrlChanged(const QString&); |
44 | void installationSettingChange(int); | 44 | void installationSettingChange(int); |
45 | void newInstallationSetting(); | 45 | void newInstallationSetting(); |
46 | void removeInstallationSetting(); | 46 | void removeInstallationSetting(); |
47 | void renameInstallationSetting(); | 47 | void renameInstallationSetting(); |
48 | 48 | ||
49 | private: | 49 | private: |
50 | QIntDict<QString> serverurlDic; | 50 | QIntDict<QString> serverurlDic; |
51 | QIntDict<QString> destinationurlDic; | 51 | QIntDict<QString> destinationurlDic; |
52 | int ipkg_old; | 52 | int ipkg_old; |
53 | int editedserver; | 53 | int editedserver; |
54 | int editeddestination; | 54 | int editeddestination; |
55 | int currentSetting; | 55 | int currentSetting; |
56 | int installationSettingsCount; | 56 | int installationSettingsCount; |
57 | bool changed; | 57 | bool changed; |
58 | bool serverChanged; | ||
58 | 59 | ||
59 | bool readIpkgConfig(const QString&); | 60 | bool readIpkgConfig(const QString&); |
60 | void writeIpkgConfig(const QString&); | 61 | void writeIpkgConfig(const QString&); |
61 | void writeSettings(); | 62 | void writeSettings(); |
62 | void readSettings(); | 63 | void readSettings(); |
63 | }; | 64 | }; |
64 | 65 | ||
65 | #endif | 66 | #endif |
66 | 67 | ||