summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp109
1 files changed, 90 insertions, 19 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index ca1e5e8..06828e0 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -25,2 +25,3 @@
#include <qmessagebox.h>
+#include <qpushbutton.h>
#include <qlayout.h>
@@ -44,3 +45,5 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
ipkg = new PmIpkg( settings, this );
+// settings->setIpkg( ipkg );
packageList.setSettings( settings );
+ packageListSearch.setSettings( settings );
packageList.update();
@@ -56,2 +59,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
+
+ connect( settings->removeLinksButton, SIGNAL( clicked()),
+ SLOT(removeLinks()) );
+ connect( settings->createLinksButton, SIGNAL( clicked()),
+ SLOT(createLinks()) );
+
+// rootLocal = new QCheckListItem(listViewPackages,tr("local"));
+// rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
displayList();
@@ -99,10 +110,2 @@ void MainWindow::makeMenu()
-// could we use for find
-// detailsAction = new QAction( tr( "Find" ),
-// Resource::loadIconSet( "find" ),
-// QString::null, 0, this, 0 );
-// connect( detailsAction, SIGNAL( activated() ),
-// this , SLOT( showFind() ) );
-// detailsAction->addTo( toolBar );
-
QAction *cfgact;
@@ -128,2 +131,3 @@ void MainWindow::makeMenu()
+ // SECTIONS
sectionBar = new QPEToolBar( this );
@@ -141,6 +145,4 @@ void MainWindow::makeMenu()
a->addTo( sectionBar );
-
setSections();
setSubSections();
-
sectionAction = new QAction( tr( "Sections" ), QString::null, 0, this, 0 );
@@ -150,4 +152,5 @@ void MainWindow::makeMenu()
+ //FIND
findBar = new QPEToolBar(this);
- addToolBar( findBar, "Search", QMainWindow::Top, TRUE );
+ addToolBar( findBar, "Filter", QMainWindow::Top, TRUE );
label = new QLabel( tr("Filter: "), findBar );
@@ -159,3 +162,2 @@ void MainWindow::makeMenu()
this, SLOT( displayList() ) );
-
a = new QAction( tr( "Clear Find" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
@@ -166,3 +168,3 @@ void MainWindow::makeMenu()
a->addTo( findBar );
- findAction = new QAction( tr( "Find" ), QString::null, 0, this, 0 );
+ findAction = new QAction( tr( "Filter" ), QString::null, 0, this, 0 );
connect( findAction, SIGNAL( toggled(bool) ), this, SLOT( findShow(bool) ) );
@@ -171,2 +173,27 @@ void MainWindow::makeMenu()
+ //SEARCH
+ searchBar = new QPEToolBar(this);
+ addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
+ label = new QLabel( tr("ipkgfind: "), searchBar );
+ label->setBackgroundColor( searchBar->backgroundColor() );
+ searchBar->setHorizontalStretchable( TRUE );
+ searchEdit = new QLineEdit( searchBar, "seachEdit" );
+ searchBar->setStretchableWidget( searchEdit );
+// connect( searchEdit, SIGNAL( textChanged( const QString & ) ),
+// this, SLOT( displayList() ) );
+ a = new QAction( tr( "Clear Search" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 );
+ 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);
@@ -179,4 +206,4 @@ void MainWindow::makeMenu()
setComboName(destination,settings->getDestinationName());
-// connect( destination, SIGNAL(activated(int)),
-// SLOT(activeDestinationChange(int)) );
+ connect( destination, SIGNAL(activated(int)),
+ settings, SLOT(activeDestinationChange(int)) );
spacer = new QLabel( " ", destBar );
@@ -186,4 +213,4 @@ void MainWindow::makeMenu()
CheckBoxLink->setChecked( settings->createLinks() );
-// connect( CheckBoxLink, SIGNAL(toggled(bool)),
-// settings, SLOT(linkEnabled(bool)) );
+ connect( CheckBoxLink, SIGNAL(toggled(bool)),
+ settings, SLOT(linkEnabled(bool)) );
destAction = new QAction( tr( "Destinations" ), QString::null, 0, this, 0 );
@@ -202,2 +229,3 @@ void MainWindow::makeMenu()
findShow( cfg.readBoolEntry( "findBar", true ) );
+ searchShow( cfg.readBoolEntry( "searchBar", true ) );
sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
@@ -211,2 +239,3 @@ MainWindow::~MainWindow()
cfg.writeEntry( "findBar", !findBar->isHidden() );
+ cfg.writeEntry( "searchBar", !searchBar->isHidden() );
cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
@@ -219,2 +248,3 @@ void MainWindow::runIpkg()
packageList.allPackages();
+ ipkg->loadList( packageListSearch );
ipkg->commit( packageList );
@@ -256,8 +286,17 @@ void MainWindow::displayList()
Package *pack = packageList.first();
+ PackageListItem *item;
+
+ QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
+ QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
while( pack )
{
- if ( pack && (pack->name() != "") )
- listViewPackages->insertItem( new PackageListItem( listViewPackages, pack, settings ) );
+ item = new PackageListItem( rootLocal, pack, settings );
pack = packageList.next();
}
+ pack = packageListSearch.first();
+ while( pack )
+ {
+ item = new PackageListItem( rootSearch, pack, settings );
+ pack = packageListSearch.next();
+ }
}
@@ -347,2 +386,15 @@ void MainWindow::findClose()
+void MainWindow::searchShow(bool b)
+{
+ if (b) searchBar->show();
+ else searchBar->hide();
+ searchAction->setOn( b );
+}
+
+void MainWindow::searchClose()
+{
+ searchAction->setOn( false );
+}
+
+
void MainWindow::destShow(bool b)
@@ -422 +474,20 @@ void MainWindow::receive(const QCString &msg, const QByteArray &arg)
}
+
+
+void MainWindow::createLinks()
+{
+ pvDebug(2,"creating links...");
+ ipkg->createLinks( settings->destinationurl->text() );
+}
+
+void MainWindow::removeLinks()
+{
+ pvDebug(2,"removing links...");
+ ipkg->removeLinks( settings->destinationurl->text() );
+}
+
+void MainWindow::remotePackageQuery()
+{
+ packageListSearch.query( searchEdit->text() );
+ displayList();
+}