4 * Copyright (c) 2007 VOROSKOI Andras <voroskoi@frugalware.org>
6 * Copyright: See COPYING file that comes with this distribution.
11 #include <qlistview.h>
13 #include <qtabwidget.h>
16 #include <qapplication.h>
17 #include <qmessagebox.h>
18 #include <qstatusbar.h>
20 #include "mainwidget.h"
21 #include "kfpm_pacman.h"
23 extern QPtrList
<PM_DB
> syncs
;
25 MainWidget::MainWidget(QWidget
* parent
, const char * name
, WFlags f
) : QWidget (parent
, name
)
28 QVBoxLayout
*topLayout
= new QVBoxLayout(this);
29 Q_CHECK_PTR(topLayout
);
32 QPopupMenu
*file
= new QPopupMenu(this);
34 file
->insertItem( "E&xit", qApp
, SLOT(quit()), CTRL
+Key_Q
);
36 QPopupMenu
*help
= new QPopupMenu(this);
38 help
->insertItem( "&About", this, SLOT(about()) );
39 help
->insertItem( "About &Qt", this, SLOT(aboutQt()) );
41 QMenuBar
*menubar
= new QMenuBar(this);
43 menubar
->insertItem( "&File", file
);
44 menubar
->insertItem( "&Help", help
);
46 topLayout
->setMenuBar(menubar
);
49 QListView
*groups
= new QListView(this);
51 groups
->addColumn("Groups");
53 /*QStringList groupnames = akarmi.sync_group(akarmi.getSync());
54 for (QStringList::Iterator it = groupnames.begin(); it != groupnames.end(); it++) {
55 (void) new QListViewItem(groups, *it);
59 QListView
*packages
= new QListView(this);
60 Q_CHECK_PTR(packages
);
61 packages
->addColumn("Name");
62 packages
->addColumn("Version");
63 packages
->addColumn("Desctiption");
66 QListBox
*info
= new QListBox(this);
68 info
->setColumnMode(QListBox::FixedNumber
);
71 QTabWidget
*pkgdetails
= new QTabWidget(this);
72 Q_CHECK_PTR(pkgdetails
);
73 pkgdetails
->addTab(info
, "Info");
76 QHBoxLayout
*leftgrouplist
= new QHBoxLayout(topLayout
);
77 Q_CHECK_PTR(leftgrouplist
);
78 leftgrouplist
->addWidget(groups
);
80 QVBoxLayout
*details
= new QVBoxLayout(leftgrouplist
);
82 details
->addWidget(packages
);
83 details
->addWidget(pkgdetails
);
86 QStatusBar
*statusbar
= new QStatusBar(this);
87 Q_CHECK_PTR(statusbar
);
88 statusbar
->message("Done.");
90 topLayout
->addWidget(statusbar
);
93 void MainWidget::about()
95 QMessageBox::about(this, "Kfpm for Frugalware",
96 "Kfpm is a graphical fronted for libpacman.\n");
99 void MainWidget::aboutQt()
101 QMessageBox::aboutQt(this, "About Qt");