author | tille <tille> | 2002-04-27 14:35:48 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 14:35:48 (UTC) |
commit | 320532727fc7dfbe9760d0eea0e17b8e1230fc8e (patch) (side-by-side diff) | |
tree | d65575cdd4c89e6a531b178de04198f39d8276c0 /noncore/unsupported/oipkg/mainwindow.cpp | |
parent | db90999f6298c1107888f062f2c25cb8817b528a (diff) | |
download | opie-320532727fc7dfbe9760d0eea0e17b8e1230fc8e.zip opie-320532727fc7dfbe9760d0eea0e17b8e1230fc8e.tar.gz opie-320532727fc7dfbe9760d0eea0e17b8e1230fc8e.tar.bz2 |
added setDocument and a qcop call to install a file
Diffstat (limited to 'noncore/unsupported/oipkg/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp index 25ca889..e3abf36 100644 --- a/noncore/unsupported/oipkg/mainwindow.cpp +++ b/noncore/unsupported/oipkg/mainwindow.cpp @@ -1,83 +1,87 @@ // adadpted form qpe/qipkg #include "mainwindow.h" #include <qpe/qpemenubar.h> #include <qpe/qpemessagebox.h> #include <qpe/resource.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 <qlistview.h> #include <qtextview.h> #include <qlineedit.h> #include <qtabwidget.h> #include <qcombobox.h> #include <qlayout.h> #include "pksettingsbase.h" #include "packagelistitem.h" MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : QMainWindow( parent, name, f ) { setCaption( tr("Package Manager") ); listViewPackages = new QListView( this,0,0 ); listViewPackages->setSelectionMode(QListView::NoSelection); setCentralWidget( listViewPackages ); + channel = new QCopChannel( "QPE/Application/oipkg", this ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), + this, SLOT(receive(const QCString&, const QByteArray&)) ); + makeMenu(); #ifdef NEWLAYOUT listViewPackages->addColumn( tr("Package") ); listViewPackages->setRootIsDecorated( true ); #endif #ifndef NEWLAYOUT QFontMetrics fm = fontMetrics(); 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-24; 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 ); #endif connect( section, SIGNAL( activated(int) ), this, SLOT( sectionChanged() ) ); connect( subsection, SIGNAL(activated(int) ), this, SLOT( subSectionChanged() ) ); connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), this, SLOT( setCurrent( QListViewItem* ) ) ); connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( stopTimer( QListViewItem* ) ) ); popupMenu = new QPopupMenu( this ); settings = new PackageManagerSettings(this,0,TRUE); ipkg = new PmIpkg( settings, this ); packageList.setSettings( settings ); getList(); setSections(); setSubSections(); displayList(); } void MainWindow::makeMenu() { QPEToolBar *toolBar = new QPEToolBar( this ); QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); QPopupMenu *srvMenu = new QPopupMenu( menuBar ); QPopupMenu *viewMenu = new QPopupMenu( menuBar ); @@ -371,48 +375,62 @@ void MainWindow::findShow(bool b) } void MainWindow::findClose() { findAction->setOn( false ); } void MainWindow::rotateUpdateIcon() { pvDebug(2, "MainWindow::rotateUpdateIcon"); if ( updateIcon ) updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); else updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); updateIcon = !updateIcon; } void MainWindow::showPopup() { popupMenu->clear(); destsMenu->clear(); QAction *popupAction; popupMenu->insertItem( tr("Install to"), destsMenu ); QStringList dests = settings->getDestinationNames(); for (uint i = 0; i < dests.count(); i++ ) { popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); popupAction->addTo( destsMenu ); } connect( destsMenu, SIGNAL( activated( int ) ), this, SLOT( changePackageDest( int ) ) ); popupMenu->popup( QCursor::pos() ); } void MainWindow::changePackageDest( int i ) { activePackage->setDest( destsMenu->text(i) ); activePackage->setOn(); activePackage->setLink( settings->createLinks() ); activePackageListItem->displayDetails(); } void MainWindow::stopTimer( QListViewItem* ) { pvDebug( 5, "stop timer" ); popupTimer->stop(); } + +void MainWindow::setDocument(const QString &fileName) +{ + ipkg->installFile( fileName ); +} + +void MainWindow::receive(const QCString &msg, const QByteArray &arg) +{ + pvDebug(3, "QCop "+msg); + if ( msg == "setDocument(QString)" ) + { + setDocument( QString(arg) ); + } +}
\ No newline at end of file |