summaryrefslogtreecommitdiff
authortille <tille>2002-04-24 19:15:02 (UTC)
committer tille <tille>2002-04-24 19:15:02 (UTC)
commit17eb865ad8248b1f47c565b074b9b6bbbd44935b (patch) (side-by-side diff)
treec494b5050ce910df3c74e2a21c5579571792d926
parent997b7685dcc48cc36737240ca53331f83b66dbeb (diff)
downloadopie-17eb865ad8248b1f47c565b074b9b6bbbd44935b.zip
opie-17eb865ad8248b1f47c565b074b9b6bbbd44935b.tar.gz
opie-17eb865ad8248b1f47c565b074b9b6bbbd44935b.tar.bz2
added find
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp204
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h26
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro1
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp23
-rw-r--r--noncore/unsupported/oipkg/packagelist.h7
-rw-r--r--noncore/unsupported/oipkg/pkwindow.ui147
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp2
7 files changed, 180 insertions, 230 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index cb2b4cd..997f449 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -14,4 +14,6 @@
#include <qstring.h>
+#include <qlabel.h>
#include <qlistview.h>
#include <qtextview.h>
+#include <qlineedit.h>
#include <qtabwidget.h>
@@ -27,4 +29,6 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
setCaption( tr("Package Manager") );
- table = new PackageWindow( this,0,0 );
- setCentralWidget( table );
+
+ listViewPackages = new QListView( this,0,0 );
+ setCentralWidget( listViewPackages );
+
makeMenu();
@@ -32,17 +36,20 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
QFontMetrics fm = fontMetrics();
- int w0 = fm.width(tr("Package"))+30;
- int w2 = fm.width("00000")+4;
- table->ListViewPackages->setColumnWidth(0,w0);
- table->ListViewPackages->setColumnWidth(1,228-w2-w0); // ### screen-biased
- table->ListViewPackages->setColumnWidth(2,w2);
- table->ListViewPackages->setColumnWidthMode(0,QListView::Manual);
- table->ListViewPackages->setColumnWidthMode(1,QListView::Manual);
- table->ListViewPackages->setColumnWidthMode(2,QListView::Manual);
- table->ListViewPackages->setSelectionMode( QListView::Multi );
-
- connect( table->section, SIGNAL( activated(int) ),
+ int wlw = width()*2;
+ int w0 = fm.width(tr("Package"))+30;
+ // int w0 = fm.width(tr("Package"))+30;
+ int w2 = fm.width("00000")+4;
+ int w1 = wlw-w2-w0-20;
+ listViewPackages->addColumn( tr("Package"), w0 );
+ listViewPackages->addColumn( tr("Description"), w1 );
+ listViewPackages->addColumn( tr("Size"), w2 );
+ listViewPackages->setColumnWidthMode(0,QListView::Manual);
+ listViewPackages->setColumnWidthMode(1,QListView::Manual);
+ listViewPackages->setColumnWidthMode(2,QListView::Manual);
+ listViewPackages->setSelectionMode( QListView::Multi );
+
+ connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
- connect( table->subsection, SIGNAL(activated(int) ),
+ connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
- connect( table->ListViewPackages, SIGNAL( clicked( QListViewItem* ) ),
+ connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ),
this, SLOT( setCurrent( QListViewItem* ) ) );
@@ -65,2 +72,3 @@ void MainWindow::makeMenu()
QPopupMenu *srvMenu = new QPopupMenu( menuBar );
+ QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
@@ -68,8 +76,3 @@ void MainWindow::makeMenu()
-//#define TOOLBAR
-#ifdef TOOLBAR
- QPEToolBar *secBar = new QPEToolBar( this );
- QComboBox *sections = new QComboBox( false, this );
- secBar->addTo( sections );
-#endif
+ popupMenu = new QPopupMenu( this );
@@ -80,2 +83,3 @@ void MainWindow::makeMenu()
menuBar->insertItem( tr( "Package" ), srvMenu );
+ menuBar->insertItem( tr( "View" ), viewMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
@@ -83,6 +87,8 @@ void MainWindow::makeMenu()
- toolBar->setStretchableWidget (srvMenu);
+ QLabel *spacer = new QLabel( "", toolBar );
+ spacer->setBackgroundColor( toolBar->backgroundColor() );
+ toolBar->setStretchableWidget( spacer );
- runAction = new QAction( tr( "Run" ),
+ runAction = new QAction( tr( "Commit" ),
Resource::loadPixmap( "oipkg/install" ),
@@ -104,9 +110,9 @@ void MainWindow::makeMenu()
- // detailsAction = new QAction( tr( "Details" ),
- // Resource::loadIconSet( "oipkg/details" ),
- // QString::null, 0, this, 0 );
- // connect( detailsAction, SIGNAL( activated() ),
- // this , SLOT( showDetails() ) );
- // detailsAction->addTo( toolBar );
- // detailsAction->addTo( srvMenu );
+ detailsAction = new QAction( tr( "Details" ),
+ Resource::loadIconSet( "find" ),
+ QString::null, 0, this, 0 );
+ connect( detailsAction, SIGNAL( activated() ),
+ this , SLOT( showDetails() ) );
+ detailsAction->addTo( toolBar );
+ detailsAction->addTo( srvMenu );
@@ -115,3 +121,3 @@ void MainWindow::makeMenu()
cfgact = new QAction( tr( "Setups" ),
- Resource::loadIconSet( "" ),
+ // Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
@@ -122,3 +128,3 @@ void MainWindow::makeMenu()
cfgact = new QAction( tr( "Servers" ),
- Resource::loadIconSet( "" ),
+ // Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
@@ -128,3 +134,3 @@ void MainWindow::makeMenu()
cfgact = new QAction( tr( "Destinations" ),
- Resource::loadIconSet( "" ),
+ // Resource::loadIconSet( "" ),
QString::null, 0, this, 0 );
@@ -133,3 +139,49 @@ void MainWindow::makeMenu()
cfgact->addTo( cfgMenu );
-
+
+ QAction *a;
+
+ sectionBar = new QPEToolBar( this );
+ addToolBar( sectionBar, "Section", QMainWindow::Top, TRUE );
+ sectionBar->setHorizontalStretchable( true );
+ QLabel *label = new QLabel( tr("Section: "), sectionBar );
+ label->setBackgroundColor( sectionBar->backgroundColor() );
+ section = new QComboBox( false, sectionBar );
+// section->setBackgroundMode( PaletteBackground );
+ label = new QLabel( " / ", sectionBar );
+ label->setBackgroundColor( sectionBar->backgroundColor() );
+ subsection = new QComboBox( false, sectionBar );
+ sectionBar->setStretchableWidget( label );
+
+ a = new QAction( tr( "Close Section" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( sectionClose() ) );
+ a->addTo( sectionBar );
+
+ sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
+ connect( sectionAction, SIGNAL( toggled(bool) ), this, SLOT( sectionShow(bool) ) );
+ sectionAction->setToggleAction( true );
+ sectionAction->setOn( true );
+ sectionAction->addTo( viewMenu );
+
+ findBar = new QPEToolBar(this);
+ addToolBar( findBar, "Search", QMainWindow::Top, TRUE );
+ label = new QLabel( tr("Filter: "), findBar );
+ label->setBackgroundColor( findBar->backgroundColor() );
+ findBar->setHorizontalStretchable( TRUE );
+ findEdit = new QLineEdit( findBar, "findEdit" );
+ findBar->setStretchableWidget( findEdit );
+ connect( findEdit, SIGNAL( textChanged( const QString & ) ),
+ this, SLOT( displayList() ) );
+// a = new QAction( tr( "Filter" ), Resource::loadPixmap( "next" ), QString::null, 0, this, 0 );
+// connect( a, SIGNAL( activated() ), this, SLOT( filterList() ) );
+// a->addTo( findBar );
+// a->addTo( edit );
+ a = new QAction( tr( "Close Find" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 );
+ connect( a, SIGNAL( activated() ), this, SLOT( findClose() ) );
+ a->addTo( findBar );
+ findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 );
+ connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
+ findAction->setToggleAction( true );
+ findAction->setOn( true );
+ findAction->addTo( viewMenu );
+
}
@@ -143,3 +195,3 @@ void MainWindow::runIpkg()
ipkg->commit( packageList );
- updateList();
+ updateList(); //to remove
}
@@ -148,3 +200,3 @@ void MainWindow::updateList()
{
- // todo: packageList.clear();
+ packageList.clear();
ipkg->update();
@@ -161,3 +213,5 @@ void MainWindow::filterList()
{
- packageList.filterPackages();
+ QString f = "";
+ if ( findAction->isOn() ) f = findEdit->text();
+ packageList.filterPackages( f );
}
@@ -166,13 +220,11 @@ void MainWindow::displayList()
{
- table->ListViewPackages->clear();
+ filterList();
+ listViewPackages->clear();
Package *pack = packageList.first();
while( pack )
- {
- if ( pack && (pack->name() != "") )
- {
- table->ListViewPackages->insertItem(
- new PackageListItem( table->ListViewPackages, pack ) );
- }
- pack = packageList.next();
- }
+ {
+ if ( pack && (pack->name() != "") )
+ listViewPackages->insertItem( new PackageListItem( listViewPackages, pack ) );
+ pack = packageList.next();
+ }
}
@@ -181,13 +233,12 @@ void MainWindow::sectionChanged()
{
- disconnect( table->section, SIGNAL( activated(int) ),
+ disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
- disconnect( table->subsection, SIGNAL(activated(int) ),
+ disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
- table->subsection->clear();
- packageList.setSection( table->section->currentText() );
+ subsection->clear();
+ packageList.setSection( section->currentText() );
setSubSections();
- filterList();
- connect( table->section, SIGNAL( activated(int) ),
+ connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
- connect( table->subsection, SIGNAL(activated(int) ),
+ connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
@@ -198,11 +249,10 @@ void MainWindow::subSectionChanged()
{
- disconnect( table->section, SIGNAL( activated(int) ),
+ disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
- disconnect( table->subsection, SIGNAL(activated(int) ),
+ disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
- packageList.setSubSection( table->subsection->currentText() );
- filterList();
- connect( table->section, SIGNAL( activated(int) ),
+ packageList.setSubSection( subsection->currentText() );
+ connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
- connect( table->subsection, SIGNAL(activated(int) ),
+ connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
@@ -213,4 +263,4 @@ void MainWindow::setSections()
{
- table->section->clear();
- table->section->insertStringList( packageList.getSections() );
+ section->clear();
+ section->insertStringList( packageList.getSections() );
}
@@ -219,4 +269,4 @@ void MainWindow::setSubSections()
{
- table->subsection->clear();
- table->subsection->insertStringList( packageList.getSubSections() );
+ subsection->clear();
+ subsection->insertStringList( packageList.getSubSections() );
}
@@ -269,4 +319,30 @@ void MainWindow::setCurrent( QListViewItem* p )
pvDebug(2, "MainWindow::setCurrent ");
- //+((Package*)p)->name());
+ return;
+ pvDebug(2, "name "+((Package*)p)->name());
activePackage = (Package*)p;
}
+
+void MainWindow::sectionShow(bool b)
+{
+ if (b) sectionBar->show();
+ else sectionBar->hide();
+ sectionAction->setOn( b );
+}
+
+void MainWindow::sectionClose()
+{
+ sectionAction->setOn( false );
+}
+
+void MainWindow::findShow(bool b)
+{
+ if (b) findBar->show();
+ else findBar->hide();
+ findAction->setOn( b );
+}
+
+void MainWindow::findClose()
+{
+ findAction->setOn( false );
+}
+
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 95dcc90..0c1e474 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -12,3 +12,7 @@
-#include "pkwindow.h"
+class QComboBox;
+class QPEToolBar;
+class QLineEdit;
+class QListView;
+
@@ -23,7 +27,2 @@ public:
-
-protected:
- PackageWindow *table;
-
-
protected slots:
@@ -32,3 +31,2 @@ protected slots:
void updateList();
- void filterList();
void displayList();
@@ -44,2 +42,7 @@ public slots:
void setCurrent( QListViewItem* );
+ void sectionClose();
+ void sectionShow(bool);
+ void findClose();
+ void findShow(bool);
+ void filterList();
@@ -58,3 +61,12 @@ private:
QAction *updateAction;
+ QAction *findAction;
+ QAction *sectionAction;
+ QListView *listViewPackages;
QPopupMenu *contextMenu;
+ QPEToolBar *findBar;
+ QLineEdit *findEdit;
+ QPEToolBar *sectionBar;
+ QComboBox *section;
+ QComboBox *subsection;
+ QPopupMenu *popupMenu;
};
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index c61af0f..c16cc73 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -23,3 +23,2 @@ INTERFACES = pkdesc.ui \
runwindow.ui \
- pkwindow.ui \
pksettingsbase.ui
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 5f6934d..944bb83 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -27,4 +27,2 @@ PackageList::PackageList()
}
- pvDebug( 5, "PackageList::PackageList statusDir "+statusDir);
- pvDebug( 5, "PackageList::PackageList listsDir "+listsDir);
sections << "All";
@@ -65,3 +63,3 @@ void PackageList::insertPackage( Package* pack )
-void PackageList::filterPackages()
+void PackageList::filterPackages( QString f )
{
@@ -73,7 +71,10 @@ void PackageList::filterPackages()
{
- if ( ((aktSection=="All")||(pack->getSection()==aktSection)) &&
- ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) )
- {
- packageList.insert( pack->name(), pack );
- }
+ if (
+ ((aktSection=="All")||(pack->getSection()==aktSection)) &&
+ ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) &&
+ pack->name().contains( f )
+ )
+ {
+ packageList.insert( pack->name(), pack );
+ }
++filterIter;
@@ -216 +217,7 @@ Package* PackageList::getByName( QString n )
}
+
+void PackageList::clear()
+{
+ origPackageList.clear();
+ packageList.clear();
+}
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h
index 68b89f0..4ce97af 100644
--- a/noncore/unsupported/oipkg/packagelist.h
+++ b/noncore/unsupported/oipkg/packagelist.h
@@ -16,2 +16,4 @@ class PackageList {
public:
+// static QString all = QObject::tr("All");
+
PackageList();
@@ -27,5 +29,6 @@ public:
void setSettings( PackageManagerSettings* );
- void filterPackages();
- /** No descriptions */
+ void filterPackages( QString );
Package* getByName( QString );
+ /** No descriptions */
+ void clear();
diff --git a/noncore/unsupported/oipkg/pkwindow.ui b/noncore/unsupported/oipkg/pkwindow.ui
deleted file mode 100644
index 9e44338..0000000
--- a/noncore/unsupported/oipkg/pkwindow.ui
+++ b/dev/null
@@ -1,147 +0,0 @@
-<!DOCTYPE UI><UI>
-<class>PackageWindow</class>
-<widget>
- <class>QWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>PackageWindow</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>0</x>
- <y>0</y>
- <width>254</width>
- <height>298</height>
- </rect>
- </property>
- <property stdset="1">
- <name>caption</name>
- <string>PackageWindow</string>
- </property>
- <property>
- <name>layoutMargin</name>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <vbox>
- <property stdset="1">
- <name>margin</name>
- <number>2</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>2</number>
- </property>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout5</cstring>
- </property>
- <property>
- <name>layoutSpacing</name>
- </property>
- <hbox>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>1</number>
- </property>
- <widget>
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>LabelSection</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Section:</string>
- </property>
- </widget>
- <widget>
- <class>QComboBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>section</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- </widget>
- <widget>
- <class>QComboBox</class>
- <property stdset="1">
- <name>name</name>
- <cstring>subsection</cstring>
- </property>
- <property stdset="1">
- <name>sizePolicy</name>
- <sizepolicy>
- <hsizetype>0</hsizetype>
- <vsizetype>0</vsizetype>
- </sizepolicy>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget>
- <class>QListView</class>
- <column>
- <property>
- <name>text</name>
- <string>Package</string>
- </property>
- <property>
- <name>clickable</name>
- <bool>true</bool>
- </property>
- <property>
- <name>resizeable</name>
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property>
- <name>text</name>
- <string>Description</string>
- </property>
- <property>
- <name>clickable</name>
- <bool>true</bool>
- </property>
- <property>
- <name>resizeable</name>
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property>
- <name>text</name>
- <string>Size</string>
- </property>
- <property>
- <name>clickable</name>
- <bool>true</bool>
- </property>
- <property>
- <name>resizeable</name>
- <bool>true</bool>
- </property>
- </column>
- <property stdset="1">
- <name>name</name>
- <cstring>ListViewPackages</cstring>
- </property>
- </widget>
- </vbox>
-</widget>
-</UI>
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 94ca824..b2ddf95 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -35,3 +35,3 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag
runwindow = new RunWindow ( p, name, f );
- linkDest = new QCopChannel( "QPE/MakeLinks", this );
+ linkDest = new QCopChannel( "QPE/oipkg", this );
connect( linkDest, SIGNAL(received(const QCString &, const QByteArray &)),