author | tille <tille> | 2002-04-27 14:35:48 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 14:35:48 (UTC) |
commit | 320532727fc7dfbe9760d0eea0e17b8e1230fc8e (patch) (unidiff) | |
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) (show 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 @@ | |||
1 | // adadpted form qpe/qipkg | 1 | // adadpted form qpe/qipkg |
2 | 2 | ||
3 | 3 | ||
4 | #include "mainwindow.h" | 4 | #include "mainwindow.h" |
5 | 5 | ||
6 | #include <qpe/qpemenubar.h> | 6 | #include <qpe/qpemenubar.h> |
7 | #include <qpe/qpemessagebox.h> | 7 | #include <qpe/qpemessagebox.h> |
8 | #include <qpe/resource.h> | 8 | #include <qpe/resource.h> |
9 | #include <qpe/qpetoolbar.h> | 9 | #include <qpe/qpetoolbar.h> |
10 | #include <qpe/qcopenvelope_qws.h> | 10 | #include <qpe/qcopenvelope_qws.h> |
11 | #include <qaction.h> | 11 | #include <qaction.h> |
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 | ||
27 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | 27 | MainWindow::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() ) ); |
60 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), | 64 | connect( listViewPackages, SIGNAL( pressed( QListViewItem* ) ), |
61 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 65 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
62 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), | 66 | connect( listViewPackages, SIGNAL( clicked( QListViewItem* ) ), |
63 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 67 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
64 | 68 | ||
65 | popupMenu = new QPopupMenu( this ); | 69 | popupMenu = new QPopupMenu( this ); |
66 | 70 | ||
67 | settings = new PackageManagerSettings(this,0,TRUE); | 71 | settings = new PackageManagerSettings(this,0,TRUE); |
68 | 72 | ||
69 | ipkg = new PmIpkg( settings, this ); | 73 | ipkg = new PmIpkg( settings, this ); |
70 | packageList.setSettings( settings ); | 74 | packageList.setSettings( settings ); |
71 | getList(); | 75 | getList(); |
72 | setSections(); | 76 | setSections(); |
73 | setSubSections(); | 77 | setSubSections(); |
74 | displayList(); | 78 | displayList(); |
75 | } | 79 | } |
76 | 80 | ||
77 | void MainWindow::makeMenu() | 81 | void MainWindow::makeMenu() |
78 | { | 82 | { |
79 | 83 | ||
80 | QPEToolBar *toolBar = new QPEToolBar( this ); | 84 | QPEToolBar *toolBar = new QPEToolBar( this ); |
81 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 85 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
82 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); | 86 | QPopupMenu *srvMenu = new QPopupMenu( menuBar ); |
83 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 87 | QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
@@ -371,48 +375,62 @@ void MainWindow::findShow(bool b) | |||
371 | } | 375 | } |
372 | 376 | ||
373 | void MainWindow::findClose() | 377 | void MainWindow::findClose() |
374 | { | 378 | { |
375 | findAction->setOn( false ); | 379 | findAction->setOn( false ); |
376 | } | 380 | } |
377 | 381 | ||
378 | void MainWindow::rotateUpdateIcon() | 382 | void MainWindow::rotateUpdateIcon() |
379 | { | 383 | { |
380 | pvDebug(2, "MainWindow::rotateUpdateIcon"); | 384 | pvDebug(2, "MainWindow::rotateUpdateIcon"); |
381 | if ( updateIcon ) | 385 | if ( updateIcon ) |
382 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); | 386 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update" ) ); |
383 | else | 387 | else |
384 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); | 388 | updateAction->setIconSet( Resource::loadIconSet( "oipkg/update2" ) ); |
385 | updateIcon = !updateIcon; | 389 | updateIcon = !updateIcon; |
386 | } | 390 | } |
387 | 391 | ||
388 | void MainWindow::showPopup() | 392 | void MainWindow::showPopup() |
389 | { | 393 | { |
390 | popupMenu->clear(); | 394 | popupMenu->clear(); |
391 | destsMenu->clear(); | 395 | destsMenu->clear(); |
392 | 396 | ||
393 | QAction *popupAction; | 397 | QAction *popupAction; |
394 | popupMenu->insertItem( tr("Install to"), destsMenu ); | 398 | popupMenu->insertItem( tr("Install to"), destsMenu ); |
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 | ||
406 | void MainWindow::changePackageDest( int i ) | 410 | void 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 | ||
414 | void MainWindow::stopTimer( QListViewItem* ) | 418 | void MainWindow::stopTimer( QListViewItem* ) |
415 | { | 419 | { |
416 | pvDebug( 5, "stop timer" ); | 420 | pvDebug( 5, "stop timer" ); |
417 | popupTimer->stop(); | 421 | popupTimer->stop(); |
418 | } | 422 | } |
423 | |||
424 | void MainWindow::setDocument(const QString &fileName) | ||
425 | { | ||
426 | ipkg->installFile( fileName ); | ||
427 | } | ||
428 | |||
429 | void 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 | ||