summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 4865c39..0422d65 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -1,89 +1,90 @@
// adadpted form qpe/qipkg
#include "mainwindow.h"
#include <qpe/qpemenubar.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qpe/qpetoolbar.h>
#include <qpe/qcopenvelope_qws.h>
#include <qaction.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qtoolbutton.h>
#include <qstring.h>
#include <qlabel.h>
#include <qfile.h>
#include <qlistview.h>
#include <qtextview.h>
#include <qcheckbox.h>
#include <qlineedit.h>
#include <qtabwidget.h>
#include <qcombobox.h>
#include <qmessagebox.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include "pksettingsbase.h"
#include "utils.h"
#include "packagelistitem.h"
MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
QMainWindow( parent, name, f )
{
setCaption( tr("Package Manager") );
settings = new PackageManagerSettings(this,0,TRUE);
listViewPackages = new PackageListView( this,"listViewPackages",settings );
setCentralWidget( listViewPackages );
-
+ listViewPackages->addList( tr("local"), &packageList );
+ listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
// wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
// wait = new QMessageBox(this);
// wait->setText(tr("Please wait"));
ipkg = new PmIpkg( settings, this );
// settings->setIpkg( ipkg );
packageList.setSettings( settings );
packageListSearch.setSettings( settings );
packageList.update();
makeMenu();
makeChannel();
//opie is hardcoded default ;)
for (int i=0;i<section->count();i++)
if (section->text(i)=="opie")
section->setCurrentItem(i);
sectionChanged();
connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
connect( settings->removeLinksButton, SIGNAL( clicked()),
SLOT(removeLinks()) );
connect( settings->createLinksButton, SIGNAL( clicked()),
SLOT(createLinks()) );
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 *sectMenu = 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( "Sections" ), sectMenu );
QLabel *spacer = new QLabel( "", toolBar );
spacer->setBackgroundColor( toolBar->backgroundColor() );
toolBar->setStretchableWidget( spacer );
@@ -235,116 +236,116 @@ 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() );
}
void MainWindow::runIpkg()
{
packageList.allPackages();
ipkg->loadList( packageListSearch );
ipkg->commit( packageList );
// ##### 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)");
QString lf = QString::null;
e << lf;
displayList();
}
void MainWindow::updateList()
{
// wait->show();
QTimer *t = new QTimer( this );
connect( t, SIGNAL(timeout()), SLOT( rotateUpdateIcon() ) );
t->start( 0, false );
packageList.clear();
ipkg->update();
packageList.update();
t->stop();
// wait->hide();
}
void MainWindow::filterList()
{
// wait->show();
QString f = "";
if ( findAction->isOn() ) f = findEdit->text();
packageList.filterPackages( f );
// wait->hide();
}
void MainWindow::displayList()
{
// wait->hide();
filterList();
- listViewPackages->clear();
- Package *pack = packageList.first();
- PackageListItem *item;
-
-// if (!rootLocal)
+ listViewPackages->display();
+//// if (!rootLocal)
+//// {
+// QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
+// QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
+//// }
+// listViewPackages->clear();
+// Package *pack = packageList.first();
+// PackageListItem *item;
+// while( pack )
+// {
+// item = new PackageListItem( rootLocal, pack, settings );
+// pack = packageList.next();
+// }
+// pack = packageListSearch.first();
+// while( pack )
// {
- QCheckListItem *rootLocal = new QCheckListItem(listViewPackages,tr("local"));
- QCheckListItem *rootSearch = new QCheckListItem(listViewPackages,tr("ipkgfind"));
-// }
- while( pack )
- {
- item = new PackageListItem( rootLocal, pack, settings );
- pack = packageList.next();
- }
- pack = packageListSearch.first();
- while( pack )
- {
- item = new PackageListItem( rootSearch, pack, settings );
- pack = packageListSearch.next();
- }
+// item = new PackageListItem( rootSearch, pack, settings );
+// pack = packageListSearch.next();
+// }
}
void MainWindow::sectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
subsection->clear();
packageList.setSection( section->currentText() );
setSubSections();
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::subSectionChanged()
{
disconnect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
disconnect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
packageList.setSubSection( subsection->currentText() );
connect( section, SIGNAL( activated(int) ),
this, SLOT( sectionChanged() ) );
connect( subsection, SIGNAL(activated(int) ),
this, SLOT( subSectionChanged() ) );
displayList();
}
void MainWindow::setSections()
{
section->clear();
section->insertStringList( packageList.getSections() );
}
void MainWindow::setSubSections()
{
subsection->clear();
subsection->insertStringList( packageList.getSubSections() );
}
void MainWindow::showSettings()
{
if ( settings->showDialog( 0 ) )