-rw-r--r-- | noncore/unsupported/oipkg/installdialog.cpp | 3 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/installdialog.h | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 52 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 2 |
4 files changed, 34 insertions, 28 deletions
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp index 72f436a..a2c9702 100644 --- a/noncore/unsupported/oipkg/installdialog.cpp +++ b/noncore/unsupported/oipkg/installdialog.cpp | |||
@@ -1,104 +1,107 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form implementation generated from reading ui file 'installdialog.ui' | 2 | ** Form implementation generated from reading ui file 'installdialog.ui' |
3 | ** | 3 | ** |
4 | ** Created: Thu May 2 22:19:02 2002 | 4 | ** Created: Thu May 2 22:19:02 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #include "installdialog.h" | 9 | #include "installdialog.h" |
10 | 10 | ||
11 | #include <qcheckbox.h> | 11 | #include <qcheckbox.h> |
12 | #include <qgroupbox.h> | 12 | #include <qgroupbox.h> |
13 | #include <qheader.h> | 13 | #include <qheader.h> |
14 | #include <qlistview.h> | 14 | #include <qlistview.h> |
15 | #include <qpushbutton.h> | 15 | #include <qpushbutton.h> |
16 | #include <qlayout.h> | 16 | #include <qlayout.h> |
17 | #include <qvariant.h> | 17 | #include <qvariant.h> |
18 | #include <qtooltip.h> | 18 | #include <qtooltip.h> |
19 | #include <qwhatsthis.h> | 19 | #include <qwhatsthis.h> |
20 | 20 | ||
21 | 21 | ||
22 | InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) | 22 | InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl ) |
23 | : QDialog( parent, name, modal, fl ) | 23 | : QDialog( parent, name, modal, fl ) |
24 | { | 24 | { |
25 | settings = s; | 25 | settings = s; |
26 | if ( !name ) | 26 | if ( !name ) |
27 | setName( "InstallDialog" ); | 27 | setName( "InstallDialog" ); |
28 | resize( 223, 269 ); | 28 | resize( 223, 269 ); |
29 | setCaption( tr( "Install" ) ); | 29 | setCaption( tr( "Install" ) ); |
30 | InstallDialogLayout = new QGridLayout( this ); | 30 | InstallDialogLayout = new QGridLayout( this ); |
31 | InstallDialogLayout->setSpacing( 2 ); | 31 | InstallDialogLayout->setSpacing( 2 ); |
32 | InstallDialogLayout->setMargin( 2 ); | 32 | InstallDialogLayout->setMargin( 2 ); |
33 | 33 | ||
34 | ListViewPackages = new PackageListView( this,"listViewPackages",settings ); | 34 | ListViewPackages = new PackageListView( this,"listViewPackages",settings ); |
35 | 35 | ||
36 | InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); | 36 | InstallDialogLayout->addWidget( ListViewPackages, 0, 0 ); |
37 | 37 | ||
38 | GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); | 38 | GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" ); |
39 | GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); | 39 | GroupBoxOptions->setTitle( tr( "Ipkg options" ) ); |
40 | GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); | 40 | GroupBoxOptions->setColumnLayout(0, Qt::Vertical ); |
41 | GroupBoxOptions->layout()->setSpacing( 0 ); | 41 | GroupBoxOptions->layout()->setSpacing( 0 ); |
42 | GroupBoxOptions->layout()->setMargin( 0 ); | 42 | GroupBoxOptions->layout()->setMargin( 0 ); |
43 | GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); | 43 | GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() ); |
44 | GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); | 44 | GroupBoxOptionsLayout->setAlignment( Qt::AlignTop ); |
45 | GroupBoxOptionsLayout->setSpacing( 2 ); | 45 | GroupBoxOptionsLayout->setSpacing( 2 ); |
46 | GroupBoxOptionsLayout->setMargin( 2 ); | 46 | GroupBoxOptionsLayout->setMargin( 2 ); |
47 | 47 | ||
48 | _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); | 48 | _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" ); |
49 | QFont _force_depends_font( _force_depends->font() ); | 49 | QFont _force_depends_font( _force_depends->font() ); |
50 | _force_depends_font.setPointSize( 8 ); | 50 | _force_depends_font.setPointSize( 8 ); |
51 | _force_depends->setFont( _force_depends_font ); | 51 | _force_depends->setFont( _force_depends_font ); |
52 | _force_depends->setText( tr( "-force-depends" ) ); | 52 | _force_depends->setText( tr( "-force-depends" ) ); |
53 | //_force_depends->setChecked( true ); | 53 | //_force_depends->setChecked( true ); |
54 | 54 | ||
55 | GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); | 55 | GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 ); |
56 | 56 | ||
57 | _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); | 57 | _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" ); |
58 | QFont _force_reinstall_font( _force_reinstall->font() ); | 58 | QFont _force_reinstall_font( _force_reinstall->font() ); |
59 | _force_reinstall_font.setPointSize( 8 ); | 59 | _force_reinstall_font.setPointSize( 8 ); |
60 | _force_reinstall->setFont( _force_reinstall_font ); | 60 | _force_reinstall->setFont( _force_reinstall_font ); |
61 | _force_reinstall->setText( tr( "-force-reinstall" ) ); | 61 | _force_reinstall->setText( tr( "-force-reinstall" ) ); |
62 | 62 | ||
63 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); | 63 | GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 ); |
64 | 64 | ||
65 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); | 65 | _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" ); |
66 | QFont _force_remove_font( _force_remove->font() ); | 66 | QFont _force_remove_font( _force_remove->font() ); |
67 | _force_remove_font.setPointSize( 8 ); | 67 | _force_remove_font.setPointSize( 8 ); |
68 | _force_remove->setFont( _force_remove_font ); | 68 | _force_remove->setFont( _force_remove_font ); |
69 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); | 69 | _force_remove->setText( tr( "-force-removal-of-essential-packages" ) ); |
70 | 70 | ||
71 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); | 71 | GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 ); |
72 | 72 | ||
73 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); | 73 | InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 ); |
74 | toRemoveItem = new QCheckListItem( ListViewPackages, QObject::tr("To remove") ); | ||
75 | toInstallItem = new QCheckListItem( ListViewPackages, QObject::tr("To install") ); | ||
76 | |||
74 | } | 77 | } |
75 | 78 | ||
76 | /* | 79 | /* |
77 | * Destroys the object and frees any allocated resources | 80 | * Destroys the object and frees any allocated resources |
78 | */ | 81 | */ |
79 | InstallDialog::~InstallDialog() | 82 | InstallDialog::~InstallDialog() |
80 | { | 83 | { |
81 | // no need to delete child widgets, Qt does it all for us | 84 | // no need to delete child widgets, Qt does it all for us |
82 | } | 85 | } |
83 | 86 | ||
84 | /* | 87 | /* |
85 | * Main event handler. Reimplemented to handle application | 88 | * Main event handler. Reimplemented to handle application |
86 | * font changes | 89 | * font changes |
87 | */ | 90 | */ |
88 | bool InstallDialog::event( QEvent* ev ) | 91 | bool InstallDialog::event( QEvent* ev ) |
89 | { | 92 | { |
90 | bool ret = QDialog::event( ev ); | 93 | bool ret = QDialog::event( ev ); |
91 | if ( ev->type() == QEvent::ApplicationFontChange ) { | 94 | if ( ev->type() == QEvent::ApplicationFontChange ) { |
92 | QFont _force_depends_font( _force_depends->font() ); | 95 | QFont _force_depends_font( _force_depends->font() ); |
93 | _force_depends_font.setPointSize( 8 ); | 96 | _force_depends_font.setPointSize( 8 ); |
94 | _force_depends->setFont( _force_depends_font ); | 97 | _force_depends->setFont( _force_depends_font ); |
95 | QFont _force_reinstall_font( _force_reinstall->font() ); | 98 | QFont _force_reinstall_font( _force_reinstall->font() ); |
96 | _force_reinstall_font.setPointSize( 8 ); | 99 | _force_reinstall_font.setPointSize( 8 ); |
97 | _force_reinstall->setFont( _force_reinstall_font ); | 100 | _force_reinstall->setFont( _force_reinstall_font ); |
98 | QFont _force_remove_font( _force_remove->font() ); | 101 | QFont _force_remove_font( _force_remove->font() ); |
99 | _force_remove_font.setPointSize( 8 ); | 102 | _force_remove_font.setPointSize( 8 ); |
100 | _force_remove->setFont( _force_remove_font ); | 103 | _force_remove->setFont( _force_remove_font ); |
101 | } | 104 | } |
102 | return ret; | 105 | return ret; |
103 | } | 106 | } |
104 | 107 | ||
diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h index f2164ac..5af2c35 100644 --- a/noncore/unsupported/oipkg/installdialog.h +++ b/noncore/unsupported/oipkg/installdialog.h | |||
@@ -1,46 +1,47 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** Form interface generated from reading ui file 'installdialog.ui' | 2 | ** Form interface generated from reading ui file 'installdialog.ui' |
3 | ** | 3 | ** |
4 | ** Created: Thu May 2 22:19:01 2002 | 4 | ** Created: Thu May 2 22:19:01 2002 |
5 | ** by: The User Interface Compiler (uic) | 5 | ** by: The User Interface Compiler (uic) |
6 | ** | 6 | ** |
7 | ** WARNING! All changes made in this file will be lost! | 7 | ** WARNING! All changes made in this file will be lost! |
8 | ****************************************************************************/ | 8 | ****************************************************************************/ |
9 | #ifndef INSTALLDIALOG_H | 9 | #ifndef INSTALLDIALOG_H |
10 | #define INSTALLDIALOG_H | 10 | #define INSTALLDIALOG_H |
11 | 11 | ||
12 | #include "pksettings.h" | 12 | #include "pksettings.h" |
13 | #include "packagelistview.h" | 13 | #include "packagelistview.h" |
14 | #include <qvariant.h> | 14 | #include <qvariant.h> |
15 | #include <qdialog.h> | 15 | #include <qdialog.h> |
16 | class QVBoxLayout; | 16 | class QVBoxLayout; |
17 | class QHBoxLayout; | 17 | class QHBoxLayout; |
18 | class QGridLayout; | 18 | class QGridLayout; |
19 | class QCheckBox; | 19 | class QCheckBox; |
20 | class QGroupBox; | 20 | class QGroupBox; |
21 | class QListView; | 21 | class QListView; |
22 | class QListViewItem; | 22 | class QListViewItem; |
23 | 23 | ||
24 | class InstallDialog : public QDialog | 24 | class InstallDialog : public QDialog |
25 | { | 25 | { |
26 | Q_OBJECT | 26 | Q_OBJECT |
27 | 27 | ||
28 | public: | 28 | public: InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
29 | InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
30 | ~InstallDialog(); | 29 | ~InstallDialog(); |
31 | 30 | ||
32 | PackageListView* ListViewPackages; | 31 | PackageListView* ListViewPackages; |
33 | QGroupBox* GroupBoxOptions; | 32 | QGroupBox* GroupBoxOptions; |
34 | QCheckBox* _force_depends; | 33 | QCheckBox* _force_depends; |
35 | QCheckBox* _force_reinstall; | 34 | QCheckBox* _force_reinstall; |
36 | QCheckBox* _force_remove; | 35 | QCheckBox* _force_remove; |
36 | QCheckListItem *toRemoveItem; | ||
37 | QCheckListItem *toInstallItem; | ||
37 | 38 | ||
38 | protected: | 39 | protected: |
39 | QGridLayout* InstallDialogLayout; | 40 | QGridLayout* InstallDialogLayout; |
40 | QGridLayout* GroupBoxOptionsLayout; | 41 | QGridLayout* GroupBoxOptionsLayout; |
41 | bool event( QEvent* ); | 42 | bool event( QEvent* ); |
42 | private: | 43 | private: |
43 | PackageManagerSettings* settings; | 44 | PackageManagerSettings* settings; |
44 | }; | 45 | }; |
45 | 46 | ||
46 | #endif // INSTALLDIALOG_H | 47 | #endif // INSTALLDIALOG_H |
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 75f93cf..f2852c3 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -25,364 +25,366 @@ | |||
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | 26 | ||
27 | #include "mainwindow.h" | 27 | #include "mainwindow.h" |
28 | 28 | ||
29 | 29 | ||
30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
31 | : QObject ( p ) | 31 | : QObject ( p ) |
32 | { | 32 | { |
33 | settings = s; | 33 | settings = s; |
34 | runwindow = new RunWindow( p, name, true, f ); | 34 | runwindow = new RunWindow( p, name, true, f ); |
35 | } | 35 | } |
36 | 36 | ||
37 | PmIpkg::~PmIpkg() | 37 | PmIpkg::~PmIpkg() |
38 | { | 38 | { |
39 | } | 39 | } |
40 | 40 | ||
41 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | 41 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
42 | { | 42 | { |
43 | bool ret=false; | 43 | bool ret=false; |
44 | QDir::setCurrent("/tmp"); | 44 | QDir::setCurrent("/tmp"); |
45 | QString cmd = "/usr/bin/ipkg "; | 45 | QString cmd = "/usr/bin/ipkg "; |
46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
47 | if ( dest == "" ) | 47 | if ( dest == "" ) |
48 | cmd += " -dest "+settings->getDestinationName(); | 48 | cmd += " -dest "+settings->getDestinationName(); |
49 | else | 49 | else |
50 | cmd += " -dest "+ dest; | 50 | cmd += " -dest "+ dest; |
51 | 51 | ||
52 | cmd += " -force-defaults "; | 52 | cmd += " -force-defaults "; |
53 | 53 | ||
54 | if (installDialog->_force_depends) | 54 | if (installDialog->_force_depends) |
55 | { | 55 | { |
56 | if (installDialog->_force_depends->isChecked()) | 56 | if (installDialog->_force_depends->isChecked()) |
57 | cmd += " -force-depends "; | 57 | cmd += " -force-depends "; |
58 | if (installDialog->_force_reinstall->isChecked()) | 58 | if (installDialog->_force_reinstall->isChecked()) |
59 | cmd += " -force-reinstall "; | 59 | cmd += " -force-reinstall "; |
60 | if (installDialog->_force_remove->isChecked()) | 60 | if (installDialog->_force_remove->isChecked()) |
61 | cmd += " -force-removal-of-essential-packages "; | 61 | cmd += " -force-removal-of-essential-packages "; |
62 | } | 62 | } |
63 | 63 | ||
64 | out( "Starting to "+ args+"\n"); | 64 | out( "Starting to "+ args+"\n"); |
65 | cmd += args; | 65 | cmd += args; |
66 | out( "running:\n"+cmd+"\n" ); | 66 | out( "running:\n"+cmd+"\n" ); |
67 | pvDebug(2,"running:"+cmd); | 67 | pvDebug(2,"running:"+cmd); |
68 | qApp->processEvents(); | 68 | qApp->processEvents(); |
69 | FILE *fp; | 69 | FILE *fp; |
70 | char line[130]; | 70 | char line[130]; |
71 | QString lineStr, lineStrOld; | 71 | QString lineStr, lineStrOld; |
72 | sleep(1); | 72 | sleep(1); |
73 | cmd +=" 2>&1"; | 73 | cmd +=" 2>&1"; |
74 | fp = popen( (const char *) cmd, "r"); | 74 | fp = popen( (const char *) cmd, "r"); |
75 | if ( !fp ) { | 75 | if ( !fp ) { |
76 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 76 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
77 | pclose(fp); | 77 | pclose(fp); |
78 | out("\nError while executing "+ cmd+"\n\n"); | 78 | out("\nError while executing "+ cmd+"\n\n"); |
79 | return false; | 79 | return false; |
80 | } else { | 80 | } else { |
81 | while ( fgets( line, sizeof line, fp)) { | 81 | while ( fgets( line, sizeof line, fp)) { |
82 | lineStr = line; | 82 | lineStr = line; |
83 | lineStr=lineStr.left(lineStr.length()-1); | 83 | lineStr=lineStr.left(lineStr.length()-1); |
84 | //Configuring opie-oipkg...Done | 84 | //Configuring opie-oipkg...Done |
85 | if (lineStr.contains("Done")) | 85 | if (lineStr.contains("Done")) |
86 | ret = true; | 86 | ret = true; |
87 | if (lineStr!=lineStrOld) | 87 | if (lineStr!=lineStrOld) |
88 | out(lineStr); | 88 | out(lineStr); |
89 | lineStrOld = lineStr; | 89 | lineStrOld = lineStr; |
90 | } | 90 | } |
91 | pclose(fp); | 91 | pclose(fp); |
92 | } | 92 | } |
93 | //out( "Finished!"); | 93 | //out( "Finished!"); |
94 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 94 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
95 | return ret; | 95 | return ret; |
96 | } | 96 | } |
97 | 97 | ||
98 | void PmIpkg::makeLinks(Package *pack) | 98 | void PmIpkg::makeLinks(Package *pack) |
99 | { | 99 | { |
100 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 100 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
101 | linkPackage( pack->name(), pack->dest() ); | 101 | linkPackage( pack->name(), pack->dest() ); |
102 | } | 102 | } |
103 | 103 | ||
104 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 104 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
105 | { | 105 | { |
106 | QString dest = settings->getDestinationUrlByName( d ); | 106 | QString dest = settings->getDestinationUrlByName( d ); |
107 | dest = dest==""?d:dest; | 107 | dest = dest==""?d:dest; |
108 | if (dest == "/" ) return 0; | 108 | if (dest == "/" ) return 0; |
109 | { | 109 | { |
110 | Config cfg( "oipkg", Config::User ); | 110 | Config cfg( "oipkg", Config::User ); |
111 | cfg.setGroup( "Common" ); | 111 | cfg.setGroup( "Common" ); |
112 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 112 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
113 | } | 113 | } |
114 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 114 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
115 | QFile f( packFileName ); | 115 | QFile f( packFileName ); |
116 | if ( ! f.open(IO_ReadOnly) ) | 116 | if ( ! f.open(IO_ReadOnly) ) |
117 | { | 117 | { |
118 | pvDebug(1," Panik! Could not open"); | 118 | pvDebug(1," Panik! Could not open"); |
119 | out( "Panik!\n Could not open:\n"+packFileName ); | 119 | out( "Panik!\n Could not open:\n"+packFileName ); |
120 | return (QStringList*)0; | 120 | return (QStringList*)0; |
121 | } | 121 | } |
122 | QStringList *fileList = new QStringList(); | 122 | QStringList *fileList = new QStringList(); |
123 | QTextStream t( &f ); | 123 | QTextStream t( &f ); |
124 | while ( !t.eof() ) | 124 | while ( !t.eof() ) |
125 | { | 125 | { |
126 | *fileList += t.readLine(); | 126 | *fileList += t.readLine(); |
127 | } | 127 | } |
128 | return fileList; | 128 | return fileList; |
129 | } | 129 | } |
130 | 130 | ||
131 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 131 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
132 | { | 132 | { |
133 | QStringList *fileList = getList( packFileName, dest ); | 133 | QStringList *fileList = getList( packFileName, dest ); |
134 | processFileList( fileList, dest ); | 134 | processFileList( fileList, dest ); |
135 | delete fileList; | 135 | delete fileList; |
136 | } | 136 | } |
137 | 137 | ||
138 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 138 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
139 | { | 139 | { |
140 | if (!fileList) return; | 140 | if (!fileList) return; |
141 | for (uint i=0; i < fileList->count(); i++) | 141 | for (uint i=0; i < fileList->count(); i++) |
142 | { | 142 | { |
143 | QString dest = settings->getDestinationUrlByName( d ); | 143 | QString dest = settings->getDestinationUrlByName( d ); |
144 | dest = dest==""?d:dest; | 144 | dest = dest==""?d:dest; |
145 | processLinkDir( (*fileList)[i], dest ); | 145 | processLinkDir( (*fileList)[i], dest ); |
146 | } | 146 | } |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | void PmIpkg::processLinkDir( QString file, QString dest ) | 150 | void PmIpkg::processLinkDir( QString file, QString dest ) |
151 | { | 151 | { |
152 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 152 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
153 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 153 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
154 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 154 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
155 | if ( dest == "???" || dest == "" ) return; | 155 | if ( dest == "???" || dest == "" ) return; |
156 | QString destFile = file; | 156 | QString destFile = file; |
157 | file = dest+"/"+file; | 157 | file = dest+"/"+file; |
158 | if (file == dest) return; | 158 | if (file == dest) return; |
159 | QFileInfo fileInfo( file ); | 159 | QFileInfo fileInfo( file ); |
160 | if ( fileInfo.isDir() ) | 160 | if ( fileInfo.isDir() ) |
161 | { | 161 | { |
162 | pvDebug(4, "process dir "+file); | 162 | pvDebug(4, "process dir "+file); |
163 | QDir destDir( destFile ); | 163 | QDir destDir( destFile ); |
164 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 164 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
165 | QDir d( file ); | 165 | QDir d( file ); |
166 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 166 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
167 | const QFileInfoList *list = d.entryInfoList(); | 167 | const QFileInfoList *list = d.entryInfoList(); |
168 | QFileInfoListIterator it( *list ); | 168 | QFileInfoListIterator it( *list ); |
169 | QFileInfo *fi; | 169 | QFileInfo *fi; |
170 | while ( (fi=it.current()) ) | 170 | while ( (fi=it.current()) ) |
171 | { | 171 | { |
172 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | 172 | pvDebug(4, "processLinkDir "+fi->absFilePath()); |
173 | processLinkDir( fi->absFilePath(), dest ); | 173 | processLinkDir( fi->absFilePath(), dest ); |
174 | ++it; | 174 | ++it; |
175 | } | 175 | } |
176 | } else | 176 | } else |
177 | if ( fileInfo.isFile() ) | 177 | if ( fileInfo.isFile() ) |
178 | { | 178 | { |
179 | const char *instFile = strdup( (file).ascii() ); | 179 | const char *instFile = strdup( (file).ascii() ); |
180 | const char *linkFile = strdup( (destFile).ascii()); | 180 | const char *linkFile = strdup( (destFile).ascii()); |
181 | if( linkOpp==createLink ) | 181 | if( linkOpp==createLink ) |
182 | { | 182 | { |
183 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 183 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
184 | symlink( instFile, linkFile ); | 184 | symlink( instFile, linkFile ); |
185 | } | 185 | } |
186 | } else { | 186 | } else { |
187 | const char *linkFile = strdup( (destFile).ascii()); | 187 | const char *linkFile = strdup( (destFile).ascii()); |
188 | if( linkOpp==removeLink ) | 188 | if( linkOpp==removeLink ) |
189 | { | 189 | { |
190 | QFileInfo toRemoveLink( destFile ); | 190 | QFileInfo toRemoveLink( destFile ); |
191 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 191 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
192 | { | 192 | { |
193 | pvDebug(4,"removing "+destFile+" no "+file); | 193 | pvDebug(4,"removing "+destFile+" no "+file); |
194 | unlink( linkFile ); | 194 | unlink( linkFile ); |
195 | } | 195 | } |
196 | } | 196 | } |
197 | } | 197 | } |
198 | } | 198 | } |
199 | 199 | ||
200 | void PmIpkg::loadList( PackageList *pl ) | 200 | void PmIpkg::loadList( PackageList *pl ) |
201 | { | 201 | { |
202 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) | 202 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) |
203 | { | 203 | { |
204 | if ( pack && (pack->name() != "") && pack) | 204 | if ( pack && (pack->name() != "") && pack) |
205 | { | 205 | { |
206 | if ( pack->toInstall() ) | 206 | if ( pack->toInstall() ) |
207 | to_install.append( pack ); | 207 | to_install.append( pack ); |
208 | if ( pack->toRemove() ) | 208 | if ( pack->toRemove() ) |
209 | to_remove.append( pack ); | 209 | to_remove.append( pack ); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | void PmIpkg::commit() | 214 | void PmIpkg::commit() |
215 | { | 215 | { |
216 | int sizecount = 0; | 216 | int sizecount = 0; |
217 | installDialog = new InstallDialog(settings,0,0,true); | 217 | installDialog = new InstallDialog(settings,0,0,true); |
218 | QCheckListItem *toRemoveItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") ); | 218 | installDialog->toRemoveItem->setOpen( true ); |
219 | QCheckListItem *toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") ); | 219 | installDialog->toInstallItem->setOpen( true ); |
220 | toRemoveItem->setOpen( true ); | ||
221 | toInstallItem->setOpen( true ); | ||
222 | for (uint i=0; i < to_remove.count(); i++) | 220 | for (uint i=0; i < to_remove.count(); i++) |
223 | { | 221 | { |
224 | sizecount += 1; | 222 | sizecount += 1; |
225 | toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 223 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
226 | } | 224 | } |
227 | for (uint i=0; i < to_install.count(); i++) | 225 | for (uint i=0; i < to_install.count(); i++) |
228 | { | 226 | { |
229 | sizecount += to_install.at(i)->size().toInt(); | 227 | sizecount += to_install.at(i)->size().toInt(); |
230 | toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 228 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
231 | } | 229 | } |
232 | runwindow->progress->setTotalSteps(sizecount); | 230 | runwindow->progress->setTotalSteps(sizecount); |
233 | qDebug("Install size %i",sizecount); | 231 | qDebug("Install size %i",sizecount); |
234 | installDialog->showMaximized(); | 232 | installDialog->showMaximized(); |
235 | installDialog->show(); | 233 | installDialog->show(); |
236 | if ( installDialog->exec() ) doIt(); | 234 | if ( installDialog->exec() ) |
235 | { | ||
236 | doIt(); | ||
237 | runwindow->showMaximized(); | ||
238 | runwindow->show(); | ||
239 | } | ||
237 | installDialog->close(); | 240 | installDialog->close(); |
238 | runwindow->showMaximized(); | ||
239 | runwindow->show(); | ||
240 | out(tr("\nAll done.")); | 241 | out(tr("\nAll done.")); |
241 | } | 242 | } |
242 | 243 | ||
243 | void PmIpkg::doIt() | 244 | void PmIpkg::doIt() |
244 | { | 245 | { |
245 | runwindow->progress->setProgress(0); | 246 | runwindow->progress->setProgress(0); |
246 | show(); | 247 | show(); |
247 | remove(); | 248 | remove(); |
248 | install(); | 249 | install(); |
249 | } | 250 | } |
250 | 251 | ||
251 | 252 | ||
252 | void PmIpkg::remove() | 253 | void PmIpkg::remove() |
253 | { | 254 | { |
254 | if ( to_remove.count() == 0 ) return; | 255 | if ( to_remove.count() == 0 ) return; |
255 | 256 | ||
256 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 257 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
257 | 258 | ||
258 | QStringList *fileList; | 259 | QStringList *fileList; |
259 | for (uint i=0; i < to_remove.count(); i++) | 260 | for (uint i=0; i < to_remove.count(); i++) |
260 | { | 261 | { |
261 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 262 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
262 | if ( runIpkg("remove " + to_remove.at(i)->name(), to_remove.at(i)->dest() )) | 263 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
263 | { | 264 | { |
264 | runwindow->progress->setProgress( 1 ); | 265 | runwindow->progress->setProgress( 1 ); |
265 | linkOpp = removeLink; | 266 | linkOpp = removeLink; |
266 | if ( to_remove.at(i)->link() ) | ||
267 | { | ||
268 | out( "\nremoving links\n" ); | ||
269 | out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" ); | ||
270 | processFileList( fileList, to_remove.at(i)->dest() ); | ||
271 | } | ||
272 | to_remove.at(i)->processed(); | 267 | to_remove.at(i)->processed(); |
273 | to_remove.take( i ); | 268 | to_remove.take( i ); |
269 | |||
274 | out("\n\n"); | 270 | out("\n\n"); |
275 | }else{ | 271 | }else{ |
276 | out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); | 272 | out(tr("Error while removing")+to_remove.at(i)->name()+"\n"); |
277 | } | 273 | } |
274 | if ( to_remove.at(i)->link() ) | ||
275 | { | ||
276 | out( "\nremoving links\n" ); | ||
277 | out( "for package "+to_remove.at(i)->name()+" in "+to_remove.at(i)->dest()+"\n" ); | ||
278 | processFileList( fileList, to_remove.at(i)->dest() ); | ||
279 | } | ||
278 | if ( to_remove.at(i)->link() )delete fileList; | 280 | if ( to_remove.at(i)->link() )delete fileList; |
279 | } | 281 | } |
280 | to_remove.clear(); | 282 | to_remove.clear(); |
281 | out("\n"); | 283 | out("\n"); |
282 | } | 284 | } |
283 | 285 | ||
284 | 286 | ||
285 | void PmIpkg::install() | 287 | void PmIpkg::install() |
286 | { | 288 | { |
287 | if ( to_install.count() == 0 ) return; | 289 | if ( to_install.count() == 0 ) return; |
288 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 290 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
289 | for (uint i=0; i < to_install.count(); i++) | 291 | for (uint i=0; i < to_install.count(); i++) |
290 | { | 292 | { |
291 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 293 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
292 | { | 294 | { |
293 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 295 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
294 | linkOpp = createLink; | ||
295 | if ( to_install.at(i)->link() ) | ||
296 | { | ||
297 | out( "\ncreating links\n" ); | ||
298 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"\n" ); | ||
299 | makeLinks( to_install.at(i) ); | ||
300 | } | ||
301 | to_install.at(i)->processed(); | 296 | to_install.at(i)->processed(); |
302 | to_install.take( i ); | 297 | to_install.take( i ); |
303 | out("\n\n"); | 298 | out("\n\n"); |
304 | }else{ | 299 | }else{ |
305 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); | 300 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); |
306 | } | 301 | } |
302 | linkOpp = createLink; | ||
303 | if ( to_install.at(i)->link() ) | ||
304 | { | ||
305 | out( "\ncreating links\n" ); | ||
306 | out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"\n" ); | ||
307 | makeLinks( to_install.at(i) ); | ||
308 | } | ||
307 | } | 309 | } |
308 | out("\n"); | 310 | out("\n"); |
309 | to_install.clear(); | 311 | to_install.clear(); |
310 | } | 312 | } |
311 | 313 | ||
312 | void PmIpkg::createLinks( const QString &dest ) | 314 | void PmIpkg::createLinks( const QString &dest ) |
313 | { | 315 | { |
314 | pvDebug(2,"PmIpkg::createLinks "+dest); | 316 | pvDebug(2,"PmIpkg::createLinks "+dest); |
315 | linkOpp=createLink; | 317 | linkOpp=createLink; |
316 | QString url = settings->getDestinationUrlByName( dest ); | 318 | QString url = settings->getDestinationUrlByName( dest ); |
317 | url = url==""?dest:url; | 319 | url = url==""?dest:url; |
318 | processLinkDir( "/opt", url ); | 320 | processLinkDir( "/opt", url ); |
319 | processLinkDir( "/usr", url ); | 321 | processLinkDir( "/usr", url ); |
320 | } | 322 | } |
321 | 323 | ||
322 | void PmIpkg::removeLinks( const QString &dest ) | 324 | void PmIpkg::removeLinks( const QString &dest ) |
323 | { | 325 | { |
324 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 326 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
325 | linkOpp=removeLink; | 327 | linkOpp=removeLink; |
326 | QString url = settings->getDestinationUrlByName( dest ); | 328 | QString url = settings->getDestinationUrlByName( dest ); |
327 | url = url==""?dest:url; | 329 | url = url==""?dest:url; |
328 | processLinkDir( "/opt", url ); | 330 | processLinkDir( "/opt", url ); |
329 | processLinkDir( "/usr", url ); | 331 | processLinkDir( "/usr", url ); |
330 | } | 332 | } |
331 | 333 | ||
332 | void PmIpkg::update() | 334 | void PmIpkg::update() |
333 | { | 335 | { |
334 | show(); | 336 | show(); |
335 | runIpkg( "update" ); | 337 | runIpkg( "update" ); |
336 | runwindow->close(); | 338 | runwindow->close(); |
337 | } | 339 | } |
338 | 340 | ||
339 | void PmIpkg::out( QString o ) | 341 | void PmIpkg::out( QString o ) |
340 | { | 342 | { |
341 | runwindow->outPut->append(o); | 343 | runwindow->outPut->append(o); |
342 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); | 344 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); |
343 | } | 345 | } |
344 | 346 | ||
345 | 347 | ||
346 | 348 | ||
347 | 349 | ||
348 | void PmIpkg::show() | 350 | void PmIpkg::show() |
349 | { | 351 | { |
350 | if (!runwindow->isVisible()) | 352 | if (!runwindow->isVisible()) |
351 | { | 353 | { |
352 | runwindow->showMaximized(); | 354 | runwindow->showMaximized(); |
353 | runwindow->show(); | 355 | runwindow->show(); |
354 | } | 356 | } |
355 | runwindow->outPut->setText(""); | 357 | runwindow->outPut->setText(""); |
356 | //showButtons(b); | 358 | //showButtons(b); |
357 | //if ( !b ) | 359 | //if ( !b ) |
358 | // runwindow->progress->hide(); | 360 | // runwindow->progress->hide(); |
359 | // else | 361 | // else |
360 | // runwindow->progress->show(); | 362 | // runwindow->progress->show(); |
361 | } | 363 | } |
362 | 364 | ||
363 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 365 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
364 | { | 366 | { |
365 | 367 | ||
366 | to_install.clear(); | 368 | to_install.clear(); |
367 | to_remove.clear(); | 369 | to_remove.clear(); |
368 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 370 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
369 | Package *p = new Package(fileName,settings); | 371 | Package *p = new Package(fileName,settings); |
370 | if ( dest!="") p->setDest( dest ); | 372 | if ( dest!="") p->setDest( dest ); |
371 | to_install.append( p ); | 373 | to_install.append( p ); |
372 | commit(); | 374 | commit(); |
373 | delete p; | 375 | delete p; |
374 | } | 376 | } |
375 | 377 | ||
376 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 378 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
377 | { | 379 | { |
378 | 380 | ||
379 | to_install.clear(); | 381 | to_install.clear(); |
380 | to_remove.clear(); | 382 | to_remove.clear(); |
381 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 383 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
382 | Package *p = new Package(fileName,settings); | 384 | Package *p = new Package(fileName,settings); |
383 | if ( dest!="") p->setDest( dest ); | 385 | if ( dest!="") p->setDest( dest ); |
384 | to_remove.append( p ); | 386 | to_remove.append( p ); |
385 | commit(); | 387 | commit(); |
386 | delete p; | 388 | delete p; |
387 | } | 389 | } |
388 | 390 | ||
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h index f8ac39a..c543304 100644 --- a/noncore/unsupported/oipkg/pmipkg.h +++ b/noncore/unsupported/oipkg/pmipkg.h | |||
@@ -1,63 +1,63 @@ | |||
1 | #ifndef PMIPKG_H | 1 | #ifndef PMIPKG_H |
2 | #define PMIPKG_H | 2 | #define PMIPKG_H |
3 | 3 | ||
4 | 4 | ||
5 | #include <qobject.h> | 5 | #include <qobject.h> |
6 | #include <qlist.h> | 6 | #include <qlist.h> |
7 | #include <qstring.h> | 7 | #include <qstring.h> |
8 | #include <qwidget.h> | 8 | #include <qwidget.h> |
9 | #include "pksettings.h" | 9 | #include "pksettings.h" |
10 | #include "runwindow.h" | 10 | #include "runwindow.h" |
11 | #include "packagelist.h" | 11 | #include "packagelist.h" |
12 | #include "installdialog.h" | 12 | #include "installdialog.h" |
13 | #include "debug.h" | 13 | #include "debug.h" |
14 | 14 | ||
15 | #define createLink 0 | 15 | #define createLink 0 |
16 | #define removeLink 1 | 16 | #define removeLink 1 |
17 | 17 | ||
18 | class Package; | 18 | class Package; |
19 | class PmIpkg : public QObject | 19 | class PmIpkg : public QObject |
20 | { | 20 | { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | public: | 22 | public: |
23 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); | 23 | PmIpkg( PackageManagerSettings* , QWidget* p=0, const char * name=0, WFlags f=0 ); |
24 | ~PmIpkg(); | 24 | ~PmIpkg(); |
25 | 25 | ||
26 | int linkOpp; | 26 | int linkOpp; |
27 | void loadList( PackageList* ); | 27 | void loadList( PackageList* ); |
28 | void commit(); | 28 | void commit(); |
29 | void update(); | 29 | void update(); |
30 | void show(); | 30 | void show(); |
31 | 31 | ||
32 | public slots: | 32 | public slots: |
33 | void doIt(); | 33 | void doIt(); |
34 | void install(); | 34 | void install(); |
35 | void remove(); | 35 | void remove(); |
36 | void installFile(const QString &fileName, const QString &dest=""); | 36 | void installFile(const QString &fileName, const QString &dest=""); |
37 | void removeFile(const QString &fileName, const QString &dest=""); | 37 | void removeFile(const QString &fileName, const QString &dest=""); |
38 | void createLinks( const QString &dest ); | 38 | void createLinks( const QString &dest ); |
39 | void removeLinks( const QString &dest ); | 39 | void removeLinks( const QString &dest ); |
40 | 40 | ||
41 | private: | 41 | private: |
42 | PackageManagerSettings* settings; | 42 | PackageManagerSettings* settings; |
43 | RunWindow *runwindow; | 43 | RunWindow *runwindow; |
44 | InstallDialog *installDialog; | 44 | InstallDialog *installDialog; |
45 | QList<Package> to_remove; | 45 | QList<Package> to_remove; |
46 | QList<Package> to_install; | 46 | QList<Package> to_install; |
47 | QString fileNameToInstall; | 47 | QString fileNameToInstall; |
48 | QCheckBox *_force_reinstall; | 48 | QCheckBox *_force_reinstall; |
49 | QCheckBox *_force_remove; | 49 | QCheckBox *_force_remove; |
50 | QCheckBox *_force_depends; | 50 | QCheckBox *_force_depends; |
51 | void startDialog(); | 51 | // void startDialog(); |
52 | void makeLinks(Package*); | 52 | void makeLinks(Package*); |
53 | void linkPackage( QString, QString ); | 53 | void linkPackage( QString, QString ); |
54 | void processLinkDir( QString , QString ); | 54 | void processLinkDir( QString , QString ); |
55 | bool runIpkg(const QString& args, const QString& dest="" ); | 55 | bool runIpkg(const QString& args, const QString& dest="" ); |
56 | void out( QString ); | 56 | void out( QString ); |
57 | QStringList* getList( QString, QString ); | 57 | QStringList* getList( QString, QString ); |
58 | void processFileList( QStringList*, QString ); | 58 | void processFileList( QStringList*, QString ); |
59 | 59 | ||
60 | 60 | ||
61 | }; | 61 | }; |
62 | 62 | ||
63 | #endif | 63 | #endif |