Diffstat (limited to 'noncore/settings/packagemanager/packageinfodlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/packagemanager/packageinfodlg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/settings/packagemanager/packageinfodlg.cpp b/noncore/settings/packagemanager/packageinfodlg.cpp index 7daf336..7abd17e 100644 --- a/noncore/settings/packagemanager/packageinfodlg.cpp +++ b/noncore/settings/packagemanager/packageinfodlg.cpp | |||
@@ -1,135 +1,135 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> | 4 | =. Copyright (c) 2003 Dan Williams <drw@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This file is distributed in the hope that | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ..}^=.= = ; Public License for more details. | 19 | ..}^=.= = ; Public License for more details. |
20 | ++= -. .` .: | 20 | ++= -. .` .: |
21 | : = ...= . :.=- You should have received a copy of the GNU | 21 | : = ...= . :.=- You should have received a copy of the GNU |
22 | -. .:....=;==+<; General Public License along with this file; | 22 | -. .:....=;==+<; General Public License along with this file; |
23 | -_. . . )=. = see the file COPYING. If not, write to the | 23 | -_. . . )=. = see the file COPYING. If not, write to the |
24 | -- :-=` Free Software Foundation, Inc., | 24 | -- :-=` Free Software Foundation, Inc., |
25 | 59 Temple Place - Suite 330, | 25 | 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | 27 | ||
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "packageinfodlg.h" | 30 | #include "packageinfodlg.h" |
31 | #include "opackage.h" | 31 | #include "opackage.h" |
32 | #include "opackagemanager.h" | 32 | #include "opackagemanager.h" |
33 | 33 | ||
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | 36 | ||
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | 38 | ||
39 | #include <opie/otabwidget.h> | 39 | #include <opie2/otabwidget.h> |
40 | 40 | ||
41 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) | 41 | PackageInfoDlg::PackageInfoDlg( QWidget *parent, OPackageManager *pm, const QString &package ) |
42 | : QWidget( 0x0 ) | 42 | : QWidget( 0x0 ) |
43 | , m_packman( pm ) | 43 | , m_packman( pm ) |
44 | , m_information( this ) | 44 | , m_information( this ) |
45 | , m_files( this ) | 45 | , m_files( this ) |
46 | { | 46 | { |
47 | // Initialize UI | 47 | // Initialize UI |
48 | if ( parent ) | 48 | if ( parent ) |
49 | parent->setCaption( package ); | 49 | parent->setCaption( package ); |
50 | 50 | ||
51 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); | 51 | QVBoxLayout *layout = new QVBoxLayout( this, 4, 2 ); |
52 | 52 | ||
53 | OTabWidget *tabWidget = new OTabWidget( this ); | 53 | OTabWidget *tabWidget = new OTabWidget( this ); |
54 | layout->addWidget( tabWidget ); | 54 | layout->addWidget( tabWidget ); |
55 | 55 | ||
56 | // Information tab | 56 | // Information tab |
57 | m_information.reparent( tabWidget, QPoint( 0, 0 ) ); | 57 | m_information.reparent( tabWidget, QPoint( 0, 0 ) ); |
58 | m_information.setReadOnly( true ); | 58 | m_information.setReadOnly( true ); |
59 | tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); | 59 | tabWidget->addTab( &m_information, "UtilsIcon", tr( "Information" ) ); |
60 | 60 | ||
61 | // Retrive package information | 61 | // Retrive package information |
62 | m_package = m_packman->findPackage( package ); | 62 | m_package = m_packman->findPackage( package ); |
63 | if ( !m_package ) | 63 | if ( !m_package ) |
64 | { | 64 | { |
65 | m_information.setText( tr( "Unable to retrieve package information." ) ); | 65 | m_information.setText( tr( "Unable to retrieve package information." ) ); |
66 | return; | 66 | return; |
67 | } | 67 | } |
68 | 68 | ||
69 | // Display package information | 69 | // Display package information |
70 | if ( !m_package->information().isNull() ) | 70 | if ( !m_package->information().isNull() ) |
71 | m_information.setText( m_package->information() ); | 71 | m_information.setText( m_package->information() ); |
72 | else | 72 | else |
73 | { | 73 | { |
74 | // Package information is not cached, retrieve it | 74 | // Package information is not cached, retrieve it |
75 | QStringList list( package ); | 75 | QStringList list( package ); |
76 | m_packman->executeCommand( OPackage::Info, &list, QString::null, this, SLOT(slotInfo(char*)), true ); | 76 | m_packman->executeCommand( OPackage::Info, &list, QString::null, this, SLOT(slotInfo(char*)), true ); |
77 | } | 77 | } |
78 | 78 | ||
79 | // Files tab (display only if package is installed) | 79 | // Files tab (display only if package is installed) |
80 | if ( !m_package->versionInstalled().isNull() ) | 80 | if ( !m_package->versionInstalled().isNull() ) |
81 | { | 81 | { |
82 | QWidget *filesWidget = new QWidget( tabWidget ); | 82 | QWidget *filesWidget = new QWidget( tabWidget ); |
83 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); | 83 | QVBoxLayout *filesLayout = new QVBoxLayout( filesWidget, 2, 2 ); |
84 | m_files.reparent( filesWidget, QPoint( 0, 0 ) ); | 84 | m_files.reparent( filesWidget, QPoint( 0, 0 ) ); |
85 | m_files.setReadOnly( true ); | 85 | m_files.setReadOnly( true ); |
86 | filesLayout->addWidget( &m_files ); | 86 | filesLayout->addWidget( &m_files ); |
87 | 87 | ||
88 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), | 88 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "packagemanager/apply" ), |
89 | tr( "Retrieve file list" ), filesWidget ); | 89 | tr( "Retrieve file list" ), filesWidget ); |
90 | filesLayout->addWidget( btn ); | 90 | filesLayout->addWidget( btn ); |
91 | connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) ); | 91 | connect( btn, SIGNAL(clicked()), this, SLOT(slotBtnFileScan()) ); |
92 | tabWidget->addTab( filesWidget, "binary", tr( "File list" ) ); | 92 | tabWidget->addTab( filesWidget, "binary", tr( "File list" ) ); |
93 | 93 | ||
94 | tabWidget->setCurrentTab( tr( "Information" ) ); | 94 | tabWidget->setCurrentTab( tr( "Information" ) ); |
95 | 95 | ||
96 | // If file list is already cached, display | 96 | // If file list is already cached, display |
97 | if ( !m_package->files().isNull() ) | 97 | if ( !m_package->files().isNull() ) |
98 | m_files.setText( m_package->files() ); | 98 | m_files.setText( m_package->files() ); |
99 | } | 99 | } |
100 | else | 100 | else |
101 | m_files.hide(); | 101 | m_files.hide(); |
102 | } | 102 | } |
103 | 103 | ||
104 | PackageInfoDlg::~PackageInfoDlg() | 104 | PackageInfoDlg::~PackageInfoDlg() |
105 | { | 105 | { |
106 | if ( !m_package ) | 106 | if ( !m_package ) |
107 | return; | 107 | return; |
108 | 108 | ||
109 | // Cache package information | 109 | // Cache package information |
110 | if ( !m_information.text().isNull() ) | 110 | if ( !m_information.text().isNull() ) |
111 | m_package->setInformation( m_information.text() ); | 111 | m_package->setInformation( m_information.text() ); |
112 | 112 | ||
113 | // Cache package file list | 113 | // Cache package file list |
114 | if ( !m_files.text().isNull() ) | 114 | if ( !m_files.text().isNull() ) |
115 | m_package->setFiles( m_files.text() ); | 115 | m_package->setFiles( m_files.text() ); |
116 | } | 116 | } |
117 | 117 | ||
118 | void PackageInfoDlg::slotBtnFileScan() | 118 | void PackageInfoDlg::slotBtnFileScan() |
119 | { | 119 | { |
120 | m_files.clear(); | 120 | m_files.clear(); |
121 | 121 | ||
122 | QStringList list( m_package->name() ); | 122 | QStringList list( m_package->name() ); |
123 | m_packman->executeCommand( OPackage::Files, &list, QString::null, this, SLOT(slotFiles(char*)), true ); | 123 | m_packman->executeCommand( OPackage::Files, &list, QString::null, this, SLOT(slotFiles(char*)), true ); |
124 | } | 124 | } |
125 | 125 | ||
126 | void PackageInfoDlg::slotInfo( char *info ) | 126 | void PackageInfoDlg::slotInfo( char *info ) |
127 | { | 127 | { |
128 | m_information.append( info ); | 128 | m_information.append( info ); |
129 | } | 129 | } |
130 | 130 | ||
131 | void PackageInfoDlg::slotFiles( char *filelist ) | 131 | void PackageInfoDlg::slotFiles( char *filelist ) |
132 | { | 132 | { |
133 | QString str = filelist; | 133 | QString str = filelist; |
134 | 134 | ||
135 | // Skip first line of output ("Package xxx is installed...") | 135 | // Skip first line of output ("Package xxx is installed...") |