Diffstat (limited to 'noncore/graphics/opie-eye/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index ea765d1..0314659 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -2,6 +2,22 @@ | |||
2 | * GPLv2 zecke@handhelds.org | 2 | * GPLv2 zecke@handhelds.org |
3 | * No WArranty... | 3 | * No WArranty... |
4 | */ | 4 | */ |
5 | #include "mainwindow.h" | ||
6 | |||
7 | #include "iconview.h" | ||
8 | #include "filesystem.h" | ||
9 | |||
10 | #include <iface/ifaceinfo.h> | ||
11 | #include <iface/dirview.h> | ||
12 | |||
13 | #include <opie2/oapplicationfactory.h> | ||
14 | #include <opie2/otabwidget.h> | ||
15 | #include <opie2/okeyconfigwidget.h> | ||
16 | |||
17 | |||
18 | #include <qpe/resource.h> | ||
19 | #include <qpe/config.h> | ||
20 | #include <qpe/ir.h> | ||
5 | 21 | ||
6 | #include <qtoolbar.h> | 22 | #include <qtoolbar.h> |
7 | #include <qtoolbutton.h> | 23 | #include <qtoolbutton.h> |
@@ -9,28 +25,20 @@ | |||
9 | #include <qdialog.h> | 25 | #include <qdialog.h> |
10 | #include <qmap.h> | 26 | #include <qmap.h> |
11 | 27 | ||
12 | #include <qpe/resource.h> | ||
13 | #include <qpe/config.h> | ||
14 | #include <qpe/ir.h> | ||
15 | 28 | ||
16 | #include <opie2/oapplicationfactory.h> | ||
17 | #include <opie2/otabwidget.h> | ||
18 | 29 | ||
19 | #include <iface/ifaceinfo.h> | ||
20 | #include <iface/dirview.h> | ||
21 | 30 | ||
22 | #include "iconview.h" | ||
23 | #include "filesystem.h" | ||
24 | |||
25 | #include "mainwindow.h" | ||
26 | 31 | ||
27 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> ) | 32 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> ) |
28 | 33 | ||
29 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 34 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
30 | : QMainWindow( wid, name, style ), m_cfg("phunkview") | 35 | : QMainWindow( wid, name, style ) |
31 | { | 36 | { |
32 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 37 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
33 | m_cfg.setGroup("Zecke_view" ); | 38 | m_cfg = new Opie::Core::OConfig("phunkview"); |
39 | m_cfg->setGroup("Zecke_view" ); | ||
40 | |||
41 | |||
34 | /* | 42 | /* |
35 | * Initialize ToolBar and IconView | 43 | * Initialize ToolBar and IconView |
36 | * And Connect Them | 44 | * And Connect Them |
@@ -39,7 +47,7 @@ PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | |||
39 | bar->setHorizontalStretchable( true ); | 47 | bar->setHorizontalStretchable( true ); |
40 | setToolBarsMovable( false ); | 48 | setToolBarsMovable( false ); |
41 | 49 | ||
42 | m_view = new PIconView( this, &m_cfg ); | 50 | m_view = new PIconView( this, m_cfg ); |
43 | setCentralWidget( m_view ); | 51 | setCentralWidget( m_view ); |
44 | 52 | ||
45 | QToolButton *btn = new QToolButton( bar ); | 53 | QToolButton *btn = new QToolButton( bar ); |
@@ -80,6 +88,11 @@ PMainWindow::~PMainWindow() { | |||
80 | 88 | ||
81 | 89 | ||
82 | void PMainWindow::slotConfig() { | 90 | void PMainWindow::slotConfig() { |
91 | /* | ||
92 | * have a tab with the possible views | ||
93 | * a tab for globals image cache size.. scaled loading | ||
94 | * and one tab for the KeyConfigs | ||
95 | */ | ||
83 | QDialog dlg(this, 0, true); | 96 | QDialog dlg(this, 0, true); |
84 | dlg.setCaption( tr("Phunk View - Config" ) ); | 97 | dlg.setCaption( tr("Phunk View - Config" ) ); |
85 | 98 | ||
@@ -91,24 +104,35 @@ void PMainWindow::slotConfig() { | |||
91 | QMap<PDirView*, QWidget*> lst; | 104 | QMap<PDirView*, QWidget*> lst; |
92 | 105 | ||
93 | for( ; _it != vM->end(); ++_it ) { | 106 | for( ; _it != vM->end(); ++_it ) { |
94 | PDirView *view = (_it.data())(m_cfg); | 107 | PDirView *view = (_it.data())(*m_cfg); |
95 | PInterfaceInfo *inf = view->interfaceInfo(); | 108 | PInterfaceInfo *inf = view->interfaceInfo(); |
96 | QWidget *_wid = inf->configWidget( m_cfg ); | 109 | QWidget *_wid = inf->configWidget( *m_cfg ); |
97 | _wid->reparent(wid, QPoint() ); | 110 | _wid->reparent(wid, QPoint() ); |
98 | lst.insert( view, _wid ); | 111 | lst.insert( view, _wid ); |
99 | wid->addTab( _wid, QString::null, inf->name() ); | 112 | wid->addTab( _wid, QString::null, inf->name() ); |
100 | } | 113 | } |
101 | 114 | ||
102 | dlg.showMaximized(); | 115 | /* |
103 | bool act = ( dlg.exec() == QDialog::Accepted ); | 116 | * Add the KeyConfigWidget |
117 | */ | ||
118 | Opie::Ui::OKeyConfigWidget* keyWid = new Opie::Ui::OKeyConfigWidget( wid, "key config" ); | ||
119 | keyWid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue ); | ||
120 | keyWid->insert( tr("Browser Keyboard Actions"), m_view->manager() ); | ||
121 | keyWid->load(); | ||
122 | wid->addTab( keyWid, QString::fromLatin1("AppsIcon" ), tr("Keyboard Configuration") ); | ||
123 | |||
124 | |||
125 | bool act = ( QPEApplication::execDialog( &dlg ) == QDialog::Accepted ); | ||
104 | 126 | ||
105 | QMap<PDirView*, QWidget*>::Iterator it; | 127 | QMap<PDirView*, QWidget*>::Iterator it; |
106 | for ( it = lst.begin(); it != lst.end(); ++it ) { | 128 | for ( it = lst.begin(); it != lst.end(); ++it ) { |
107 | if ( act ) | 129 | if ( act ) |
108 | it.key()->interfaceInfo()->writeConfig(it.data(), m_cfg); | 130 | it.key()->interfaceInfo()->writeConfig(it.data(), *m_cfg); |
109 | delete it.key(); | 131 | delete it.key(); |
110 | } | 132 | } |
111 | 133 | ||
112 | if ( act ) | 134 | if ( act ) { |
113 | m_view->resetView(); | 135 | m_view->resetView(); |
136 | keyWid->save(); | ||
137 | } | ||
114 | } | 138 | } |