summaryrefslogtreecommitdiff
authortille <tille>2002-05-03 09:40:11 (UTC)
committer tille <tille>2002-05-03 09:40:11 (UTC)
commit6bf450ac622d22ba7e9156e474a7abb714167eba (patch) (side-by-side diff)
treeff89dd745715e0b540e6c8f17b6af4dec4c3c84a
parent6ebb8228b660634b4ca8a2a5bf05aef828e39f31 (diff)
downloadopie-6bf450ac622d22ba7e9156e474a7abb714167eba.zip
opie-6bf450ac622d22ba7e9156e474a7abb714167eba.tar.gz
opie-6bf450ac622d22ba7e9156e474a7abb714167eba.tar.bz2
added install dialog with ipkg options (that are shown ;)
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/TODO2
-rw-r--r--noncore/unsupported/oipkg/installdialog.cpp104
-rw-r--r--noncore/unsupported/oipkg/installdialog.h46
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp5
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro2
-rw-r--r--noncore/unsupported/oipkg/packagelistremote.cpp2
-rw-r--r--noncore/unsupported/oipkg/pksettings.cpp11
-rw-r--r--noncore/unsupported/oipkg/pksettings.h1
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp78
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h7
-rw-r--r--noncore/unsupported/oipkg/settings.h1
11 files changed, 193 insertions, 66 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO
index 1aa9e6b..b1ae6e3 100644
--- a/noncore/unsupported/oipkg/TODO
+++ b/noncore/unsupported/oipkg/TODO
@@ -11,4 +11,4 @@
* allow reinstalling
* different types of filters and searches
i.e. name, desc, files etc
-* get packages from doclnk \ No newline at end of file
+* mark packages from doclnk and ipkgfind installed if installed \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/installdialog.cpp b/noncore/unsupported/oipkg/installdialog.cpp
new file mode 100644
index 0000000..72f436a
--- a/dev/null
+++ b/noncore/unsupported/oipkg/installdialog.cpp
@@ -0,0 +1,104 @@
+/****************************************************************************
+** Form implementation generated from reading ui file 'installdialog.ui'
+**
+** Created: Thu May 2 22:19:02 2002
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "installdialog.h"
+
+#include <qcheckbox.h>
+#include <qgroupbox.h>
+#include <qheader.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+
+InstallDialog::InstallDialog( PackageManagerSettings* s, QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl )
+{
+ settings = s;
+ if ( !name )
+ setName( "InstallDialog" );
+ resize( 223, 269 );
+ setCaption( tr( "Install" ) );
+ InstallDialogLayout = new QGridLayout( this );
+ InstallDialogLayout->setSpacing( 2 );
+ InstallDialogLayout->setMargin( 2 );
+
+ ListViewPackages = new PackageListView( this,"listViewPackages",settings );
+
+ InstallDialogLayout->addWidget( ListViewPackages, 0, 0 );
+
+ GroupBoxOptions = new QGroupBox( this, "GroupBoxOptions" );
+ GroupBoxOptions->setTitle( tr( "Ipkg options" ) );
+ GroupBoxOptions->setColumnLayout(0, Qt::Vertical );
+ GroupBoxOptions->layout()->setSpacing( 0 );
+ GroupBoxOptions->layout()->setMargin( 0 );
+ GroupBoxOptionsLayout = new QGridLayout( GroupBoxOptions->layout() );
+ GroupBoxOptionsLayout->setAlignment( Qt::AlignTop );
+ GroupBoxOptionsLayout->setSpacing( 2 );
+ GroupBoxOptionsLayout->setMargin( 2 );
+
+ _force_depends = new QCheckBox( GroupBoxOptions, "_force_depends" );
+ QFont _force_depends_font( _force_depends->font() );
+ _force_depends_font.setPointSize( 8 );
+ _force_depends->setFont( _force_depends_font );
+ _force_depends->setText( tr( "-force-depends" ) );
+ //_force_depends->setChecked( true );
+
+ GroupBoxOptionsLayout->addWidget( _force_depends, 0, 0 );
+
+ _force_reinstall = new QCheckBox( GroupBoxOptions, "_force_reinstall" );
+ QFont _force_reinstall_font( _force_reinstall->font() );
+ _force_reinstall_font.setPointSize( 8 );
+ _force_reinstall->setFont( _force_reinstall_font );
+ _force_reinstall->setText( tr( "-force-reinstall" ) );
+
+ GroupBoxOptionsLayout->addWidget( _force_reinstall, 1, 0 );
+
+ _force_remove = new QCheckBox( GroupBoxOptions, "_force_remove" );
+ QFont _force_remove_font( _force_remove->font() );
+ _force_remove_font.setPointSize( 8 );
+ _force_remove->setFont( _force_remove_font );
+ _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
+
+ GroupBoxOptionsLayout->addWidget( _force_remove, 2, 0 );
+
+ InstallDialogLayout->addWidget( GroupBoxOptions, 1, 0 );
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+InstallDialog::~InstallDialog()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+/*
+ * Main event handler. Reimplemented to handle application
+ * font changes
+ */
+bool InstallDialog::event( QEvent* ev )
+{
+ bool ret = QDialog::event( ev );
+ if ( ev->type() == QEvent::ApplicationFontChange ) {
+ QFont _force_depends_font( _force_depends->font() );
+ _force_depends_font.setPointSize( 8 );
+ _force_depends->setFont( _force_depends_font );
+ QFont _force_reinstall_font( _force_reinstall->font() );
+ _force_reinstall_font.setPointSize( 8 );
+ _force_reinstall->setFont( _force_reinstall_font );
+ QFont _force_remove_font( _force_remove->font() );
+ _force_remove_font.setPointSize( 8 );
+ _force_remove->setFont( _force_remove_font );
+ }
+ return ret;
+}
+
diff --git a/noncore/unsupported/oipkg/installdialog.h b/noncore/unsupported/oipkg/installdialog.h
new file mode 100644
index 0000000..f2164ac
--- a/dev/null
+++ b/noncore/unsupported/oipkg/installdialog.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+** Form interface generated from reading ui file 'installdialog.ui'
+**
+** Created: Thu May 2 22:19:01 2002
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef INSTALLDIALOG_H
+#define INSTALLDIALOG_H
+
+#include "pksettings.h"
+#include "packagelistview.h"
+#include <qvariant.h>
+#include <qdialog.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QCheckBox;
+class QGroupBox;
+class QListView;
+class QListViewItem;
+
+class InstallDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ InstallDialog( PackageManagerSettings* s, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~InstallDialog();
+
+ PackageListView* ListViewPackages;
+ QGroupBox* GroupBoxOptions;
+ QCheckBox* _force_depends;
+ QCheckBox* _force_reinstall;
+ QCheckBox* _force_remove;
+
+protected:
+ QGridLayout* InstallDialogLayout;
+ QGridLayout* GroupBoxOptionsLayout;
+ bool event( QEvent* );
+private:
+ PackageManagerSettings* settings;
+};
+
+#endif // INSTALLDIALOG_H
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index b668660..259a789 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -236,12 +236,14 @@ void MainWindow::makeMenu()
MainWindow::~MainWindow()
{
+ pvDebug(7,"MainWindow::~MainWindow ");
Config cfg( "oipkg", Config::User );
cfg.setGroup( "gui" );
cfg.writeEntry( "findBar", !findBar->isHidden() );
cfg.writeEntry( "searchBar", !searchBar->isHidden() );
cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
cfg.writeEntry( "destBar", !destBar->isHidden() );
+ pvDebug(7,"MainWindow::~MainWindow ");
}
@@ -250,7 +252,8 @@ void MainWindow::runIpkg()
packageListServers.allPackages();
ipkg->loadList( packageListSearch );
ipkg->loadList( packageListDocLnk );
- ipkg->commit( packageListServers );
+ ipkg->loadList( packageListServers );
+ ipkg->commit();
// ##### If we looked in the list of files, we could send out accurate
// ##### messages. But we don't bother yet, and just do an "all".
QCopEnvelope e("QPE/System", "linkChanged(QString)");
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index 6ee1963..9e2f5f8 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -6,6 +6,7 @@ HEADERS = mainwindow.h \
pksettings.h \
pmipkg.h \
packagelistdoclnk.h \
+ installdialog.h \
utils.h \
packagelistitem.h \
packagelistremote.h \
@@ -18,6 +19,7 @@ SOURCES = main.cpp \
utils.cpp \
packagelistdoclnk.cpp \
packagelistview.cpp \
+ installdialog.cpp \
packagelistremote.cpp \
packagelistlocal.cpp \
pksettings.cpp \
diff --git a/noncore/unsupported/oipkg/packagelistremote.cpp b/noncore/unsupported/oipkg/packagelistremote.cpp
index 1ec7292..3c6ede7 100644
--- a/noncore/unsupported/oipkg/packagelistremote.cpp
+++ b/noncore/unsupported/oipkg/packagelistremote.cpp
@@ -41,7 +41,7 @@ void PackageListRemote::update()
cmd += "&query="+searchString;
cmd += "\"";
- pvDebug(2,"search :"+cmd);
+ pvDebug(4,"search :"+cmd);
r = system(cmd.latin1());
readFileEntries( redirect );
}
diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp
index 7e2ef10..24c7beb 100644
--- a/noncore/unsupported/oipkg/pksettings.cpp
+++ b/noncore/unsupported/oipkg/pksettings.cpp
@@ -58,6 +58,7 @@ PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* na
destinationurlDic.setAutoDelete(TRUE);
readSettings();
activeLinkDestination->hide();
+ serverChanged = false;
}
PackageManagerSettings::~PackageManagerSettings()
@@ -119,7 +120,7 @@ void PackageManagerSettings::editServer(int i)
serverurl->setText( *serverurlDic[i] );
editedserver = i;
-
+ serverChanged = true;
connect( servername, SIGNAL(textChanged(const QString&)), this, SLOT(serverNameChanged(const QString&)) );
connect( serverurl, SIGNAL(textChanged(const QString&)), this, SLOT(serverUrlChanged(const QString&)) );
changed = true;
@@ -134,8 +135,9 @@ void PackageManagerSettings::editDestination(int i)
} else {
destinationname->setEnabled(TRUE);
destinationurl->setEnabled(TRUE);
- createLinksButton->setEnabled(TRUE);
- removeLinksButton->setEnabled(TRUE);
+ //since it does not work anyway
+// createLinksButton->setEnabled(TRUE);
+// removeLinksButton->setEnabled(TRUE);
}
destinationname->setText( destinations->text(i) );
@@ -184,9 +186,9 @@ void PackageManagerSettings::serverNameChanged(const QString& t)
disconnect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
servers->changeItem( t, editedserver );
activeServers->changeItem( t, editedserver );
- changed = true;
connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) );
changed = true;
+ serverChanged = true;
}
void PackageManagerSettings::destNameChanged(const QString& t)
@@ -203,6 +205,7 @@ void PackageManagerSettings::serverUrlChanged(const QString& t)
{
serverurlDic.replace(editedserver, new QString(t));
changed = true;
+ serverChanged = true;
}
void PackageManagerSettings::destUrlChanged(const QString& t)
diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h
index 1632d4a..dcc1e3a 100644
--- a/noncore/unsupported/oipkg/pksettings.h
+++ b/noncore/unsupported/oipkg/pksettings.h
@@ -64,6 +64,7 @@ private:
int currentSetting;
int installationSettingsCount;
bool changed;
+ bool serverChanged;
bool readIpkgConfig(const QString&);
void writeIpkgConfig(const QString&);
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index be9d6da..fd8279b 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -57,13 +57,13 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
cmd += " -force-defaults ";
- if (_force_depends)
+ if (installDialog->_force_depends)
{
- if (_force_depends->isChecked())
+ if (installDialog->_force_depends->isChecked())
cmd += " -force-depends ";
- if (_force_reinstall->isChecked())
+ if (installDialog->_force_reinstall->isChecked())
cmd += " -force-reinstall ";
- if (_force_remove->isChecked())
+ if (installDialog->_force_remove->isChecked())
cmd += " -force-removal-of-essential-packages ";
}
@@ -173,20 +173,17 @@ void PmIpkg::processLinkDir( QString file, QString dest )
QDir destDir( destFile );
if (linkOpp==createLink) destDir.mkdir( destFile, true );
QDir d( file );
- d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
+// d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks );
const QFileInfoList *list = d.entryInfoList();
QFileInfoListIterator it( *list );
QFileInfo *fi;
+ qDebug( "while %i",list->count());
while ( (fi=it.current()) )
{
+ pvDebug(4, "processLinkDir "+fi->absFilePath());
processLinkDir( fi->absFilePath(), dest );
++it;
}
-// if (linkOpp==removeLink)
-// {
-// pvDebug(2,"remove destDir "+ destFile );
-// destDir.remove( destFile, true );
-// }
} else
if ( fileInfo.isFile() )
{
@@ -201,13 +198,15 @@ void PmIpkg::processLinkDir( QString file, QString dest )
const char *linkFile = strdup( (destFile).ascii());
if( linkOpp==removeLink )
{
- pvDebug(4,"removing "+destFile+" no "+file);
QFileInfo toRemoveLink( destFile );
if ( !QFile::exists( file ) && toRemoveLink.isSymLink() )
+ {
+ pvDebug(4,"removing "+destFile+" no "+file);
unlink( linkFile );
}
}
}
+}
void PmIpkg::loadList( PackageList pl )
{
@@ -223,12 +222,9 @@ void PmIpkg::loadList( PackageList pl )
}
}
-void PmIpkg::commit( PackageList pl )
+void PmIpkg::commit()
{
int sizecount = 0;
-// QString rem="<b>"+tr("To remove:")+"</b><br>\n";
-// QString inst="<b>"+tr("To install:")+"</b><br>\n";
- loadList(pl);
for (uint i=0; i < to_remove.count(); i++)
sizecount += 1;
for (uint i=0; i < to_install.count(); i++)
@@ -239,57 +235,26 @@ void PmIpkg::commit( PackageList pl )
void PmIpkg::startDialog()
{
- installDialog = new QDialog(0,0,true);
- QGridLayout *RunWindowLayout = new QGridLayout( installDialog );
- RunWindowLayout->setSpacing( 2 );
- RunWindowLayout->setMargin( 2 );
-
- PackageListView *plv = new PackageListView(installDialog, "install",settings);
- plv->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding, plv->sizePolicy().mayShrinkVertically()) );
- RunWindowLayout->addWidget( plv, 1, 0 );
+ installDialog = new InstallDialog(settings,0,0,true);
QCheckListItem *toRemoveItem;
- toRemoveItem= new QCheckListItem( plv, QObject::tr("To remove") );
+ toRemoveItem= new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To remove") );
toRemoveItem->setOpen( true );
for (Package *it=to_remove.first(); it != 0; it=to_remove.next() )
{
- toRemoveItem->insertItem( new PackageListItem(plv, it,settings) );
+ toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) );
}
QCheckListItem *toInstallItem;
- toInstallItem = new QCheckListItem( plv, QObject::tr("To install") );
+ toInstallItem = new QCheckListItem( installDialog->ListViewPackages, QObject::tr("To install") );
toInstallItem->setOpen( true );
for (Package *it=to_install.first(); it != 0; it=to_install.next() )
{
- toInstallItem->insertItem( new PackageListItem(plv, it,settings) );
- }
-
- QGroupBox *GroupBox1 = new QGroupBox( installDialog, "Ipkg" );
- GroupBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, GroupBox1->sizePolicy().mayShrinkVertically() ) );
- GroupBox1->setTitle( tr( "Ipkg options" ) );
- GroupBox1->setColumnLayout(0, Qt::Vertical );
- GroupBox1->layout()->setSpacing( 0 );
- GroupBox1->layout()->setMargin( 0 );
- QGridLayout *GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
- GroupBox1Layout->setAlignment( Qt::AlignTop );
- GroupBox1Layout->setSpacing( 3 );
- GroupBox1Layout->setMargin( 3 );
- _force_depends = new QCheckBox( GroupBox1, "_force_depends" );
- _force_depends->setText( tr( "-force-depends" ) );
- _force_depends->setAutoResize( TRUE );
- _force_depends->setChecked(true);
- GroupBox1Layout->addWidget( _force_depends, 0, 0 );
- _force_reinstall = new QCheckBox( GroupBox1, "_force_reinstall" );
- _force_reinstall->setText( tr( "-force-reinstall" ) );
- _force_reinstall->setAutoResize( TRUE );
- GroupBox1Layout->addWidget( _force_reinstall, 1, 0 );
- _force_remove = new QCheckBox( GroupBox1, "_force_remove" );
- _force_remove->setText( tr( "-force-removal-of-essential-packages" ) );
- _force_remove->setAutoResize( TRUE );
- GroupBox1Layout->addWidget( _force_remove, 1, 0 );
- RunWindowLayout->addWidget( GroupBox1 , 3, 0 );
+ toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, it,settings) );
+ }
installDialog->showMaximized();
if ( installDialog->exec() ) doIt();
installDialog->close();
out(tr("<b>All done.</b>"));
+ to_install.clear();
}
void PmIpkg::doIt()
@@ -357,6 +322,7 @@ void PmIpkg::install()
}
}
out("<br>");
+ to_install.clear();
}
void PmIpkg::createLinks( const QString &dest )
@@ -365,7 +331,8 @@ void PmIpkg::createLinks( const QString &dest )
linkOpp=createLink;
QString url = settings->getDestinationUrlByName( dest );
url = url==""?dest:url;
- processLinkDir( "/", url );
+ processLinkDir( "/opt", url );
+ processLinkDir( "/usr", url );
}
void PmIpkg::removeLinks( const QString &dest )
@@ -374,7 +341,8 @@ void PmIpkg::removeLinks( const QString &dest )
linkOpp=removeLink;
QString url = settings->getDestinationUrlByName( dest );
url = url==""?dest:url;
- processLinkDir( "/", url );
+ processLinkDir( "/opt", url );
+ processLinkDir( "/usr", url );
}
void PmIpkg::update()
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 3799969..d2490e8 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -9,6 +9,7 @@
#include "pksettings.h"
#include "runwindow.h"
#include "packagelist.h"
+#include "installdialog.h"
#include "debug.h"
#define createLink 0
@@ -24,7 +25,7 @@ public:
int linkOpp;
void loadList( PackageList );
- void commit( PackageList );
+ void commit();
void update();
void showButtons(bool b=true);
void show( bool buttons=true );
@@ -39,13 +40,11 @@ public slots:
void removeLinks( const QString &dest );
private:
-// int sizecount;
PackageManagerSettings* settings;
RunWindow *runwindow;
- QDialog *installDialog;
+ InstallDialog *installDialog;
QList<Package> to_remove;
QList<Package> to_install;
-// bool runwindowopen;
QString fileNameToInstall;
QCheckBox *_force_reinstall;
QCheckBox *_force_remove;
diff --git a/noncore/unsupported/oipkg/settings.h b/noncore/unsupported/oipkg/settings.h
index bab7a4f..f01cb69 100644
--- a/noncore/unsupported/oipkg/settings.h
+++ b/noncore/unsupported/oipkg/settings.h
@@ -55,6 +55,7 @@ private:
int currentSetting;
int installationSettingsCount;
bool changed;
+ bool serverChanged;
bool readIpkgConfig(const QString&);
void writeIpkgConfig(const QString&);