summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/mainwindow.cpp
authortille <tille>2002-04-27 14:35:48 (UTC)
committer tille <tille>2002-04-27 14:35:48 (UTC)
commit320532727fc7dfbe9760d0eea0e17b8e1230fc8e (patch) (unidiff)
treed65575cdd4c89e6a531b178de04198f39d8276c0 /noncore/unsupported/oipkg/mainwindow.cpp
parentdb90999f6298c1107888f062f2c25cb8817b528a (diff)
downloadopie-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) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp18
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
@@ -12,48 +12,52 @@
12#include <qmessagebox.h> 12#include <qmessagebox.h>
13#include <qpopupmenu.h> 13#include <qpopupmenu.h>
14#include <qtoolbutton.h> 14#include <qtoolbutton.h>
15#include <qstring.h> 15#include <qstring.h>
16#include <qlabel.h> 16#include <qlabel.h>
17#include <qlistview.h> 17#include <qlistview.h>
18#include <qtextview.h> 18#include <qtextview.h>
19#include <qlineedit.h> 19#include <qlineedit.h>
20#include <qtabwidget.h> 20#include <qtabwidget.h>
21#include <qcombobox.h> 21#include <qcombobox.h>
22#include <qlayout.h> 22#include <qlayout.h>
23 23
24#include "pksettingsbase.h" 24#include "pksettingsbase.h"
25#include "packagelistitem.h" 25#include "packagelistitem.h"
26 26
27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : 27MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
28 QMainWindow( parent, name, f ) 28 QMainWindow( parent, name, f )
29 { 29 {
30 setCaption( tr("Package Manager") ); 30 setCaption( tr("Package Manager") );
31 31
32 listViewPackages = new QListView( this,0,0 ); 32 listViewPackages = new QListView( this,0,0 );
33 listViewPackages->setSelectionMode(QListView::NoSelection); 33 listViewPackages->setSelectionMode(QListView::NoSelection);
34 setCentralWidget( listViewPackages ); 34 setCentralWidget( listViewPackages );
35 35
36 channel = new QCopChannel( "QPE/Application/oipkg", this );
37 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
38 this, SLOT(receive(const QCString&, const QByteArray&)) );
39
36 makeMenu(); 40 makeMenu();
37#ifdef NEWLAYOUT 41#ifdef NEWLAYOUT
38 listViewPackages->addColumn( tr("Package") ); 42 listViewPackages->addColumn( tr("Package") );
39 listViewPackages->setRootIsDecorated( true ); 43 listViewPackages->setRootIsDecorated( true );
40#endif 44#endif
41#ifndef NEWLAYOUT 45#ifndef NEWLAYOUT
42 QFontMetrics fm = fontMetrics(); 46 QFontMetrics fm = fontMetrics();
43 int wlw = width()*2; 47 int wlw = width()*2;
44 int w0 = fm.width(tr("Package"))+30; 48 int w0 = fm.width(tr("Package"))+30;
45 // int w0 = fm.width(tr("Package"))+30; 49 // int w0 = fm.width(tr("Package"))+30;
46 int w2 = fm.width("00000")+4; 50 int w2 = fm.width("00000")+4;
47 int w1 = wlw-w2-w0-24; 51 int w1 = wlw-w2-w0-24;
48 listViewPackages->addColumn( tr("Package"), w0 ); 52 listViewPackages->addColumn( tr("Package"), w0 );
49 listViewPackages->addColumn( tr("Description"), w1 ); 53 listViewPackages->addColumn( tr("Description"), w1 );
50 listViewPackages->addColumn( tr("Size"), w2 ); 54 listViewPackages->addColumn( tr("Size"), w2 );
51 listViewPackages->setColumnWidthMode(0,QListView::Manual); 55 listViewPackages->setColumnWidthMode(0,QListView::Manual);
52 listViewPackages->setColumnWidthMode(1,QListView::Manual); 56 listViewPackages->setColumnWidthMode(1,QListView::Manual);
53 listViewPackages->setColumnWidthMode(2,QListView::Manual); 57 listViewPackages->setColumnWidthMode(2,QListView::Manual);
54 listViewPackages->setSelectionMode( QListView::Multi ); 58 listViewPackages->setSelectionMode( QListView::Multi );
55#endif 59#endif
56 connect( section, SIGNAL( activated(int) ), 60 connect( section, SIGNAL( activated(int) ),
57 this, SLOT( sectionChanged() ) ); 61 this, SLOT( sectionChanged() ) );
58 connect( subsection, SIGNAL(activated(int) ), 62 connect( subsection, SIGNAL(activated(int) ),
59 this, SLOT( subSectionChanged() ) ); 63 this, SLOT( subSectionChanged() ) );
@@ -395,24 +399,38 @@ void MainWindow::showPopup()
395 QStringList dests = settings->getDestinationNames(); 399 QStringList dests = settings->getDestinationNames();
396 for (uint i = 0; i < dests.count(); i++ ) 400 for (uint i = 0; i < dests.count(); i++ )
397 { 401 {
398 popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); 402 popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
399 popupAction->addTo( destsMenu ); 403 popupAction->addTo( destsMenu );
400 } 404 }
401 connect( destsMenu, SIGNAL( activated( int ) ), 405 connect( destsMenu, SIGNAL( activated( int ) ),
402 this, SLOT( changePackageDest( int ) ) ); 406 this, SLOT( changePackageDest( int ) ) );
403 popupMenu->popup( QCursor::pos() ); 407 popupMenu->popup( QCursor::pos() );
404} 408}
405 409
406void MainWindow::changePackageDest( int i ) 410void MainWindow::changePackageDest( int i )
407{ 411{
408 activePackage->setDest( destsMenu->text(i) ); 412 activePackage->setDest( destsMenu->text(i) );
409 activePackage->setOn(); 413 activePackage->setOn();
410 activePackage->setLink( settings->createLinks() ); 414 activePackage->setLink( settings->createLinks() );
411 activePackageListItem->displayDetails(); 415 activePackageListItem->displayDetails();
412} 416}
413 417
414void MainWindow::stopTimer( QListViewItem* ) 418void MainWindow::stopTimer( QListViewItem* )
415{ 419{
416 pvDebug( 5, "stop timer" ); 420 pvDebug( 5, "stop timer" );
417 popupTimer->stop(); 421 popupTimer->stop();
418} 422}
423
424void MainWindow::setDocument(const QString &fileName)
425{
426 ipkg->installFile( fileName );
427}
428
429void MainWindow::receive(const QCString &msg, const QByteArray &arg)
430{
431 pvDebug(3, "QCop "+msg);
432 if ( msg == "setDocument(QString)" )
433 {
434 setDocument( QString(arg) );
435 }
436} \ No newline at end of file