22 files changed, 197 insertions, 27 deletions
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp index bb50103..c676e84 100644 --- a/noncore/unsupported/oipkg/installdialog.cpp +++ b/noncore/unsupported/oipkg/installdialog.cpp | |||
@@ -1,107 +1,108 @@ | |||
1 | /**************************************************************************** | 1 | /*************************************************************************** |
2 | ** Form implementation generated from reading ui file 'installdialog.ui' | 2 | * * |
3 | ** | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | ** Created: Thu May 2 22:19:02 2002 | 4 | * it under the terms of the GNU General Public License as published by * |
5 | ** by: The User Interface Compiler (uic) | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | ** | 6 | * (at your option) any later version. * |
7 | ** WARNING! All changes made in this file will be lost! | 7 | * * |
8 | ****************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
9 | #include "installdialog.h" | 10 | #include "installdialog.h" |
10 | 11 | ||
11 | #include <qcheckbox.h> | 12 | #include <qcheckbox.h> |
12 | #include <qgroupbox.h> | 13 | #include <qgroupbox.h> |
13 | #include <qheader.h> | 14 | #include <qheader.h> |
14 | #include <qlistview.h> | 15 | #include <qlistview.h> |
15 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
16 | #include <qlayout.h> | 17 | #include <qlayout.h> |
17 | #include <qvariant.h> | 18 | #include <qvariant.h> |
18 | #include <qtooltip.h> | 19 | #include <qtooltip.h> |
19 | #include <qwhatsthis.h> | 20 | #include <qwhatsthis.h> |
20 | 21 | ||
21 | 22 | ||
22 | InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) | 23 | InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) |
23 | : QDialog( parent, name, modal, fl ) | 24 | : QDialog( parent, name, modal, fl ) |
24 | { | 25 | { |
25 | settings = s; | 26 | settings = s; |
26 | if ( !name ) | 27 | if ( !name ) |
27 | setName( "InstallDialog" ); | 28 | setName( "InstallDialog" ); |
28 | resize( 223, 269 ); | 29 | resize( 223, 269 ); |
29 | setCaption( tr( "Install" ) ); | 30 | setCaption( tr( "Install" ) ); |
30 | InstallDialogLayout = new QGridLayout( this ); | 31 | InstallDialogLayout = new QGridLayout( this ); |
31 | InstallDialogLayout->setSpacing( 2 ); | 32 | InstallDialogLayout->setSpacing( 2 ); |
32 | InstallDialogLayout->setMargin( 2 ); | 33 | InstallDialogLayout->setMargin( 2 ); |
33 | 34 | ||
34 | ListViewPackages = new PackageListView( this,"listViewPackages",settings ); | 35 | ListViewPackages = new PackageListView( this,"listViewPackages",settings ); |
35 | 36 | ||
36 | InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); | 37 | InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); |
37 | 38 | ||
38 | GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); | 39 | GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); |
39 | GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); | 40 | GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); |
40 | GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); | 41 | GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); |
41 | GroupBoxOptions->layout()->setSpacing( 0 ); | 42 | GroupBoxOptions->layout()->setSpacing( 0 ); |
42 | GroupBoxOptions->layout()->setMargin( 0 ); | 43 | GroupBoxOptions->layout()->setMargin( 0 ); |
43 | GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); | 44 | GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); |
44 | GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); | 45 | GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); |
45 | GroupBoxOptionsLayout->setSpacing( 2 ); | 46 | GroupBoxOptionsLayout->setSpacing( 2 ); |
46 | GroupBoxOptionsLayout->setMargin( 2 ); | 47 | GroupBoxOptionsLayout->setMargin( 2 ); |
47 | 48 | ||
48 | _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); | 49 | _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); |
49 | QFont _force_depends_font( _force_depends->font() ); | 50 | QFont _force_depends_font( _force_depends->font() ); |
50 | _force_depends_font.setPointSize( 8 ); | 51 | _force_depends_font.setPointSize( 8 ); |
51 | _force_depends->setFont( _force_depends_font ); | 52 | _force_depends->setFont( _force_depends_font ); |
52 | _force_depends->setText( tr( "-force-depends" ) ); | 53 | _force_depends->setText( tr( "-force-depends" ) ); |
53 | //_force_depends->setChecked( true ); | 54 | //_force_depends->setChecked( true ); |
54 | 55 | ||
55 | GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); | 56 | GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); |
56 | 57 | ||
57 | _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); | 58 | _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); |
58 | QFont _force_reinstall_font( _force_reinstall->font() ); | 59 | QFont _force_reinstall_font( _force_reinstall->font() ); |
59 | _force_reinstall_font.setPointSize( 8 ); | 60 | _force_reinstall_font.setPointSize( 8 ); |
60 | _force_reinstall->setFont( _force_reinstall_font ); | 61 | _force_reinstall->setFont( _force_reinstall_font ); |
61 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | 62 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
62 | 63 | ||
63 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); | 64 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); |
64 | 65 | ||
65 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); | 66 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); |
66 | QFont _force_remove_font( _force_remove->font() ); | 67 | QFont _force_remove_font( _force_remove->font() ); |
67 | _force_remove_font.setPointSize( 8 ); | 68 | _force_remove_font.setPointSize( 8 ); |
68 | _force_remove->setFont( _force_remove_font ); | 69 | _force_remove->setFont( _force_remove_font ); |
69 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | 70 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
70 | 71 | ||
71 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); | 72 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); |
72 | 73 | ||
73 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); | 74 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); |
74 | toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); | 75 | toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); |
75 | toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); | 76 | toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); |
76 | 77 | ||
77 | } | 78 | } |
78 | 79 | ||
79 | /* | 80 | /* |
80 | * Destroys the object and frees any allocated resources | 81 | * Destroys the object and frees any allocated resources |
81 | */ | 82 | */ |
82 | InstallDialog::~InstallDialog() | 83 | InstallDialog::~InstallDialog() |
83 | { | 84 | { |
84 | // no need to delete child widgets, Qt does it all for us | 85 | // no need to delete child widgets, Qt does it all for us |
85 | } | 86 | } |
86 | 87 | ||
87 | /* | 88 | /* |
88 | * Main event handler. Reimplemented to handle application | 89 | * Main event handler. Reimplemented to handle application |
89 | * font changes | 90 | * font changes |
90 | */ | 91 | */ |
91 | bool InstallDialog::event( QEvent* ev ) | 92 | bool InstallDialog::event( QEvent* ev ) |
92 | { | 93 | { |
93 | bool ret = QDialog::event( ev ); | 94 | bool ret = QDialog::event( ev ); |
94 | if ( ev->type() == QEvent::ApplicationFontChange ) { | 95 | if ( ev->type() == QEvent::ApplicationFontChange ) { |
95 | QFont _force_depends_font( _force_depends->font() ); | 96 | QFont _force_depends_font( _force_depends->font() ); |
96 | _force_depends_font.setPointSize( 8 ); | 97 | _force_depends_font.setPointSize( 8 ); |
97 | _force_depends->setFont( _force_depends_font ); | 98 | _force_depends->setFont( _force_depends_font ); |
98 | QFont _force_reinstall_font( _force_reinstall->font() ); | 99 | QFont _force_reinstall_font( _force_reinstall->font() ); |
99 | _force_reinstall_font.setPointSize( 8 ); | 100 | _force_reinstall_font.setPointSize( 8 ); |
100 | _force_reinstall->setFont( _force_reinstall_font ); | 101 | _force_reinstall->setFont( _force_reinstall_font ); |
101 | QFont _force_remove_font( _force_remove->font() ); | 102 | QFont _force_remove_font( _force_remove->font() ); |
102 | _force_remove_font.setPointSize( 8 ); | 103 | _force_remove_font.setPointSize( 8 ); |
103 | _force_remove->setFont( _force_remove_font ); | 104 | _force_remove->setFont( _force_remove_font ); |
104 | } | 105 | } |
105 | return ret; | 106 | return ret; |
106 | } | 107 | } |
107 | 108 | ||
diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h index 5af2c35..828c8df 100644 --- a/noncore/unsupported/oipkg/installdialog.h +++ b/noncore/unsupported/oipkg/installdialog.h | |||
@@ -1,47 +1,50 @@ | |||
1 | /**************************************************************************** | 1 | /*************************************************************************** |
2 | ** Form interface generated from reading ui file 'installdialog.ui' | 2 | * * |
3 | ** | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | ** Created: Thu May 2 22:19:01 2002 | 4 | * it under the terms of the GNU General Public License as published by * |
5 | ** by: The User Interface Compiler (uic) | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | ** | 6 | * (at your option) any later version. * |
7 | ** WARNING! All changes made in this file will be lost! | 7 | * * |
8 | ****************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
10 | |||
11 | |||
9 | #ifndef INSTALLDIALOG_H | 12 | #ifndef INSTALLDIALOG_H |
10 | #define INSTALLDIALOG_H | 13 | #define INSTALLDIALOG_H |
11 | 14 | ||
12 | #include "pksettings.h" | 15 | #include "pksettings.h" |
13 | #include "packagelistview.h" | 16 | #include "packagelistview.h" |
14 | #include <qvariant.h> | 17 | #include <qvariant.h> |
15 | #include <qdialog.h> | 18 | #include <qdialog.h> |
16 | class QVBoxLayout; | 19 | class QVBoxLayout; |
17 | class QHBoxLayout; | 20 | class QHBoxLayout; |
18 | class QGridLayout; | 21 | class QGridLayout; |
19 | class QCheckBox; | 22 | class QCheckBox; |
20 | class QGroupBox; | 23 | class QGroupBox; |
21 | class QListView; | 24 | class QListView; |
22 | class QListViewItem; | 25 | class QListViewItem; |
23 | 26 | ||
24 | class InstallDialog : public QDialog | 27 | class InstallDialog : public QDialog |
25 | { | 28 | { |
26 | Q_OBJECT | 29 | Q_OBJECT |
27 | 30 | ||
28 | public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | 31 | public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
29 | ~InstallDialog(); | 32 | ~InstallDialog(); |
30 | 33 | ||
31 | PackageListView* ListViewPackages; | 34 | PackageListView* ListViewPackages; |
32 | QGroupBox* GroupBoxOptions; | 35 | QGroupBox* GroupBoxOptions; |
33 | QCheckBox* _force_depends; | 36 | QCheckBox* _force_depends; |
34 | QCheckBox* _force_reinstall; | 37 | QCheckBox* _force_reinstall; |
35 | QCheckBox* _force_remove; | 38 | QCheckBox* _force_remove; |
36 | QCheckListItem *toRemoveItem; | 39 | QCheckListItem *toRemoveItem; |
37 | QCheckListItem *toInstallItem; | 40 | QCheckListItem *toInstallItem; |
38 | 41 | ||
39 | protected: | 42 | protected: |
40 | QGridLayout* InstallDialogLayout; | 43 | QGridLayout* InstallDialogLayout; |
41 | QGridLayout* GroupBoxOptionsLayout; | 44 | QGridLayout* GroupBoxOptionsLayout; |
42 | bool event( QEvent* ); | 45 | bool event( QEvent* ); |
43 | private: | 46 | private: |
44 | PackageManagerSettings* settings; | 47 | PackageManagerSettings* settings; |
45 | }; | 48 | }; |
46 | 49 | ||
47 | #endif // INSTALLDIALOG_H | 50 | #endif // INSTALLDIALOG_H |
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 8778b85..084900d 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp | |||
@@ -1,430 +1,440 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // Copyright (C) 2000 Trolltech AS. | ||
1 | // adadpted form qpe/qipkg | 10 | // adadpted form qpe/qipkg |
11 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
2 | 12 | ||
3 | 13 | ||
4 | #include "mainwindow.h" | 14 | #include "mainwindow.h" |
5 | 15 | ||
6 | #include <qpe/qpemenubar.h> | 16 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 17 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
9 | #include <qpe/config.h> | 19 | #include <qpe/config.h> |
10 | #include <qpe/qpetoolbar.h> | 20 | #include <qpe/qpetoolbar.h> |
11 | #include <qpe/qcopenvelope_qws.h> | 21 | #include <qpe/qcopenvelope_qws.h> |
12 | #include <qaction.h> | 22 | #include <qaction.h> |
13 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
14 | #include <qpopupmenu.h> | 24 | #include <qpopupmenu.h> |
15 | #include <qtoolbutton.h> | 25 | #include <qtoolbutton.h> |
16 | #include <qstring.h> | 26 | #include <qstring.h> |
17 | #include <qlabel.h> | 27 | #include <qlabel.h> |
18 | #include <qfile.h> | 28 | #include <qfile.h> |
19 | #include <qlistview.h> | 29 | #include <qlistview.h> |
20 | #include <qtextview.h> | 30 | #include <qtextview.h> |
21 | #include <qcheckbox.h> | 31 | #include <qcheckbox.h> |
22 | #include <qlineedit.h> | 32 | #include <qlineedit.h> |
23 | #include <qtabwidget.h> | 33 | #include <qtabwidget.h> |
24 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
25 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
26 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
27 | #include <qlayout.h> | 37 | #include <qlayout.h> |
28 | 38 | ||
29 | #include "pksettingsbase.h" | 39 | #include "pksettingsbase.h" |
30 | #include "utils.h" | 40 | #include "utils.h" |
31 | #include "packagelistitem.h" | 41 | #include "packagelistitem.h" |
32 | 42 | ||
33 | 43 | ||
34 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 44 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
35 | QMainWindow( parent, name, f ) | 45 | QMainWindow( parent, name, f ) |
36 | // packageListServers( QObject(parent), name ), | 46 | // packageListServers( QObject(parent), name ), |
37 | // packageListSearch( parent, name ), | 47 | // packageListSearch( parent, name ), |
38 | // packageListDocLnk( parent, name ) | 48 | // packageListDocLnk( parent, name ) |
39 | { | 49 | { |
40 | setCaption( tr("Package Manager") ); | 50 | setCaption( tr("Package Manager") ); |
41 | settings = new PackageManagerSettings(this,0,TRUE); | 51 | settings = new PackageManagerSettings(this,0,TRUE); |
42 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); | 52 | listViewPackages = new PackageListView( this,"listViewPackages",settings ); |
43 | setCentralWidget( listViewPackages ); | 53 | setCentralWidget( listViewPackages ); |
44 | listViewPackages->addList( tr("feeds"), &packageListServers ); | 54 | listViewPackages->addList( tr("feeds"), &packageListServers ); |
45 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); | 55 | listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); |
46 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); | 56 | listViewPackages->addList( tr("documents"), &packageListDocLnk ); |
47 | ipkg = new PmIpkg( settings, this ); | 57 | ipkg = new PmIpkg( settings, this ); |
48 | packageListServers.setSettings( settings ); | 58 | packageListServers.setSettings( settings ); |
49 | packageListSearch.setSettings( settings ); | 59 | packageListSearch.setSettings( settings ); |
50 | packageListDocLnk.setSettings( settings ); | 60 | packageListDocLnk.setSettings( settings ); |
51 | pvDebug(9,"packageListServers.update"); | 61 | pvDebug(9,"packageListServers.update"); |
52 | packageListServers.update(); | 62 | packageListServers.update(); |
53 | pvDebug(9,"packageListDocLnk.update"); | 63 | pvDebug(9,"packageListDocLnk.update"); |
54 | pvDebug(0,"no UPDATE of DocLnk"); | 64 | pvDebug(0,"no UPDATE of DocLnk"); |
55 | packageListDocLnk.update(); | 65 | packageListDocLnk.update(); |
56 | pvDebug(9,"makeMenu"); | 66 | pvDebug(9,"makeMenu"); |
57 | makeMenu(); | 67 | makeMenu(); |
58 | makeChannel(); | 68 | makeChannel(); |
59 | //opie is hardcoded default ;) | 69 | //opie is hardcoded default ;) |
60 | //pvDebug(9,"section->setCurrentItem"); | 70 | //pvDebug(9,"section->setCurrentItem"); |
61 | // for (int i=0;i<section->count();i++) | 71 | // for (int i=0;i<section->count();i++) |
62 | // if (section->text(i)=="opie") | 72 | // if (section->text(i)=="opie") |
63 | // section->setCurrentItem(i); | 73 | // section->setCurrentItem(i); |
64 | // sectionChanged(); | 74 | // sectionChanged(); |
65 | 75 | ||
66 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); | 76 | connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); |
67 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); | 77 | connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); |
68 | 78 | ||
69 | connect( settings->removeLinksButton, SIGNAL( clicked()), | 79 | connect( settings->removeLinksButton, SIGNAL( clicked()), |
70 | SLOT(removeLinks()) ); | 80 | SLOT(removeLinks()) ); |
71 | connect( settings->createLinksButton, SIGNAL( clicked()), | 81 | connect( settings->createLinksButton, SIGNAL( clicked()), |
72 | SLOT(createLinks()) ); | 82 | SLOT(createLinks()) ); |
73 | 83 | ||
74 | pvDebug(9,"displayList"); | 84 | pvDebug(9,"displayList"); |
75 | displayList(); | 85 | displayList(); |
76 | } | 86 | } |
77 | 87 | ||
78 | void MainWindow::makeMenu() | 88 | void MainWindow::makeMenu() |
79 | { | 89 | { |
80 | 90 | ||
81 | QPEToolBar *toolBar = new QPEToolBar( this ); | 91 | QPEToolBar *toolBar = new QPEToolBar( this ); |
82 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 92 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
83 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 93 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
84 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 94 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
85 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 95 | QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
86 | QPopupMenu *helpMenu = new QPopupMenu( menuBar ); | 96 | QPopupMenu *helpMenu = new QPopupMenu( menuBar ); |
87 | 97 | ||
88 | setToolBarsMovable( false ); | 98 | setToolBarsMovable( false ); |
89 | toolBar->setHorizontalStretchable( true ); | 99 | toolBar->setHorizontalStretchable( true ); |
90 | menuBar->insertItem( tr( "Package" ), srvMenu ); | 100 | menuBar->insertItem( tr( "Package" ), srvMenu ); |
91 | menuBar->insertItem( tr( "View" ), viewMenu ); | 101 | menuBar->insertItem( tr( "View" ), viewMenu ); |
92 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); | 102 | menuBar->insertItem( tr( "Settings" ), cfgMenu ); |
93 | menuBar->insertItem( tr( "Help" ), helpMenu ); | 103 | menuBar->insertItem( tr( "Help" ), helpMenu ); |
94 | 104 | ||
95 | QLabel *spacer; | 105 | QLabel *spacer; |
96 | // spacer = new QLabel( "", toolBar ); | 106 | // spacer = new QLabel( "", toolBar ); |
97 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); | 107 | // spacer->setBackgroundColor( toolBar->backgroundColor() ); |
98 | // toolBar->setStretchableWidget( spacer ); | 108 | // toolBar->setStretchableWidget( spacer ); |
99 | 109 | ||
100 | 110 | ||
101 | runAction = new QAction( tr( "Apply" ), | 111 | runAction = new QAction( tr( "Apply" ), |
102 | Resource::loadPixmap( "oipkg/install" ), | 112 | Resource::loadPixmap( "oipkg/install" ), |
103 | QString::null, 0, this, 0 ); | 113 | QString::null, 0, this, 0 ); |
104 | connect( runAction, SIGNAL( activated() ), | 114 | connect( runAction, SIGNAL( activated() ), |
105 | this, SLOT( runIpkg() ) ); | 115 | this, SLOT( runIpkg() ) ); |
106 | runAction->addTo( toolBar ); | 116 | runAction->addTo( toolBar ); |
107 | runAction->addTo( srvMenu ); | 117 | runAction->addTo( srvMenu ); |
108 | 118 | ||
109 | srvMenu->insertSeparator(); | 119 | srvMenu->insertSeparator(); |
110 | 120 | ||
111 | updateAction = new QAction( tr( "Update" ), | 121 | updateAction = new QAction( tr( "Update" ), |
112 | Resource::loadIconSet( "oipkg/update" ), | 122 | Resource::loadIconSet( "oipkg/update" ), |
113 | QString::null, 0, this, 0 ); | 123 | QString::null, 0, this, 0 ); |
114 | connect( updateAction, SIGNAL( activated() ), | 124 | connect( updateAction, SIGNAL( activated() ), |
115 | this , SLOT( updateList() ) ); | 125 | this , SLOT( updateList() ) ); |
116 | updateAction->addTo( toolBar ); | 126 | updateAction->addTo( toolBar ); |
117 | updateAction->addTo( srvMenu ); | 127 | updateAction->addTo( srvMenu ); |
118 | 128 | ||
119 | QAction *cfgact; | 129 | QAction *cfgact; |
120 | 130 | ||
121 | cfgact = new QAction( tr( "Setups" ), | 131 | cfgact = new QAction( tr( "Setups" ), |
122 | QString::null, 0, this, 0 ); | 132 | QString::null, 0, this, 0 ); |
123 | connect( cfgact, SIGNAL( activated() ), | 133 | connect( cfgact, SIGNAL( activated() ), |
124 | SLOT( showSettings() ) ); | 134 | SLOT( showSettings() ) ); |
125 | cfgact->addTo( cfgMenu ); | 135 | cfgact->addTo( cfgMenu ); |
126 | 136 | ||
127 | cfgact = new QAction( tr( "Servers" ), | 137 | cfgact = new QAction( tr( "Servers" ), |
128 | QString::null, 0, this, 0 ); | 138 | QString::null, 0, this, 0 ); |
129 | connect( cfgact, SIGNAL( activated() ), | 139 | connect( cfgact, SIGNAL( activated() ), |
130 | SLOT( showSettingsSrv() ) ); | 140 | SLOT( showSettingsSrv() ) ); |
131 | cfgact->addTo( cfgMenu ); | 141 | cfgact->addTo( cfgMenu ); |
132 | cfgact = new QAction( tr( "Destinations" ), | 142 | cfgact = new QAction( tr( "Destinations" ), |
133 | QString::null, 0, this, 0 ); | 143 | QString::null, 0, this, 0 ); |
134 | connect( cfgact, SIGNAL( activated() ), | 144 | connect( cfgact, SIGNAL( activated() ), |
135 | SLOT( showSettingsDst() ) ); | 145 | SLOT( showSettingsDst() ) ); |
136 | cfgact->addTo( cfgMenu ); | 146 | cfgact->addTo( cfgMenu ); |
137 | 147 | ||
138 | QAction *a; | 148 | QAction *a; |
139 | 149 | ||
140 | // SECTIONS | 150 | // SECTIONS |
141 | sectionBar = new QPEToolBar( this ); | 151 | sectionBar = new QPEToolBar( this ); |
142 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); | 152 | addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE ); |
143 | sectionBar->setHorizontalStretchable( true ); | 153 | sectionBar->setHorizontalStretchable( true ); |
144 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); | 154 | QLabel *label = new QLabel( tr("Section: "), sectionBar ); |
145 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 155 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
146 | section = new QComboBox( false, sectionBar ); | 156 | section = new QComboBox( false, sectionBar ); |
147 | label = new QLabel( " / ", sectionBar ); | 157 | label = new QLabel( " / ", sectionBar ); |
148 | label->setBackgroundColor( sectionBar->backgroundColor() ); | 158 | label->setBackgroundColor( sectionBar->backgroundColor() ); |
149 | subsection = new QComboBox( false, sectionBar ); | 159 | subsection = new QComboBox( false, sectionBar ); |
150 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 160 | a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
151 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); | 161 | connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) ); |
152 | a->addTo( sectionBar ); | 162 | a->addTo( sectionBar ); |
153 | setSections(); | 163 | setSections(); |
154 | setSubSections(); | 164 | setSubSections(); |
155 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); | 165 | sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 ); |
156 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); | 166 | connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) ); |
157 | sectionAction->setToggleAction( true ); | 167 | sectionAction->setToggleAction( true ); |
158 | sectionAction->addTo( viewMenu ); | 168 | sectionAction->addTo( viewMenu ); |
159 | sectionBar->setStretchableWidget( section ); | 169 | sectionBar->setStretchableWidget( section ); |
160 | 170 | ||
161 | //FIND | 171 | //FIND |
162 | findBar = new QPEToolBar(this); | 172 | findBar = new QPEToolBar(this); |
163 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); | 173 | addToolBar( findBar, "Filter", QMainWindow::Top, TRUE ); |
164 | label = new QLabel( tr("Filter: "), findBar ); | 174 | label = new QLabel( tr("Filter: "), findBar ); |
165 | label->setBackgroundColor( findBar->backgroundColor() ); | 175 | label->setBackgroundColor( findBar->backgroundColor() ); |
166 | findBar->setHorizontalStretchable( TRUE ); | 176 | findBar->setHorizontalStretchable( TRUE ); |
167 | findEdit = new QLineEdit( findBar, "findEdit" ); | 177 | findEdit = new QLineEdit( findBar, "findEdit" ); |
168 | findBar->setStretchableWidget( findEdit ); | 178 | findBar->setStretchableWidget( findEdit ); |
169 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), | 179 | connect( findEdit, SIGNAL( textChanged( const QString & ) ), |
170 | this, SLOT( displayList() ) ); | 180 | this, SLOT( displayList() ) ); |
171 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 181 | a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
172 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); | 182 | connect( a, SIGNAL( activated() ), findEdit, SLOT( clear() ) ); |
173 | a->addTo( findBar ); | 183 | a->addTo( findBar ); |
174 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 184 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
175 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); | 185 | connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) ); |
176 | a->addTo( findBar ); | 186 | a->addTo( findBar ); |
177 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); | 187 | findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 ); |
178 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); | 188 | connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) ); |
179 | findAction->setToggleAction( true ); | 189 | findAction->setToggleAction( true ); |
180 | findAction->addTo( viewMenu ); | 190 | findAction->addTo( viewMenu ); |
181 | 191 | ||
182 | //SEARCH | 192 | //SEARCH |
183 | searchBar = new QPEToolBar(this); | 193 | searchBar = new QPEToolBar(this); |
184 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); | 194 | addToolBar( searchBar, "Search", QMainWindow::Top, TRUE ); |
185 | label = new QLabel( tr("ipkgfind: "), searchBar ); | 195 | label = new QLabel( tr("ipkgfind: "), searchBar ); |
186 | label->setBackgroundColor( searchBar->backgroundColor() ); | 196 | label->setBackgroundColor( searchBar->backgroundColor() ); |
187 | searchBar->setHorizontalStretchable( TRUE ); | 197 | searchBar->setHorizontalStretchable( TRUE ); |
188 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); | 198 | searchEdit = new QLineEdit( searchBar, "seachEdit" ); |
189 | searchBar->setStretchableWidget( searchEdit ); | 199 | searchBar->setStretchableWidget( searchEdit ); |
190 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), | 200 | // connect( searchEdit, SIGNAL( textChanged( const QString & ) ), |
191 | // this, SLOT( displayList() ) ); | 201 | // this, SLOT( displayList() ) ); |
192 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); | 202 | a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); |
193 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); | 203 | connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); |
194 | a->addTo( searchBar ); | 204 | a->addTo( searchBar ); |
195 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); | 205 | searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); |
196 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); | 206 | connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); |
197 | searchCommit->addTo( searchBar ); | 207 | searchCommit->addTo( searchBar ); |
198 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 208 | a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
199 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); | 209 | connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); |
200 | a->addTo( searchBar ); | 210 | a->addTo( searchBar ); |
201 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); | 211 | searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); |
202 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); | 212 | connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); |
203 | searchAction->setToggleAction( true ); | 213 | searchAction->setToggleAction( true ); |
204 | searchAction->addTo( viewMenu ); | 214 | searchAction->addTo( viewMenu ); |
205 | 215 | ||
206 | //DEST | 216 | //DEST |
207 | destBar = new QPEToolBar(this); | 217 | destBar = new QPEToolBar(this); |
208 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); | 218 | addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); |
209 | label = new QLabel( tr("Destination: "), destBar ); | 219 | label = new QLabel( tr("Destination: "), destBar ); |
210 | label->setBackgroundColor( destBar->backgroundColor() ); | 220 | label->setBackgroundColor( destBar->backgroundColor() ); |
211 | destBar->setHorizontalStretchable( TRUE ); | 221 | destBar->setHorizontalStretchable( TRUE ); |
212 | destination = new QComboBox( false, destBar ); | 222 | destination = new QComboBox( false, destBar ); |
213 | destination->insertStringList( settings->getDestinationNames() ); | 223 | destination->insertStringList( settings->getDestinationNames() ); |
214 | setComboName(destination,settings->getDestinationName()); | 224 | setComboName(destination,settings->getDestinationName()); |
215 | connect( destination, SIGNAL(activated(int)), | 225 | connect( destination, SIGNAL(activated(int)), |
216 | settings, SLOT(activeDestinationChange(int)) ); | 226 | settings, SLOT(activeDestinationChange(int)) ); |
217 | spacer = new QLabel( " ", destBar ); | 227 | spacer = new QLabel( " ", destBar ); |
218 | spacer->setBackgroundColor( destBar->backgroundColor() ); | 228 | spacer->setBackgroundColor( destBar->backgroundColor() ); |
219 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); | 229 | CheckBoxLink = new QCheckBox( tr("Link"), destBar); |
220 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); | 230 | CheckBoxLink->setBackgroundColor( destBar->backgroundColor() ); |
221 | CheckBoxLink->setChecked( settings->createLinks() ); | 231 | CheckBoxLink->setChecked( settings->createLinks() ); |
222 | connect( CheckBoxLink, SIGNAL(toggled(bool)), | 232 | connect( CheckBoxLink, SIGNAL(toggled(bool)), |
223 | settings, SLOT(linkEnabled(bool)) ); | 233 | settings, SLOT(linkEnabled(bool)) ); |
224 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); | 234 | destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); |
225 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); | 235 | connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); |
226 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); | 236 | a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); |
227 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); | 237 | connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); |
228 | a->addTo( destBar ); | 238 | a->addTo( destBar ); |
229 | destBar->setStretchableWidget( CheckBoxLink ); | 239 | destBar->setStretchableWidget( CheckBoxLink ); |
230 | destAction->setToggleAction( true ); | 240 | destAction->setToggleAction( true ); |
231 | // destAction->addTo( viewMenu ); | 241 | // destAction->addTo( viewMenu ); |
232 | 242 | ||
233 | // helpMenu | 243 | // helpMenu |
234 | helpMenu->insertSeparator(); | 244 | helpMenu->insertSeparator(); |
235 | a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); | 245 | a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); |
236 | a->addTo( helpMenu ); | 246 | a->addTo( helpMenu ); |
237 | helpMenu->insertSeparator(); | 247 | helpMenu->insertSeparator(); |
238 | a = new QAction( tr( "Install" ), | 248 | a = new QAction( tr( "Install" ), |
239 | Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); | 249 | Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); |
240 | a->addTo( helpMenu ); | 250 | a->addTo( helpMenu ); |
241 | a = new QAction( tr( "Remove" ), | 251 | a = new QAction( tr( "Remove" ), |
242 | Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); | 252 | Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); |
243 | a->addTo( helpMenu ); | 253 | a->addTo( helpMenu ); |
244 | helpMenu->insertSeparator(); | 254 | helpMenu->insertSeparator(); |
245 | a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); | 255 | a = new QAction( tr( "Package Status" ), QString::null, 0, this, 0 ); |
246 | a->addTo( helpMenu ); | 256 | a->addTo( helpMenu ); |
247 | helpMenu->insertSeparator(); | 257 | helpMenu->insertSeparator(); |
248 | a = new QAction( tr( "New version, installed" ), | 258 | a = new QAction( tr( "New version, installed" ), |
249 | Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); | 259 | Resource::loadPixmap( "oipkg/installed" ), QString::null, 0, this, 0 ); |
250 | a->addTo( helpMenu ); | 260 | a->addTo( helpMenu ); |
251 | a = new QAction( tr( "New version, not installed" ), | 261 | a = new QAction( tr( "New version, not installed" ), |
252 | Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); | 262 | Resource::loadPixmap( "oipkg/uninstalled" ), QString::null, 0, this, 0 ); |
253 | a->addTo( helpMenu ); | 263 | a->addTo( helpMenu ); |
254 | a = new QAction( tr( "Old version, installed" ), | 264 | a = new QAction( tr( "Old version, installed" ), |
255 | Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); | 265 | Resource::loadPixmap( "oipkg/installedOld" ), QString::null, 0, this, 0 ); |
256 | a->addTo( helpMenu ); | 266 | a->addTo( helpMenu ); |
257 | a = new QAction( tr( "Old version, not installed" ), | 267 | a = new QAction( tr( "Old version, not installed" ), |
258 | Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 ); | 268 | Resource::loadPixmap( "oipkg/uninstalledOld" ), QString::null, 0, this, 0 ); |
259 | a->addTo( helpMenu ); | 269 | a->addTo( helpMenu ); |
260 | a = new QAction( tr( "Old version, new version installed" ), | 270 | a = new QAction( tr( "Old version, new version installed" ), |
261 | Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 ); | 271 | Resource::loadPixmap( "oipkg/uninstalledOldinstalledNew" ), QString::null, 0, this, 0 ); |
262 | a->addTo( helpMenu ); | 272 | a->addTo( helpMenu ); |
263 | a = new QAction( tr( "New version, old version installed" ), | 273 | a = new QAction( tr( "New version, old version installed" ), |
264 | Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 ); | 274 | Resource::loadPixmap( "oipkg/uninstalledInstalledOld" ), QString::null, 0, this, 0 ); |
265 | a->addTo( helpMenu ); | 275 | a->addTo( helpMenu ); |
266 | //a = new QAction( tr( "" ), | 276 | //a = new QAction( tr( "" ), |
267 | // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 ); | 277 | // Resource::loadPixmap( "oipkg/" ), QString::null, 0, this, 0 ); |
268 | // a->addTo( helpMenu ); | 278 | // a->addTo( helpMenu ); |
269 | 279 | ||
270 | // configure the menus | 280 | // configure the menus |
271 | Config cfg( "oipkg", Config::User ); | 281 | Config cfg( "oipkg", Config::User ); |
272 | cfg.setGroup( "gui" ); | 282 | cfg.setGroup( "gui" ); |
273 | 283 | ||
274 | findShow( cfg.readBoolEntry( "findBar", true ) ); | 284 | findShow( cfg.readBoolEntry( "findBar", true ) ); |
275 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); | 285 | searchShow( cfg.readBoolEntry( "searchBar", true ) ); |
276 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); | 286 | sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); |
277 | destShow( cfg.readBoolEntry( "destBar", false ) ); | 287 | destShow( cfg.readBoolEntry( "destBar", false ) ); |
278 | } | 288 | } |
279 | 289 | ||
280 | MainWindow::~MainWindow() | 290 | MainWindow::~MainWindow() |
281 | { | 291 | { |
282 | Config cfg( "oipkg", Config::User ); | 292 | Config cfg( "oipkg", Config::User ); |
283 | cfg.setGroup( "gui" ); | 293 | cfg.setGroup( "gui" ); |
284 | cfg.writeEntry( "findBar", !findBar->isHidden() ); | 294 | cfg.writeEntry( "findBar", !findBar->isHidden() ); |
285 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); | 295 | cfg.writeEntry( "searchBar", !searchBar->isHidden() ); |
286 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); | 296 | cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); |
287 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 297 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
288 | 298 | ||
289 | } | 299 | } |
290 | 300 | ||
291 | void MainWindow::runIpkg() | 301 | void MainWindow::runIpkg() |
292 | { | 302 | { |
293 | packageListServers.allPackages(); | 303 | packageListServers.allPackages(); |
294 | ipkg->loadList( &packageListSearch ); | 304 | ipkg->loadList( &packageListSearch ); |
295 | ipkg->loadList( &packageListDocLnk ); | 305 | ipkg->loadList( &packageListDocLnk ); |
296 | ipkg->loadList( &packageListServers ); | 306 | ipkg->loadList( &packageListServers ); |
297 | ipkg->commit(); | 307 | ipkg->commit(); |
298 | ipkg->clearLists(); | 308 | ipkg->clearLists(); |
299 | // ##### If we looked in the list of files, we could send out accurate | 309 | // ##### If we looked in the list of files, we could send out accurate |
300 | // ##### messages. But we don't bother yet, and just do an "all". | 310 | // ##### messages. But we don't bother yet, and just do an "all". |
301 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); | 311 | QCopEnvelope e("QPE/System", "linkChanged(QString)"); |
302 | QString lf = QString::null; | 312 | QString lf = QString::null; |
303 | e << lf; | 313 | e << lf; |
304 | displayList(); | 314 | displayList(); |
305 | } | 315 | } |
306 | 316 | ||
307 | void MainWindow::updateList() | 317 | void MainWindow::updateList() |
308 | { | 318 | { |
309 | packageListServers.clear(); | 319 | packageListServers.clear(); |
310 | packageListSearch.clear(); | 320 | packageListSearch.clear(); |
311 | 321 | ||
312 | packageListDocLnk.clear(); | 322 | packageListDocLnk.clear(); |
313 | ipkg->update(); | 323 | ipkg->update(); |
314 | packageListServers.update(); | 324 | packageListServers.update(); |
315 | packageListSearch.update(); | 325 | packageListSearch.update(); |
316 | packageListDocLnk.update(); | 326 | packageListDocLnk.update(); |
317 | } | 327 | } |
318 | 328 | ||
319 | void MainWindow::filterList() | 329 | void MainWindow::filterList() |
320 | { | 330 | { |
321 | QString f = ""; | 331 | QString f = ""; |
322 | if ( findAction->isOn() ) f = findEdit->text(); | 332 | if ( findAction->isOn() ) f = findEdit->text(); |
323 | packageListServers.filterPackages( f ); | 333 | packageListServers.filterPackages( f ); |
324 | } | 334 | } |
325 | 335 | ||
326 | void MainWindow::displayList() | 336 | void MainWindow::displayList() |
327 | { | 337 | { |
328 | filterList(); | 338 | filterList(); |
329 | listViewPackages->display(); | 339 | listViewPackages->display(); |
330 | } | 340 | } |
331 | 341 | ||
332 | void MainWindow::sectionChanged() | 342 | void MainWindow::sectionChanged() |
333 | { | 343 | { |
334 | disconnect( section, SIGNAL( activated(int) ), | 344 | disconnect( section, SIGNAL( activated(int) ), |
335 | this, SLOT( sectionChanged() ) ); | 345 | this, SLOT( sectionChanged() ) ); |
336 | disconnect( subsection, SIGNAL(activated(int) ), | 346 | disconnect( subsection, SIGNAL(activated(int) ), |
337 | this, SLOT( subSectionChanged() ) ); | 347 | this, SLOT( subSectionChanged() ) ); |
338 | subsection->clear(); | 348 | subsection->clear(); |
339 | packageListServers.setSection( section->currentText() ); | 349 | packageListServers.setSection( section->currentText() ); |
340 | setSubSections(); | 350 | setSubSections(); |
341 | connect( section, SIGNAL( activated(int) ), | 351 | connect( section, SIGNAL( activated(int) ), |
342 | this, SLOT( sectionChanged() ) ); | 352 | this, SLOT( sectionChanged() ) ); |
343 | connect( subsection, SIGNAL(activated(int) ), | 353 | connect( subsection, SIGNAL(activated(int) ), |
344 | this, SLOT( subSectionChanged() ) ); | 354 | this, SLOT( subSectionChanged() ) ); |
345 | displayList(); | 355 | displayList(); |
346 | } | 356 | } |
347 | 357 | ||
348 | void MainWindow::subSectionChanged() | 358 | void MainWindow::subSectionChanged() |
349 | { | 359 | { |
350 | disconnect( section, SIGNAL( activated(int) ), | 360 | disconnect( section, SIGNAL( activated(int) ), |
351 | this, SLOT( sectionChanged() ) ); | 361 | this, SLOT( sectionChanged() ) ); |
352 | disconnect( subsection, SIGNAL(activated(int) ), | 362 | disconnect( subsection, SIGNAL(activated(int) ), |
353 | this, SLOT( subSectionChanged() ) ); | 363 | this, SLOT( subSectionChanged() ) ); |
354 | packageListServers.setSubSection( subsection->currentText() ); | 364 | packageListServers.setSubSection( subsection->currentText() ); |
355 | connect( section, SIGNAL( activated(int) ), | 365 | connect( section, SIGNAL( activated(int) ), |
356 | this, SLOT( sectionChanged() ) ); | 366 | this, SLOT( sectionChanged() ) ); |
357 | connect( subsection, SIGNAL(activated(int) ), | 367 | connect( subsection, SIGNAL(activated(int) ), |
358 | this, SLOT( subSectionChanged() ) ); | 368 | this, SLOT( subSectionChanged() ) ); |
359 | displayList(); | 369 | displayList(); |
360 | } | 370 | } |
361 | 371 | ||
362 | void MainWindow::setSections() | 372 | void MainWindow::setSections() |
363 | { | 373 | { |
364 | section->clear(); | 374 | section->clear(); |
365 | section->insertStringList( packageListServers.getSections() ); | 375 | section->insertStringList( packageListServers.getSections() ); |
366 | } | 376 | } |
367 | 377 | ||
368 | void MainWindow::setSubSections() | 378 | void MainWindow::setSubSections() |
369 | { | 379 | { |
370 | subsection->clear(); | 380 | subsection->clear(); |
371 | subsection->insertStringList( packageListServers.getSubSections() ); | 381 | subsection->insertStringList( packageListServers.getSubSections() ); |
372 | } | 382 | } |
373 | 383 | ||
374 | 384 | ||
375 | void MainWindow::showSettings() | 385 | void MainWindow::showSettings() |
376 | { | 386 | { |
377 | if ( settings->showDialog( 0 ) ) | 387 | if ( settings->showDialog( 0 ) ) |
378 | updateList(); | 388 | updateList(); |
379 | } | 389 | } |
380 | void MainWindow::showSettingsSrv() | 390 | void MainWindow::showSettingsSrv() |
381 | { | 391 | { |
382 | if ( settings->showDialog( 1 ) ) | 392 | if ( settings->showDialog( 1 ) ) |
383 | updateList(); | 393 | updateList(); |
384 | } | 394 | } |
385 | void MainWindow::showSettingsDst() | 395 | void MainWindow::showSettingsDst() |
386 | { | 396 | { |
387 | if ( settings->showDialog( 2 ) ) | 397 | if ( settings->showDialog( 2 ) ) |
388 | updateList(); | 398 | updateList(); |
389 | } | 399 | } |
390 | 400 | ||
391 | void MainWindow::sectionShow(bool b) | 401 | void MainWindow::sectionShow(bool b) |
392 | { | 402 | { |
393 | if (b) sectionBar->show(); | 403 | if (b) sectionBar->show(); |
394 | else sectionBar->hide(); | 404 | else sectionBar->hide(); |
395 | sectionAction->setOn( b ); | 405 | sectionAction->setOn( b ); |
396 | } | 406 | } |
397 | 407 | ||
398 | void MainWindow::sectionClose() | 408 | void MainWindow::sectionClose() |
399 | { | 409 | { |
400 | sectionAction->setOn( false ); | 410 | sectionAction->setOn( false ); |
401 | } | 411 | } |
402 | 412 | ||
403 | void MainWindow::findShow(bool b) | 413 | void MainWindow::findShow(bool b) |
404 | { | 414 | { |
405 | if (b) findBar->show(); | 415 | if (b) findBar->show(); |
406 | else findBar->hide(); | 416 | else findBar->hide(); |
407 | findAction->setOn( b ); | 417 | findAction->setOn( b ); |
408 | } | 418 | } |
409 | 419 | ||
410 | void MainWindow::findClose() | 420 | void MainWindow::findClose() |
411 | { | 421 | { |
412 | findAction->setOn( false ); | 422 | findAction->setOn( false ); |
413 | } | 423 | } |
414 | 424 | ||
415 | void MainWindow::searchShow(bool b) | 425 | void MainWindow::searchShow(bool b) |
416 | { | 426 | { |
417 | if (b) searchBar->show(); | 427 | if (b) searchBar->show(); |
418 | else searchBar->hide(); | 428 | else searchBar->hide(); |
419 | searchAction->setOn( b ); | 429 | searchAction->setOn( b ); |
420 | } | 430 | } |
421 | 431 | ||
422 | void MainWindow::searchClose() | 432 | void MainWindow::searchClose() |
423 | { | 433 | { |
424 | searchAction->setOn( false ); | 434 | searchAction->setOn( false ); |
425 | } | 435 | } |
426 | 436 | ||
427 | 437 | ||
428 | void MainWindow::destShow(bool b) | 438 | void MainWindow::destShow(bool b) |
429 | { | 439 | { |
430 | if (b) destBar->show(); | 440 | if (b) destBar->show(); |
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h index 4a5e8bf..090ddd3 100644 --- a/noncore/unsupported/oipkg/mainwindow.h +++ b/noncore/unsupported/oipkg/mainwindow.h | |||
@@ -1,94 +1,106 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // Copyright (C) 2000 Trolltech AS. | ||
10 | // adadpted form qpe/qipkg | ||
11 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
12 | |||
1 | #ifndef MAINWINDOW_H | 13 | #ifndef MAINWINDOW_H |
2 | #define MAINWINDOW_H | 14 | #define MAINWINDOW_H |
3 | 15 | ||
4 | #include <qmainwindow.h> | 16 | #include <qmainwindow.h> |
5 | #include <qaction.h> | 17 | #include <qaction.h> |
6 | #include <qtimer.h> | 18 | #include <qtimer.h> |
7 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
8 | 20 | ||
9 | #include "packagelist.h" | 21 | #include "packagelist.h" |
10 | #include "packagelistremote.h" | 22 | #include "packagelistremote.h" |
11 | #include "packagelistlocal.h" | 23 | #include "packagelistlocal.h" |
12 | #include "packagelistdoclnk.h" | 24 | #include "packagelistdoclnk.h" |
13 | #include "pmipkg.h" | 25 | #include "pmipkg.h" |
14 | #include "pksettings.h" | 26 | #include "pksettings.h" |
15 | #include "packagelistview.h" | 27 | #include "packagelistview.h" |
16 | 28 | ||
17 | class QComboBox; | 29 | class QComboBox; |
18 | class QPEToolBar; | 30 | class QPEToolBar; |
19 | class QLineEdit; | 31 | class QLineEdit; |
20 | class PackageListItem; | 32 | class PackageListItem; |
21 | class QCopChannel; | 33 | class QCopChannel; |
22 | class QMessageBox; | 34 | class QMessageBox; |
23 | class QCheckBox; | 35 | class QCheckBox; |
24 | 36 | ||
25 | class MainWindow : public QMainWindow | 37 | class MainWindow : public QMainWindow |
26 | { | 38 | { |
27 | Q_OBJECT | 39 | Q_OBJECT |
28 | 40 | ||
29 | 41 | ||
30 | public: | 42 | public: |
31 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); | 43 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); |
32 | ~MainWindow(); | 44 | ~MainWindow(); |
33 | void makeChannel(); | 45 | void makeChannel(); |
34 | 46 | ||
35 | QCopChannel *channel; | 47 | QCopChannel *channel; |
36 | 48 | ||
37 | protected slots: | 49 | protected slots: |
38 | void runIpkg(); | 50 | void runIpkg(); |
39 | void updateList(); | 51 | void updateList(); |
40 | void displayList(); | 52 | void displayList(); |
41 | void subSectionChanged(); | 53 | void subSectionChanged(); |
42 | void sectionChanged(); | 54 | void sectionChanged(); |
43 | void showSettings(); | 55 | void showSettings(); |
44 | void showSettingsSrv(); | 56 | void showSettingsSrv(); |
45 | void showSettingsDst(); | 57 | void showSettingsDst(); |
46 | 58 | ||
47 | public slots: | 59 | public slots: |
48 | void sectionClose(); | 60 | void sectionClose(); |
49 | void sectionShow(bool); | 61 | void sectionShow(bool); |
50 | void findClose(); | 62 | void findClose(); |
51 | void findShow(bool); | 63 | void findShow(bool); |
52 | void searchClose(); | 64 | void searchClose(); |
53 | void searchShow(bool); | 65 | void searchShow(bool); |
54 | void destClose(); | 66 | void destClose(); |
55 | void destShow(bool); | 67 | void destShow(bool); |
56 | void filterList(); | 68 | void filterList(); |
57 | void createLinks(); | 69 | void createLinks(); |
58 | void removeLinks(); | 70 | void removeLinks(); |
59 | void receive (const QCString &, const QByteArray &); | 71 | void receive (const QCString &, const QByteArray &); |
60 | void setDocument (const QString &); | 72 | void setDocument (const QString &); |
61 | void remotePackageQuery(); | 73 | void remotePackageQuery(); |
62 | 74 | ||
63 | private: | 75 | private: |
64 | void makeMenu(); | 76 | void makeMenu(); |
65 | void setSections(); | 77 | void setSections(); |
66 | void setSubSections(); | 78 | void setSubSections(); |
67 | bool updateIcon; | 79 | bool updateIcon; |
68 | 80 | ||
69 | PmIpkg* ipkg; | 81 | PmIpkg* ipkg; |
70 | PackageManagerSettings *settings; | 82 | PackageManagerSettings *settings; |
71 | PackageListLocal packageListServers; | 83 | PackageListLocal packageListServers; |
72 | PackageListRemote packageListSearch; | 84 | PackageListRemote packageListSearch; |
73 | PackageListDocLnk packageListDocLnk; | 85 | PackageListDocLnk packageListDocLnk; |
74 | PackageListView *listViewPackages; | 86 | PackageListView *listViewPackages; |
75 | QAction *runAction; | 87 | QAction *runAction; |
76 | QAction *updateAction; | 88 | QAction *updateAction; |
77 | QAction *findAction; | 89 | QAction *findAction; |
78 | QPEToolBar *findBar; | 90 | QPEToolBar *findBar; |
79 | QLineEdit *findEdit; | 91 | QLineEdit *findEdit; |
80 | QAction *searchAction; | 92 | QAction *searchAction; |
81 | QAction *searchCommit; | 93 | QAction *searchCommit; |
82 | QPEToolBar *searchBar; | 94 | QPEToolBar *searchBar; |
83 | QLineEdit *searchEdit; | 95 | QLineEdit *searchEdit; |
84 | QAction *sectionAction; | 96 | QAction *sectionAction; |
85 | QPEToolBar *sectionBar; | 97 | QPEToolBar *sectionBar; |
86 | QComboBox *section; | 98 | QComboBox *section; |
87 | QComboBox *subsection; | 99 | QComboBox *subsection; |
88 | QAction *destAction; | 100 | QAction *destAction; |
89 | QPEToolBar *destBar; | 101 | QPEToolBar *destBar; |
90 | QComboBox *destination; | 102 | QComboBox *destination; |
91 | QCheckBox* CheckBoxLink; | 103 | QCheckBox* CheckBoxLink; |
92 | }; | 104 | }; |
93 | 105 | ||
94 | #endif | 106 | #endif |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 0cd93bf..7aaa240 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -1,384 +1,393 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #include "package.h" | 10 | #include "package.h" |
2 | 11 | ||
3 | #include <qpe/process.h> | 12 | #include <qpe/process.h> |
4 | #include <qpe/stringutil.h> | 13 | #include <qpe/stringutil.h> |
5 | #include <qfile.h> | 14 | #include <qfile.h> |
6 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
7 | #include <stdlib.h> | 16 | #include <stdlib.h> |
8 | #include <unistd.h> | 17 | #include <unistd.h> |
9 | 18 | ||
10 | #include "debug.h" | 19 | #include "debug.h" |
11 | 20 | ||
12 | Package::Package( QObject *parent, const char *name ) | 21 | Package::Package( QObject *parent, const char *name ) |
13 | : QObject(parent,name) | 22 | : QObject(parent,name) |
14 | { | 23 | { |
15 | 24 | ||
16 | } | 25 | } |
17 | 26 | ||
18 | Package::~Package() | 27 | Package::~Package() |
19 | { | 28 | { |
20 | } | 29 | } |
21 | 30 | ||
22 | Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) | 31 | Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) |
23 | : QObject(parent,name) | 32 | : QObject(parent,name) |
24 | { | 33 | { |
25 | Package(parent,name); | 34 | Package(parent,name); |
26 | init(s); | 35 | init(s); |
27 | } | 36 | } |
28 | 37 | ||
29 | void Package::init( PackageManagerSettings *s ) | 38 | void Package::init( PackageManagerSettings *s ) |
30 | { | 39 | { |
31 | settings = s; | 40 | settings = s; |
32 | _size = ""; | 41 | _size = ""; |
33 | _section = ""; | 42 | _section = ""; |
34 | _subsection = ""; | 43 | _subsection = ""; |
35 | _shortDesc = ""; | 44 | _shortDesc = ""; |
36 | _desc = ""; | 45 | _desc = ""; |
37 | _name = ""; | 46 | _name = ""; |
38 | _toProcess = false; | 47 | _toProcess = false; |
39 | _useFileName = false; | 48 | _useFileName = false; |
40 | _old = false; | 49 | _old = false; |
41 | _status = ""; | 50 | _status = ""; |
42 | _dest = settings->getDestinationName(); | 51 | _dest = settings->getDestinationName(); |
43 | _link = settings->createLinks(); | 52 | _link = settings->createLinks(); |
44 | _versions=0; | 53 | _versions=0; |
45 | _version=""; | 54 | _version=""; |
46 | } | 55 | } |
47 | 56 | ||
48 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) | 57 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) |
49 | : QObject(parent,name) | 58 | : QObject(parent,name) |
50 | { | 59 | { |
51 | init(s); | 60 | init(s); |
52 | parsePackage( pack ); | 61 | parsePackage( pack ); |
53 | } | 62 | } |
54 | 63 | ||
55 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) | 64 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) |
56 | : QObject(parent,name) | 65 | : QObject(parent,name) |
57 | { | 66 | { |
58 | init(s); | 67 | init(s); |
59 | if ( !QFile::exists( n ) ) | 68 | if ( !QFile::exists( n ) ) |
60 | { | 69 | { |
61 | _name = QString( n ); | 70 | _name = QString( n ); |
62 | }else{ | 71 | }else{ |
63 | pvDebug(4,"remote file: "+n); | 72 | pvDebug(4,"remote file: "+n); |
64 | parseIpkgFile( n ); | 73 | parseIpkgFile( n ); |
65 | _useFileName = true; | 74 | _useFileName = true; |
66 | _fileName = QString( n ); | 75 | _fileName = QString( n ); |
67 | } | 76 | } |
68 | } | 77 | } |
69 | 78 | ||
70 | Package::Package( Package *pi, QObject *parent, const char *name ) | 79 | Package::Package( Package *pi, QObject *parent, const char *name ) |
71 | : QObject(parent,name) | 80 | : QObject(parent,name) |
72 | { | 81 | { |
73 | init(pi->settings); | 82 | init(pi->settings); |
74 | copyValues( pi ); | 83 | copyValues( pi ); |
75 | } | 84 | } |
76 | 85 | ||
77 | 86 | ||
78 | void Package::setValue( QString n, QString t ) | 87 | void Package::setValue( QString n, QString t ) |
79 | { | 88 | { |
80 | if ( n == "Package" ) | 89 | if ( n == "Package" ) |
81 | { | 90 | { |
82 | _name = QString( t ); | 91 | _name = QString( t ); |
83 | }else if ( n == "Installed-Size" ) | 92 | }else if ( n == "Installed-Size" ) |
84 | { | 93 | { |
85 | _size = t; | 94 | _size = t; |
86 | // }else if ( n == "Priority") | 95 | // }else if ( n == "Priority") |
87 | // { | 96 | // { |
88 | 97 | ||
89 | }else if ( n == "Section") | 98 | }else if ( n == "Section") |
90 | { | 99 | { |
91 | setSection( t ); | 100 | setSection( t ); |
92 | // }else if ( n == "Maintainer") | 101 | // }else if ( n == "Maintainer") |
93 | // { | 102 | // { |
94 | // | 103 | // |
95 | // }else if ( n == "Architecture") | 104 | // }else if ( n == "Architecture") |
96 | // { | 105 | // { |
97 | 106 | ||
98 | }else if ( n == "Version") | 107 | }else if ( n == "Version") |
99 | { | 108 | { |
100 | _version = t; | 109 | _version = t; |
101 | // }else if ( n == "Pre-Depends") | 110 | // }else if ( n == "Pre-Depends") |
102 | // { | 111 | // { |
103 | // | 112 | // |
104 | // }else if ( n == "Depends") | 113 | // }else if ( n == "Depends") |
105 | // { | 114 | // { |
106 | 115 | ||
107 | }else if ( n == "Filename") | 116 | }else if ( n == "Filename") |
108 | { | 117 | { |
109 | _fileName = t; | 118 | _fileName = t; |
110 | // }else if ( n == "Size") | 119 | // }else if ( n == "Size") |
111 | // { | 120 | // { |
112 | // | 121 | // |
113 | //}else if ( n == "MD5Sum") | 122 | //}else if ( n == "MD5Sum") |
114 | //{ | 123 | //{ |
115 | 124 | ||
116 | }else if ( n == "Description") | 125 | }else if ( n == "Description") |
117 | { | 126 | { |
118 | setDesc( t ); | 127 | setDesc( t ); |
119 | }else if ( n == "Status") | 128 | }else if ( n == "Status") |
120 | { | 129 | { |
121 | if ( installed() ) return; | 130 | if ( installed() ) return; |
122 | _status = t; | 131 | _status = t; |
123 | // }else if ( n == "Essential") | 132 | // }else if ( n == "Essential") |
124 | // { | 133 | // { |
125 | 134 | ||
126 | }else{ | 135 | }else{ |
127 | _values.insert(n,new QString(t)); | 136 | _values.insert(n,new QString(t)); |
128 | } | 137 | } |
129 | } | 138 | } |
130 | 139 | ||
131 | QString Package::name() | 140 | QString Package::name() |
132 | { | 141 | { |
133 | if (_displayName.isEmpty() ) return _name; | 142 | if (_displayName.isEmpty() ) return _name; |
134 | else return _displayName; | 143 | else return _displayName; |
135 | } | 144 | } |
136 | 145 | ||
137 | 146 | ||
138 | QString Package::installName() | 147 | QString Package::installName() |
139 | { | 148 | { |
140 | if (_useFileName) return _fileName; | 149 | if (_useFileName) return _fileName; |
141 | else return _name; | 150 | else return _name; |
142 | } | 151 | } |
143 | 152 | ||
144 | QString Package::packageName() | 153 | QString Package::packageName() |
145 | { | 154 | { |
146 | QString pn = installName(); | 155 | QString pn = installName(); |
147 | pn = pn.right(pn.length()-pn.findRev("/")); | 156 | pn = pn.right(pn.length()-pn.findRev("/")); |
148 | pn = pn.left(pn.find("_")); | 157 | pn = pn.left(pn.find("_")); |
149 | return pn; | 158 | return pn; |
150 | } | 159 | } |
151 | 160 | ||
152 | bool Package::installed() | 161 | bool Package::installed() |
153 | { | 162 | { |
154 | if (_status.contains("installed")) | 163 | if (_status.contains("installed")) |
155 | { | 164 | { |
156 | if (_status.contains("not-installed")) | 165 | if (_status.contains("not-installed")) |
157 | { | 166 | { |
158 | _toProcess = true; | 167 | _toProcess = true; |
159 | return false; | 168 | return false; |
160 | } | 169 | } |
161 | else return true; | 170 | else return true; |
162 | } | 171 | } |
163 | else | 172 | else |
164 | if (_versions) | 173 | if (_versions) |
165 | { | 174 | { |
166 | QDictIterator<Package> other( *_versions ); | 175 | QDictIterator<Package> other( *_versions ); |
167 | while ( other.current() ) | 176 | while ( other.current() ) |
168 | { | 177 | { |
169 | if (other.current()->status().contains("installed") | 178 | if (other.current()->status().contains("installed") |
170 | && other.current()->version() == version()) | 179 | && other.current()->version() == version()) |
171 | return true; | 180 | return true; |
172 | ++other; | 181 | ++other; |
173 | } | 182 | } |
174 | } | 183 | } |
175 | return false; | 184 | return false; |
176 | } | 185 | } |
177 | 186 | ||
178 | bool Package::otherInstalled() | 187 | bool Package::otherInstalled() |
179 | { | 188 | { |
180 | if (_versions) | 189 | if (_versions) |
181 | { | 190 | { |
182 | QDictIterator<Package> other( *_versions ); | 191 | QDictIterator<Package> other( *_versions ); |
183 | while ( other.current() ) | 192 | while ( other.current() ) |
184 | { | 193 | { |
185 | if (other.current()->installed()) return true; | 194 | if (other.current()->installed()) return true; |
186 | ++other; | 195 | ++other; |
187 | } | 196 | } |
188 | } | 197 | } |
189 | return false; | 198 | return false; |
190 | } | 199 | } |
191 | 200 | ||
192 | void Package::setDesc( QString s ) | 201 | void Package::setDesc( QString s ) |
193 | { | 202 | { |
194 | _desc = s; | 203 | _desc = s; |
195 | _shortDesc = s.left( s.find("\n") ); | 204 | _shortDesc = s.left( s.find("\n") ); |
196 | } | 205 | } |
197 | 206 | ||
198 | QString Package::desc() | 207 | QString Package::desc() |
199 | { | 208 | { |
200 | return _desc; | 209 | return _desc; |
201 | } | 210 | } |
202 | 211 | ||
203 | QString Package::shortDesc() | 212 | QString Package::shortDesc() |
204 | { | 213 | { |
205 | return _shortDesc; | 214 | return _shortDesc; |
206 | } | 215 | } |
207 | 216 | ||
208 | QString Package::size() | 217 | QString Package::size() |
209 | { | 218 | { |
210 | return _size; | 219 | return _size; |
211 | } | 220 | } |
212 | 221 | ||
213 | 222 | ||
214 | QString Package::version() | 223 | QString Package::version() |
215 | { | 224 | { |
216 | return _version; | 225 | return _version; |
217 | } | 226 | } |
218 | 227 | ||
219 | QString Package::sizeUnits() | 228 | QString Package::sizeUnits() |
220 | { | 229 | { |
221 | int i = _size.toInt(); | 230 | int i = _size.toInt(); |
222 | int c = 0; | 231 | int c = 0; |
223 | QString ret; | 232 | QString ret; |
224 | QStringList unit; | 233 | QStringList unit; |
225 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) | 234 | unit << "B" << "KB" << "MB" << "GB" << "TB"; //prepair for the future ;) |
226 | while (i > 1) | 235 | while (i > 1) |
227 | { | 236 | { |
228 | ret=QString::number(i)+" "+unit[c]; | 237 | ret=QString::number(i)+" "+unit[c]; |
229 | c++; | 238 | c++; |
230 | i /= 1024; | 239 | i /= 1024; |
231 | } | 240 | } |
232 | return ret; | 241 | return ret; |
233 | } | 242 | } |
234 | 243 | ||
235 | bool Package::toProcess() | 244 | bool Package::toProcess() |
236 | { | 245 | { |
237 | return _toProcess; | 246 | return _toProcess; |
238 | } | 247 | } |
239 | 248 | ||
240 | bool Package::toRemove() | 249 | bool Package::toRemove() |
241 | { | 250 | { |
242 | if ( _toProcess && installed() ) return true; | 251 | if ( _toProcess && installed() ) return true; |
243 | else return false; | 252 | else return false; |
244 | } | 253 | } |
245 | 254 | ||
246 | bool Package::toInstall() | 255 | bool Package::toInstall() |
247 | { | 256 | { |
248 | if ( _toProcess && !installed() ) return true; | 257 | if ( _toProcess && !installed() ) return true; |
249 | else return false; | 258 | else return false; |
250 | } | 259 | } |
251 | 260 | ||
252 | void Package::toggleProcess() | 261 | void Package::toggleProcess() |
253 | { | 262 | { |
254 | _toProcess = ! _toProcess; | 263 | _toProcess = ! _toProcess; |
255 | } | 264 | } |
256 | 265 | ||
257 | 266 | ||
258 | 267 | ||
259 | void Package::copyValues( Package* pack ) | 268 | void Package::copyValues( Package* pack ) |
260 | { | 269 | { |
261 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); | 270 | if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); |
262 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); | 271 | if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); |
263 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); | 272 | if (_subsection.isEmpty()&& !pack->_subsection.isEmpty()) _subsection = QString( pack->_subsection ); |
264 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); | 273 | if (_shortDesc.isEmpty() && !pack->_shortDesc.isEmpty()) _shortDesc = QString( pack->_shortDesc ); |
265 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); | 274 | if (_desc.isEmpty() && !pack->_desc.isEmpty()) _desc = QString( pack->_desc ); |
266 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); | 275 | if (_name.isEmpty() && !pack->_name.isEmpty()) _name = QString( pack->_name ); |
267 | if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); | 276 | if (_dest.isEmpty() && !pack->_dest.isEmpty()) _dest= QString( pack->_dest ); |
268 | if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); | 277 | if (_displayName.isEmpty()&& !pack->_displayName.isEmpty()) _displayName = QString( pack->_displayName ); |
269 | if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); | 278 | if (_fileName.isEmpty() && !pack->_fileName.isEmpty()) _fileName = QString( pack->_fileName ); |
270 | if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); | 279 | if (_version.isEmpty() && !pack->_version.isEmpty()) _version = QString( pack->_version ); |
271 | if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); | 280 | if (_values.isEmpty() && !pack->_values.isEmpty())_values = QDict<QString>( pack->_values ); |
272 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); | 281 | if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); |
273 | } | 282 | } |
274 | 283 | ||
275 | QString Package::section() | 284 | QString Package::section() |
276 | { | 285 | { |
277 | return _section; | 286 | return _section; |
278 | } | 287 | } |
279 | 288 | ||
280 | void Package::setSection( QString s) | 289 | void Package::setSection( QString s) |
281 | { | 290 | { |
282 | int i = s.find("/"); | 291 | int i = s.find("/"); |
283 | if ( i > 0 ) | 292 | if ( i > 0 ) |
284 | { | 293 | { |
285 | _section = s.left(i); | 294 | _section = s.left(i); |
286 | _subsection = s.mid(i+1); | 295 | _subsection = s.mid(i+1); |
287 | }else{ | 296 | }else{ |
288 | _section = s; | 297 | _section = s; |
289 | _subsection = ""; | 298 | _subsection = ""; |
290 | } | 299 | } |
291 | } | 300 | } |
292 | 301 | ||
293 | QString Package::subSection() | 302 | QString Package::subSection() |
294 | { | 303 | { |
295 | return _subsection; | 304 | return _subsection; |
296 | } | 305 | } |
297 | 306 | ||
298 | void Package::parsePackage( QStringList pack ) | 307 | void Package::parsePackage( QStringList pack ) |
299 | { | 308 | { |
300 | if ( pack.isEmpty() ) return; | 309 | if ( pack.isEmpty() ) return; |
301 | int count = pack.count(); | 310 | int count = pack.count(); |
302 | for( int i = 0; i < count; i++ ) | 311 | for( int i = 0; i < count; i++ ) |
303 | { | 312 | { |
304 | QString line = pack[i]; | 313 | QString line = pack[i]; |
305 | int sep = line.find( QRegExp(":[\t ]+") ); | 314 | int sep = line.find( QRegExp(":[\t ]+") ); |
306 | if ( sep >= 0 ) | 315 | if ( sep >= 0 ) |
307 | { | 316 | { |
308 | QString tag = line.left(sep); | 317 | QString tag = line.left(sep); |
309 | QString value = line.mid(sep+2).simplifyWhiteSpace(); | 318 | QString value = line.mid(sep+2).simplifyWhiteSpace(); |
310 | setValue( tag, value ); | 319 | setValue( tag, value ); |
311 | }else{ | 320 | }else{ |
312 | } | 321 | } |
313 | } | 322 | } |
314 | return; | 323 | return; |
315 | } | 324 | } |
316 | 325 | ||
317 | QString Package::details() | 326 | QString Package::details() |
318 | { | 327 | { |
319 | QString status; | 328 | QString status; |
320 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); | 329 | Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); |
321 | QString description; | 330 | QString description; |
322 | if ( ipkg_status.exec("",status) ) | 331 | if ( ipkg_status.exec("",status) ) |
323 | { | 332 | { |
324 | QStringList lines = QStringList::split('\n',status,TRUE); | 333 | QStringList lines = QStringList::split('\n',status,TRUE); |
325 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { | 334 | for (QStringList::Iterator it = lines.begin(); it!=lines.end(); ++it) { |
326 | QString line = *it; | 335 | QString line = *it; |
327 | if ( line == " ." ) | 336 | if ( line == " ." ) |
328 | { | 337 | { |
329 | description.append("<p>"); | 338 | description.append("<p>"); |
330 | } else | 339 | } else |
331 | if ( line[0] == ' ' || line[0] == '\t' ) | 340 | if ( line[0] == ' ' || line[0] == '\t' ) |
332 | { | 341 | { |
333 | // continuation | 342 | // continuation |
334 | description.append(" "); | 343 | description.append(" "); |
335 | description.append(Qtopia::escapeString(line)); | 344 | description.append(Qtopia::escapeString(line)); |
336 | } else { | 345 | } else { |
337 | int sep = line.find(QRegExp(":[\t ]+")); | 346 | int sep = line.find(QRegExp(":[\t ]+")); |
338 | if ( sep >= 0 ) | 347 | if ( sep >= 0 ) |
339 | { | 348 | { |
340 | QString tag = line.left(sep); | 349 | QString tag = line.left(sep); |
341 | description.append("<br>"); | 350 | description.append("<br>"); |
342 | description.append("<b>"); | 351 | description.append("<b>"); |
343 | description.append(Qtopia::escapeString(tag)); | 352 | description.append(Qtopia::escapeString(tag)); |
344 | description.append(":</b> "); | 353 | description.append(":</b> "); |
345 | description.append(Qtopia::escapeString(line.mid(sep+2))); | 354 | description.append(Qtopia::escapeString(line.mid(sep+2))); |
346 | } else { | 355 | } else { |
347 | description.append(" "); | 356 | description.append(" "); |
348 | description.append(Qtopia::escapeString(line)); | 357 | description.append(Qtopia::escapeString(line)); |
349 | } | 358 | } |
350 | } | 359 | } |
351 | } | 360 | } |
352 | } | 361 | } |
353 | return description; | 362 | return description; |
354 | } | 363 | } |
355 | 364 | ||
356 | void Package::processed() | 365 | void Package::processed() |
357 | { | 366 | { |
358 | _toProcess = false; | 367 | _toProcess = false; |
359 | //hack, but we're not writing status anyway... | 368 | //hack, but we're not writing status anyway... |
360 | if ( installed() ) _status = "install"; | 369 | if ( installed() ) _status = "install"; |
361 | else _status = "installed"; | 370 | else _status = "installed"; |
362 | } | 371 | } |
363 | 372 | ||
364 | QString Package::dest() | 373 | QString Package::dest() |
365 | { | 374 | { |
366 | if ( installed()||(!installed() && _toProcess) ) | 375 | if ( installed()||(!installed() && _toProcess) ) |
367 | return _dest!=""?_dest:settings->getDestinationName(); | 376 | return _dest!=""?_dest:settings->getDestinationName(); |
368 | else return ""; | 377 | else return ""; |
369 | } | 378 | } |
370 | 379 | ||
371 | void Package::setDest( QString d ) | 380 | void Package::setDest( QString d ) |
372 | { | 381 | { |
373 | if ( d == "remote") _useFileName = true; | 382 | if ( d == "remote") _useFileName = true; |
374 | else _dest = d; | 383 | else _dest = d; |
375 | } | 384 | } |
376 | 385 | ||
377 | void Package::setOn() | 386 | void Package::setOn() |
378 | { | 387 | { |
379 | _toProcess = true; | 388 | _toProcess = true; |
380 | } | 389 | } |
381 | 390 | ||
382 | bool Package::link() | 391 | bool Package::link() |
383 | { | 392 | { |
384 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 393 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 0f76ece..c147420 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -1,91 +1,100 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PK_ITEM_H | 10 | #ifndef PK_ITEM_H |
2 | #define PK_ITEM_H | 11 | #define PK_ITEM_H |
3 | 12 | ||
4 | #include <qstring.h> | 13 | #include <qstring.h> |
5 | #include <qlistview.h> | 14 | #include <qlistview.h> |
6 | #include <qpainter.h> | 15 | #include <qpainter.h> |
7 | #include <qpixmap.h> | 16 | #include <qpixmap.h> |
8 | #include <qdict.h> | 17 | #include <qdict.h> |
9 | #include <qobject.h> | 18 | #include <qobject.h> |
10 | 19 | ||
11 | #include "pksettings.h" | 20 | #include "pksettings.h" |
12 | 21 | ||
13 | class Package : public QObject | 22 | class Package : public QObject |
14 | { | 23 | { |
15 | Q_OBJECT | 24 | Q_OBJECT |
16 | public: | 25 | public: |
17 | Package(QObject *parent=0, const char *name=0); | 26 | Package(QObject *parent=0, const char *name=0); |
18 | Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); | 27 | Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); |
19 | ~Package(); | 28 | ~Package(); |
20 | Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); | 29 | Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); |
21 | Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); | 30 | Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); |
22 | Package( Package*s, QObject *parent=0, const char *name=0 ); | 31 | Package( Package*s, QObject *parent=0, const char *name=0 ); |
23 | 32 | ||
24 | void setValue( QString, QString ); | 33 | void setValue( QString, QString ); |
25 | void copyValues( Package* ); | 34 | void copyValues( Package* ); |
26 | 35 | ||
27 | QString name(); | 36 | QString name(); |
28 | QString installName(); | 37 | QString installName(); |
29 | QString packageName(); | 38 | QString packageName(); |
30 | bool installed(); | 39 | bool installed(); |
31 | bool otherInstalled(); | 40 | bool otherInstalled(); |
32 | 41 | ||
33 | void setDesc( QString ); | 42 | void setDesc( QString ); |
34 | QString shortDesc(); | 43 | QString shortDesc(); |
35 | QString desc(); | 44 | QString desc(); |
36 | QString size(); | 45 | QString size(); |
37 | QString sizeUnits(); | 46 | QString sizeUnits(); |
38 | QString version(); | 47 | QString version(); |
39 | void setSection( QString ); | 48 | void setSection( QString ); |
40 | QString section(); | 49 | QString section(); |
41 | QString subSection(); | 50 | QString subSection(); |
42 | QString details(); | 51 | QString details(); |
43 | bool toProcess(); | 52 | bool toProcess(); |
44 | bool toInstall(); | 53 | bool toInstall(); |
45 | bool toRemove(); | 54 | bool toRemove(); |
46 | void processed(); | 55 | void processed(); |
47 | QString dest(); | 56 | QString dest(); |
48 | void setDest( QString d ); | 57 | void setDest( QString d ); |
49 | void setOn(); | 58 | void setOn(); |
50 | bool link(); | 59 | bool link(); |
51 | void setLink(bool); | 60 | void setLink(bool); |
52 | bool isOld(); | 61 | bool isOld(); |
53 | bool hasVersions(); | 62 | bool hasVersions(); |
54 | void parseIpkgFile( QString ); | 63 | void parseIpkgFile( QString ); |
55 | void instalFromFile(bool iff=true); | 64 | void instalFromFile(bool iff=true); |
56 | void setName(QString); | 65 | void setName(QString); |
57 | QDict<QString>* getFields(); | 66 | QDict<QString>* getFields(); |
58 | QString status(); | 67 | QString status(); |
59 | 68 | ||
60 | QDict<Package>* getOtherVersions(); | 69 | QDict<Package>* getOtherVersions(); |
61 | void setOtherVersions(QDict<Package>*); | 70 | void setOtherVersions(QDict<Package>*); |
62 | 71 | ||
63 | public slots: | 72 | public slots: |
64 | void toggleProcess(); | 73 | void toggleProcess(); |
65 | 74 | ||
66 | private: | 75 | private: |
67 | PackageManagerSettings *settings; | 76 | PackageManagerSettings *settings; |
68 | QString _displayName; | 77 | QString _displayName; |
69 | QString _name; | 78 | QString _name; |
70 | QString _fileName; | 79 | QString _fileName; |
71 | bool _old; | 80 | bool _old; |
72 | bool _hasVersions; | 81 | bool _hasVersions; |
73 | bool _toProcess; | 82 | bool _toProcess; |
74 | bool _link; | 83 | bool _link; |
75 | QString _status; | 84 | QString _status; |
76 | QString _size; | 85 | QString _size; |
77 | QString _section; | 86 | QString _section; |
78 | QString _subsection; | 87 | QString _subsection; |
79 | QString _shortDesc; | 88 | QString _shortDesc; |
80 | QString _desc; | 89 | QString _desc; |
81 | QString _version; | 90 | QString _version; |
82 | QString _dest; | 91 | QString _dest; |
83 | QDict<QString> _values; | 92 | QDict<QString> _values; |
84 | QDict<Package> *_versions; | 93 | QDict<Package> *_versions; |
85 | bool _useFileName; | 94 | bool _useFileName; |
86 | void parsePackage( QStringList ); | 95 | void parsePackage( QStringList ); |
87 | void init(PackageManagerSettings *); | 96 | void init(PackageManagerSettings *); |
88 | }; | 97 | }; |
89 | 98 | ||
90 | 99 | ||
91 | #endif | 100 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index e445570..f6c4c37 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -1,221 +1,230 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #include "packagelist.h" | 10 | #include "packagelist.h" |
2 | 11 | ||
3 | #include <assert.h> | 12 | #include <assert.h> |
4 | #include <qfile.h> | 13 | #include <qfile.h> |
5 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
6 | #include <qtextstream.h> | 15 | #include <qtextstream.h> |
7 | 16 | ||
8 | #include "debug.h" | 17 | #include "debug.h" |
9 | 18 | ||
10 | static QDict<Package> *packageListAll; | 19 | static QDict<Package> *packageListAll; |
11 | static int packageListAllRefCount = 0; | 20 | static int packageListAllRefCount = 0; |
12 | 21 | ||
13 | PackageList::PackageList(QObject *parent, const char *name) | 22 | PackageList::PackageList(QObject *parent, const char *name) |
14 | : QObject(parent,name), packageIter( packageList ) | 23 | : QObject(parent,name), packageIter( packageList ) |
15 | { | 24 | { |
16 | empty=true; | 25 | empty=true; |
17 | if (!packageListAll) packageListAll = new QDict<Package>(); | 26 | if (!packageListAll) packageListAll = new QDict<Package>(); |
18 | packageListAllRefCount++; | 27 | packageListAllRefCount++; |
19 | sections << "All"; | 28 | sections << "All"; |
20 | subSections.insert("All", new QStringList() ); | 29 | subSections.insert("All", new QStringList() ); |
21 | QStringList *ss = subSections["All"]; | 30 | QStringList *ss = subSections["All"]; |
22 | *ss << "All"; | 31 | *ss << "All"; |
23 | aktSection = "All"; | 32 | aktSection = "All"; |
24 | aktSubSection = "All"; | 33 | aktSubSection = "All"; |
25 | } | 34 | } |
26 | 35 | ||
27 | PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) | 36 | PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char *name) |
28 | : QObject(parent,name), packageIter( packageList ) | 37 | : QObject(parent,name), packageIter( packageList ) |
29 | { | 38 | { |
30 | settings = s; | 39 | settings = s; |
31 | PackageList(parent, name); | 40 | PackageList(parent, name); |
32 | } | 41 | } |
33 | 42 | ||
34 | PackageList::~PackageList() | 43 | PackageList::~PackageList() |
35 | { | 44 | { |
36 | if (--packageListAllRefCount < 1 ) delete packageListAll; | 45 | if (--packageListAllRefCount < 1 ) delete packageListAll; |
37 | } | 46 | } |
38 | 47 | ||
39 | /** Inserts a package into the list */ | 48 | /** Inserts a package into the list */ |
40 | void PackageList::insertPackage( Package* pack ) | 49 | void PackageList::insertPackage( Package* pack ) |
41 | { | 50 | { |
42 | if (!pack) return; | 51 | if (!pack) return; |
43 | Package* p = packageListAll->find( pack->name() ); | 52 | Package* p = packageListAll->find( pack->name() ); |
44 | if ( p ) | 53 | if ( p ) |
45 | { | 54 | { |
46 | if ( (p->version() == pack->version()) | 55 | if ( (p->version() == pack->version()) |
47 | // && (p->dest() == pack->dest()) | 56 | // && (p->dest() == pack->dest()) |
48 | ) | 57 | ) |
49 | { | 58 | { |
50 | p->copyValues( pack ); | 59 | p->copyValues( pack ); |
51 | delete pack; | 60 | delete pack; |
52 | pack = p; | 61 | pack = p; |
53 | } else { | 62 | } else { |
54 | QDict<Package> *packver = p->getOtherVersions(); | 63 | QDict<Package> *packver = p->getOtherVersions(); |
55 | // p->setName( pack->name()+"["+p->version()+"]" ); | 64 | // p->setName( pack->name()+"["+p->version()+"]" ); |
56 | if (!packver) | 65 | if (!packver) |
57 | { | 66 | { |
58 | packver = new QDict<Package>(); | 67 | packver = new QDict<Package>(); |
59 | packver->insert( pack->name(), p ); | 68 | packver->insert( pack->name(), p ); |
60 | p->setOtherVersions( packver ); | 69 | p->setOtherVersions( packver ); |
61 | } | 70 | } |
62 | pack->setName( pack->name()+"["+pack->version()+"]" ); | 71 | pack->setName( pack->name()+"["+pack->version()+"]" ); |
63 | pack->setOtherVersions( packver ); | 72 | pack->setOtherVersions( packver ); |
64 | packver->insert( pack->name(), pack ); | 73 | packver->insert( pack->name(), pack ); |
65 | packageListAll->insert( pack->name(), pack ); | 74 | packageListAll->insert( pack->name(), pack ); |
66 | packageList.insert( pack->name(), pack ); | 75 | packageList.insert( pack->name(), pack ); |
67 | origPackageList.insert( pack->name(), pack ); | 76 | origPackageList.insert( pack->name(), pack ); |
68 | } | 77 | } |
69 | }else{ | 78 | }else{ |
70 | packageListAll->insert( pack->name(), pack ); | 79 | packageListAll->insert( pack->name(), pack ); |
71 | packageList.insert( pack->name(), pack ); | 80 | packageList.insert( pack->name(), pack ); |
72 | origPackageList.insert( pack->name(), pack ); | 81 | origPackageList.insert( pack->name(), pack ); |
73 | }; | 82 | }; |
74 | empty=false; | 83 | empty=false; |
75 | updateSections( pack ); | 84 | updateSections( pack ); |
76 | } | 85 | } |
77 | 86 | ||
78 | void PackageList::filterPackages( QString f ) | 87 | void PackageList::filterPackages( QString f ) |
79 | { | 88 | { |
80 | packageList.clear(); | 89 | packageList.clear(); |
81 | QDictIterator<Package> filterIter( origPackageList ); | 90 | QDictIterator<Package> filterIter( origPackageList ); |
82 | filterIter.toFirst(); | 91 | filterIter.toFirst(); |
83 | Package *pack= filterIter.current() ; | 92 | Package *pack= filterIter.current() ; |
84 | while ( pack ) | 93 | while ( pack ) |
85 | { | 94 | { |
86 | if ( | 95 | if ( |
87 | ((aktSection=="All")||(pack->section()==aktSection)) && | 96 | ((aktSection=="All")||(pack->section()==aktSection)) && |
88 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && | 97 | ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && |
89 | pack->name().contains( f ) | 98 | pack->name().contains( f ) |
90 | ) | 99 | ) |
91 | { | 100 | { |
92 | packageList.insert( pack->name(), pack ); | 101 | packageList.insert( pack->name(), pack ); |
93 | } | 102 | } |
94 | ++filterIter; | 103 | ++filterIter; |
95 | pack = filterIter.current(); | 104 | pack = filterIter.current(); |
96 | } | 105 | } |
97 | } | 106 | } |
98 | 107 | ||
99 | Package* PackageList::find( QString n ) | 108 | Package* PackageList::find( QString n ) |
100 | { | 109 | { |
101 | return packageList.find( n ); | 110 | return packageList.find( n ); |
102 | } | 111 | } |
103 | 112 | ||
104 | Package* PackageList::first() | 113 | Package* PackageList::first() |
105 | { | 114 | { |
106 | packageIter.toFirst(); | 115 | packageIter.toFirst(); |
107 | return packageIter.current(); | 116 | return packageIter.current(); |
108 | } | 117 | } |
109 | 118 | ||
110 | Package* PackageList::next() | 119 | Package* PackageList::next() |
111 | { | 120 | { |
112 | ++packageIter; | 121 | ++packageIter; |
113 | return packageIter.current(); | 122 | return packageIter.current(); |
114 | } | 123 | } |
115 | 124 | ||
116 | QStringList PackageList::getSections() | 125 | QStringList PackageList::getSections() |
117 | { | 126 | { |
118 | sections.sort(); | 127 | sections.sort(); |
119 | return sections; | 128 | return sections; |
120 | } | 129 | } |
121 | 130 | ||
122 | QStringList PackageList::getSubSections() | 131 | QStringList PackageList::getSubSections() |
123 | { | 132 | { |
124 | QStringList ss; | 133 | QStringList ss; |
125 | if ( !subSections[aktSection] ) return ss; | 134 | if ( !subSections[aktSection] ) return ss; |
126 | ss = *subSections[aktSection]; | 135 | ss = *subSections[aktSection]; |
127 | ss.sort(); | 136 | ss.sort(); |
128 | return ss; | 137 | return ss; |
129 | } | 138 | } |
130 | 139 | ||
131 | void PackageList::setSection( QString sec ) | 140 | void PackageList::setSection( QString sec ) |
132 | { | 141 | { |
133 | aktSection = sec; | 142 | aktSection = sec; |
134 | } | 143 | } |
135 | 144 | ||
136 | void PackageList::setSubSection( QString ssec ) | 145 | void PackageList::setSubSection( QString ssec ) |
137 | { | 146 | { |
138 | aktSubSection = ssec; | 147 | aktSubSection = ssec; |
139 | } | 148 | } |
140 | 149 | ||
141 | void PackageList::updateSections( Package* pack ) | 150 | void PackageList::updateSections( Package* pack ) |
142 | { | 151 | { |
143 | QString s = pack->section(); | 152 | QString s = pack->section(); |
144 | if ( s.isEmpty() || s == "") return; | 153 | if ( s.isEmpty() || s == "") return; |
145 | if ( sections.contains(s) ) return; | 154 | if ( sections.contains(s) ) return; |
146 | sections += s; | 155 | sections += s; |
147 | QString ss = pack->subSection(); | 156 | QString ss = pack->subSection(); |
148 | if ( ss.isEmpty() || ss == "" ) return; | 157 | if ( ss.isEmpty() || ss == "" ) return; |
149 | if ( !subSections[s] ) { | 158 | if ( !subSections[s] ) { |
150 | subSections.insert( s, new QStringList() ); | 159 | subSections.insert( s, new QStringList() ); |
151 | QStringList *subsecs = subSections[s]; | 160 | QStringList *subsecs = subSections[s]; |
152 | *subsecs += "All"; | 161 | *subsecs += "All"; |
153 | } | 162 | } |
154 | QStringList *subsecs = subSections[s]; | 163 | QStringList *subsecs = subSections[s]; |
155 | *subsecs += ss; | 164 | *subsecs += ss; |
156 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 165 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
157 | subsecs = subSections["All"]; | 166 | subsecs = subSections["All"]; |
158 | *subsecs += ss; | 167 | *subsecs += ss; |
159 | } | 168 | } |
160 | 169 | ||
161 | 170 | ||
162 | void PackageList::readFileEntries( QString filename, QString dest ) | 171 | void PackageList::readFileEntries( QString filename, QString dest ) |
163 | { | 172 | { |
164 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | 173 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); |
165 | QStringList packEntry; | 174 | QStringList packEntry; |
166 | QFile f( filename ); | 175 | QFile f( filename ); |
167 | if ( !f.open(IO_ReadOnly) ) return; | 176 | if ( !f.open(IO_ReadOnly) ) return; |
168 | QTextStream *statusStream = new QTextStream( &f ); | 177 | QTextStream *statusStream = new QTextStream( &f ); |
169 | while ( !statusStream ->eof() ) | 178 | while ( !statusStream ->eof() ) |
170 | { | 179 | { |
171 | QString line = statusStream->readLine(); | 180 | QString line = statusStream->readLine(); |
172 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 181 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
173 | { | 182 | { |
174 | //end of package | 183 | //end of package |
175 | if ( ! packEntry.isEmpty() ) | 184 | if ( ! packEntry.isEmpty() ) |
176 | { | 185 | { |
177 | Package *p = new Package( packEntry, settings ); | 186 | Package *p = new Package( packEntry, settings ); |
178 | if ( p ) | 187 | if ( p ) |
179 | { | 188 | { |
180 | p->setDest( dest ); | 189 | p->setDest( dest ); |
181 | insertPackage( p ); | 190 | insertPackage( p ); |
182 | packEntry.clear(); | 191 | packEntry.clear(); |
183 | } | 192 | } |
184 | } | 193 | } |
185 | }else{ | 194 | }else{ |
186 | packEntry << line; | 195 | packEntry << line; |
187 | }; | 196 | }; |
188 | } | 197 | } |
189 | delete statusStream; | 198 | delete statusStream; |
190 | return; | 199 | return; |
191 | } | 200 | } |
192 | 201 | ||
193 | void PackageList::setSettings( PackageManagerSettings *s ) | 202 | void PackageList::setSettings( PackageManagerSettings *s ) |
194 | { | 203 | { |
195 | settings = s; | 204 | settings = s; |
196 | } | 205 | } |
197 | 206 | ||
198 | Package* PackageList::getByName( QString n ) | 207 | Package* PackageList::getByName( QString n ) |
199 | { | 208 | { |
200 | return origPackageList[n]; | 209 | return origPackageList[n]; |
201 | } | 210 | } |
202 | 211 | ||
203 | void PackageList::clear() | 212 | void PackageList::clear() |
204 | { | 213 | { |
205 | origPackageList.clear(); | 214 | origPackageList.clear(); |
206 | packageList.clear(); | 215 | packageList.clear(); |
207 | } | 216 | } |
208 | 217 | ||
209 | void PackageList::allPackages() | 218 | void PackageList::allPackages() |
210 | { | 219 | { |
211 | packageList.clear(); | 220 | packageList.clear(); |
212 | QDictIterator<Package> filterIter( origPackageList ); | 221 | QDictIterator<Package> filterIter( origPackageList ); |
213 | filterIter.toFirst(); | 222 | filterIter.toFirst(); |
214 | Package *pack= filterIter.current() ; | 223 | Package *pack= filterIter.current() ; |
215 | while ( pack ) | 224 | while ( pack ) |
216 | { | 225 | { |
217 | packageList.insert( pack->name(), pack ); | 226 | packageList.insert( pack->name(), pack ); |
218 | ++filterIter; | 227 | ++filterIter; |
219 | pack = filterIter.current(); | 228 | pack = filterIter.current(); |
220 | } | 229 | } |
221 | } | 230 | } |
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h index 46a00e9..0c13688 100644 --- a/noncore/unsupported/oipkg/packagelist.h +++ b/noncore/unsupported/oipkg/packagelist.h | |||
@@ -1,60 +1,69 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PACKAGELIST_H | 10 | #ifndef PACKAGELIST_H |
2 | #define PACKAGELIST_H | 11 | #define PACKAGELIST_H |
3 | 12 | ||
4 | #include <qdict.h> | 13 | #include <qdict.h> |
5 | #include "package.h" | 14 | #include "package.h" |
6 | #include "pksettings.h" | 15 | #include "pksettings.h" |
7 | #include "debug.h" | 16 | #include "debug.h" |
8 | 17 | ||
9 | class PackageList : public QObject | 18 | class PackageList : public QObject |
10 | { | 19 | { |
11 | Q_OBJECT | 20 | Q_OBJECT |
12 | public: | 21 | public: |
13 | //static QString all = QObject::tr("All"); | 22 | //static QString all = QObject::tr("All"); |
14 | 23 | ||
15 | PackageList (QObject *parent=0, const char *name=0); | 24 | PackageList (QObject *parent=0, const char *name=0); |
16 | PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0); | 25 | PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0); |
17 | virtual ~PackageList(); | 26 | virtual ~PackageList(); |
18 | void insertPackage( Package* ); | 27 | void insertPackage( Package* ); |
19 | Package* find( QString ); | 28 | Package* find( QString ); |
20 | Package* next(); | 29 | Package* next(); |
21 | Package* first(); | 30 | Package* first(); |
22 | 31 | ||
23 | QStringList getSections(); | 32 | QStringList getSections(); |
24 | QStringList getSubSections(); | 33 | QStringList getSubSections(); |
25 | void setSettings( PackageManagerSettings* ); | 34 | void setSettings( PackageManagerSettings* ); |
26 | void filterPackages( QString ); | 35 | void filterPackages( QString ); |
27 | Package* getByName( QString ); | 36 | Package* getByName( QString ); |
28 | void clear(); | 37 | void clear(); |
29 | void allPackages(); | 38 | void allPackages(); |
30 | 39 | ||
31 | QDict<Package> *versions; | 40 | QDict<Package> *versions; |
32 | 41 | ||
33 | public slots: | 42 | public slots: |
34 | void setSection(QString); | 43 | void setSection(QString); |
35 | void setSubSection(QString); | 44 | void setSubSection(QString); |
36 | // virtual void update(); | 45 | // virtual void update(); |
37 | 46 | ||
38 | protected: | 47 | protected: |
39 | int currentPackage; | 48 | int currentPackage; |
40 | int packageCount; | 49 | int packageCount; |
41 | 50 | ||
42 | PackageManagerSettings *settings; | 51 | PackageManagerSettings *settings; |
43 | QDict<Package> packageList; | 52 | QDict<Package> packageList; |
44 | QDict<Package> origPackageList; | 53 | QDict<Package> origPackageList; |
45 | QDictIterator<Package> packageIter; | 54 | QDictIterator<Package> packageIter; |
46 | 55 | ||
47 | bool empty; | 56 | bool empty; |
48 | QString aktSection; | 57 | QString aktSection; |
49 | QString aktSubSection; | 58 | QString aktSubSection; |
50 | QStringList sections; | 59 | QStringList sections; |
51 | QDict<QStringList> subSections; | 60 | QDict<QStringList> subSections; |
52 | QDict<bool> sectionsDict; | 61 | QDict<bool> sectionsDict; |
53 | 62 | ||
54 | 63 | ||
55 | void updateSections( Package* ); | 64 | void updateSections( Package* ); |
56 | void readFileEntries( QString file, QString dest="" ); | 65 | void readFileEntries( QString file, QString dest="" ); |
57 | }; | 66 | }; |
58 | 67 | ||
59 | 68 | ||
60 | #endif | 69 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp index deb8a6d..76e91ff 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp +++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp | |||
@@ -1,45 +1,53 @@ | |||
1 | 1 | /*************************************************************************** | |
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
2 | #include "packagelistdoclnk.h" | 10 | #include "packagelistdoclnk.h" |
3 | 11 | ||
4 | #include <qpe/applnk.h> | 12 | #include <qpe/applnk.h> |
5 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
6 | #include <qlist.h> | 14 | #include <qlist.h> |
7 | 15 | ||
8 | #include "package.h" | 16 | #include "package.h" |
9 | #include "pksettings.h" | 17 | #include "pksettings.h" |
10 | 18 | ||
11 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name) | 19 | PackageListDocLnk::PackageListDocLnk(PackageManagerSettings* s, QObject *parent, const char *name) |
12 | : PackageList(s) | 20 | : PackageList(s) |
13 | { | 21 | { |
14 | PackageListDocLnk(parent, name); | 22 | PackageListDocLnk(parent, name); |
15 | } | 23 | } |
16 | 24 | ||
17 | PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name) | 25 | PackageListDocLnk::PackageListDocLnk(QObject *parent, const char *name) |
18 | : PackageList(parent, name) | 26 | : PackageList(parent, name) |
19 | { | 27 | { |
20 | Config cfg( "oipkg", Config::User ); | 28 | Config cfg( "oipkg", Config::User ); |
21 | cfg.setGroup( "Common" ); | 29 | cfg.setGroup( "Common" ); |
22 | docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); | 30 | docLnkDir = cfg.readEntry( "docLnkDir", "/root/" ); |
23 | pvDebug(2,"opening DocLnkSet "+docLnkDir); | 31 | pvDebug(2,"opening DocLnkSet "+docLnkDir); |
24 | doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); | 32 | doclnkset = new DocLnkSet(docLnkDir,"application/ipkg"); |
25 | } | 33 | } |
26 | 34 | ||
27 | PackageListDocLnk::~PackageListDocLnk() | 35 | PackageListDocLnk::~PackageListDocLnk() |
28 | { | 36 | { |
29 | Config cfg( "oipkg", Config::User ); | 37 | Config cfg( "oipkg", Config::User ); |
30 | cfg.setGroup( "Common" ); | 38 | cfg.setGroup( "Common" ); |
31 | cfg.writeEntry( "docLnkDir", docLnkDir ); | 39 | cfg.writeEntry( "docLnkDir", docLnkDir ); |
32 | delete doclnkset; | 40 | delete doclnkset; |
33 | } | 41 | } |
34 | 42 | ||
35 | 43 | ||
36 | 44 | ||
37 | void PackageListDocLnk::update() | 45 | void PackageListDocLnk::update() |
38 | { | 46 | { |
39 | pvDebug(2,"PackageListDocLnk::update "); | 47 | pvDebug(2,"PackageListDocLnk::update "); |
40 | QList<DocLnk> packlist = doclnkset->children(); | 48 | QList<DocLnk> packlist = doclnkset->children(); |
41 | for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) | 49 | for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) |
42 | { | 50 | { |
43 | insertPackage( new Package(pack->file(), settings ) ); | 51 | insertPackage( new Package(pack->file(), settings ) ); |
44 | } | 52 | } |
45 | } | 53 | } |
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.h b/noncore/unsupported/oipkg/packagelistdoclnk.h index a63fb59..af06a45 100644 --- a/noncore/unsupported/oipkg/packagelistdoclnk.h +++ b/noncore/unsupported/oipkg/packagelistdoclnk.h | |||
@@ -1,23 +1,32 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PACKAGELISTDOCLNK_H | 10 | #ifndef PACKAGELISTDOCLNK_H |
2 | #define PACKAGELISTDOCLNK_H | 11 | #define PACKAGELISTDOCLNK_H |
3 | 12 | ||
4 | #include "packagelist.h" | 13 | #include "packagelist.h" |
5 | #include "debug.h" | 14 | #include "debug.h" |
6 | 15 | ||
7 | class DocLnkSet; | 16 | class DocLnkSet; |
8 | 17 | ||
9 | class PackageListDocLnk : public PackageList | 18 | class PackageListDocLnk : public PackageList |
10 | { | 19 | { |
11 | public: | 20 | public: |
12 | PackageListDocLnk(QObject *parent=0, const char *name=0); | 21 | PackageListDocLnk(QObject *parent=0, const char *name=0); |
13 | PackageListDocLnk( PackageManagerSettings *s, QObject *parent=0, const char *name=0); | 22 | PackageListDocLnk( PackageManagerSettings *s, QObject *parent=0, const char *name=0); |
14 | virtual ~PackageListDocLnk(); | 23 | virtual ~PackageListDocLnk(); |
15 | public slots: | 24 | public slots: |
16 | void update(); | 25 | void update(); |
17 | private: | 26 | private: |
18 | DocLnkSet *doclnkset; | 27 | DocLnkSet *doclnkset; |
19 | QString docLnkDir; | 28 | QString docLnkDir; |
20 | }; | 29 | }; |
21 | 30 | ||
22 | 31 | ||
23 | #endif | 32 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 7c54441..b5e86f5 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,166 +1,175 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #include "packagelistitem.h" | 10 | #include "packagelistitem.h" |
2 | 11 | ||
3 | #include <qpe/resource.h> | 12 | #include <qpe/resource.h> |
4 | #include <qobject.h> | 13 | #include <qobject.h> |
5 | 14 | ||
6 | #include "debug.h" | 15 | #include "debug.h" |
7 | 16 | ||
8 | static QPixmap *pm_uninstalled=0; | 17 | static QPixmap *pm_uninstalled=0; |
9 | static QPixmap *pm_uninstalled_old=0; | 18 | static QPixmap *pm_uninstalled_old=0; |
10 | static QPixmap *pm_installed=0; | 19 | static QPixmap *pm_installed=0; |
11 | static QPixmap *pm_installed_old=0; | 20 | static QPixmap *pm_installed_old=0; |
12 | static QPixmap *pm_uninstall=0; | 21 | static QPixmap *pm_uninstall=0; |
13 | static QPixmap *pm_install=0; | 22 | static QPixmap *pm_install=0; |
14 | static QPixmap *pm_uninstalled_old_installed_new=0; | 23 | static QPixmap *pm_uninstalled_old_installed_new=0; |
15 | static QPixmap *pm_uninstalled_installed_old=0; | 24 | static QPixmap *pm_uninstalled_installed_old=0; |
16 | 25 | ||
17 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) | 26 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
18 | :QCheckListItem(lv,pi->name(),CheckBox) | 27 | :QCheckListItem(lv,pi->name(),CheckBox) |
19 | { | 28 | { |
20 | init(pi,s); | 29 | init(pi,s); |
21 | } | 30 | } |
22 | 31 | ||
23 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) | 32 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) |
24 | :QCheckListItem(lvi,pi->name(),CheckBox) | 33 | :QCheckListItem(lvi,pi->name(),CheckBox) |
25 | { | 34 | { |
26 | init(pi,s); | 35 | init(pi,s); |
27 | } | 36 | } |
28 | 37 | ||
29 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) | 38 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) |
30 | { | 39 | { |
31 | package = pi; | 40 | package = pi; |
32 | settings = s; | 41 | settings = s; |
33 | setExpandable( true ); | 42 | setExpandable( true ); |
34 | QCheckListItem *item; | 43 | QCheckListItem *item; |
35 | nameItem = new QCheckListItem( this, "" ); | 44 | nameItem = new QCheckListItem( this, "" ); |
36 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); | 45 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); |
37 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | 46 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); |
38 | destItem = new QCheckListItem( this, "" ); | 47 | destItem = new QCheckListItem( this, "" ); |
39 | linkItem = new QCheckListItem( this, "" ); | 48 | linkItem = new QCheckListItem( this, "" ); |
40 | statusItem = new QCheckListItem( this, "" ); | 49 | statusItem = new QCheckListItem( this, "" ); |
41 | QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); | 50 | QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); |
42 | item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() ); | 51 | item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() ); |
43 | QDict<QString> *fields = pi->getFields(); | 52 | QDict<QString> *fields = pi->getFields(); |
44 | QDictIterator<QString> it( *fields ); | 53 | QDictIterator<QString> it( *fields ); |
45 | while ( it.current() ) { | 54 | while ( it.current() ) { |
46 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); | 55 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); |
47 | ++it; | 56 | ++it; |
48 | } | 57 | } |
49 | displayDetails(); | 58 | displayDetails(); |
50 | 59 | ||
51 | if (!pm_uninstalled) | 60 | if (!pm_uninstalled) |
52 | { | 61 | { |
53 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 62 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
54 | pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); | 63 | pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); |
55 | pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); | 64 | pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); |
56 | pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); | 65 | pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); |
57 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 66 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
58 | pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); | 67 | pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); |
59 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 68 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
60 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 69 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
61 | } | 70 | } |
62 | } | 71 | } |
63 | 72 | ||
64 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 73 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
65 | int column, int width, int alignment ) | 74 | int column, int width, int alignment ) |
66 | { | 75 | { |
67 | if ( !p ) | 76 | if ( !p ) |
68 | return; | 77 | return; |
69 | 78 | ||
70 | p->fillRect( 0, 0, width, height(), | 79 | p->fillRect( 0, 0, width, height(), |
71 | isSelected()? cg.highlight() : cg.base() ); | 80 | isSelected()? cg.highlight() : cg.base() ); |
72 | 81 | ||
73 | if ( column != 0 ) { | 82 | if ( column != 0 ) { |
74 | // The rest is text | 83 | // The rest is text |
75 | QListViewItem::paintCell( p, cg, column, width, alignment ); | 84 | QListViewItem::paintCell( p, cg, column, width, alignment ); |
76 | return; | 85 | return; |
77 | } | 86 | } |
78 | 87 | ||
79 | QListView *lv = listView(); | 88 | QListView *lv = listView(); |
80 | if ( !lv ) | 89 | if ( !lv ) |
81 | return; | 90 | return; |
82 | int marg = lv->itemMargin(); | 91 | int marg = lv->itemMargin(); |
83 | int r = marg; | 92 | int r = marg; |
84 | 93 | ||
85 | QPixmap pm = statePixmap(); | 94 | QPixmap pm = statePixmap(); |
86 | p->drawPixmap(marg,(height()-pm.height())/2,pm); | 95 | p->drawPixmap(marg,(height()-pm.height())/2,pm); |
87 | r += pm.width()+1; | 96 | r += pm.width()+1; |
88 | 97 | ||
89 | p->translate( r, 0 ); | 98 | p->translate( r, 0 ); |
90 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); | 99 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); |
91 | } | 100 | } |
92 | 101 | ||
93 | 102 | ||
94 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, | 103 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, |
95 | const QRect & r ) | 104 | const QRect & r ) |
96 | { | 105 | { |
97 | // Skip QCheckListItem | 106 | // Skip QCheckListItem |
98 | // (makes you wonder what we're getting from QCheckListItem) | 107 | // (makes you wonder what we're getting from QCheckListItem) |
99 | QListViewItem::paintFocus(p,cg,r); | 108 | QListViewItem::paintFocus(p,cg,r); |
100 | } | 109 | } |
101 | 110 | ||
102 | QPixmap PackageListItem::statePixmap() const | 111 | QPixmap PackageListItem::statePixmap() const |
103 | { | 112 | { |
104 | bool installed = package->installed(); | 113 | bool installed = package->installed(); |
105 | bool old = package->isOld(); | 114 | bool old = package->isOld(); |
106 | bool versions = package->hasVersions(); | 115 | bool versions = package->hasVersions(); |
107 | bool verinstalled = package->otherInstalled(); | 116 | bool verinstalled = package->otherInstalled(); |
108 | if ( !package->toProcess() ) { | 117 | if ( !package->toProcess() ) { |
109 | if ( !installed ) | 118 | if ( !installed ) |
110 | if (old) | 119 | if (old) |
111 | { | 120 | { |
112 | if (verinstalled) return *pm_uninstalled_old_installed_new; | 121 | if (verinstalled) return *pm_uninstalled_old_installed_new; |
113 | else return *pm_uninstalled_old; | 122 | else return *pm_uninstalled_old; |
114 | } | 123 | } |
115 | else | 124 | else |
116 | { | 125 | { |
117 | if (verinstalled) return *pm_uninstalled_installed_old; | 126 | if (verinstalled) return *pm_uninstalled_installed_old; |
118 | else return *pm_uninstalled; | 127 | else return *pm_uninstalled; |
119 | } | 128 | } |
120 | else | 129 | else |
121 | if (old) return *pm_installed_old; | 130 | if (old) return *pm_installed_old; |
122 | else return *pm_installed; | 131 | else return *pm_installed; |
123 | } else { //toProcess() == true | 132 | } else { //toProcess() == true |
124 | if ( !installed ) | 133 | if ( !installed ) |
125 | return *pm_install; | 134 | return *pm_install; |
126 | else | 135 | else |
127 | return *pm_uninstall; | 136 | return *pm_uninstall; |
128 | } | 137 | } |
129 | } | 138 | } |
130 | 139 | ||
131 | QString PackageListItem::key( int column, bool ascending ) const | 140 | QString PackageListItem::key( int column, bool ascending ) const |
132 | { | 141 | { |
133 | if ( column == 2 ) { | 142 | if ( column == 2 ) { |
134 | QString t = text(2); | 143 | QString t = text(2); |
135 | double bytes=t.toDouble(); | 144 | double bytes=t.toDouble(); |
136 | if ( t.contains('M') ) bytes*=1024*1024; | 145 | if ( t.contains('M') ) bytes*=1024*1024; |
137 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; | 146 | else if ( t.contains('K') || t.contains('k') ) bytes*=1024; |
138 | if ( !ascending ) bytes=999999999-bytes; | 147 | if ( !ascending ) bytes=999999999-bytes; |
139 | return QString().sprintf("%09d",(int)bytes); | 148 | return QString().sprintf("%09d",(int)bytes); |
140 | } else { | 149 | } else { |
141 | return QListViewItem::key(column,ascending); | 150 | return QListViewItem::key(column,ascending); |
142 | } | 151 | } |
143 | } | 152 | } |
144 | 153 | ||
145 | void PackageListItem::setOn( bool b ) | 154 | void PackageListItem::setOn( bool b ) |
146 | { | 155 | { |
147 | QCheckListItem::setOn( b ); | 156 | QCheckListItem::setOn( b ); |
148 | package->toggleProcess(); | 157 | package->toggleProcess(); |
149 | package->setLink( settings->createLinks() ); | 158 | package->setLink( settings->createLinks() ); |
150 | displayDetails(); | 159 | displayDetails(); |
151 | } | 160 | } |
152 | 161 | ||
153 | void PackageListItem::displayDetails() | 162 | void PackageListItem::displayDetails() |
154 | { | 163 | { |
155 | QString sod; | 164 | QString sod; |
156 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); | 165 | sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); |
157 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); | 166 | //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); |
158 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); | 167 | sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); |
159 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); | 168 | sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); |
160 | setText(0, package->name()+sod ); | 169 | setText(0, package->name()+sod ); |
161 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); | 170 | nameItem->setText( 0, QObject::tr("Name: ")+package->name()); |
162 | linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); | 171 | linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); |
163 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); | 172 | destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); |
164 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); | 173 | statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); |
165 | repaint(); | 174 | repaint(); |
166 | } | 175 | } |
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h index 65e9711..dba44f7 100644 --- a/noncore/unsupported/oipkg/packagelistitem.h +++ b/noncore/unsupported/oipkg/packagelistitem.h | |||
@@ -1,41 +1,50 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PK_LISTITEM_H | 10 | #ifndef PK_LISTITEM_H |
2 | #define PK_LISTITEM_H | 11 | #define PK_LISTITEM_H |
3 | 12 | ||
4 | #include "package.h" | 13 | #include "package.h" |
5 | 14 | ||
6 | #include <qstring.h> | 15 | #include <qstring.h> |
7 | #include <qlistview.h> | 16 | #include <qlistview.h> |
8 | #include <qpainter.h> | 17 | #include <qpainter.h> |
9 | #include <qpixmap.h> | 18 | #include <qpixmap.h> |
10 | #include <qdict.h> | 19 | #include <qdict.h> |
11 | 20 | ||
12 | #include "pksettings.h" | 21 | #include "pksettings.h" |
13 | 22 | ||
14 | class PackageListItem | 23 | class PackageListItem |
15 | : public QCheckListItem | 24 | : public QCheckListItem |
16 | { | 25 | { |
17 | public: | 26 | public: |
18 | PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); | 27 | PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); |
19 | PackageListItem(QListView*, Package*, PackageManagerSettings*); | 28 | PackageListItem(QListView*, Package*, PackageManagerSettings*); |
20 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); | 29 | void paintCell( QPainter*, const QColorGroup&, int, int, int ); |
21 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); | 30 | void paintFocus( QPainter*, const QColorGroup&, const QRect& ); |
22 | QPixmap statePixmap() const; | 31 | QPixmap statePixmap() const; |
23 | QString key( int, bool ) const; | 32 | QString key( int, bool ) const; |
24 | Package* getPackage() { return package; } ; | 33 | Package* getPackage() { return package; } ; |
25 | QString getName() { return package->name(); } ; | 34 | QString getName() { return package->name(); } ; |
26 | bool isInstalled(){ return package->installed(); }; | 35 | bool isInstalled(){ return package->installed(); }; |
27 | virtual void setOn ( bool ); | 36 | virtual void setOn ( bool ); |
28 | void displayDetails(); | 37 | void displayDetails(); |
29 | 38 | ||
30 | private: | 39 | private: |
31 | void init(Package*, PackageManagerSettings*); | 40 | void init(Package*, PackageManagerSettings*); |
32 | QCheckListItem *nameItem; | 41 | QCheckListItem *nameItem; |
33 | QCheckListItem *destItem; | 42 | QCheckListItem *destItem; |
34 | QCheckListItem *linkItem; | 43 | QCheckListItem *linkItem; |
35 | QCheckListItem *statusItem; | 44 | QCheckListItem *statusItem; |
36 | PackageManagerSettings *settings; | 45 | PackageManagerSettings *settings; |
37 | Package *package; | 46 | Package *package; |
38 | }; | 47 | }; |
39 | 48 | ||
40 | 49 | ||
41 | #endif | 50 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp index 6d931c8..b8a19253 100644 --- a/noncore/unsupported/oipkg/packagelistlocal.cpp +++ b/noncore/unsupported/oipkg/packagelistlocal.cpp | |||
@@ -1,66 +1,75 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #include <qpe/config.h> | 10 | #include <qpe/config.h> |
2 | #include <qfile.h> | 11 | #include <qfile.h> |
3 | #include <qfileinfo.h> | 12 | #include <qfileinfo.h> |
4 | #include <qtextstream.h> | 13 | #include <qtextstream.h> |
5 | #include <qstringlist.h> | 14 | #include <qstringlist.h> |
6 | #include "packagelistlocal.h" | 15 | #include "packagelistlocal.h" |
7 | 16 | ||
8 | PackageListLocal::PackageListLocal() | 17 | PackageListLocal::PackageListLocal() |
9 | : PackageList() | 18 | : PackageList() |
10 | { | 19 | { |
11 | Config cfg( "oipkg", Config::User ); | 20 | Config cfg( "oipkg", Config::User ); |
12 | cfg.setGroup( "Common" ); | 21 | cfg.setGroup( "Common" ); |
13 | statusDir = cfg.readEntry( "statusDir", "" ); | 22 | statusDir = cfg.readEntry( "statusDir", "" ); |
14 | listsDir = cfg.readEntry( "listsDir", "" ); | 23 | listsDir = cfg.readEntry( "listsDir", "" ); |
15 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) | 24 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) |
16 | { | 25 | { |
17 | statusDir="/usr/lib/ipkg/"; | 26 | statusDir="/usr/lib/ipkg/"; |
18 | listsDir="/usr/lib/ipkg/lists/"; | 27 | listsDir="/usr/lib/ipkg/lists/"; |
19 | cfg.writeEntry( "statusDir", statusDir ); | 28 | cfg.writeEntry( "statusDir", statusDir ); |
20 | cfg.writeEntry( "listsDir", listsDir ); | 29 | cfg.writeEntry( "listsDir", listsDir ); |
21 | } | 30 | } |
22 | } | 31 | } |
23 | 32 | ||
24 | PackageListLocal::PackageListLocal(PackageManagerSettings* s) | 33 | PackageListLocal::PackageListLocal(PackageManagerSettings* s) |
25 | : PackageList(s) | 34 | : PackageList(s) |
26 | { | 35 | { |
27 | PackageListLocal(); | 36 | PackageListLocal(); |
28 | } | 37 | } |
29 | 38 | ||
30 | PackageListLocal::~PackageListLocal() | 39 | PackageListLocal::~PackageListLocal() |
31 | { | 40 | { |
32 | } | 41 | } |
33 | 42 | ||
34 | void PackageListLocal::parseStatus() | 43 | void PackageListLocal::parseStatus() |
35 | { | 44 | { |
36 | QStringList dests = settings->getDestinationUrls(); | 45 | QStringList dests = settings->getDestinationUrls(); |
37 | QStringList destnames = settings->getDestinationNames(); | 46 | QStringList destnames = settings->getDestinationNames(); |
38 | QStringList::Iterator name = destnames.begin(); | 47 | QStringList::Iterator name = destnames.begin(); |
39 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) | 48 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) |
40 | { | 49 | { |
41 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); | 50 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); |
42 | readFileEntries( *dir+statusDir+"/status", *name ); | 51 | readFileEntries( *dir+statusDir+"/status", *name ); |
43 | ++name; | 52 | ++name; |
44 | }; | 53 | }; |
45 | } | 54 | } |
46 | 55 | ||
47 | void PackageListLocal::parseList() | 56 | void PackageListLocal::parseList() |
48 | { | 57 | { |
49 | QStringList srvs = settings->getActiveServers(); | 58 | QStringList srvs = settings->getActiveServers(); |
50 | 59 | ||
51 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) | 60 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) |
52 | { | 61 | { |
53 | pvDebug( 2, "List: "+listsDir+"/"+*it); | 62 | pvDebug( 2, "List: "+listsDir+"/"+*it); |
54 | readFileEntries( listsDir+"/"+*it ); | 63 | readFileEntries( listsDir+"/"+*it ); |
55 | } | 64 | } |
56 | } | 65 | } |
57 | 66 | ||
58 | 67 | ||
59 | void PackageListLocal::update() | 68 | void PackageListLocal::update() |
60 | { | 69 | { |
61 | pvDebug( 2, "parseStatus"); | 70 | pvDebug( 2, "parseStatus"); |
62 | parseStatus(); | 71 | parseStatus(); |
63 | pvDebug( 2, "parseList"); | 72 | pvDebug( 2, "parseList"); |
64 | parseList(); | 73 | parseList(); |
65 | pvDebug( 2, "finished parsing"); | 74 | pvDebug( 2, "finished parsing"); |
66 | } | 75 | } |
diff --git a/noncore/unsupported/oipkg/packagelistlocal.h b/noncore/unsupported/oipkg/packagelistlocal.h index 887126b..69f871c 100644 --- a/noncore/unsupported/oipkg/packagelistlocal.h +++ b/noncore/unsupported/oipkg/packagelistlocal.h | |||
@@ -1,30 +1,39 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PACKAGELISTLOCAL_H | 10 | #ifndef PACKAGELISTLOCAL_H |
2 | #define PACKAGELISTLOCAL_H | 11 | #define PACKAGELISTLOCAL_H |
3 | 12 | ||
4 | #include "packagelist.h" | 13 | #include "packagelist.h" |
5 | 14 | ||
6 | 15 | ||
7 | #define HACK | 16 | #define HACK |
8 | #ifdef HACK | 17 | #ifdef HACK |
9 | static QString listsDir="/usr/lib/ipkg/"; | 18 | static QString listsDir="/usr/lib/ipkg/"; |
10 | static QString statusDir="/usr/lib/ipkg/"; | 19 | static QString statusDir="/usr/lib/ipkg/"; |
11 | #endif | 20 | #endif |
12 | 21 | ||
13 | class PackageListLocal : public PackageList { | 22 | class PackageListLocal : public PackageList { |
14 | public: | 23 | public: |
15 | PackageListLocal(); | 24 | PackageListLocal(); |
16 | PackageListLocal( PackageManagerSettings* ); | 25 | PackageListLocal( PackageManagerSettings* ); |
17 | virtual ~PackageListLocal(); | 26 | virtual ~PackageListLocal(); |
18 | 27 | ||
19 | public slots: | 28 | public slots: |
20 | void update(); | 29 | void update(); |
21 | private: | 30 | private: |
22 | #ifndef HACK | 31 | #ifndef HACK |
23 | QString listsDir; | 32 | QString listsDir; |
24 | QString statusDir; | 33 | QString statusDir; |
25 | #endif | 34 | #endif |
26 | void parseStatus(); | 35 | void parseStatus(); |
27 | void parseList(); | 36 | void parseList(); |
28 | }; | 37 | }; |
29 | 38 | ||
30 | #endif | 39 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp index bb29e80..b4b6979 100644 --- a/noncore/unsupported/oipkg/packagelistremote.cpp +++ b/noncore/unsupported/oipkg/packagelistremote.cpp | |||
@@ -1,49 +1,58 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | 10 | ||
2 | #include "packagelistremote.h" | 11 | #include "packagelistremote.h" |
3 | 12 | ||
4 | #include <qstring.h> | 13 | #include <qstring.h> |
5 | #include <stdlib.h> | 14 | #include <stdlib.h> |
6 | #include <unistd.h> | 15 | #include <unistd.h> |
7 | 16 | ||
8 | PackageListRemote::PackageListRemote(PackageManagerSettings* s) | 17 | PackageListRemote::PackageListRemote(PackageManagerSettings* s) |
9 | : PackageList(s) | 18 | : PackageList(s) |
10 | { | 19 | { |
11 | PackageListRemote(); | 20 | PackageListRemote(); |
12 | } | 21 | } |
13 | 22 | ||
14 | PackageListRemote::PackageListRemote() | 23 | PackageListRemote::PackageListRemote() |
15 | : PackageList() | 24 | : PackageList() |
16 | { | 25 | { |
17 | } | 26 | } |
18 | 27 | ||
19 | PackageListRemote::~PackageListRemote() | 28 | PackageListRemote::~PackageListRemote() |
20 | { | 29 | { |
21 | } | 30 | } |
22 | 31 | ||
23 | void PackageListRemote::query(QString s) | 32 | void PackageListRemote::query(QString s) |
24 | { | 33 | { |
25 | pvDebug(4,"set query "+s); | 34 | pvDebug(4,"set query "+s); |
26 | searchString = s; | 35 | searchString = s; |
27 | } | 36 | } |
28 | 37 | ||
29 | void PackageListRemote::update() | 38 | void PackageListRemote::update() |
30 | { | 39 | { |
31 | pvDebug(2,"PackageListRemote::update"); | 40 | pvDebug(2,"PackageListRemote::update"); |
32 | if (searchString.isEmpty()) return; | 41 | if (searchString.isEmpty()) return; |
33 | int r=0; | 42 | int r=0; |
34 | QString cmd = "wget"; | 43 | QString cmd = "wget"; |
35 | QString redirect = "/tmp/oipkg.query"; | 44 | QString redirect = "/tmp/oipkg.query"; |
36 | 45 | ||
37 | // use file for output | 46 | // use file for output |
38 | cmd += " --output-document="+redirect; | 47 | cmd += " --output-document="+redirect; |
39 | //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= | 48 | //http://ipkgfind.handhelds.org/packages.phtml?format=pda&query=ipkg&searchtype=package§ion= |
40 | QString server="http://ipkgfind.handhelds.org/"; | 49 | QString server="http://ipkgfind.handhelds.org/"; |
41 | cmd += " \""+server+"/packages.phtml"; | 50 | cmd += " \""+server+"/packages.phtml"; |
42 | cmd += "?format=pda&searchtype=package§ion="; | 51 | cmd += "?format=pda&searchtype=package§ion="; |
43 | cmd += "&query="+searchString; | 52 | cmd += "&query="+searchString; |
44 | cmd += "\""; | 53 | cmd += "\""; |
45 | 54 | ||
46 | pvDebug(4,"search :"+cmd); | 55 | pvDebug(4,"search :"+cmd); |
47 | r = system(cmd.latin1()); | 56 | r = system(cmd.latin1()); |
48 | readFileEntries( redirect, "remote" ); | 57 | readFileEntries( redirect, "remote" ); |
49 | } | 58 | } |
diff --git a/noncore/unsupported/oipkg/packagelistremote.h b/noncore/unsupported/oipkg/packagelistremote.h index 87bf10d..98632ca 100644 --- a/noncore/unsupported/oipkg/packagelistremote.h +++ b/noncore/unsupported/oipkg/packagelistremote.h | |||
@@ -1,21 +1,30 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PACKAGELISTREMOTE_H | 10 | #ifndef PACKAGELISTREMOTE_H |
2 | #define PACKAGELISTREMOTE_H | 11 | #define PACKAGELISTREMOTE_H |
3 | 12 | ||
4 | #include "packagelist.h" | 13 | #include "packagelist.h" |
5 | #include "package.h" | 14 | #include "package.h" |
6 | #include "pksettings.h" | 15 | #include "pksettings.h" |
7 | #include "debug.h" | 16 | #include "debug.h" |
8 | 17 | ||
9 | class PackageListRemote : public PackageList { | 18 | class PackageListRemote : public PackageList { |
10 | public: | 19 | public: |
11 | PackageListRemote(); | 20 | PackageListRemote(); |
12 | PackageListRemote( PackageManagerSettings* s); | 21 | PackageListRemote( PackageManagerSettings* s); |
13 | virtual ~PackageListRemote(); | 22 | virtual ~PackageListRemote(); |
14 | void query(QString); | 23 | void query(QString); |
15 | public slots: | 24 | public slots: |
16 | void update(); | 25 | void update(); |
17 | private: | 26 | private: |
18 | QString searchString; | 27 | QString searchString; |
19 | }; | 28 | }; |
20 | 29 | ||
21 | #endif | 30 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 2bb74e9..0d6fa80 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -1,144 +1,153 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #include "packagelistview.h" | 10 | #include "packagelistview.h" |
2 | 11 | ||
3 | #include <qpopupmenu.h> | 12 | #include <qpopupmenu.h> |
4 | #include <qaction.h> | 13 | #include <qaction.h> |
5 | 14 | ||
6 | #include "packagelistitem.h" | 15 | #include "packagelistitem.h" |
7 | #include "pksettings.h" | 16 | #include "pksettings.h" |
8 | 17 | ||
9 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | 18 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) |
10 | : QListView(p,n) | 19 | : QListView(p,n) |
11 | { | 20 | { |
12 | settings = s; | 21 | settings = s; |
13 | popupMenu = new QPopupMenu( this ); | 22 | popupMenu = new QPopupMenu( this ); |
14 | destsMenu = new QPopupMenu( popupMenu ); | 23 | destsMenu = new QPopupMenu( popupMenu ); |
15 | popupTimer = new QTimer( this ); | 24 | popupTimer = new QTimer( this ); |
16 | setSelectionMode(QListView::NoSelection); | 25 | setSelectionMode(QListView::NoSelection); |
17 | addColumn( tr("Package") ); | 26 | addColumn( tr("Package") ); |
18 | setRootIsDecorated( true ); | 27 | setRootIsDecorated( true ); |
19 | 28 | ||
20 | connect( popupTimer, SIGNAL(timeout()), | 29 | connect( popupTimer, SIGNAL(timeout()), |
21 | this, SLOT(showPopup()) ); | 30 | this, SLOT(showPopup()) ); |
22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 31 | connect( this, SIGNAL( pressed( QListViewItem* ) ), |
23 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 32 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 33 | connect( this, SIGNAL( clicked( QListViewItem* ) ), |
25 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 34 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
26 | 35 | ||
27 | } | 36 | } |
28 | 37 | ||
29 | //PackageListView::~PackageListView() | 38 | //PackageListView::~PackageListView() |
30 | //{ | 39 | //{ |
31 | //} | 40 | //} |
32 | 41 | ||
33 | void PackageListView::setCurrent( QListViewItem* p ) | 42 | void PackageListView::setCurrent( QListViewItem* p ) |
34 | { | 43 | { |
35 | if ( !p ) return; | 44 | if ( !p ) return; |
36 | activePackageListItem = (PackageListItem*)p; | 45 | activePackageListItem = (PackageListItem*)p; |
37 | activePackage = activePackageListItem->getPackage(); | 46 | activePackage = activePackageListItem->getPackage(); |
38 | if (!activePackage) | 47 | if (!activePackage) |
39 | { | 48 | { |
40 | // QDictIterator<QCheckListItem> it( rootItems ); | 49 | // QDictIterator<QCheckListItem> it( rootItems ); |
41 | // while ( it.current() ) | 50 | // while ( it.current() ) |
42 | // { | 51 | // { |
43 | // if ( it.current()==p ) | 52 | // if ( it.current()==p ) |
44 | // pvDebug(2,"current item"); | 53 | // pvDebug(2,"current item"); |
45 | // ++it; | 54 | // ++it; |
46 | // } | 55 | // } |
47 | 56 | ||
48 | return; | 57 | return; |
49 | } | 58 | } |
50 | popupTimer->start( 750, true ); | 59 | popupTimer->start( 750, true ); |
51 | } | 60 | } |
52 | 61 | ||
53 | 62 | ||
54 | void PackageListView::showPopup() | 63 | void PackageListView::showPopup() |
55 | { | 64 | { |
56 | popupMenu->clear(); | 65 | popupMenu->clear(); |
57 | destsMenu->clear(); | 66 | destsMenu->clear(); |
58 | 67 | ||
59 | QAction *popupAction; | 68 | QAction *popupAction; |
60 | if ( !activePackage->installed() ) | 69 | if ( !activePackage->installed() ) |
61 | { | 70 | { |
62 | popupMenu->insertItem( tr("Install to"), destsMenu ); | 71 | popupMenu->insertItem( tr("Install to"), destsMenu ); |
63 | QStringList dests = settings->getDestinationNames(); | 72 | QStringList dests = settings->getDestinationNames(); |
64 | QString ad = settings->getDestinationName(); | 73 | QString ad = settings->getDestinationName(); |
65 | for (uint i = 0; i < dests.count(); i++ ) | 74 | for (uint i = 0; i < dests.count(); i++ ) |
66 | { | 75 | { |
67 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 76 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
68 | popupAction->addTo( destsMenu ); | 77 | popupAction->addTo( destsMenu ); |
69 | if ( dests[i] == ad && activePackage->toInstall() ) | 78 | if ( dests[i] == ad && activePackage->toInstall() ) |
70 | { | 79 | { |
71 | popupAction->setToggleAction( true ); | 80 | popupAction->setToggleAction( true ); |
72 | popupAction->setOn(true); | 81 | popupAction->setOn(true); |
73 | }; | 82 | }; |
74 | } | 83 | } |
75 | connect( destsMenu, SIGNAL( activated( int ) ), | 84 | connect( destsMenu, SIGNAL( activated( int ) ), |
76 | this, SLOT( changePackageDest( int ) ) ); | 85 | this, SLOT( changePackageDest( int ) ) ); |
77 | }else{ | 86 | }else{ |
78 | popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 ); | 87 | popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 ); |
79 | popupAction->addTo( popupMenu ); | 88 | popupAction->addTo( popupMenu ); |
80 | connect( popupAction, SIGNAL( activated() ), | 89 | connect( popupAction, SIGNAL( activated() ), |
81 | this , SLOT( toggleProcess() ) ); | 90 | this , SLOT( toggleProcess() ) ); |
82 | popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 ); | 91 | popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 ); |
83 | popupAction->addTo( popupMenu ); | 92 | popupAction->addTo( popupMenu ); |
84 | popupAction->setEnabled( false ); | 93 | popupAction->setEnabled( false ); |
85 | } | 94 | } |
86 | popupMenu->popup( QCursor::pos() ); | 95 | popupMenu->popup( QCursor::pos() ); |
87 | } | 96 | } |
88 | 97 | ||
89 | void PackageListView::stopTimer( QListViewItem* ) | 98 | void PackageListView::stopTimer( QListViewItem* ) |
90 | { | 99 | { |
91 | popupTimer->stop(); | 100 | popupTimer->stop(); |
92 | } | 101 | } |
93 | 102 | ||
94 | 103 | ||
95 | void PackageListView::changePackageDest( int i ) | 104 | void PackageListView::changePackageDest( int i ) |
96 | { | 105 | { |
97 | activePackage->setDest( destsMenu->text(i) ); | 106 | activePackage->setDest( destsMenu->text(i) ); |
98 | activePackage->setOn(); | 107 | activePackage->setOn(); |
99 | activePackage->setLink( settings->createLinks() ); | 108 | activePackage->setLink( settings->createLinks() ); |
100 | activePackageListItem->displayDetails(); | 109 | activePackageListItem->displayDetails(); |
101 | } | 110 | } |
102 | 111 | ||
103 | void PackageListView::toggleProcess() | 112 | void PackageListView::toggleProcess() |
104 | { | 113 | { |
105 | activePackage->toggleProcess() ; | 114 | activePackage->toggleProcess() ; |
106 | activePackageListItem->displayDetails(); | 115 | activePackageListItem->displayDetails(); |
107 | } | 116 | } |
108 | 117 | ||
109 | void PackageListView::display() | 118 | void PackageListView::display() |
110 | { | 119 | { |
111 | QDictIterator<PackageList> list( PackageLists ); | 120 | QDictIterator<PackageList> list( PackageLists ); |
112 | PackageList *packlist; | 121 | PackageList *packlist; |
113 | Package *pack; | 122 | Package *pack; |
114 | PackageListItem *item; | 123 | PackageListItem *item; |
115 | QCheckListItem *rootItem; | 124 | QCheckListItem *rootItem; |
116 | QListViewItem* it; | 125 | QListViewItem* it; |
117 | QListViewItem* itdel; | 126 | QListViewItem* itdel; |
118 | while ( list.current() ) { | 127 | while ( list.current() ) { |
119 | packlist = list.current(); | 128 | packlist = list.current(); |
120 | rootItem = rootItems.find( list.currentKey() ); | 129 | rootItem = rootItems.find( list.currentKey() ); |
121 | //rootItem->clear(); | 130 | //rootItem->clear(); |
122 | it=rootItem->firstChild(); | 131 | it=rootItem->firstChild(); |
123 | while ( it ) | 132 | while ( it ) |
124 | { | 133 | { |
125 | itdel = it; | 134 | itdel = it; |
126 | it = it->nextSibling(); | 135 | it = it->nextSibling(); |
127 | delete itdel; | 136 | delete itdel; |
128 | } | 137 | } |
129 | pack = packlist->first(); | 138 | pack = packlist->first(); |
130 | while( pack ) | 139 | while( pack ) |
131 | { | 140 | { |
132 | item = new PackageListItem( rootItem, pack, settings ); | 141 | item = new PackageListItem( rootItem, pack, settings ); |
133 | pack = packlist->next(); | 142 | pack = packlist->next(); |
134 | } | 143 | } |
135 | ++list; | 144 | ++list; |
136 | } | 145 | } |
137 | } | 146 | } |
138 | 147 | ||
139 | void PackageListView::addList( QString n, PackageList* pl) | 148 | void PackageListView::addList( QString n, PackageList* pl) |
140 | { | 149 | { |
141 | PackageLists.insert(n, pl); | 150 | PackageLists.insert(n, pl); |
142 | QCheckListItem *item = new QCheckListItem(this,n); | 151 | QCheckListItem *item = new QCheckListItem(this,n); |
143 | rootItems.insert(n, item); | 152 | rootItems.insert(n, item); |
144 | } | 153 | } |
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h index 00c0320..3c09ba8 100644 --- a/noncore/unsupported/oipkg/packagelistview.h +++ b/noncore/unsupported/oipkg/packagelistview.h | |||
@@ -1,61 +1,54 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | packagelistview.h - description | ||
3 | ------------------- | ||
4 | begin : Sat Apr 27 2002 | ||
5 | copyright : (C) 2002 by tille | ||
6 | email : tille@handhelds.org | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | 2 | * * |
11 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
15 | * * | 7 | * * |
16 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
17 | 10 | ||
18 | #ifndef PACKAGELISTVIEW_H | 11 | #ifndef PACKAGELISTVIEW_H |
19 | #define PACKAGELISTVIEW_H | 12 | #define PACKAGELISTVIEW_H |
20 | 13 | ||
21 | #include <qlistview.h> | 14 | #include <qlistview.h> |
22 | #include <qaction.h> | 15 | #include <qaction.h> |
23 | #include <qdict.h> | 16 | #include <qdict.h> |
24 | #include <qstring.h> | 17 | #include <qstring.h> |
25 | #include <qtimer.h> | 18 | #include <qtimer.h> |
26 | #include <qwidget.h> | 19 | #include <qwidget.h> |
27 | #include <qpopupmenu.h> | 20 | #include <qpopupmenu.h> |
28 | #include "packagelist.h" | 21 | #include "packagelist.h" |
29 | #include "debug.h" | 22 | #include "debug.h" |
30 | 23 | ||
31 | class PackageListItem; | 24 | class PackageListItem; |
32 | class Package; | 25 | class Package; |
33 | class PackageManagerSettings; | 26 | class PackageManagerSettings; |
34 | 27 | ||
35 | class PackageListView : public QListView | 28 | class PackageListView : public QListView |
36 | { | 29 | { |
37 | Q_OBJECT | 30 | Q_OBJECT |
38 | 31 | ||
39 | public: | 32 | public: |
40 | PackageListView(QWidget*, const char*, PackageManagerSettings*); | 33 | PackageListView(QWidget*, const char*, PackageManagerSettings*); |
41 | void addList( QString, PackageList* ); | 34 | void addList( QString, PackageList* ); |
42 | //~PackageListView(); | 35 | //~PackageListView(); |
43 | QTimer *popupTimer; | 36 | QTimer *popupTimer; |
44 | private: | 37 | private: |
45 | QDict<PackageList> PackageLists; | 38 | QDict<PackageList> PackageLists; |
46 | QDict<QCheckListItem> rootItems; | 39 | QDict<QCheckListItem> rootItems; |
47 | PackageManagerSettings *settings; | 40 | PackageManagerSettings *settings; |
48 | Package *activePackage; | 41 | Package *activePackage; |
49 | PackageListItem *activePackageListItem; | 42 | PackageListItem *activePackageListItem; |
50 | QPopupMenu *popupMenu; | 43 | QPopupMenu *popupMenu; |
51 | QPopupMenu *destsMenu; | 44 | QPopupMenu *destsMenu; |
52 | public slots: | 45 | public slots: |
53 | void showPopup(); | 46 | void showPopup(); |
54 | void changePackageDest( int ); | 47 | void changePackageDest( int ); |
55 | void setCurrent( QListViewItem* ); | 48 | void setCurrent( QListViewItem* ); |
56 | void stopTimer( QListViewItem* ); | 49 | void stopTimer( QListViewItem* ); |
57 | void toggleProcess(); | 50 | void toggleProcess(); |
58 | void display(); | 51 | void display(); |
59 | }; | 52 | }; |
60 | 53 | ||
61 | #endif | 54 | #endif |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 89309a2..de1f162 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,384 +1,393 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #include "pmipkg.h" | 10 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 11 | #include "pksettings.h" |
3 | #include "package.h" | 12 | #include "package.h" |
4 | #include "packagelistitem.h" | 13 | #include "packagelistitem.h" |
5 | 14 | ||
6 | #include <opie/oprocess.h> | 15 | #include <opie/oprocess.h> |
7 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
8 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
9 | #include <qpe/stringutil.h> | 18 | #include <qpe/stringutil.h> |
10 | #include <qpe/qpeapplication.h> | 19 | #include <qpe/qpeapplication.h> |
11 | #include <qdir.h> | 20 | #include <qdir.h> |
12 | #include <qfile.h> | 21 | #include <qfile.h> |
13 | #include <qgroupbox.h> | 22 | #include <qgroupbox.h> |
14 | #include <qmultilineedit.h> | 23 | #include <qmultilineedit.h> |
15 | #include <qstring.h> | 24 | #include <qstring.h> |
16 | #include <qcheckbox.h> | 25 | #include <qcheckbox.h> |
17 | #include <qtextstream.h> | 26 | #include <qtextstream.h> |
18 | #include <qtextview.h> | 27 | #include <qtextview.h> |
19 | 28 | ||
20 | #include <qprogressbar.h> | 29 | #include <qprogressbar.h> |
21 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
22 | #include <qlayout.h> | 31 | #include <qlayout.h> |
23 | 32 | ||
24 | #include <stdlib.h> | 33 | #include <stdlib.h> |
25 | #include <unistd.h> | 34 | #include <unistd.h> |
26 | 35 | ||
27 | #include "mainwindow.h" | 36 | #include "mainwindow.h" |
28 | 37 | ||
29 | 38 | ||
30 | //#define OPROCESS | 39 | //#define OPROCESS |
31 | 40 | ||
32 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 41 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
33 | : QObject ( p ) | 42 | : QObject ( p ) |
34 | { | 43 | { |
35 | settings = s; | 44 | settings = s; |
36 | runwindow = new RunWindow( p, name, true, f ); | 45 | runwindow = new RunWindow( p, name, true, f ); |
37 | #ifdef OPROCESS | 46 | #ifdef OPROCESS |
38 | ipkgProcess = new OProcess(); | 47 | ipkgProcess = new OProcess(); |
39 | connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), | 48 | connect ( ipkgProcess, SIGNAL(receivedStdout(OProcess*,char*,int)), |
40 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); | 49 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); |
41 | 50 | ||
42 | connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), | 51 | connect ( ipkgProcess, SIGNAL(receivedStderr(OProcess*,char*,int)), |
43 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); | 52 | this, SLOT(getIpkgOutput(OProcess*,char*,int))); |
44 | installDialog = 0; | 53 | installDialog = 0; |
45 | #endif | 54 | #endif |
46 | } | 55 | } |
47 | 56 | ||
48 | PmIpkg::~PmIpkg() | 57 | PmIpkg::~PmIpkg() |
49 | { | 58 | { |
50 | #ifdef OPROCESS | 59 | #ifdef OPROCESS |
51 | delete ipkgProcess; | 60 | delete ipkgProcess; |
52 | #endif | 61 | #endif |
53 | } | 62 | } |
54 | 63 | ||
55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | 64 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
56 | { | 65 | { |
57 | bool ret=false; | 66 | bool ret=false; |
58 | QDir::setCurrent("/tmp"); | 67 | QDir::setCurrent("/tmp"); |
59 | QString cmd = "/usr/bin/ipkg "; | 68 | QString cmd = "/usr/bin/ipkg "; |
60 | #ifdef OPROCESS | 69 | #ifdef OPROCESS |
61 | ipkgProcess->clearArguments(); | 70 | ipkgProcess->clearArguments(); |
62 | *ipkgProcess << "/usr/bin/ipkg "; | 71 | *ipkgProcess << "/usr/bin/ipkg "; |
63 | cmd = ""; | 72 | cmd = ""; |
64 | #endif | 73 | #endif |
65 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 74 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
66 | if ( dest == "" ) | 75 | if ( dest == "" ) |
67 | cmd += " -dest "+settings->getDestinationName(); | 76 | cmd += " -dest "+settings->getDestinationName(); |
68 | else | 77 | else |
69 | cmd += " -dest "+ dest; | 78 | cmd += " -dest "+ dest; |
70 | 79 | ||
71 | cmd += " -force-defaults "; | 80 | cmd += " -force-defaults "; |
72 | 81 | ||
73 | if (installDialog && installDialog->_force_depends) | 82 | if (installDialog && installDialog->_force_depends) |
74 | { | 83 | { |
75 | if (installDialog->_force_depends->isChecked()) | 84 | if (installDialog->_force_depends->isChecked()) |
76 | cmd += " -force-depends "; | 85 | cmd += " -force-depends "; |
77 | if (installDialog->_force_reinstall->isChecked()) | 86 | if (installDialog->_force_reinstall->isChecked()) |
78 | cmd += " -force-reinstall "; | 87 | cmd += " -force-reinstall "; |
79 | if (installDialog->_force_remove->isChecked()) | 88 | if (installDialog->_force_remove->isChecked()) |
80 | cmd += " -force-removal-of-essential-packages "; | 89 | cmd += " -force-removal-of-essential-packages "; |
81 | } | 90 | } |
82 | 91 | ||
83 | out( "Starting to "+ args+"\n"); | 92 | out( "Starting to "+ args+"\n"); |
84 | cmd += args; | 93 | cmd += args; |
85 | out( "running:\n"+cmd+"\n" ); | 94 | out( "running:\n"+cmd+"\n" ); |
86 | pvDebug(2,"running:"+cmd); | 95 | pvDebug(2,"running:"+cmd); |
87 | #ifdef OPROCESS | 96 | #ifdef OPROCESS |
88 | *ipkgProcess << args; | 97 | *ipkgProcess << args; |
89 | out( "running:\n" + cmd); | 98 | out( "running:\n" + cmd); |
90 | *ipkgProcess << cmd; | 99 | *ipkgProcess << cmd; |
91 | 100 | ||
92 | //debug | 101 | //debug |
93 | ipkgProcess->clearArguments(); | 102 | ipkgProcess->clearArguments(); |
94 | *ipkgProcess << "/bin/ls "; | 103 | *ipkgProcess << "/bin/ls "; |
95 | //debug | 104 | //debug |
96 | QValueList<QCString> a = ipkgProcess->args(); | 105 | QValueList<QCString> a = ipkgProcess->args(); |
97 | QValueList<QCString>::Iterator it; | 106 | QValueList<QCString>::Iterator it; |
98 | for( it = a.begin(); it != a.end(); ++it ) | 107 | for( it = a.begin(); it != a.end(); ++it ) |
99 | { | 108 | { |
100 | out( *it ); | 109 | out( *it ); |
101 | cmd += *it; | 110 | cmd += *it; |
102 | } | 111 | } |
103 | 112 | ||
104 | pvDebug(2,"running:"+cmd); | 113 | pvDebug(2,"running:"+cmd); |
105 | qApp->processEvents(); | 114 | qApp->processEvents(); |
106 | // sleep(1); | 115 | // sleep(1); |
107 | ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); | 116 | ret = ipkgProcess->start(OProcess::NotifyOnExit,OProcess::AllOutput); |
108 | if ( !ret ) { | 117 | if ( !ret ) { |
109 | pvDebug(2,"Could not execute '" + cmd); | 118 | pvDebug(2,"Could not execute '" + cmd); |
110 | out("\nError while executing "+ cmd+"\n\n"); | 119 | out("\nError while executing "+ cmd+"\n\n"); |
111 | out("\nError while executing\n\n"); | 120 | out("\nError while executing\n\n"); |
112 | // return false; | 121 | // return false; |
113 | } | 122 | } |
114 | 123 | ||
115 | while ( ipkgProcess->isRunning() ) | 124 | while ( ipkgProcess->isRunning() ) |
116 | { | 125 | { |
117 | out("."); | 126 | out("."); |
118 | pvDebug(7,"wait for oprocess to terminate"); | 127 | pvDebug(7,"wait for oprocess to terminate"); |
119 | qApp->processEvents(); | 128 | qApp->processEvents(); |
120 | }; | 129 | }; |
121 | #else | 130 | #else |
122 | qApp->processEvents(); | 131 | qApp->processEvents(); |
123 | FILE *fp; | 132 | FILE *fp; |
124 | char line[130]; | 133 | char line[130]; |
125 | QString lineStr, lineStrOld; | 134 | QString lineStr, lineStrOld; |
126 | sleep(1); | 135 | sleep(1); |
127 | cmd +=" 2>&1"; | 136 | cmd +=" 2>&1"; |
128 | fp = popen( (const char *) cmd, "r"); | 137 | fp = popen( (const char *) cmd, "r"); |
129 | if ( fp == NULL ) { | 138 | if ( fp == NULL ) { |
130 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 139 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
131 | out("\nError while executing "+ cmd+"\n\n"); | 140 | out("\nError while executing "+ cmd+"\n\n"); |
132 | ret = false; | 141 | ret = false; |
133 | } else { | 142 | } else { |
134 | while ( fgets( line, sizeof line, fp) != NULL) | 143 | while ( fgets( line, sizeof line, fp) != NULL) |
135 | { | 144 | { |
136 | lineStr = line; | 145 | lineStr = line; |
137 | lineStr=lineStr.left(lineStr.length()-1); | 146 | lineStr=lineStr.left(lineStr.length()-1); |
138 | //Configuring opie-oipkg...Done | 147 | //Configuring opie-oipkg...Done |
139 | if (lineStr.contains("Done")) ret = true; | 148 | if (lineStr.contains("Done")) ret = true; |
140 | if (lineStr!=lineStrOld) | 149 | if (lineStr!=lineStrOld) |
141 | out(lineStr); | 150 | out(lineStr); |
142 | lineStrOld = lineStr; | 151 | lineStrOld = lineStr; |
143 | qApp->processEvents(); | 152 | qApp->processEvents(); |
144 | } | 153 | } |
145 | } | 154 | } |
146 | pclose(fp); | 155 | pclose(fp); |
147 | #endif | 156 | #endif |
148 | //out( "Finished!"); | 157 | //out( "Finished!"); |
149 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 158 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
150 | return ret; | 159 | return ret; |
151 | } | 160 | } |
152 | 161 | ||
153 | void PmIpkg::makeLinks(Package *pack) | 162 | void PmIpkg::makeLinks(Package *pack) |
154 | { | 163 | { |
155 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 164 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
156 | QString pn = pack->name(); | 165 | QString pn = pack->name(); |
157 | linkPackage( pack->packageName(), pack->dest() ); | 166 | linkPackage( pack->packageName(), pack->dest() ); |
158 | } | 167 | } |
159 | 168 | ||
160 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 169 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
161 | { | 170 | { |
162 | QString dest = settings->getDestinationUrlByName( d ); | 171 | QString dest = settings->getDestinationUrlByName( d ); |
163 | dest = dest==""?d:dest; | 172 | dest = dest==""?d:dest; |
164 | if (dest == "/" ) return 0; | 173 | if (dest == "/" ) return 0; |
165 | { | 174 | { |
166 | Config cfg( "oipkg", Config::User ); | 175 | Config cfg( "oipkg", Config::User ); |
167 | cfg.setGroup( "Common" ); | 176 | cfg.setGroup( "Common" ); |
168 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 177 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
169 | } | 178 | } |
170 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 179 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
171 | QFile f( packFileName ); | 180 | QFile f( packFileName ); |
172 | if ( ! f.open(IO_ReadOnly) ) | 181 | if ( ! f.open(IO_ReadOnly) ) |
173 | { | 182 | { |
174 | pvDebug(1," Panik! Could not open"); | 183 | pvDebug(1," Panik! Could not open"); |
175 | out( "Panik!\n Could not open:\n"+packFileName ); | 184 | out( "Panik!\n Could not open:\n"+packFileName ); |
176 | return (QStringList*)0; | 185 | return (QStringList*)0; |
177 | } | 186 | } |
178 | QStringList *fileList = new QStringList(); | 187 | QStringList *fileList = new QStringList(); |
179 | QTextStream t( &f ); | 188 | QTextStream t( &f ); |
180 | while ( !t.eof() ) | 189 | while ( !t.eof() ) |
181 | { | 190 | { |
182 | *fileList += t.readLine(); | 191 | *fileList += t.readLine(); |
183 | } | 192 | } |
184 | return fileList; | 193 | return fileList; |
185 | } | 194 | } |
186 | 195 | ||
187 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 196 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
188 | { | 197 | { |
189 | QStringList *fileList = getList( packFileName, dest ); | 198 | QStringList *fileList = getList( packFileName, dest ); |
190 | processFileList( fileList, dest ); | 199 | processFileList( fileList, dest ); |
191 | delete fileList; | 200 | delete fileList; |
192 | } | 201 | } |
193 | 202 | ||
194 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 203 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
195 | { | 204 | { |
196 | if (!fileList) return; | 205 | if (!fileList) return; |
197 | for (uint i=0; i < fileList->count(); i++) | 206 | for (uint i=0; i < fileList->count(); i++) |
198 | { | 207 | { |
199 | QString dest = settings->getDestinationUrlByName( d ); | 208 | QString dest = settings->getDestinationUrlByName( d ); |
200 | dest = dest==""?d:dest; | 209 | dest = dest==""?d:dest; |
201 | processLinkDir( (*fileList)[i], dest ); | 210 | processLinkDir( (*fileList)[i], dest ); |
202 | } | 211 | } |
203 | } | 212 | } |
204 | 213 | ||
205 | 214 | ||
206 | void PmIpkg::processLinkDir( QString file, QString dest ) | 215 | void PmIpkg::processLinkDir( QString file, QString dest ) |
207 | { | 216 | { |
208 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 217 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
209 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 218 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
210 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 219 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
211 | if ( dest == "???" || dest == "" ) return; | 220 | if ( dest == "???" || dest == "" ) return; |
212 | QString destFile = file; | 221 | QString destFile = file; |
213 | file = dest+"/"+file; | 222 | file = dest+"/"+file; |
214 | if (file == dest) return; | 223 | if (file == dest) return; |
215 | // if (linkOpp==createLink) out( "\ncreating links\n" ); | 224 | // if (linkOpp==createLink) out( "\ncreating links\n" ); |
216 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); | 225 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); |
217 | QFileInfo fileInfo( file ); | 226 | QFileInfo fileInfo( file ); |
218 | if ( fileInfo.isDir() ) | 227 | if ( fileInfo.isDir() ) |
219 | { | 228 | { |
220 | pvDebug(4, "process dir "+file); | 229 | pvDebug(4, "process dir "+file); |
221 | QDir destDir( destFile ); | 230 | QDir destDir( destFile ); |
222 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 231 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
223 | QDir d( file ); | 232 | QDir d( file ); |
224 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 233 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
225 | const QFileInfoList *list = d.entryInfoList(); | 234 | const QFileInfoList *list = d.entryInfoList(); |
226 | QFileInfoListIterator it( *list ); | 235 | QFileInfoListIterator it( *list ); |
227 | QFileInfo *fi; | 236 | QFileInfo *fi; |
228 | while ( (fi=it.current()) ) | 237 | while ( (fi=it.current()) ) |
229 | { | 238 | { |
230 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | 239 | pvDebug(4, "processLinkDir "+fi->absFilePath()); |
231 | processLinkDir( fi->absFilePath(), dest ); | 240 | processLinkDir( fi->absFilePath(), dest ); |
232 | ++it; | 241 | ++it; |
233 | } | 242 | } |
234 | } else | 243 | } else |
235 | if ( fileInfo.isFile() ) | 244 | if ( fileInfo.isFile() ) |
236 | { | 245 | { |
237 | const char *instFile = strdup( (file).latin1() ); | 246 | const char *instFile = strdup( (file).latin1() ); |
238 | const char *linkFile = strdup( (destFile).latin1()); | 247 | const char *linkFile = strdup( (destFile).latin1()); |
239 | if( linkOpp==createLink ) | 248 | if( linkOpp==createLink ) |
240 | { | 249 | { |
241 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 250 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
242 | symlink( instFile, linkFile ); | 251 | symlink( instFile, linkFile ); |
243 | } | 252 | } |
244 | } else { | 253 | } else { |
245 | const char *linkFile = strdup( (destFile).latin1()); | 254 | const char *linkFile = strdup( (destFile).latin1()); |
246 | if( linkOpp==removeLink ) | 255 | if( linkOpp==removeLink ) |
247 | { | 256 | { |
248 | QFileInfo toRemoveLink( destFile ); | 257 | QFileInfo toRemoveLink( destFile ); |
249 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 258 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
250 | { | 259 | { |
251 | pvDebug(4,"removing "+destFile+" no "+file); | 260 | pvDebug(4,"removing "+destFile+" no "+file); |
252 | unlink( linkFile ); | 261 | unlink( linkFile ); |
253 | } | 262 | } |
254 | } | 263 | } |
255 | } | 264 | } |
256 | } | 265 | } |
257 | 266 | ||
258 | void PmIpkg::loadList( PackageList *pl ) | 267 | void PmIpkg::loadList( PackageList *pl ) |
259 | { | 268 | { |
260 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) | 269 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) |
261 | { | 270 | { |
262 | if ( pack && (pack->name() != "") && pack) | 271 | if ( pack && (pack->name() != "") && pack) |
263 | { | 272 | { |
264 | if ( pack->toInstall() ) | 273 | if ( pack->toInstall() ) |
265 | to_install.append( pack ); | 274 | to_install.append( pack ); |
266 | if ( pack->toRemove() ) | 275 | if ( pack->toRemove() ) |
267 | to_remove.append( pack ); | 276 | to_remove.append( pack ); |
268 | } | 277 | } |
269 | } | 278 | } |
270 | } | 279 | } |
271 | 280 | ||
272 | void PmIpkg::commit() | 281 | void PmIpkg::commit() |
273 | { | 282 | { |
274 | int sizecount = 0; | 283 | int sizecount = 0; |
275 | installDialog = new InstallDialog(settings,0,0,true); | 284 | installDialog = new InstallDialog(settings,0,0,true); |
276 | installDialog->toRemoveItem->setOpen( true ); | 285 | installDialog->toRemoveItem->setOpen( true ); |
277 | installDialog->toInstallItem->setOpen( true ); | 286 | installDialog->toInstallItem->setOpen( true ); |
278 | for (uint i=0; i < to_remove.count(); i++) | 287 | for (uint i=0; i < to_remove.count(); i++) |
279 | { | 288 | { |
280 | sizecount += 1; | 289 | sizecount += 1; |
281 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 290 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
282 | } | 291 | } |
283 | for (uint i=0; i < to_install.count(); i++) | 292 | for (uint i=0; i < to_install.count(); i++) |
284 | { | 293 | { |
285 | sizecount += to_install.at(i)->size().toInt(); | 294 | sizecount += to_install.at(i)->size().toInt(); |
286 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 295 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
287 | } | 296 | } |
288 | runwindow->progress->setTotalSteps(sizecount); | 297 | runwindow->progress->setTotalSteps(sizecount); |
289 | qDebug("Install size %i",sizecount); | 298 | qDebug("Install size %i",sizecount); |
290 | installDialog->showMaximized(); | 299 | installDialog->showMaximized(); |
291 | installDialog->show(); | 300 | installDialog->show(); |
292 | if ( installDialog->exec() ) | 301 | if ( installDialog->exec() ) |
293 | { | 302 | { |
294 | doIt(); | 303 | doIt(); |
295 | runwindow->showMaximized(); | 304 | runwindow->showMaximized(); |
296 | runwindow->show(); | 305 | runwindow->show(); |
297 | } | 306 | } |
298 | installDialog->close(); | 307 | installDialog->close(); |
299 | delete installDialog; | 308 | delete installDialog; |
300 | installDialog = 0; | 309 | installDialog = 0; |
301 | out(tr("\nAll done.")); | 310 | out(tr("\nAll done.")); |
302 | } | 311 | } |
303 | 312 | ||
304 | void PmIpkg::doIt() | 313 | void PmIpkg::doIt() |
305 | { | 314 | { |
306 | runwindow->progress->setProgress(0); | 315 | runwindow->progress->setProgress(0); |
307 | show(); | 316 | show(); |
308 | remove(); | 317 | remove(); |
309 | install(); | 318 | install(); |
310 | } | 319 | } |
311 | 320 | ||
312 | 321 | ||
313 | void PmIpkg::remove() | 322 | void PmIpkg::remove() |
314 | { | 323 | { |
315 | if ( to_remove.count() == 0 ) return; | 324 | if ( to_remove.count() == 0 ) return; |
316 | 325 | ||
317 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 326 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
318 | 327 | ||
319 | QStringList *fileList; | 328 | QStringList *fileList; |
320 | for (uint i=0; i < to_remove.count(); i++) | 329 | for (uint i=0; i < to_remove.count(); i++) |
321 | { | 330 | { |
322 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 331 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
323 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 332 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
324 | { | 333 | { |
325 | runwindow->progress->setProgress( 1 ); | 334 | runwindow->progress->setProgress( 1 ); |
326 | linkOpp = removeLink; | 335 | linkOpp = removeLink; |
327 | to_remove.at(i)->processed(); | 336 | to_remove.at(i)->processed(); |
328 | pvDebug(3,"link "+QString::number(i)); | 337 | pvDebug(3,"link "+QString::number(i)); |
329 | if ( to_remove.at(i)->link() ) | 338 | if ( to_remove.at(i)->link() ) |
330 | processFileList( fileList, to_remove.at(i)->dest() ); | 339 | processFileList( fileList, to_remove.at(i)->dest() ); |
331 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); | 340 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); |
332 | //if ( to_remove.at(i) ) to_remove.take( i ); | 341 | //if ( to_remove.at(i) ) to_remove.take( i ); |
333 | 342 | ||
334 | out("\n"); | 343 | out("\n"); |
335 | }else{ | 344 | }else{ |
336 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); | 345 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); |
337 | if ( to_remove.at(i)->link() ) | 346 | if ( to_remove.at(i)->link() ) |
338 | processFileList( fileList, to_remove.at(i)->dest() ); | 347 | processFileList( fileList, to_remove.at(i)->dest() ); |
339 | } | 348 | } |
340 | if ( to_remove.at(i)->link() ) | 349 | if ( to_remove.at(i)->link() ) |
341 | processFileList( fileList, to_remove.at(i)->dest() ); | 350 | processFileList( fileList, to_remove.at(i)->dest() ); |
342 | if ( to_remove.at(i)->link() )delete fileList; | 351 | if ( to_remove.at(i)->link() )delete fileList; |
343 | } | 352 | } |
344 | to_remove.clear(); | 353 | to_remove.clear(); |
345 | out("\n"); | 354 | out("\n"); |
346 | } | 355 | } |
347 | 356 | ||
348 | 357 | ||
349 | void PmIpkg::install() | 358 | void PmIpkg::install() |
350 | { | 359 | { |
351 | if ( to_install.count() == 0 ) return; | 360 | if ( to_install.count() == 0 ) return; |
352 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 361 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
353 | for (uint i=0; i < to_install.count(); i++) | 362 | for (uint i=0; i < to_install.count(); i++) |
354 | { | 363 | { |
355 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug | 364 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug |
356 | if (to_install.at(i)->link()) | 365 | if (to_install.at(i)->link()) |
357 | { | 366 | { |
358 | // hack to have package.list | 367 | // hack to have package.list |
359 | // in "dest"/usr/lib/ipkg/info/ | 368 | // in "dest"/usr/lib/ipkg/info/ |
360 | QString rds = settings->getDestinationUrlByName("root"); | 369 | QString rds = settings->getDestinationUrlByName("root"); |
361 | QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); | 370 | QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); |
362 | QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; | 371 | QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; |
363 | rds += listFile; | 372 | rds += listFile; |
364 | lds += listFile; | 373 | lds += listFile; |
365 | const char *rd = rds.latin1(); | 374 | const char *rd = rds.latin1(); |
366 | const char *ld = lds.latin1(); | 375 | const char *ld = lds.latin1(); |
367 | pvDebug(4, "linking: "+rds+" -> "+lds ); | 376 | pvDebug(4, "linking: "+rds+" -> "+lds ); |
368 | symlink( rd, ld ); | 377 | symlink( rd, ld ); |
369 | } | 378 | } |
370 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 379 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
371 | { | 380 | { |
372 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 381 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
373 | to_install.at(i)->processed(); | 382 | to_install.at(i)->processed(); |
374 | linkOpp = createLink; | 383 | linkOpp = createLink; |
375 | if ( to_install.at(i)->link() ) | 384 | if ( to_install.at(i)->link() ) |
376 | makeLinks( to_install.at(i) ); | 385 | makeLinks( to_install.at(i) ); |
377 | // to_install.take( i ); | 386 | // to_install.take( i ); |
378 | out("\n"); | 387 | out("\n"); |
379 | }else{ | 388 | }else{ |
380 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); | 389 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); |
381 | linkOpp = createLink; | 390 | linkOpp = createLink; |
382 | if ( to_install.at(i)->link() ) | 391 | if ( to_install.at(i)->link() ) |
383 | makeLinks( to_install.at(i) ); | 392 | makeLinks( to_install.at(i) ); |
384 | } | 393 | } |
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index 2c92348..28bc5dd 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,65 +1,74 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PMIPKG_H | 10 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 11 | #define PMIPKG_H |
3 | 12 | ||
4 | 13 | ||
5 | #include <opie/oprocess.h> | 14 | #include <opie/oprocess.h> |
6 | #include <qobject.h> | 15 | #include <qobject.h> |
7 | #include <qlist.h> | 16 | #include <qlist.h> |
8 | #include <qstring.h> | 17 | #include <qstring.h> |
9 | #include <qwidget.h> | 18 | #include <qwidget.h> |
10 | #include "pksettings.h" | 19 | #include "pksettings.h" |
11 | #include "runwindow.h" | 20 | #include "runwindow.h" |
12 | #include "packagelist.h" | 21 | #include "packagelist.h" |
13 | #include "installdialog.h" | 22 | #include "installdialog.h" |
14 | #include "debug.h" | 23 | #include "debug.h" |
15 | 24 | ||
16 | #define createLink 0 | 25 | #define createLink 0 |
17 | #define removeLink 1 | 26 | #define removeLink 1 |
18 | 27 | ||
19 | class Package; | 28 | class Package; |
20 | class PmIpkg : public QObject | 29 | class PmIpkg : public QObject |
21 | { | 30 | { |
22 | Q_OBJECT | 31 | Q_OBJECT |
23 | public: | 32 | public: |
24 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 33 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
25 | ~PmIpkg(); | 34 | ~PmIpkg(); |
26 | 35 | ||
27 | int linkOpp; | 36 | int linkOpp; |
28 | void loadList( PackageList* ); | 37 | void loadList( PackageList* ); |
29 | void commit(); | 38 | void commit(); |
30 | void update(); | 39 | void update(); |
31 | void show(); | 40 | void show(); |
32 | /** No descriptions */ | 41 | /** No descriptions */ |
33 | void clearLists(); | 42 | void clearLists(); |
34 | 43 | ||
35 | public slots: | 44 | public slots: |
36 | void doIt(); | 45 | void doIt(); |
37 | void install(); | 46 | void install(); |
38 | void remove(); | 47 | void remove(); |
39 | void installFile(const QString &fileName, const QString &dest=""); | 48 | void installFile(const QString &fileName, const QString &dest=""); |
40 | void removeFile(const QString &fileName, const QString &dest=""); | 49 | void removeFile(const QString &fileName, const QString &dest=""); |
41 | void createLinks( const QString &dest ); | 50 | void createLinks( const QString &dest ); |
42 | void removeLinks( const QString &dest ); | 51 | void removeLinks( const QString &dest ); |
43 | 52 | ||
44 | //private slots: | 53 | //private slots: |
45 | void getIpkgOutput(OProcess *proc, char *buffer, int buflen); | 54 | void getIpkgOutput(OProcess *proc, char *buffer, int buflen); |
46 | 55 | ||
47 | private: | 56 | private: |
48 | OProcess *ipkgProcess; | 57 | OProcess *ipkgProcess; |
49 | PackageManagerSettings* settings; | 58 | PackageManagerSettings* settings; |
50 | RunWindow *runwindow; | 59 | RunWindow *runwindow; |
51 | InstallDialog *installDialog; | 60 | InstallDialog *installDialog; |
52 | QList<Package> to_remove; | 61 | QList<Package> to_remove; |
53 | QList<Package> to_install; | 62 | QList<Package> to_install; |
54 | void makeLinks(Package*); | 63 | void makeLinks(Package*); |
55 | void linkPackage( QString, QString ); | 64 | void linkPackage( QString, QString ); |
56 | void processLinkDir( QString , QString ); | 65 | void processLinkDir( QString , QString ); |
57 | bool runIpkg(const QString& args, const QString& dest="" ); | 66 | bool runIpkg(const QString& args, const QString& dest="" ); |
58 | void out( QString ); | 67 | void out( QString ); |
59 | QStringList* getList( QString, QString ); | 68 | QStringList* getList( QString, QString ); |
60 | void processFileList( QStringList*, QString ); | 69 | void processFileList( QStringList*, QString ); |
61 | 70 | ||
62 | 71 | ||
63 | }; | 72 | }; |
64 | 73 | ||
65 | #endif | 74 | #endif |
diff --git a/noncore/unsupported/oipkg/settings.cpp b/noncore/unsupported/oipkg/settings.cpp index 85daa98..4bd60c0 100644 --- a/noncore/unsupported/oipkg/settings.cpp +++ b/noncore/unsupported/oipkg/settings.cpp | |||
@@ -1,384 +1,393 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #include "pksettings.h" | 10 | #include "pksettings.h" |
2 | 11 | ||
3 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
4 | #include <qcombobox.h> | 13 | #include <qcombobox.h> |
5 | #include <qfile.h> | 14 | #include <qfile.h> |
6 | #include <qlineedit.h> | 15 | #include <qlineedit.h> |
7 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
8 | #include <qlistbox.h> | 17 | #include <qlistbox.h> |
9 | #include <qcheckbox.h> | 18 | #include <qcheckbox.h> |
10 | #include <qstring.h> | 19 | #include <qstring.h> |
11 | #include <qobject.h> | 20 | #include <qobject.h> |
12 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
13 | #include <qtabwidget.h> | 22 | #include <qtabwidget.h> |
14 | 23 | ||
15 | 24 | ||
16 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) | 25 | PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) |
17 | : PackageManagerSettingsBase( parent, name, fl ) | 26 | : PackageManagerSettingsBase( parent, name, fl ) |
18 | { | 27 | { |
19 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); | 28 | connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); |
20 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); | 29 | connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); |
21 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 30 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
22 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); | 31 | connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); |
23 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); | 32 | connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); |
24 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 33 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
25 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), | 34 | // connect( CheckBoxLink, SIGNAL(toggled(bool)), |
26 | // activeLinkDestination, SLOT(setEnabled(bool)) ); | 35 | // activeLinkDestination, SLOT(setEnabled(bool)) ); |
27 | 36 | ||
28 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); | 37 | connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); |
29 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); | 38 | connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); |
30 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); | 39 | connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); |
31 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); | 40 | connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); |
32 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); | 41 | connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); |
33 | servername->setEnabled(FALSE); | 42 | servername->setEnabled(FALSE); |
34 | serverurl->setEnabled(FALSE); | 43 | serverurl->setEnabled(FALSE); |
35 | serverurlDic.setAutoDelete(TRUE); | 44 | serverurlDic.setAutoDelete(TRUE); |
36 | destinationname->setEnabled(FALSE); | 45 | destinationname->setEnabled(FALSE); |
37 | destinationurl->setEnabled(FALSE); | 46 | destinationurl->setEnabled(FALSE); |
38 | destinationurlDic.setAutoDelete(TRUE); | 47 | destinationurlDic.setAutoDelete(TRUE); |
39 | readSettings(); | 48 | readSettings(); |
40 | } | 49 | } |
41 | 50 | ||
42 | PackageManagerSettings::~PackageManagerSettings() | 51 | PackageManagerSettings::~PackageManagerSettings() |
43 | { | 52 | { |
44 | } | 53 | } |
45 | 54 | ||
46 | 55 | ||
47 | void PackageManagerSettings::newServer() | 56 | void PackageManagerSettings::newServer() |
48 | { | 57 | { |
49 | int i = servers->count(); | 58 | int i = servers->count(); |
50 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { | 59 | if ( servername->isEnabled() || serverurl->text().isEmpty() ) { |
51 | serverurlDic.insert(i,new QString("http://")); | 60 | serverurlDic.insert(i,new QString("http://")); |
52 | servers->insertItem(tr("New")); | 61 | servers->insertItem(tr("New")); |
53 | activeServers->insertItem(tr("New")); | 62 | activeServers->insertItem(tr("New")); |
54 | } else { | 63 | } else { |
55 | // allows one-level undo | 64 | // allows one-level undo |
56 | serverurlDic.insert(i,new QString(serverurl->text())); | 65 | serverurlDic.insert(i,new QString(serverurl->text())); |
57 | servers->insertItem(servername->text()); | 66 | servers->insertItem(servername->text()); |
58 | activeServers->insertItem(servername->text()); | 67 | activeServers->insertItem(servername->text()); |
59 | } | 68 | } |
60 | servers->setSelected(i,TRUE); | 69 | servers->setSelected(i,TRUE); |
61 | editServer(i); | 70 | editServer(i); |
62 | } | 71 | } |
63 | 72 | ||
64 | void PackageManagerSettings::newDestination() | 73 | void PackageManagerSettings::newDestination() |
65 | { | 74 | { |
66 | int i = destinations->count(); | 75 | int i = destinations->count(); |
67 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { | 76 | if ( destinationname->isEnabled() || destinationurl->text().isEmpty() ) { |
68 | destinationurlDic.insert(i,new QString("/")); | 77 | destinationurlDic.insert(i,new QString("/")); |
69 | destinations->insertItem(tr("New")); | 78 | destinations->insertItem(tr("New")); |
70 | activeDestination->insertItem(tr("New")); | 79 | activeDestination->insertItem(tr("New")); |
71 | activeLinkDestination->insertItem(tr("New")); | 80 | activeLinkDestination->insertItem(tr("New")); |
72 | } else { | 81 | } else { |
73 | // allows one-level undo | 82 | // allows one-level undo |
74 | destinationurlDic.insert(i,new QString(destinationurl->text())); | 83 | destinationurlDic.insert(i,new QString(destinationurl->text())); |
75 | destinations->insertItem(destinationname->text()); | 84 | destinations->insertItem(destinationname->text()); |
76 | activeDestination->insertItem(destinationname->text()); | 85 | activeDestination->insertItem(destinationname->text()); |
77 | activeLinkDestination->insertItem(destinationname->text()); | 86 | activeLinkDestination->insertItem(destinationname->text()); |
78 | } | 87 | } |
79 | destinations->setSelected(i,TRUE); | 88 | destinations->setSelected(i,TRUE); |
80 | editDestination(i); | 89 | editDestination(i); |
81 | } | 90 | } |
82 | 91 | ||
83 | 92 | ||
84 | void PackageManagerSettings::editServer(int i) | 93 | void PackageManagerSettings::editServer(int i) |
85 | { | 94 | { |
86 | if ( servername->isEnabled() ) { | 95 | if ( servername->isEnabled() ) { |
87 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 96 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
88 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 97 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
89 | } else { | 98 | } else { |
90 | servername->setEnabled(TRUE); | 99 | servername->setEnabled(TRUE); |
91 | serverurl->setEnabled(TRUE); | 100 | serverurl->setEnabled(TRUE); |
92 | } | 101 | } |
93 | 102 | ||
94 | servername->setText( servers->text(i) ); | 103 | servername->setText( servers->text(i) ); |
95 | serverurl->setText( *serverurlDic[i] ); | 104 | serverurl->setText( *serverurlDic[i] ); |
96 | 105 | ||
97 | editedserver = i; | 106 | editedserver = i; |
98 | 107 | ||
99 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 108 | connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
100 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 109 | connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
101 | } | 110 | } |
102 | 111 | ||
103 | 112 | ||
104 | void PackageManagerSettings::editDestination(int i) | 113 | void PackageManagerSettings::editDestination(int i) |
105 | { | 114 | { |
106 | if ( destinationname->isEnabled() ) { | 115 | if ( destinationname->isEnabled() ) { |
107 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 116 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
108 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 117 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
109 | } else { | 118 | } else { |
110 | destinationname->setEnabled(TRUE); | 119 | destinationname->setEnabled(TRUE); |
111 | destinationurl->setEnabled(TRUE); | 120 | destinationurl->setEnabled(TRUE); |
112 | } | 121 | } |
113 | 122 | ||
114 | destinationname->setText( destinations->text(i) ); | 123 | destinationname->setText( destinations->text(i) ); |
115 | destinationurl->setText( *destinationurlDic[i] ); | 124 | destinationurl->setText( *destinationurlDic[i] ); |
116 | 125 | ||
117 | editeddestination = i; | 126 | editeddestination = i; |
118 | 127 | ||
119 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 128 | connect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
120 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 129 | connect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
121 | } | 130 | } |
122 | 131 | ||
123 | void PackageManagerSettings::removeServer() | 132 | void PackageManagerSettings::removeServer() |
124 | { | 133 | { |
125 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); | 134 | disconnect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) ); |
126 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); | 135 | disconnect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) ); |
127 | servername->setText(servers->text(editedserver)); | 136 | servername->setText(servers->text(editedserver)); |
128 | serverurl->setText(*serverurlDic[editedserver]); | 137 | serverurl->setText(*serverurlDic[editedserver]); |
129 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 138 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
130 | servers->removeItem(editedserver); | 139 | servers->removeItem(editedserver); |
131 | activeServers->removeItem(editedserver); | 140 | activeServers->removeItem(editedserver); |
132 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 141 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
133 | servername->setEnabled(FALSE); | 142 | servername->setEnabled(FALSE); |
134 | serverurl->setEnabled(FALSE); | 143 | serverurl->setEnabled(FALSE); |
135 | } | 144 | } |
136 | 145 | ||
137 | void PackageManagerSettings::removeDestination() | 146 | void PackageManagerSettings::removeDestination() |
138 | { | 147 | { |
139 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); | 148 | disconnect( destinationname, SIGNAL(textChanged(const QString&)), this, SLOT(destNameChanged(const QString&)) ); |
140 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); | 149 | disconnect( destinationurl, SIGNAL(textChanged(const QString&)), this, SLOT(destUrlChanged(const QString&)) ); |
141 | destinationname->setText(destinations->text(editedserver)); | 150 | destinationname->setText(destinations->text(editedserver)); |
142 | destinationurl->setText(*destinationurlDic[editedserver]); | 151 | destinationurl->setText(*destinationurlDic[editedserver]); |
143 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 152 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
144 | destinations->removeItem(editeddestination); | 153 | destinations->removeItem(editeddestination); |
145 | activeDestination->removeItem(editeddestination); | 154 | activeDestination->removeItem(editeddestination); |
146 | activeLinkDestination->removeItem(editeddestination); | 155 | activeLinkDestination->removeItem(editeddestination); |
147 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 156 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
148 | destinationname->setEnabled(FALSE); | 157 | destinationname->setEnabled(FALSE); |
149 | destinationurl->setEnabled(FALSE); | 158 | destinationurl->setEnabled(FALSE); |
150 | } | 159 | } |
151 | 160 | ||
152 | void PackageManagerSettings::serverNameChanged(const QString& t) | 161 | void PackageManagerSettings::serverNameChanged(const QString& t) |
153 | { | 162 | { |
154 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 163 | disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
155 | servers->changeItem( t, editedserver ); | 164 | servers->changeItem( t, editedserver ); |
156 | activeServers->changeItem( t, editedserver ); | 165 | activeServers->changeItem( t, editedserver ); |
157 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); | 166 | connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); |
158 | } | 167 | } |
159 | 168 | ||
160 | void PackageManagerSettings::destNameChanged(const QString& t) | 169 | void PackageManagerSettings::destNameChanged(const QString& t) |
161 | { | 170 | { |
162 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 171 | disconnect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
163 | destinations->changeItem( t, editeddestination ); | 172 | destinations->changeItem( t, editeddestination ); |
164 | activeDestination->changeItem( t, editeddestination ); | 173 | activeDestination->changeItem( t, editeddestination ); |
165 | activeLinkDestination->changeItem( t, editeddestination ); | 174 | activeLinkDestination->changeItem( t, editeddestination ); |
166 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); | 175 | connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); |
167 | } | 176 | } |
168 | 177 | ||
169 | void PackageManagerSettings::serverUrlChanged(const QString& t) | 178 | void PackageManagerSettings::serverUrlChanged(const QString& t) |
170 | { | 179 | { |
171 | serverurlDic.replace(editedserver, new QString(t)); | 180 | serverurlDic.replace(editedserver, new QString(t)); |
172 | } | 181 | } |
173 | 182 | ||
174 | void PackageManagerSettings::destUrlChanged(const QString& t) | 183 | void PackageManagerSettings::destUrlChanged(const QString& t) |
175 | { | 184 | { |
176 | destinationurlDic.replace(editeddestination, new QString(t)); | 185 | destinationurlDic.replace(editeddestination, new QString(t)); |
177 | } | 186 | } |
178 | 187 | ||
179 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) | 188 | void PackageManagerSettings::writeIpkgConfig(const QString& conffile) |
180 | { | 189 | { |
181 | QFile conf(conffile); | 190 | QFile conf(conffile); |
182 | if ( ! conf.open(IO_WriteOnly) ) return; | 191 | if ( ! conf.open(IO_WriteOnly) ) return; |
183 | QTextStream s(&conf); | 192 | QTextStream s(&conf); |
184 | s << "# "+tr("Written by Opie Package Manager")+"\n"; | 193 | s << "# "+tr("Written by Opie Package Manager")+"\n"; |
185 | for (int i=0; i<(int)activeServers->count(); i++) | 194 | for (int i=0; i<(int)activeServers->count(); i++) |
186 | { | 195 | { |
187 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); | 196 | QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); |
188 | if ( !activeServers->isSelected(i) ) | 197 | if ( !activeServers->isSelected(i) ) |
189 | s << "#"; | 198 | s << "#"; |
190 | s << "src " << activeServers->text(i) << " " << url << "\n"; | 199 | s << "src " << activeServers->text(i) << " " << url << "\n"; |
191 | } | 200 | } |
192 | for (int i=0; i<(int)destinations->count(); i++) | 201 | for (int i=0; i<(int)destinations->count(); i++) |
193 | { | 202 | { |
194 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); | 203 | QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); |
195 | s << "dest " << destinations->text(i) << " " << url << "\n"; | 204 | s << "dest " << destinations->text(i) << " " << url << "\n"; |
196 | } | 205 | } |
197 | conf.close(); | 206 | conf.close(); |
198 | } | 207 | } |
199 | 208 | ||
200 | 209 | ||
201 | void PackageManagerSettings::readInstallationSettings() | 210 | void PackageManagerSettings::readInstallationSettings() |
202 | { | 211 | { |
203 | Config cfg( "oipkg", Config::User ); | 212 | Config cfg( "oipkg", Config::User ); |
204 | cfg.setGroup( "Settings" ); | 213 | cfg.setGroup( "Settings" ); |
205 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); | 214 | installationSettingsCount = cfg.readNumEntry( "count", -1 ); |
206 | currentSetting = cfg.readNumEntry( "current", 0 ); | 215 | currentSetting = cfg.readNumEntry( "current", 0 ); |
207 | 216 | ||
208 | for (int i = 0; i < installationSettingsCount; i++) | 217 | for (int i = 0; i < installationSettingsCount; i++) |
209 | { | 218 | { |
210 | cfg.setGroup( "Setting_" + QString::number(i) ); | 219 | cfg.setGroup( "Setting_" + QString::number(i) ); |
211 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); | 220 | settingName->insertItem( cfg.readEntry( "name", "???" ), i ); |
212 | }; | 221 | }; |
213 | readInstallationSetting( currentSetting ); | 222 | readInstallationSetting( currentSetting ); |
214 | } | 223 | } |
215 | 224 | ||
216 | 225 | ||
217 | void PackageManagerSettings::removeInstallationSetting() | 226 | void PackageManagerSettings::removeInstallationSetting() |
218 | { | 227 | { |
219 | settingName->removeItem( settingName->currentItem() ); | 228 | settingName->removeItem( settingName->currentItem() ); |
220 | Config cfg( "oipkg", Config::User ); | 229 | Config cfg( "oipkg", Config::User ); |
221 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); | 230 | cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); |
222 | cfg.clearGroup(); | 231 | cfg.clearGroup(); |
223 | installationSettingsCount--; | 232 | installationSettingsCount--; |
224 | settingName->setEditable( false ); | 233 | settingName->setEditable( false ); |
225 | } | 234 | } |
226 | 235 | ||
227 | void PackageManagerSettings::newInstallationSetting() | 236 | void PackageManagerSettings::newInstallationSetting() |
228 | { | 237 | { |
229 | installationSettingsCount++; | 238 | installationSettingsCount++; |
230 | settingName->insertItem( "New", installationSettingsCount ); | 239 | settingName->insertItem( "New", installationSettingsCount ); |
231 | settingName->setCurrentItem( installationSettingsCount ); | 240 | settingName->setCurrentItem( installationSettingsCount ); |
232 | settingName->setEditable( true ); | 241 | settingName->setEditable( true ); |
233 | } | 242 | } |
234 | 243 | ||
235 | void PackageManagerSettings::installationSettingChange(int cs) | 244 | void PackageManagerSettings::installationSettingChange(int cs) |
236 | { | 245 | { |
237 | writeCurrentInstallationSetting(); | 246 | writeCurrentInstallationSetting(); |
238 | currentSetting = cs; | 247 | currentSetting = cs; |
239 | readInstallationSetting( cs ); | 248 | readInstallationSetting( cs ); |
240 | } | 249 | } |
241 | 250 | ||
242 | void PackageManagerSettings::writeInstallationSettings() | 251 | void PackageManagerSettings::writeInstallationSettings() |
243 | { | 252 | { |
244 | { | 253 | { |
245 | Config cfg( "oipkg", Config::User ); | 254 | Config cfg( "oipkg", Config::User ); |
246 | cfg.setGroup( "Settings" ); | 255 | cfg.setGroup( "Settings" ); |
247 | cfg.writeEntry( "count", installationSettingsCount ); | 256 | cfg.writeEntry( "count", installationSettingsCount ); |
248 | cfg.writeEntry( "current", currentSetting ); | 257 | cfg.writeEntry( "current", currentSetting ); |
249 | writeCurrentInstallationSetting(); | 258 | writeCurrentInstallationSetting(); |
250 | } | 259 | } |
251 | } | 260 | } |
252 | 261 | ||
253 | 262 | ||
254 | void PackageManagerSettings::readInstallationSetting(int setting) | 263 | void PackageManagerSettings::readInstallationSetting(int setting) |
255 | { | 264 | { |
256 | if ( setting < 0 ) return; | 265 | if ( setting < 0 ) return; |
257 | Config cfg( "oipkg", Config::User ); | 266 | Config cfg( "oipkg", Config::User ); |
258 | cfg.setGroup( "Setting_" + QString::number( setting ) ); | 267 | cfg.setGroup( "Setting_" + QString::number( setting ) ); |
259 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); | 268 | CheckBoxLink->setChecked( cfg.readBoolEntry( "link", false ) ); |
260 | QString dest = cfg.readEntry( "dest" ); | 269 | QString dest = cfg.readEntry( "dest" ); |
261 | QString linkdest = cfg.readEntry( "linkdest" ); | 270 | QString linkdest = cfg.readEntry( "linkdest" ); |
262 | 271 | ||
263 | for ( int i = 0; i < activeDestination->count(); i++) | 272 | for ( int i = 0; i < activeDestination->count(); i++) |
264 | { | 273 | { |
265 | QString name = cfg.readEntry( "name" ); | 274 | QString name = cfg.readEntry( "name" ); |
266 | if ( activeDestination->text( i ) == name ) | 275 | if ( activeDestination->text( i ) == name ) |
267 | activeDestination->setCurrentItem( i ); | 276 | activeDestination->setCurrentItem( i ); |
268 | if ( activeLinkDestination->text( i ) == name ) | 277 | if ( activeLinkDestination->text( i ) == name ) |
269 | activeLinkDestination->setCurrentItem( i ); | 278 | activeLinkDestination->setCurrentItem( i ); |
270 | } | 279 | } |
271 | } | 280 | } |
272 | 281 | ||
273 | void PackageManagerSettings::writeCurrentInstallationSetting() | 282 | void PackageManagerSettings::writeCurrentInstallationSetting() |
274 | { | 283 | { |
275 | Config cfg( "oipkg", Config::User ); | 284 | Config cfg( "oipkg", Config::User ); |
276 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); | 285 | cfg.setGroup( "Setting_" + QString::number(currentSetting) ); |
277 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); | 286 | cfg.writeEntry( "link", CheckBoxLink->isChecked() ); |
278 | cfg.writeEntry( "dest", getDestinationName() ); | 287 | cfg.writeEntry( "dest", getDestinationName() ); |
279 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); | 288 | cfg.writeEntry( "linkdest" , getLinkDestinationName() ); |
280 | QStringList sers = getActiveServers(); | 289 | QStringList sers = getActiveServers(); |
281 | int srvc = 0; | 290 | int srvc = 0; |
282 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { | 291 | for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { |
283 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); | 292 | cfg.writeEntry( "server_" + QString::number(srvc++), *it ); |
284 | } | 293 | } |
285 | cfg.writeEntry( "server_count", srvc ); | 294 | cfg.writeEntry( "server_count", srvc ); |
286 | } | 295 | } |
287 | 296 | ||
288 | void PackageManagerSettings::renameInstallationSetting() | 297 | void PackageManagerSettings::renameInstallationSetting() |
289 | { | 298 | { |
290 | settingName->setEditable( true ); | 299 | settingName->setEditable( true ); |
291 | } | 300 | } |
292 | 301 | ||
293 | void PackageManagerSettings::installationSettingSetName(const QString &name) | 302 | void PackageManagerSettings::installationSettingSetName(const QString &name) |
294 | { | 303 | { |
295 | settingName->changeItem( name, settingName->currentItem() ); | 304 | settingName->changeItem( name, settingName->currentItem() ); |
296 | } | 305 | } |
297 | 306 | ||
298 | 307 | ||
299 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) | 308 | bool PackageManagerSettings::readIpkgConfig(const QString& conffile) |
300 | { | 309 | { |
301 | QFile conf(conffile); | 310 | QFile conf(conffile); |
302 | if ( conf.open(IO_ReadOnly) ) { | 311 | if ( conf.open(IO_ReadOnly) ) { |
303 | QTextStream s(&conf); | 312 | QTextStream s(&conf); |
304 | servers->clear(); | 313 | servers->clear(); |
305 | activeServers->clear(); | 314 | activeServers->clear(); |
306 | activeDestination->clear(); | 315 | activeDestination->clear(); |
307 | activeLinkDestination->clear(); | 316 | activeLinkDestination->clear(); |
308 | serverurlDic.clear(); | 317 | serverurlDic.clear(); |
309 | destinationurlDic.clear(); | 318 | destinationurlDic.clear(); |
310 | ipkg_old=0; | 319 | ipkg_old=0; |
311 | int currentserver=0; | 320 | int currentserver=0; |
312 | while ( !s.atEnd() ) { | 321 | while ( !s.atEnd() ) { |
313 | QString l = s.readLine(); | 322 | QString l = s.readLine(); |
314 | QStringList token = QStringList::split(' ', l); | 323 | QStringList token = QStringList::split(' ', l); |
315 | if ( token[0] == "src" || token[0] == "#src" ) { | 324 | if ( token[0] == "src" || token[0] == "#src" ) { |
316 | currentserver=servers->count(); | 325 | currentserver=servers->count(); |
317 | serverurlDic.insert(servers->count(),new QString(token[2])); | 326 | serverurlDic.insert(servers->count(),new QString(token[2])); |
318 | int a = token[0] == "src" ? 1 : 0; | 327 | int a = token[0] == "src" ? 1 : 0; |
319 | int i = servers->count(); | 328 | int i = servers->count(); |
320 | servers->insertItem(token[1]); | 329 | servers->insertItem(token[1]); |
321 | activeServers->insertItem( token[1] ); | 330 | activeServers->insertItem( token[1] ); |
322 | activeServers->setSelected(i,a); | 331 | activeServers->setSelected(i,a); |
323 | } else if ( token[0] == "dest" ) { | 332 | } else if ( token[0] == "dest" ) { |
324 | currentserver=destinations->count(); | 333 | currentserver=destinations->count(); |
325 | destinationurlDic.insert(destinations->count(),new QString(token[2])); | 334 | destinationurlDic.insert(destinations->count(),new QString(token[2])); |
326 | destinations->insertItem(token[1]); | 335 | destinations->insertItem(token[1]); |
327 | activeDestination->insertItem( token[1] ); | 336 | activeDestination->insertItem( token[1] ); |
328 | activeLinkDestination->insertItem( token[1] ); | 337 | activeLinkDestination->insertItem( token[1] ); |
329 | 338 | ||
330 | } else if ( token[0] == "option" ) { | 339 | } else if ( token[0] == "option" ) { |
331 | } else { | 340 | } else { |
332 | // Old style? | 341 | // Old style? |
333 | int eq = l.find('='); | 342 | int eq = l.find('='); |
334 | if ( eq >= 0 ) { | 343 | if ( eq >= 0 ) { |
335 | QString v = l.mid(eq+1).stripWhiteSpace(); | 344 | QString v = l.mid(eq+1).stripWhiteSpace(); |
336 | if ( v[0] == '"' || v[0] == '\'' ) { | 345 | if ( v[0] == '"' || v[0] == '\'' ) { |
337 | int cl=v.find(v[0],1); | 346 | int cl=v.find(v[0],1); |
338 | if ( cl >= 0 ) | 347 | if ( cl >= 0 ) |
339 | v = v.mid(1,cl-1); | 348 | v = v.mid(1,cl-1); |
340 | } | 349 | } |
341 | if ( l.left(12) == "IPKG_SOURCE=" ) { | 350 | if ( l.left(12) == "IPKG_SOURCE=" ) { |
342 | ipkg_old=1; | 351 | ipkg_old=1; |
343 | currentserver=servers->count(); | 352 | currentserver=servers->count(); |
344 | serverurlDic.insert(servers->count(),new QString(v)); | 353 | serverurlDic.insert(servers->count(),new QString(v)); |
345 | servers->insertItem(v); | 354 | servers->insertItem(v); |
346 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { | 355 | } else if ( l.left(13) == "#IPKG_SOURCE=" ) { |
347 | serverurlDic.insert(servers->count(),new QString(v)); | 356 | serverurlDic.insert(servers->count(),new QString(v)); |
348 | servers->insertItem(v); | 357 | servers->insertItem(v); |
349 | } else if ( l.left(10) == "IPKG_ROOT=" ) { | 358 | } else if ( l.left(10) == "IPKG_ROOT=" ) { |
350 | 359 | ||
351 | } | 360 | } |
352 | } | 361 | } |
353 | } | 362 | } |
354 | } | 363 | } |
355 | if ( ipkg_old ) { | 364 | if ( ipkg_old ) { |
356 | servers->setSelectionMode(QListBox::Single); | 365 | servers->setSelectionMode(QListBox::Single); |
357 | servers->setSelected(currentserver,TRUE); | 366 | servers->setSelected(currentserver,TRUE); |
358 | } | 367 | } |
359 | return TRUE; | 368 | return TRUE; |
360 | } else { | 369 | } else { |
361 | return FALSE; | 370 | return FALSE; |
362 | } | 371 | } |
363 | } | 372 | } |
364 | 373 | ||
365 | void PackageManagerSettings::readSettings() | 374 | void PackageManagerSettings::readSettings() |
366 | { | 375 | { |
367 | readIpkgConfig("/etc/ipkg.conf"); | 376 | readIpkgConfig("/etc/ipkg.conf"); |
368 | readInstallationSettings(); | 377 | readInstallationSettings(); |
369 | } | 378 | } |
370 | 379 | ||
371 | void PackageManagerSettings::writeSettings() | 380 | void PackageManagerSettings::writeSettings() |
372 | { | 381 | { |
373 | writeIpkgConfig("/etc/ipkg.conf"); | 382 | writeIpkgConfig("/etc/ipkg.conf"); |
374 | writeInstallationSettings(); | 383 | writeInstallationSettings(); |
375 | } | 384 | } |
376 | 385 | ||
377 | bool PackageManagerSettings::showDialog( int i ) | 386 | bool PackageManagerSettings::showDialog( int i ) |
378 | { | 387 | { |
379 | TabWidget->setCurrentPage( i ); | 388 | TabWidget->setCurrentPage( i ); |
380 | showMaximized(); | 389 | showMaximized(); |
381 | bool ret = exec(); | 390 | bool ret = exec(); |
382 | if ( ret ) writeSettings(); | 391 | if ( ret ) writeSettings(); |
383 | else readSettings(); | 392 | else readSettings(); |
384 | return ret; | 393 | return ret; |
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h index 9cb7a9b..44459b2 100644 --- a/noncore/unsupported/oipkg/settings.h +++ b/noncore/unsupported/oipkg/settings.h | |||
@@ -1,67 +1,75 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * This program is free software; you can redistribute it and/or modify * | ||
4 | * it under the terms of the GNU General Public License as published by * | ||
5 | * the Free Software Foundation; either version 2 of the License, or * | ||
6 | * (at your option) any later version. * | ||
7 | * * | ||
8 | ***************************************************************************/ | ||
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | ||
1 | #ifndef PACKAGEMANAGERSETTINGS_H | 10 | #ifndef PACKAGEMANAGERSETTINGS_H |
2 | #define PACKAGEMANAGERSETTINGS_H | 11 | #define PACKAGEMANAGERSETTINGS_H |
3 | 12 | ||
4 | #include "pksettingsbase.h" | 13 | #include "pksettingsbase.h" |
5 | #include <qintdict.h> | 14 | #include <qintdict.h> |
6 | 15 | ||
7 | 16 | ||
8 | class PackageManagerSettings : public PackageManagerSettingsBase | 17 | class PackageManagerSettings : public PackageManagerSettingsBase |
9 | //class PackageManagerSettings : private PackageManagerSettingsBase | ||
10 | { | 18 | { |
11 | Q_OBJECT | 19 | Q_OBJECT |
12 | public: | 20 | public: |
13 | PackageManagerSettings( QWidget* , const char* , WFlags ); | 21 | PackageManagerSettings( QWidget* , const char* , WFlags ); |
14 | ~PackageManagerSettings(); | 22 | ~PackageManagerSettings(); |
15 | 23 | ||
16 | bool showDialog( int ) ; | 24 | bool showDialog( int ) ; |
17 | QString getDestinationUrl(); | 25 | QString getDestinationUrl(); |
18 | QString getDestinationName(); | 26 | QString getDestinationName(); |
19 | QString getLinkDestinationName(); | 27 | QString getLinkDestinationName(); |
20 | bool createLinks(); | 28 | bool createLinks(); |
21 | QStringList getActiveServers(); | 29 | QStringList getActiveServers(); |
22 | QStringList getDestinationUrls(); | 30 | QStringList getDestinationUrls(); |
23 | 31 | ||
24 | public slots: /** No descriptions */ | 32 | public slots: /** No descriptions */ |
25 | void createLinks(); | 33 | void createLinks(); |
26 | void removeLinks(); | 34 | void removeLinks(); |
27 | void writeInstallationSettings(); | 35 | void writeInstallationSettings(); |
28 | void readInstallationSettings(); | 36 | void readInstallationSettings(); |
29 | void writeCurrentInstallationSetting(); | 37 | void writeCurrentInstallationSetting(); |
30 | void readInstallationSetting(int); | 38 | void readInstallationSetting(int); |
31 | void installationSettingSetName(const QString &); | 39 | void installationSettingSetName(const QString &); |
32 | void activeDestinationChange(int) | 40 | void activeDestinationChange(int) |
33 | void newServer(); | 41 | void newServer(); |
34 | void editServer(int); | 42 | void editServer(int); |
35 | void removeDestination(); | 43 | void removeDestination(); |
36 | void newDestination(); | 44 | void newDestination(); |
37 | void editDestination(int); | 45 | void editDestination(int); |
38 | void linkEnabled(bool); | 46 | void linkEnabled(bool); |
39 | void removeServer(); | 47 | void removeServer(); |
40 | void serverNameChanged(const QString&); | 48 | void serverNameChanged(const QString&); |
41 | void serverUrlChanged(const QString&); | 49 | void serverUrlChanged(const QString&); |
42 | void destNameChanged(const QString&); | 50 | void destNameChanged(const QString&); |
43 | void destUrlChanged(const QString&); | 51 | void destUrlChanged(const QString&); |
44 | void installationSettingChange(int); | 52 | void installationSettingChange(int); |
45 | void newInstallationSetting(); | 53 | void newInstallationSetting(); |
46 | void removeInstallationSetting(); | 54 | void removeInstallationSetting(); |
47 | void renameInstallationSetting(); | 55 | void renameInstallationSetting(); |
48 | 56 | ||
49 | private: | 57 | private: |
50 | QIntDict<QString> serverurlDic; | 58 | QIntDict<QString> serverurlDic; |
51 | QIntDict<QString> destinationurlDic; | 59 | QIntDict<QString> destinationurlDic; |
52 | int ipkg_old; | 60 | int ipkg_old; |
53 | int editedserver; | 61 | int editedserver; |
54 | int editeddestination; | 62 | int editeddestination; |
55 | int currentSetting; | 63 | int currentSetting; |
56 | int installationSettingsCount; | 64 | int installationSettingsCount; |
57 | bool changed; | 65 | bool changed; |
58 | bool serverChanged; | 66 | bool serverChanged; |
59 | 67 | ||
60 | bool readIpkgConfig(const QString&); | 68 | bool readIpkgConfig(const QString&); |
61 | void writeIpkgConfig(const QString&); | 69 | void writeIpkgConfig(const QString&); |
62 | void writeSettings(); | 70 | void writeSettings(); |
63 | void readSettings(); | 71 | void readSettings(); |
64 | }; | 72 | }; |
65 | 73 | ||
66 | #endif | 74 | #endif |
67 | 75 | ||