-rw-r--r-- | noncore/unsupported/oipkg/installdialog.cpp | 17 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 2 |
3 files changed, 16 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp index c676e84..fd93ad3 100644 --- a/noncore/unsupported/oipkg/installdialog.cpp +++ b/noncore/unsupported/oipkg/installdialog.cpp | |||
@@ -14,95 +14,104 @@ | |||
14 | #include <qheader.h> | 14 | #include <qheader.h> |
15 | #include <qlistview.h> | 15 | #include <qlistview.h> |
16 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qvariant.h> | 18 | #include <qvariant.h> |
19 | #include <qtooltip.h> | 19 | #include <qtooltip.h> |
20 | #include <qwhatsthis.h> | 20 | #include <qwhatsthis.h> |
21 | 21 | ||
22 | 22 | ||
23 | 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 ) |
24 | : QDialog( parent, name, modal, fl ) | 24 | : QDialog( parent, name, modal, fl ) |
25 | { | 25 | { |
26 | settings = s; | 26 | settings = s; |
27 | if ( !name ) | 27 | if ( !name ) |
28 | setName( "InstallDialog" ); | 28 | setName( "InstallDialog" ); |
29 | resize( 223, 269 ); | 29 | resize( 223, 269 ); |
30 | setCaption( tr( "Install" ) ); | 30 | setCaption( tr( "Install" ) ); |
31 | InstallDialogLayout = new QGridLayout( this ); | 31 | InstallDialogLayout = new QGridLayout( this ); |
32 | InstallDialogLayout->setSpacing( 2 ); | 32 | InstallDialogLayout->setSpacing( 2 ); |
33 | InstallDialogLayout->setMargin( 2 ); | 33 | InstallDialogLayout->setMargin( 2 ); |
34 | 34 | ||
35 | ListViewPackages = new PackageListView( this,"listViewPackages",settings ); | 35 | ListViewPackages = new PackageListView( this,"listViewPackages",settings ); |
36 | 36 | ||
37 | InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); | 37 | InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); |
38 | 38 | ||
39 | GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); | 39 | GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); |
40 | GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); | 40 | GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); |
41 | GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); | 41 | GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); |
42 | GroupBoxOptions->layout()->setSpacing( 0 ); | 42 | GroupBoxOptions->layout()->setSpacing( 0 ); |
43 | GroupBoxOptions->layout()->setMargin( 0 ); | 43 | GroupBoxOptions->layout()->setMargin( 0 ); |
44 | GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); | 44 | GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); |
45 | GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); | 45 | GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); |
46 | GroupBoxOptionsLayout->setSpacing( 2 ); | 46 | GroupBoxOptionsLayout->setSpacing( 0 ); |
47 | GroupBoxOptionsLayout->setMargin( 2 ); | 47 | GroupBoxOptionsLayout->setMargin( 0 ); |
48 | 48 | ||
49 | _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); | 49 | _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); |
50 | QFont _force_depends_font( _force_depends->font() ); | 50 | QFont _force_depends_font( _force_depends->font() ); |
51 | _force_depends_font.setPointSize( 8 ); | 51 | _force_depends_font.setPointSize( 8 ); |
52 | _force_depends->setFont( _force_depends_font ); | 52 | _force_depends->setFont( _force_depends_font ); |
53 | _force_depends->setText( tr( "-force-depends" ) ); | 53 | _force_depends->setText( tr( "-force-depends" ) ); |
54 | //_force_depends->setChecked( true ); | 54 | //_force_depends->setChecked( true ); |
55 | 55 | ||
56 | GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); | 56 | GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); |
57 | 57 | ||
58 | _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); | 58 | _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); |
59 | QFont _force_reinstall_font( _force_reinstall->font() ); | 59 | QFont _force_reinstall_font( _force_reinstall->font() ); |
60 | _force_reinstall_font.setPointSize( 8 ); | 60 | _force_reinstall_font.setPointSize( 8 ); |
61 | _force_reinstall->setFont( _force_reinstall_font ); | 61 | _force_reinstall->setFont( _force_reinstall_font ); |
62 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | 62 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
63 | 63 | ||
64 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); | 64 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); |
65 | 65 | ||
66 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); | 66 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); |
67 | QFont _force_remove_font( _force_remove->font() ); | 67 | QFont _force_remove_font( _force_remove->font() ); |
68 | _force_remove_font.setPointSize( 8 ); | 68 | _force_remove_font.setPointSize( 8 ); |
69 | _force_remove->setFont( _force_remove_font ); | 69 | _force_remove->setFont( _force_remove_font ); |
70 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | 70 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
71 | 71 | ||
72 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); | 72 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); |
73 | 73 | ||
74 | _force_overwrite = new QCheckBox( GroupBoxOptions, "_force_overwrite" ); | ||
75 | QFont _force_overwrite_font( _force_overwrite->font() ); | ||
76 | _force_overwrite_font.setPointSize( 8 ); | ||
77 | _force_overwrite->setFont( _force_overwrite_font ); | ||
78 | _force_overwrite->setText( tr( "-force-overwrite" ) ); | ||
79 | |||
80 | GroupBoxOptionsLayout->addWidget(_force_overwrite, 3, 0 ); | ||
81 | |||
74 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); | 82 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); |
75 | toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); | 83 | toRemoveItem = new QCheckListItem( ListViewPackages, tr("To remove") ); |
76 | toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); | 84 | toInstallItem = new QCheckListItem( ListViewPackages, tr("To install") ); |
77 | 85 | ||
78 | } | 86 | } |
79 | 87 | ||
80 | /* | 88 | /* |
81 | * Destroys the object and frees any allocated resources | 89 | * Destroys the object and frees any allocated resources |
82 | */ | 90 | */ |
83 | InstallDialog::~InstallDialog() | 91 | InstallDialog::~InstallDialog() |
84 | { | 92 | { |
85 | // no need to delete child widgets, Qt does it all for us | 93 | // no need to delete child widgets, Qt does it all for us |
86 | } | 94 | } |
87 | 95 | ||
88 | /* | 96 | /* |
89 | * Main event handler. Reimplemented to handle application | 97 | * Main event handler. Reimplemented to handle application |
90 | * font changes | 98 | * font changes |
91 | */ | 99 | */ |
92 | bool InstallDialog::event( QEvent* ev ) | 100 | bool InstallDialog::event( QEvent* ev ) |
93 | { | 101 | { |
94 | bool ret = QDialog::event( ev ); | 102 | bool ret = QDialog::event( ev ); |
95 | if ( ev->type() == QEvent::ApplicationFontChange ) { | 103 | if ( ev->type() == QEvent::ApplicationFontChange ) { |
96 | QFont _force_depends_font( _force_depends->font() ); | 104 | QFont _force_depends_font( _force_depends->font() ); |
97 | _force_depends_font.setPointSize( 8 ); | 105 | _force_depends_font.setPointSize( 8 ); |
98 | _force_depends->setFont( _force_depends_font ); | 106 | _force_depends->setFont( _force_depends_font ); |
99 | QFont _force_reinstall_font( _force_reinstall->font() ); | 107 | QFont _force_reinstall_font( _force_reinstall->font() ); |
100 | _force_reinstall_font.setPointSize( 8 ); | 108 | _force_reinstall_font.setPointSize( 8 ); |
101 | _force_reinstall->setFont( _force_reinstall_font ); | 109 | _force_reinstall->setFont( _force_reinstall_font ); |
102 | QFont _force_remove_font( _force_remove->font() ); | 110 | QFont _force_remove_font( _force_remove->font() ); |
111 | QFont _force_overwrite_font( _force_overwrite->font() ); | ||
103 | _force_remove_font.setPointSize( 8 ); | 112 | _force_remove_font.setPointSize( 8 ); |
104 | _force_remove->setFont( _force_remove_font ); | 113 | _force_remove->setFont( _force_remove_font ); |
105 | } | 114 | } |
106 | return ret; | 115 | return ret; |
107 | } | 116 | } |
108 | 117 | ||
diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h index 828c8df..d3510ff 100644 --- a/noncore/unsupported/oipkg/installdialog.h +++ b/noncore/unsupported/oipkg/installdialog.h | |||
@@ -6,45 +6,46 @@ | |||
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
10 | 10 | ||
11 | 11 | ||
12 | #ifndef INSTALLDIALOG_H | 12 | #ifndef INSTALLDIALOG_H |
13 | #define INSTALLDIALOG_H | 13 | #define INSTALLDIALOG_H |
14 | 14 | ||
15 | #include "pksettings.h" | 15 | #include "pksettings.h" |
16 | #include "packagelistview.h" | 16 | #include "packagelistview.h" |
17 | #include <qvariant.h> | 17 | #include <qvariant.h> |
18 | #include <qdialog.h> | 18 | #include <qdialog.h> |
19 | class QVBoxLayout; | 19 | class QVBoxLayout; |
20 | class QHBoxLayout; | 20 | class QHBoxLayout; |
21 | class QGridLayout; | 21 | class QGridLayout; |
22 | class QCheckBox; | 22 | class QCheckBox; |
23 | class QGroupBox; | 23 | class QGroupBox; |
24 | class QListView; | 24 | class QListView; |
25 | class QListViewItem; | 25 | class QListViewItem; |
26 | 26 | ||
27 | class InstallDialog : public QDialog | 27 | class InstallDialog : public QDialog |
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | 30 | ||
31 | 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 ); |
32 | ~InstallDialog(); | 32 | ~InstallDialog(); |
33 | 33 | ||
34 | PackageListView* ListViewPackages; | 34 | PackageListView* ListViewPackages; |
35 | QGroupBox* GroupBoxOptions; | 35 | QGroupBox* GroupBoxOptions; |
36 | QCheckBox* _force_depends; | 36 | QCheckBox* _force_depends; |
37 | QCheckBox* _force_reinstall; | 37 | QCheckBox* _force_reinstall; |
38 | QCheckBox* _force_overwrite; | ||
38 | QCheckBox* _force_remove; | 39 | QCheckBox* _force_remove; |
39 | QCheckListItem *toRemoveItem; | 40 | QCheckListItem *toRemoveItem; |
40 | QCheckListItem *toInstallItem; | 41 | QCheckListItem *toInstallItem; |
41 | 42 | ||
42 | protected: | 43 | protected: |
43 | QGridLayout* InstallDialogLayout; | 44 | QGridLayout* InstallDialogLayout; |
44 | QGridLayout* GroupBoxOptionsLayout; | 45 | QGridLayout* GroupBoxOptionsLayout; |
45 | bool event( QEvent* ); | 46 | bool event( QEvent* ); |
46 | private: | 47 | private: |
47 | PackageManagerSettings* settings; | 48 | PackageManagerSettings* settings; |
48 | }; | 49 | }; |
49 | 50 | ||
50 | #endif // INSTALLDIALOG_H | 51 | #endif // INSTALLDIALOG_H |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 84de67b..2ed313c 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -46,64 +46,66 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag | |||
46 | Config cfg( "oipkg", Config::User ); | 46 | Config cfg( "oipkg", Config::User ); |
47 | cfg.setGroup( "ipkg" ); | 47 | cfg.setGroup( "ipkg" ); |
48 | ipkg_cmd = cfg.readEntry( "cmd", "ipkg" )+" "; | 48 | ipkg_cmd = cfg.readEntry( "cmd", "ipkg" )+" "; |
49 | } | 49 | } |
50 | 50 | ||
51 | PmIpkg::~PmIpkg() | 51 | PmIpkg::~PmIpkg() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | 54 | ||
55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | 55 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
56 | { | 56 | { |
57 | bool ret=false; | 57 | bool ret=false; |
58 | QDir::setCurrent("/tmp"); | 58 | QDir::setCurrent("/tmp"); |
59 | QString cmd = ipkg_cmd; | 59 | QString cmd = ipkg_cmd; |
60 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 60 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
61 | if (!args.contains("update")) | 61 | if (!args.contains("update")) |
62 | { | 62 | { |
63 | if ( dest == "" ) | 63 | if ( dest == "" ) |
64 | cmd += " -dest "+settings->getDestinationName(); | 64 | cmd += " -dest "+settings->getDestinationName(); |
65 | else | 65 | else |
66 | cmd += " -dest "+ dest; | 66 | cmd += " -dest "+ dest; |
67 | 67 | ||
68 | cmd += " -force-defaults "; | 68 | cmd += " -force-defaults "; |
69 | 69 | ||
70 | if ( installDialog && installDialog->_force_depends ) | 70 | if ( installDialog && installDialog->_force_depends ) |
71 | { | 71 | { |
72 | if (installDialog->_force_depends->isChecked()) | 72 | if (installDialog->_force_depends->isChecked()) |
73 | cmd += " -force-depends "; | 73 | cmd += " -force-depends "; |
74 | if (installDialog->_force_reinstall->isChecked()) | 74 | if (installDialog->_force_reinstall->isChecked()) |
75 | cmd += " -force-reinstall "; | 75 | cmd += " -force-reinstall "; |
76 | if (installDialog->_force_remove->isChecked()) | 76 | if (installDialog->_force_remove->isChecked()) |
77 | cmd += " -force-removal-of-essential-packages "; | 77 | cmd += " -force-removal-of-essential-packages "; |
78 | if (installDialog->_force_overwrite->isChecked()) | ||
79 | cmd += " -force-overwrite "; | ||
78 | } | 80 | } |
79 | } //!args.contains("update") | 81 | } //!args.contains("update") |
80 | 82 | ||
81 | out( "Starting to "+ args+"\n"); | 83 | out( "Starting to "+ args+"\n"); |
82 | qApp->processEvents(); | 84 | qApp->processEvents(); |
83 | cmd += args; | 85 | cmd += args; |
84 | out( "running:\n"+cmd+"\n" ); | 86 | out( "running:\n"+cmd+"\n" ); |
85 | pvDebug(2,"running:"+cmd); | 87 | pvDebug(2,"running:"+cmd); |
86 | qApp->processEvents(); | 88 | qApp->processEvents(); |
87 | FILE *fp; | 89 | FILE *fp; |
88 | char line[130]; | 90 | char line[130]; |
89 | QString lineStr, lineStrOld; | 91 | QString lineStr, lineStrOld; |
90 | sleep(1); | 92 | sleep(1); |
91 | cmd +=" 2>&1"; | 93 | cmd +=" 2>&1"; |
92 | fp = popen( (const char *) cmd, "r"); | 94 | fp = popen( (const char *) cmd, "r"); |
93 | if ( fp == NULL ) { | 95 | if ( fp == NULL ) { |
94 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 96 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
95 | out("\nError while executing "+ cmd+"\n\n"); | 97 | out("\nError while executing "+ cmd+"\n\n"); |
96 | ret = false; | 98 | ret = false; |
97 | } else { | 99 | } else { |
98 | while ( fgets( line, sizeof line, fp) != NULL) | 100 | while ( fgets( line, sizeof line, fp) != NULL) |
99 | { | 101 | { |
100 | lineStr = line; | 102 | lineStr = line; |
101 | lineStr=lineStr.left(lineStr.length()-1); | 103 | lineStr=lineStr.left(lineStr.length()-1); |
102 | //Configuring opie-oipkg...Done | 104 | //Configuring opie-oipkg...Done |
103 | if (lineStr.contains("Done")) ret = true; | 105 | if (lineStr.contains("Done")) ret = true; |
104 | if (lineStr!=lineStrOld) | 106 | if (lineStr!=lineStrOld) |
105 | out(lineStr); | 107 | out(lineStr); |
106 | lineStrOld = lineStr; | 108 | lineStrOld = lineStr; |
107 | qApp->processEvents(); | 109 | qApp->processEvents(); |
108 | } | 110 | } |
109 | } | 111 | } |