-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.cpp | 114 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettings.h | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pksettingsbase.ui | 138 |
5 files changed, 64 insertions, 204 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 11fc91b..04362d3 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -75,49 +75,49 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : connect( settings->createLinksButton, SIGNAL( clicked()), SLOT(createLinks()) ); pvDebug(9,"displayList"); displayList(); } void MainWindow::makeMenu() { QPEToolBar *toolBar = new QPEToolBar( this ); QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); QPopupMenu *srvMenu = new QPopupMenu( menuBar ); QPopupMenu *viewMenu = new QPopupMenu( menuBar ); QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); QPopupMenu *helpMenu = new QPopupMenu( menuBar ); setToolBarsMovable( false ); toolBar->setHorizontalStretchable( true ); menuBar->insertItem( tr( "Package" ), srvMenu ); menuBar->insertItem( tr( "View" ), viewMenu ); menuBar->insertItem( tr( "Settings" ), cfgMenu ); menuBar->insertItem( tr( "Help" ), helpMenu ); - QLabel *spacer; +// QLabel *spacer; // spacer = new QLabel( "", toolBar ); // spacer->setBackgroundColor( toolBar->backgroundColor() ); // toolBar->setStretchableWidget( spacer ); runAction = new QAction( tr( "Apply" ), Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); connect( runAction, SIGNAL( activated() ), this, SLOT( runIpkg() ) ); runAction->addTo( toolBar ); runAction->addTo( srvMenu ); srvMenu->insertSeparator(); updateAction = new QAction( tr( "Update" ), Resource::loadIconSet( "oipkg/update" ), QString::null, 0, this, 0 ); connect( updateAction, SIGNAL( activated() ), this , SLOT( updateList() ) ); updateAction->addTo( toolBar ); updateAction->addTo( srvMenu ); QAction *cfgact; @@ -203,50 +203,49 @@ void MainWindow::makeMenu() connect( a, SIGNAL( activated() ), searchEdit, SLOT( clear() ) ); a->addTo( searchBar ); searchCommit = new QAction( tr( "Do Search" ), Resource::loadPixmap( "find" ), QString::null, 0, this, 0 ); connect( searchCommit, SIGNAL( activated() ), SLOT( remotePackageQuery() ) ); searchCommit->addTo( searchBar ); a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( searchClose() ) ); a->addTo( searchBar ); searchAction = new QAction( tr( "Search" ), QString::null, 0, this, 0 ); connect( searchAction, SIGNAL( toggled(bool) ), this, SLOT( searchShow(bool) ) ); searchAction->setToggleAction( true ); searchAction->addTo( viewMenu ); //DEST destBar = new QPEToolBar(this); addToolBar( destBar, "Destination", QMainWindow::Top, TRUE ); label = new QLabel( tr("Destination: "), destBar ); // label->setBackgroundMode( PaletteForeground ); destBar->setHorizontalStretchable( TRUE ); destination = new QComboBox( false, destBar ); destination->insertStringList( settings->getDestinationNames() ); setComboName(destination,settings->getDestinationName()); connect( destination, SIGNAL(activated(int)), settings, SLOT(activeDestinationChange(int)) ); -// spacer = new QLabel( " ", destBar ); -// spacer->setBackgroundMode( PaletteForeground ); +// space->setBackgroundMode( PaletteForeground ); CheckBoxLink = new QCheckBox( tr("Link"), destBar); // CheckBoxLink->setBackgroundMode( PaletteForeground ); CheckBoxLink->setChecked( settings->createLinks() ); connect( CheckBoxLink, SIGNAL(toggled(bool)), settings, SLOT(linkEnabled(bool)) ); destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 ); connect( destAction, SIGNAL( toggled(bool) ), SLOT( destShow(bool) ) ); a = new QAction( tr( "Close Destinations" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), SLOT( destClose() ) ); a->addTo( destBar ); destBar->setStretchableWidget( CheckBoxLink ); destAction->setToggleAction( true ); destAction->addTo( viewMenu ); // helpMenu helpMenu->insertSeparator(); a = new QAction( tr( "Package Actions" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); helpMenu->insertSeparator(); a = new QAction( tr( "Install" ), Resource::loadPixmap( "oipkg/install" ), QString::null, 0, this, 0 ); a->addTo( helpMenu ); a = new QAction( tr( "Remove" ), Resource::loadPixmap( "oipkg/uninstall" ), QString::null, 0, this, 0 ); diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index b5e86f5..03bf477 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp @@ -91,49 +91,48 @@ void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, int marg = lv->itemMargin(); int r = marg; QPixmap pm = statePixmap(); p->drawPixmap(marg,(height()-pm.height())/2,pm); r += pm.width()+1; p->translate( r, 0 ); QListViewItem::paintCell( p, cg, column, width - r, alignment ); } void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, const QRect & r ) { // Skip QCheckListItem // (makes you wonder what we're getting from QCheckListItem) QListViewItem::paintFocus(p,cg,r); } QPixmap PackageListItem::statePixmap() const { bool installed = package->installed(); bool old = package->isOld(); - bool versions = package->hasVersions(); bool verinstalled = package->otherInstalled(); if ( !package->toProcess() ) { if ( !installed ) if (old) { if (verinstalled) return *pm_uninstalled_old_installed_new; else return *pm_uninstalled_old; } else { if (verinstalled) return *pm_uninstalled_installed_old; else return *pm_uninstalled; } else if (old) return *pm_installed_old; else return *pm_installed; } else { //toProcess() == true if ( !installed ) return *pm_install; else return *pm_uninstall; } } diff --git a/noncore/unsupported/oipkg/pksettings.cpp b/noncore/unsupported/oipkg/pksettings.cpp index 14c1944..acabaed 100644 --- a/noncore/unsupported/oipkg/pksettings.cpp +++ b/noncore/unsupported/oipkg/pksettings.cpp @@ -24,69 +24,69 @@ #include <qstring.h> #include <qobject.h> #include <qtextstream.h> #include <qtextview.h> #include <qtoolbutton.h> #include <qtabwidget.h> #include <stdlib.h> #include <unistd.h> #include "debug.h" //#include "utils.h" PackageManagerSettings::PackageManagerSettings( QWidget* parent, const char* name, WFlags fl ) : PackageManagerSettingsBase( parent, name, fl ) { connect( newserver, SIGNAL(clicked()), this, SLOT(newServer()) ); connect( removeserver, SIGNAL(clicked()), this, SLOT(removeServer()) ); connect( servers, SIGNAL(highlighted(int)), this, SLOT(editServer(int)) ); connect( newdestination, SIGNAL(clicked()), this, SLOT(newDestination()) ); connect( removedestination, SIGNAL(clicked()), this, SLOT(removeDestination()) ); connect( destinations, SIGNAL(highlighted(int)), this, SLOT(editDestination(int)) ); // connect( CheckBoxLink, SIGNAL(toggled(bool)), // activeLinkDestination, SLOT(setEnabled(bool)) ); - connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); - connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); - connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); - connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); - connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); +// connect( settingName, SIGNAL(activated(int)), this, SLOT(installationSettingChange(int)) ); +// connect( settingName, SIGNAL(textChanged(const QString &)), this, SLOT(installationSettingSetName(const QString &)) ); +// connect( newsetting, SIGNAL(clicked()), this, SLOT(newInstallationSetting()) ); +// connect( renamesetting, SIGNAL(clicked()), this, SLOT(renameInstallationSetting()) ); + // connect( removesetting, SIGNAL(clicked()), this, SLOT(removeInstallationSetting()) ); servername->setEnabled(FALSE); serverurl->setEnabled(FALSE); serverurlDic.setAutoDelete(TRUE); destinationname->setEnabled(FALSE); destinationurl->setEnabled(FALSE); destinationurlDic.setAutoDelete(TRUE); readSettings(); activeLinkDestination->hide(); serverChanged = false; // get rid of setups // Settings->hide(); - settingName->hide(); - newsetting->hide(); - renamesetting->hide(); - removesetting->hide(); +// settingName->hide(); +// newsetting->hide(); +// renamesetting->hide(); +// removesetting->hide(); } PackageManagerSettings::~PackageManagerSettings() { } void PackageManagerSettings::newServer() { int i = servers->count(); if ( servername->isEnabled() || serverurl->text().isEmpty() ) { serverurlDic.insert(i,new QString("http://")); servers->insertItem(tr("New")); activeServers->insertItem(tr("New")); } else { // allows one-level undo serverurlDic.insert(i,new QString(serverurl->text())); servers->insertItem(servername->text()); activeServers->insertItem(servername->text()); } changed = true; servers->setSelected(i,TRUE); editServer(i); changed = true; @@ -231,149 +231,149 @@ void PackageManagerSettings::writeIpkgConfig(const QString& conffile) for (int i=0; i<(int)activeServers->count(); i++) { QString url = serverurlDic[i] ? *serverurlDic[i] : QString("???"); if ( !activeServers->isSelected(i) ) s << "#"; s << "src " << activeServers->text(i) << " " << url << "\n"; } for (int i=0; i<(int)destinations->count(); i++) { QString url = destinationurlDic[i] ? *destinationurlDic[i] : QString("???"); s << "dest " << destinations->text(i) << " " << url << "\n"; } conf.close(); } void PackageManagerSettings::readInstallationSettings() { Config cfg( "oipkg", Config::User ); cfg.setGroup( "Settings" ); installationSettingsCount = cfg.readNumEntry( "count", -1 ); currentSetting = cfg.readNumEntry( "current", 0 );// o should be -1 - for (int i = 0; i < installationSettingsCount; i++) - { - cfg.setGroup( "Setting_" + QString::number(i) ); - settingName->insertItem( cfg.readEntry( "name", "???" ), i ); - }; +// for (int i = 0; i < installationSettingsCount; i++) +// { +// cfg.setGroup( "Setting_" + QString::number(i) ); +// settingName->insertItem( cfg.readEntry( "name", "???" ), i ); +// }; readInstallationSetting( currentSetting ); } -/** - * remove from conf file - */ -void PackageManagerSettings::removeInstallationSetting() -{ - settingName->removeItem( settingName->currentItem() ); - Config cfg( "oipkg", Config::User ); - cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); - cfg.clearGroup(); - installationSettingsCount--; - changed = true; - settingName->setEditable( false ); -} - -/** - * write to confgile - */ -void PackageManagerSettings::newInstallationSetting() -{ - installationSettingsCount++; - settingName->insertItem( "New", installationSettingsCount ); - settingName->setCurrentItem( installationSettingsCount ); - settingName->setEditable( true ); - changed = true; -} - -void PackageManagerSettings::installationSettingChange(int cs) -{ - writeCurrentInstallationSetting(); - currentSetting = cs; - readInstallationSetting( cs ); - changed = true; -} +///** +// * remove from conf file +// */ +//void PackageManagerSettings::removeInstallationSetting() +//{ +// settingName->removeItem( settingName->currentItem() ); +// Config cfg( "oipkg", Config::User ); +// cfg.setGroup( "Setting_" + QString::number( installationSettingsCount ) ); +// cfg.clearGroup(); +// installationSettingsCount--; +// changed = true; +// settingName->setEditable( false ); +//} + +///** +// * write to confgile +// */ +//void PackageManagerSettings::newInstallationSetting() +//{ +// installationSettingsCount++; +// settingName->insertItem( "New", installationSettingsCount ); +// settingName->setCurrentItem( installationSettingsCount ); +// settingName->setEditable( true ); +// changed = true; +//} + +//void PackageManagerSettings::installationSettingChange(int cs) +//{ +// writeCurrentInstallationSetting(); +// currentSetting = cs; +// readInstallationSetting( cs ); +// changed = true; +//} void PackageManagerSettings::writeInstallationSettings() { { Config cfg( "oipkg", Config::User ); cfg.setGroup( "Settings" ); cfg.writeEntry( "count", installationSettingsCount ); cfg.writeEntry( "current", currentSetting ); } writeCurrentInstallationSetting(); } void PackageManagerSettings::readInstallationSetting(int setting) { if ( setting < 0 ) return; Config cfg( "oipkg", Config::User ); cfg.setGroup( "Setting_" + QString::number( setting ) ); CheckBoxLink->setChecked( cfg.readBoolEntry( "link", true ) ); QString dest = cfg.readEntry( "dest" ); QString linkdest = cfg.readEntry( "linkdest" ); pvDebug(3, "dest="+dest); pvDebug(3, "linkdest="+linkdest); for ( int i = 0; i < activeDestination->count(); i++) { if ( activeDestination->text( i ) == dest ) activeDestination->setCurrentItem( i ); if ( activeLinkDestination->text( i ) == linkdest ) activeLinkDestination->setCurrentItem( i ); } } void PackageManagerSettings::writeCurrentInstallationSetting() { Config cfg( "oipkg", Config::User ); cfg.setGroup( "Setting_" + QString::number(currentSetting) ); cfg.writeEntry( "link", CheckBoxLink->isChecked() ); cfg.writeEntry( "dest", getDestinationName() ); cfg.writeEntry( "linkdest" , getLinkDestinationName() ); QStringList sers = getActiveServers(); int srvc = 0; for ( QStringList::Iterator it = sers.begin(); it != sers.end(); ++it ) { cfg.writeEntry( "server_" + QString::number(srvc++), *it ); } cfg.writeEntry( "server_count", srvc ); } -void PackageManagerSettings::renameInstallationSetting() -{ - settingName->setEditable( true ); - changed = true; -} +//void PackageManagerSettings::renameInstallationSetting() +//{ +// settingName->setEditable( true ); +// changed = true; +//} -void PackageManagerSettings::installationSettingSetName(const QString &name) -{ - settingName->changeItem( name, settingName->currentItem() ); - changed = true; -} +//void PackageManagerSettings::installationSettingSetName(const QString &name) +//{ +// settingName->changeItem( name, settingName->currentItem() ); +// changed = true; +//} bool PackageManagerSettings::readIpkgConfig(const QString& conffile) { QFile conf(conffile); changed = false; if ( conf.open(IO_ReadOnly) ) { QTextStream s(&conf); servers->clear(); activeServers->clear(); destinations->clear(); activeDestination->clear(); activeLinkDestination->clear(); serverurlDic.clear(); destinationurlDic.clear(); ipkg_old=0; int currentserver=0; while ( !s.atEnd() ) { QString l = s.readLine(); QStringList token = QStringList::split(' ', l); if ( token[0] == "src" || token[0] == "#src" ) { currentserver=servers->count(); serverurlDic.insert(servers->count(),new QString(token[2])); int a = token[0] == "src" ? 1 : 0; diff --git a/noncore/unsupported/oipkg/pksettings.h b/noncore/unsupported/oipkg/pksettings.h index d66c4e8..db991f6 100644 --- a/noncore/unsupported/oipkg/pksettings.h +++ b/noncore/unsupported/oipkg/pksettings.h @@ -9,66 +9,66 @@ class PackageManagerSettings : public PackageManagerSettingsBase { Q_OBJECT public: PackageManagerSettings( QWidget* , const char* , WFlags ); ~PackageManagerSettings(); bool showDialog( int ) ; QString getDestinationUrl(); QString getDestinationName(); QString getLinkDestinationName(); bool createLinks(); QStringList getServers(); QStringList getActiveServers(); QStringList getDestinationUrls(); QStringList getDestinationNames(); QString getDestinationUrlByName(QString); public slots: void writeInstallationSettings(); void readInstallationSettings(); void writeCurrentInstallationSetting(); void readInstallationSetting(int); - void installationSettingSetName(const QString &); +// void installationSettingSetName(const QString &); void removeLinksToDest(); void createLinksToDest(); void newServer(); void editServer(int); void removeDestination(); void newDestination(); void editDestination(int); void linkEnabled(bool); void removeServer(); void serverNameChanged(const QString&); void serverUrlChanged(const QString&); void destNameChanged(const QString&); void destUrlChanged(const QString&); - void installationSettingChange(int); - void newInstallationSetting(); - void removeInstallationSetting(); - void renameInstallationSetting(); +// void installationSettingChange(int); +// void newInstallationSetting(); +// void removeInstallationSetting(); +// void renameInstallationSetting(); void activeServerChanged(); void activeDestinationChange(int); signals: // void doCreateLinks( QString dest ); // void doRemoveLinks( QString dest ); private: QIntDict<QString> serverurlDic; QIntDict<QString> destinationurlDic; int ipkg_old; int editedserver; int editeddestination; int currentSetting; int installationSettingsCount; bool changed; bool serverChanged; bool readIpkgConfig(const QString&); void writeIpkgConfig(const QString&); void writeSettings(); void readSettings(); }; #endif diff --git a/noncore/unsupported/oipkg/pksettingsbase.ui b/noncore/unsupported/oipkg/pksettingsbase.ui index e95ed83..5bc5b46 100644 --- a/noncore/unsupported/oipkg/pksettingsbase.ui +++ b/noncore/unsupported/oipkg/pksettingsbase.ui @@ -48,97 +48,48 @@ <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Settings</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> - <widget row="0" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout3_2</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QLabel</class> - <property stdset="1"> - <name>name</name> - <cstring>Settings</cstring> - </property> - <property stdset="1"> - <name>text</name> - <string>Installation Setups</string> - </property> - </widget> - <spacer> - <property> - <name>name</name> - <cstring>Spacer2_2_2</cstring> - </property> - <property stdset="1"> - <name>orientation</name> - <enum>Horizontal</enum> - </property> - <property stdset="1"> - <name>sizeType</name> - <enum>Expanding</enum> - </property> - <property> - <name>sizeHint</name> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </hbox> - </widget> <widget row="5" column="0" > <class>QLayoutWidget</class> <property stdset="1"> <name>name</name> <cstring>Layout8</cstring> </property> <hbox> <property stdset="1"> <name>margin</name> <number>0</number> </property> <property stdset="1"> <name>spacing</name> <number>6</number> </property> <widget> <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel1</cstring> </property> <property stdset="1"> <name>text</name> <string>Install destination:</string> @@ -235,137 +186,48 @@ <name>sizeHint</name> <size> <width>20</width> <height>20</height> </size> </property> </spacer> </hbox> </widget> <widget row="4" column="0" > <class>QListBox</class> <property stdset="1"> <name>name</name> <cstring>activeServers</cstring> </property> <property stdset="1"> <name>enabled</name> <bool>true</bool> </property> <property stdset="1"> <name>selectionMode</name> <enum>Multi</enum> </property> </widget> - <widget row="1" column="0" > - <class>QComboBox</class> - <property stdset="1"> - <name>name</name> - <cstring>settingName</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>true</bool> - </property> - <property stdset="1"> - <name>focusPolicy</name> - <enum>NoFocus</enum> - </property> - <property stdset="1"> - <name>editable</name> - <bool>false</bool> - </property> - </widget> - <widget row="2" column="0" > - <class>QLayoutWidget</class> - <property stdset="1"> - <name>name</name> - <cstring>Layout11</cstring> - </property> - <hbox> - <property stdset="1"> - <name>margin</name> - <number>0</number> - </property> - <property stdset="1"> - <name>spacing</name> - <number>6</number> - </property> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>newsetting</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>New</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>renamesetting</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>Rename</string> - </property> - </widget> - <widget> - <class>QPushButton</class> - <property stdset="1"> - <name>name</name> - <cstring>removesetting</cstring> - </property> - <property stdset="1"> - <name>enabled</name> - <bool>false</bool> - </property> - <property stdset="1"> - <name>text</name> - <string>Remove</string> - </property> - <property stdset="1"> - <name>autoDefault</name> - <bool>false</bool> - </property> - </widget> - </hbox> - </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Servers</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>3</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="3" column="0" rowspan="1" colspan="2" > <class>QLayoutWidget</class> <property stdset="1"> |