summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-02 13:34:44 (UTC)
committer zecke <zecke>2004-04-02 13:34:44 (UTC)
commit96105800596dfbd6b828ef47dd7774769f1e3ef3 (patch) (unidiff)
treee8862c0d4f8cc6fb3a90da0856857cd21010ba8b
parent02696a8b22d86f74a4f123edcd24bfa32dd00441 (diff)
downloadopie-96105800596dfbd6b828ef47dd7774769f1e3ef3.zip
opie-96105800596dfbd6b828ef47dd7774769f1e3ef3.tar.gz
opie-96105800596dfbd6b828ef47dd7774769f1e3ef3.tar.bz2
-Use OConfig
-Use OKeyConfigManager/Widget for Keyboard short cuts
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.cpp63
-rw-r--r--noncore/graphics/opie-eye/gui/iconview.h26
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.cpp64
-rw-r--r--noncore/graphics/opie-eye/gui/mainwindow.h13
4 files changed, 139 insertions, 27 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp
index 74a8d0f..b3f0006 100644
--- a/noncore/graphics/opie-eye/gui/iconview.cpp
+++ b/noncore/graphics/opie-eye/gui/iconview.cpp
@@ -1,53 +1,57 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#include "iconview.h" 6#include "iconview.h"
7 7
8#include <lib/imagecache.h> 8#include <lib/imagecache.h>
9 9
10#include <iface/dirview.h> 10#include <iface/dirview.h>
11#include <iface/dirlister.h> 11#include <iface/dirlister.h>
12 12
13#include <qpe/config.h> 13#include <opie2/oconfig.h>
14#include <opie2/okeyconfigwidget.h>
15
14#include <qpe/resource.h> 16#include <qpe/resource.h>
15#include <qpe/qpemessagebox.h> 17#include <qpe/qpemessagebox.h>
16#include <qpe/ir.h> 18#include <qpe/ir.h>
17#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
18 20
21
19#include <qiconview.h> 22#include <qiconview.h>
20#include <qlabel.h> 23#include <qlabel.h>
21#include <qhbox.h> 24#include <qhbox.h>
22#include <qcombobox.h> 25#include <qcombobox.h>
23#include <qdir.h> 26#include <qdir.h>
24#include <qapplication.h> 27#include <qapplication.h>
25#include <qmainwindow.h> 28#include <qmainwindow.h>
26#include <qtimer.h> 29#include <qtimer.h>
27#include <qstyle.h> 30#include <qstyle.h>
28 31
29 32
33using Opie::Ui::OKeyConfigItem;
30 34
31namespace { 35namespace {
32 QPixmap* _dirPix = 0; 36 QPixmap* _dirPix = 0;
33 QPixmap* _unkPix = 0; 37 QPixmap* _unkPix = 0;
34 class IconViewItem : public QIconViewItem { 38 class IconViewItem : public QIconViewItem {
35 public: 39 public:
36 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false); 40 IconViewItem( QIconView*, const QString& path, const QString& name, bool isDir = false);
37 QPixmap* pixmap()const; 41 QPixmap* pixmap()const;
38 QString path()const { return m_path; } 42 QString path()const { return m_path; }
39 bool isDir()const { return m_isDir; } 43 bool isDir()const { return m_isDir; }
40 void setText( const QString& ); 44 void setText( const QString& );
41 void reCalc(); 45 void reCalc();
42 private: 46 private:
43 mutable QPixmap* m_pix; 47 mutable QPixmap* m_pix;
44 QString m_path; 48 QString m_path;
45 bool m_isDir : 1; 49 bool m_isDir : 1;
46 bool m_noInfo :1; 50 bool m_noInfo :1;
47 }; 51 };
48 52
49 53
50/* 54/*
51 * If we request an Image or String 55 * If we request an Image or String
52 * we add it to the map 56 * we add it to the map
53 */ 57 */
@@ -75,107 +79,149 @@ namespace {
75 } 79 }
76 80
77 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 ); 81 m_pix = PPixmapCache::self()->cachedImage( m_path, 64, 64 );
78 if ( !m_pix && !g_stringPix.contains( m_path )) { 82 if ( !m_pix && !g_stringPix.contains( m_path )) {
79 currentView()->dirLister()->thumbNail( m_path, 64, 64 ); 83 currentView()->dirLister()->thumbNail( m_path, 64, 64 );
80 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this)); 84 g_stringPix.insert( m_path, const_cast<IconViewItem*>(this));
81 } 85 }
82 return m_pix ? m_pix : _unkPix; 86 return m_pix ? m_pix : _unkPix;
83 } 87 }
84 } 88 }
85 inline void IconViewItem::setText( const QString& str ) { 89 inline void IconViewItem::setText( const QString& str ) {
86 QString text = QIconViewItem::text()+"\n"+str; 90 QString text = QIconViewItem::text()+"\n"+str;
87 m_noInfo = true; 91 m_noInfo = true;
88 QIconViewItem::setText( text ); 92 QIconViewItem::setText( text );
89 reCalc(); 93 reCalc();
90 } 94 }
91 95
92 inline void IconViewItem::reCalc() 96 inline void IconViewItem::reCalc()
93 { 97 {
94 calcRect(); 98 calcRect();
95 } 99 }
96} 100}
97 101
98 102
99PIconView::PIconView( QWidget* wid, Config* cfg ) 103PIconView::PIconView( QWidget* wid, Opie::Core::OConfig* cfg )
100 : QVBox( wid ), m_cfg( cfg ) 104 : QVBox( wid ), m_cfg( cfg )
101{ 105{
102 { 106 {
103 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" ); 107 QCopEnvelope( "QPE/Application/opie-eye_slave", "refUp()" );
104 } 108 }
105 m_path = QDir::homeDirPath(); 109 m_path = QDir::homeDirPath();
106 110
107 QHBox *hbox = new QHBox( this ); 111 QHBox *hbox = new QHBox( this );
108 QLabel* lbl = new QLabel( hbox ); 112 QLabel* lbl = new QLabel( hbox );
109 lbl->setText( tr("View as" ) ); 113 lbl->setText( tr("View as" ) );
110 114
111 m_views = new QComboBox( hbox, "View As" ); 115 m_views = new QComboBox( hbox, "View As" );
112 connect( m_views, SIGNAL(activated(int)), 116 connect( m_views, SIGNAL(activated(int)),
113 this, SLOT(slotViewChanged(int)) ); 117 this, SLOT(slotViewChanged(int)) );
114 118
115 m_view= new QIconView( this ); 119 m_view= new QIconView( this );
116 connect(m_view, SIGNAL(clicked(QIconViewItem*) ), 120 connect(m_view, SIGNAL(clicked(QIconViewItem*) ),
117 this, SLOT(slotClicked(QIconViewItem*)) ); 121 this, SLOT(slotClicked(QIconViewItem*)) );
118 122
119 m_view->setArrangement( QIconView::LeftToRight ); 123 m_view->setArrangement( QIconView::LeftToRight );
120 m_view->setItemTextPos( QIconView::Right ); 124 m_view->setItemTextPos( QIconView::Right );
121 m_view->setResizeMode(QIconView::Adjust); 125 m_view->setResizeMode(QIconView::Adjust);
122 126
123 int dw = QApplication::desktop()->width(); 127 int dw = QApplication::desktop()->width();
124 int viewerWidth = dw-style().scrollBarExtent().width(); 128 int viewerWidth = dw-style().scrollBarExtent().width();
125 m_view->setGridX( viewerWidth-2*m_view->spacing() ); 129 m_view->setGridX( viewerWidth-2*m_view->spacing() );
126 m_view->setGridY( fontMetrics().height()*2+40 ); 130 m_view->setGridY( fontMetrics().height()*2+40 );
131
132
133 initKeys();
134
127 loadViews(); 135 loadViews();
128 slotViewChanged( m_views->currentItem() ); 136 slotViewChanged( m_views->currentItem() );
129} 137}
130 138
131PIconView::~PIconView() { 139PIconView::~PIconView() {
132 { 140 {
133 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); 141 QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" );
134 } 142 }
143 m_viewManager->save();
144 delete m_viewManager;
145}
146
147Opie::Ui::OKeyConfigManager* PIconView::manager() {
148 return m_viewManager;
149}
150
151void PIconView::initKeys() {
152 Opie::Ui::OKeyPair::List lst;
153 lst.append( Opie::Ui::OKeyPair::upArrowKey() );
154 lst.append( Opie::Ui::OKeyPair::downArrowKey() );
155 lst.append( Opie::Ui::OKeyPair::leftArrowKey() );
156 lst.append( Opie::Ui::OKeyPair::rightArrowKey() );
157 lst.append( Opie::Ui::OKeyPair::returnKey() );
158
159 m_viewManager = new Opie::Ui::OKeyConfigManager(m_cfg, "View-KeyBoard-Config",
160 lst, false,this, "keyconfig name" );
161 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Beam Current Item") , "beam",
162 QString::fromLatin1("beam"), BeamItem,
163 Opie::Ui::OKeyPair(Qt::Key_B, Qt::ShiftButton),
164 this, SLOT(slotBeam())) );
165 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Delete Current Item"), "delete",
166 QString::fromLatin1("trash"), DeleteItem,
167 Opie::Ui::OKeyPair(Qt::Key_D, Qt::ShiftButton),
168 this, SLOT(slotTrash())) );
169 m_viewManager->addKeyConfig( OKeyConfigItem(tr("View Current Item"), "view",
170 QString::fromLatin1("1to1"), ViewItem,
171 Opie::Ui::OKeyPair(Qt::Key_V, Qt::ShiftButton),
172 this, SLOT(slotShowImage())));
173 m_viewManager->addKeyConfig( OKeyConfigItem(tr("Show Image Info") , "info",
174 QString::fromLatin1("DocumentTypeWord"), InfoItem,
175 Opie::Ui::OKeyPair(Qt::Key_I, Qt::ShiftButton ),
176 this, SLOT(slotImageInfo()) ) );
177 m_viewManager->load();
178 m_viewManager->handleWidget( m_view );
135} 179}
136 180
137void PIconView::slotDirUp() { 181void PIconView::slotDirUp() {
138 QDir dir( m_path ); 182 QDir dir( m_path );
139 dir.cdUp(); 183 dir.cdUp();
140 slotChangeDir( dir.absPath() ); 184 slotChangeDir( dir.absPath() );
141 185
142} 186}
143 187
144void PIconView::slotChangeDir(const QString& path) { 188void PIconView::slotChangeDir(const QString& path) {
145 if ( !currentView() ) 189 if ( !currentView() )
146 return; 190 return;
147 191
148 PDirLister *lister = currentView()->dirLister(); 192 PDirLister *lister = currentView()->dirLister();
149 if (!lister ) 193 if (!lister )
150 return; 194 return;
151 195
152 lister->setStartPath( path ); 196 lister->setStartPath( path );
153 m_path = lister->currentPath(); 197 m_path = lister->currentPath();
154 198
199 m_view->setUpdatesEnabled( false );
155 m_view->clear(); 200 m_view->clear();
156 addFolders( lister->folders() ); 201 addFolders( lister->folders() );
157 addFiles( lister->files() ); 202 addFiles( lister->files() );
203 m_view->setUpdatesEnabled( true );
158 204
159 // Also invalidate the cache. We can't cancel the operations anyway 205 // Also invalidate the cache. We can't cancel the operations anyway
160 g_stringPix.clear(); 206 g_stringPix.clear();
161 g_stringInf.clear(); 207 g_stringInf.clear();
162 208
163 // looks ugly 209 // looks ugly
164 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) ); 210 static_cast<QMainWindow*>(parent())->setCaption( QObject::tr("%1 - O View", "Name of the dir").arg( m_path ) );
165} 211}
166 212
167QString PIconView::currentFileName(bool &isDir)const { 213QString PIconView::currentFileName(bool &isDir)const {
168 isDir = false; 214 isDir = false;
169 QIconViewItem* _it = m_view->currentItem(); 215 QIconViewItem* _it = m_view->currentItem();
170 if ( !_it ) 216 if ( !_it )
171 return QString::null; 217 return QString::null;
172 218
173 IconViewItem* it = static_cast<IconViewItem*>( _it ); 219 IconViewItem* it = static_cast<IconViewItem*>( _it );
174 isDir = it->isDir(); 220 isDir = it->isDir();
175 return it->path(); 221 return it->path();
176} 222}
177 223
178void PIconView::slotTrash() { 224void PIconView::slotTrash() {
179 bool isDir; 225 bool isDir;
180 QString pa = currentFileName( isDir ); 226 QString pa = currentFileName( isDir );
181 if ( isDir && pa.isEmpty() ) 227 if ( isDir && pa.isEmpty() )
@@ -296,24 +342,37 @@ void PIconView::slotRename() {
296void PIconView::slotBeam() { 342void PIconView::slotBeam() {
297 bool isDir; 343 bool isDir;
298 QString pa = currentFileName( isDir ); 344 QString pa = currentFileName( isDir );
299 if ( isDir && pa.isEmpty() ) 345 if ( isDir && pa.isEmpty() )
300 return; 346 return;
301 347
302 Ir* ir = new Ir( this ); 348 Ir* ir = new Ir( this );
303 connect( ir, SIGNAL(done(Ir*)), 349 connect( ir, SIGNAL(done(Ir*)),
304 this, SLOT(slotBeamDone(Ir*))); 350 this, SLOT(slotBeamDone(Ir*)));
305 ir->send(pa, tr( "Image" ) ); 351 ir->send(pa, tr( "Image" ) );
306 352
307} 353}
308 354
309void PIconView::slotBeamDone( Ir* ir) { 355void PIconView::slotBeamDone( Ir* ir) {
310 delete ir; 356 delete ir;
311} 357}
312 358
313void PIconView::slotStart() { 359void PIconView::slotStart() {
314 m_view->setUpdatesEnabled( false ); 360 m_view->setUpdatesEnabled( false );
315} 361}
316 362
317void PIconView::slotEnd() { 363void PIconView::slotEnd() {
318 m_view->setUpdatesEnabled( true ); 364 m_view->setUpdatesEnabled( true );
319} 365}
366
367void PIconView::slotShowImage() {
368
369}
370void PIconView::slotShowImage( const QString& ) {
371
372}
373void PIconView::slotImageInfo() {
374
375}
376void PIconView::slotImageInfo( const QString& ) {
377
378}
diff --git a/noncore/graphics/opie-eye/gui/iconview.h b/noncore/graphics/opie-eye/gui/iconview.h
index 439833a..0fba327 100644
--- a/noncore/graphics/opie-eye/gui/iconview.h
+++ b/noncore/graphics/opie-eye/gui/iconview.h
@@ -1,59 +1,79 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_ICON_VIEW_H 6#ifndef PHUNK_ICON_VIEW_H
7#define PHUNK_ICON_VIEW_H 7#define PHUNK_ICON_VIEW_H
8 8
9#include <qvbox.h> 9#include <qvbox.h>
10 10
11#include <qpe/config.h>
12 11
13class QIconView; 12class QIconView;
14class QIconViewItem; 13class QIconViewItem;
15class QComboBox; 14class QComboBox;
16class PIconViewItem; 15class PIconViewItem;
17class PDirLister; 16class PDirLister;
18class Ir; 17class Ir;
18
19namespace Opie {
20namespace Core{
21 class OConfig;
22}
23namespace Ui {
24 class OKeyConfigManager;
25}
26}
27
19class PIconView : public QVBox { 28class PIconView : public QVBox {
20 Q_OBJECT 29 Q_OBJECT
21 friend class PIconViewItem; 30 friend class PIconViewItem;
31 enum ActionIds {
32 BeamItem, DeleteItem, ViewItem, InfoItem
33 };
22public: 34public:
23 PIconView( QWidget* wid, Config *cfg ); 35 PIconView( QWidget* wid, Opie::Core::OConfig *cfg );
24 ~PIconView(); 36 ~PIconView();
25 void resetView(); 37 void resetView();
38 Opie::Ui::OKeyConfigManager* manager();
26 39
27private: 40private:
41 void initKeys();
28 QString currentFileName(bool &isDir)const; 42 QString currentFileName(bool &isDir)const;
29 void loadViews(); 43 void loadViews();
30 44
31private slots: 45private slots:
32 void slotDirUp(); 46 void slotDirUp();
33 void slotChangeDir(const QString&); 47 void slotChangeDir(const QString&);
34 void slotTrash(); 48 void slotTrash();
35 void slotViewChanged( int ); 49 void slotViewChanged( int );
36 void slotReloadDir(); 50 void slotReloadDir();
37 void slotRename(); 51 void slotRename();
38 void slotBeam(); 52 void slotBeam();
39 void slotBeamDone( Ir* ); 53 void slotBeamDone( Ir* );
40 54
55 void slotShowImage();
56 void slotShowImage( const QString& );
57 void slotImageInfo();
58 void slotImageInfo( const QString& );
59
41 void slotStart(); 60 void slotStart();
42 void slotEnd(); 61 void slotEnd();
43 62
44/* for performance reasons make it inline in the future */ 63/* for performance reasons make it inline in the future */
45 void addFolders( const QStringList& ); 64 void addFolders( const QStringList& );
46 void addFiles( const QStringList& ); 65 void addFiles( const QStringList& );
47 void slotClicked(QIconViewItem* ); 66 void slotClicked(QIconViewItem* );
48 67
49/**/ 68/**/
50 void slotThumbInfo(const QString&, const QString&); 69 void slotThumbInfo(const QString&, const QString&);
51 void slotThumbNail(const QString&, const QPixmap&); 70 void slotThumbNail(const QString&, const QPixmap&);
52private: 71private:
53 Config *m_cfg; 72 Opie::Ui::OKeyConfigManager *m_viewManager;
73 Opie::Core::OConfig *m_cfg;
54 QComboBox* m_views; 74 QComboBox* m_views;
55 QIconView* m_view; 75 QIconView* m_view;
56 QString m_path; 76 QString m_path;
57}; 77};
58 78
59#endif 79#endif
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
@@ -1,114 +1,138 @@
1/* 1/*
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>
8#include <qlayout.h> 24#include <qlayout.h>
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
27OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> ) 32OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow> )
28 33
29PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) 34PMainWindow::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
37 */ 45 */
38 QToolBar *bar = new QToolBar( this ); 46 QToolBar *bar = new QToolBar( this );
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 );
46 btn->setIconSet( Resource::loadIconSet( "up" ) ); 54 btn->setIconSet( Resource::loadIconSet( "up" ) );
47 connect( btn, SIGNAL(clicked()), 55 connect( btn, SIGNAL(clicked()),
48 m_view, SLOT(slotDirUp()) ); 56 m_view, SLOT(slotDirUp()) );
49 57
50 btn = new PFileSystem( bar ); 58 btn = new PFileSystem( bar );
51 connect( btn, SIGNAL( changeDir( const QString& ) ), 59 connect( btn, SIGNAL( changeDir( const QString& ) ),
52 m_view, SLOT(slotChangeDir( const QString& ) ) ); 60 m_view, SLOT(slotChangeDir( const QString& ) ) );
53 61
54 btn = new QToolButton( bar ); 62 btn = new QToolButton( bar );
55 btn->setIconSet( Resource::loadIconSet( "edit" ) ); 63 btn->setIconSet( Resource::loadIconSet( "edit" ) );
56 connect( btn, SIGNAL(clicked()), 64 connect( btn, SIGNAL(clicked()),
57 m_view, SLOT(slotRename()) ); 65 m_view, SLOT(slotRename()) );
58 66
59 if ( Ir::supported() ) { 67 if ( Ir::supported() ) {
60 btn = new QToolButton( bar ); 68 btn = new QToolButton( bar );
61 btn->setIconSet( Resource::loadIconSet( "beam" ) ); 69 btn->setIconSet( Resource::loadIconSet( "beam" ) );
62 connect( btn, SIGNAL(clicked()), 70 connect( btn, SIGNAL(clicked()),
63 m_view, SLOT(slotBeam()) ); 71 m_view, SLOT(slotBeam()) );
64 } 72 }
65 73
66 btn = new QToolButton( bar ); 74 btn = new QToolButton( bar );
67 btn->setIconSet( Resource::loadIconSet( "trash" ) ); 75 btn->setIconSet( Resource::loadIconSet( "trash" ) );
68 connect( btn, SIGNAL(clicked() ), 76 connect( btn, SIGNAL(clicked() ),
69 m_view, SLOT(slotTrash() ) ); 77 m_view, SLOT(slotTrash() ) );
70 78
71 btn = new QToolButton( bar ); 79 btn = new QToolButton( bar );
72 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) ); 80 btn->setIconSet( Resource::loadIconSet( "SettingsIcon" ) );
73 connect( btn, SIGNAL(clicked() ), 81 connect( btn, SIGNAL(clicked() ),
74 this, SLOT(slotConfig() ) ); 82 this, SLOT(slotConfig() ) );
75 83
76} 84}
77 85
78PMainWindow::~PMainWindow() { 86PMainWindow::~PMainWindow() {
79} 87}
80 88
81 89
82void PMainWindow::slotConfig() { 90void 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
86 QHBoxLayout *lay = new QHBoxLayout(&dlg); 99 QHBoxLayout *lay = new QHBoxLayout(&dlg);
87 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg ); 100 Opie::Ui::OTabWidget *wid = new Opie::Ui::OTabWidget(&dlg );
88 lay->addWidget( wid ); 101 lay->addWidget( wid );
89 ViewMap *vM = viewMap(); 102 ViewMap *vM = viewMap();
90 ViewMap::Iterator _it = vM->begin(); 103 ViewMap::Iterator _it = vM->begin();
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}
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.h b/noncore/graphics/opie-eye/gui/mainwindow.h
index 408fe32..317a51e 100644
--- a/noncore/graphics/opie-eye/gui/mainwindow.h
+++ b/noncore/graphics/opie-eye/gui/mainwindow.h
@@ -1,29 +1,38 @@
1/* 1/*
2 * GPLv2 zecke@handhelds.org 2 * GPLv2 zecke@handhelds.org
3 * No WArranty... 3 * No WArranty...
4 */ 4 */
5 5
6#ifndef PHUNK_MAIN_WINDOW_H 6#ifndef PHUNK_MAIN_WINDOW_H
7#define PHUNK_MAIN_WINDOW_H 7#define PHUNK_MAIN_WINDOW_H
8 8
9#include <opie2/oconfig.h>
10
9#include <qmainwindow.h> 11#include <qmainwindow.h>
10 12
11#include <qpe/config.h> 13
14
15namespace Opie {
16namespace Ui{
17 class OKeyConfigManager;
18}
19}
12 20
13class PIconView; 21class PIconView;
14class PMainWindow : public QMainWindow { 22class PMainWindow : public QMainWindow {
15 Q_OBJECT 23 Q_OBJECT
16public: 24public:
17 static QString appName() { return QString::fromLatin1("opie-eye" ); } 25 static QString appName() { return QString::fromLatin1("opie-eye" ); }
18 PMainWindow(QWidget*, const char*, WFlags ); 26 PMainWindow(QWidget*, const char*, WFlags );
19 ~PMainWindow(); 27 ~PMainWindow();
20 28
21private: 29private:
22 Config m_cfg; 30 Opie::Core::OConfig *m_cfg;
23 PIconView* m_view; 31 PIconView* m_view;
24 32
33
25private slots: 34private slots:
26 void slotConfig(); 35 void slotConfig();
27}; 36};
28 37
29#endif 38#endif