author | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 12:14:15 (UTC) |
commit | 0d59c780513da78033f4d9040475dee9db0256d4 (patch) (unidiff) | |
tree | 503d320b4aa3daae9982082e7b34e3e2c48bdfb7 /libopie2 | |
parent | a0981652d61776d70f25980f035748b21339e946 (diff) | |
download | opie-0d59c780513da78033f4d9040475dee9db0256d4.zip opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.gz opie-0d59c780513da78033f4d9040475dee9db0256d4.tar.bz2 |
run the optimize_connect script
the whole cvs is tagged with "before_optimize_connect" if there are problems you
can check the diff (but it had compiled and run here)
-rw-r--r-- | libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp | 4 | ||||
-rw-r--r-- | libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp | 2 | ||||
-rw-r--r-- | libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp | 20 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_ipaq.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_simpad.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_yopy.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/oprocess.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiepim/core/ocontactaccess.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiepim/ui/opimmainwindow.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiepim/ui/opimrecurrencewidget.cpp | 4 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofiledialog.cpp | 4 | ||||
-rw-r--r-- | libopie2/opieui/fileselector/ofileselector.cpp | 14 | ||||
-rw-r--r-- | libopie2/opieui/ofontselector.cpp | 8 | ||||
-rw-r--r-- | libopie2/opieui/otabwidget.cpp | 4 | ||||
-rw-r--r-- | libopie2/opieui/otimepicker.cpp | 12 | ||||
-rw-r--r-- | libopie2/opieui/oversatileview.cpp | 40 |
18 files changed, 77 insertions, 77 deletions
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp index a75f9dc..789496c 100644 --- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp +++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp | |||
@@ -1,79 +1,79 @@ | |||
1 | 1 | ||
2 | #include <qstring.h> | 2 | #include <qstring.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qheader.h> | 4 | #include <qheader.h> |
5 | #include <qlayout.h> | 5 | #include <qlayout.h> |
6 | 6 | ||
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | 8 | ||
9 | #include <opie2/oapplicationfactory.h> | 9 | #include <opie2/oapplicationfactory.h> |
10 | #include "osplitter_mail.h" | 10 | #include "osplitter_mail.h" |
11 | 11 | ||
12 | OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) | 12 | OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) |
13 | 13 | ||
14 | class Folder { | 14 | class Folder { |
15 | int dummy; | 15 | int dummy; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | // ----------------------------------------------------------------- | 18 | // ----------------------------------------------------------------- |
19 | 19 | ||
20 | ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) | 20 | ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) |
21 | : QWidget( p, name, fl ) { | 21 | : QWidget( p, name, fl ) { |
22 | qApp->installEventFilter( this ); | 22 | qApp->installEventFilter( this ); |
23 | m_lstFolders.setAutoDelete( true ); | 23 | m_lstFolders.setAutoDelete( true ); |
24 | QHBoxLayout *lay = new QHBoxLayout(this); | 24 | QHBoxLayout *lay = new QHBoxLayout(this); |
25 | 25 | ||
26 | m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); | 26 | m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); |
27 | lay->addWidget( m_splitter ); | 27 | lay->addWidget( m_splitter ); |
28 | connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ), | 28 | connect(m_splitter, SIGNAL(sizeChange(bool,const QSize&) ), |
29 | this, SLOT(slotSizeChange(bool, const QSize& ) ) ); | 29 | this, SLOT(slotSizeChange(bool,const QSize&) ) ); |
30 | 30 | ||
31 | m_overview = new QListView( m_splitter ); | 31 | m_overview = new QListView( m_splitter ); |
32 | m_overview->header()->setClickEnabled( FALSE ); | 32 | m_overview->header()->setClickEnabled( FALSE ); |
33 | m_overview->addColumn( tr("Folder") ); | 33 | m_overview->addColumn( tr("Folder") ); |
34 | m_overview->setMaximumWidth( 200 ); | 34 | m_overview->setMaximumWidth( 200 ); |
35 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); | 35 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); |
36 | m_splitter->setSizeChange( 300 ); | 36 | m_splitter->setSizeChange( 300 ); |
37 | 37 | ||
38 | /* OSplitter starts with the small mode */ | 38 | /* OSplitter starts with the small mode */ |
39 | m_messages = 0; | 39 | m_messages = 0; |
40 | m_message = m_attach = 0; | 40 | m_message = m_attach = 0; |
41 | 41 | ||
42 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); | 42 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); |
43 | splitti->setSizeChange( 300 ); | 43 | splitti->setSizeChange( 300 ); |
44 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 44 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
45 | 45 | ||
46 | QLabel *lbl = new QLabel(splitti); | 46 | QLabel *lbl = new QLabel(splitti); |
47 | lbl->setTextFormat ( Qt::RichText ); | 47 | lbl->setTextFormat ( Qt::RichText ); |
48 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); | 48 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); |
49 | 49 | ||
50 | m_messages = new QListView( splitti ); | 50 | m_messages = new QListView( splitti ); |
51 | m_messages->addColumn(" Messages "); | 51 | m_messages->addColumn(" Messages "); |
52 | 52 | ||
53 | folder1 = new QListView( splitti ); | 53 | folder1 = new QListView( splitti ); |
54 | folder1->addColumn( "Messages 2 " ); | 54 | folder1->addColumn( "Messages 2 " ); |
55 | 55 | ||
56 | splitti->addWidget(m_messages, "mail", tr("Mails") ); | 56 | splitti->addWidget(m_messages, "mail", tr("Mails") ); |
57 | splitti->addWidget(folder1, "folder", tr("Folder") ); | 57 | splitti->addWidget(folder1, "folder", tr("Folder") ); |
58 | splitti->addWidget( lbl, "logo", tr("Label") ); | 58 | splitti->addWidget( lbl, "logo", tr("Label") ); |
59 | m_message = lbl; | 59 | m_message = lbl; |
60 | 60 | ||
61 | m_splitter->addWidget( splitti ); | 61 | m_splitter->addWidget( splitti ); |
62 | 62 | ||
63 | } | 63 | } |
64 | 64 | ||
65 | 65 | ||
66 | ListViews::~ListViews() { | 66 | ListViews::~ListViews() { |
67 | 67 | ||
68 | } | 68 | } |
69 | 69 | ||
70 | 70 | ||
71 | bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { | 71 | bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { |
72 | if (!obj->isWidgetType() ) | 72 | if (!obj->isWidgetType() ) |
73 | return false; | 73 | return false; |
74 | if ( ev->type() == QEvent::MouseButtonRelease ) { | 74 | if ( ev->type() == QEvent::MouseButtonRelease ) { |
75 | qWarning(" name %s, class %s", obj->name(), obj->className() ); | 75 | qWarning(" name %s, class %s", obj->name(), obj->className() ); |
76 | } | 76 | } |
77 | 77 | ||
78 | return false; | 78 | return false; |
79 | } | 79 | } |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp index f62729c..0d8bc9f 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp | |||
@@ -17,189 +17,189 @@ | |||
17 | 17 | ||
18 | #include <qcolor.h> | 18 | #include <qcolor.h> |
19 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
20 | #include <qmenubar.h> | 20 | #include <qmenubar.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | 25 | ||
26 | // Qtopia | 26 | // Qtopia |
27 | 27 | ||
28 | #ifdef QWS | 28 | #ifdef QWS |
29 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
30 | #include <qpe/global.h> | 30 | #include <qpe/global.h> |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | // Opie | 33 | // Opie |
34 | 34 | ||
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | #include <opie2/odevice.h> | 36 | #include <opie2/odevice.h> |
37 | using namespace Opie; | 37 | using namespace Opie; |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #include <opie2/ocompletionbox.h> | 40 | #include <opie2/ocompletionbox.h> |
41 | #include <opie2/olineedit.h> | 41 | #include <opie2/olineedit.h> |
42 | #include <opie2/ocombobox.h> | 42 | #include <opie2/ocombobox.h> |
43 | #include <opie2/oeditlistbox.h> | 43 | #include <opie2/oeditlistbox.h> |
44 | #include <opie2/oselector.h> | 44 | #include <opie2/oselector.h> |
45 | #include <opie2/opopupmenu.h> | 45 | #include <opie2/opopupmenu.h> |
46 | 46 | ||
47 | #include <qtabwidget.h> | 47 | #include <qtabwidget.h> |
48 | #include "oversatileviewdemo.h" | 48 | #include "oversatileviewdemo.h" |
49 | 49 | ||
50 | // Local | 50 | // Local |
51 | 51 | ||
52 | #include "opieuidemo.h" | 52 | #include "opieuidemo.h" |
53 | 53 | ||
54 | enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; | 54 | enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; |
55 | 55 | ||
56 | OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) | 56 | OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) |
57 | : QMainWindow( parent, name, fl ) | 57 | : QMainWindow( parent, name, fl ) |
58 | { | 58 | { |
59 | 59 | ||
60 | QMenuBar* mbar = this->menuBar(); | 60 | QMenuBar* mbar = this->menuBar(); |
61 | OPopupMenu* demo = new OPopupMenu( this ); | 61 | OPopupMenu* demo = new OPopupMenu( this ); |
62 | demo->setTitle( "Title" ); | 62 | demo->setTitle( "Title" ); |
63 | demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); | 63 | demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); |
64 | demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); | 64 | demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); |
65 | demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); | 65 | demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); |
66 | demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); | 66 | demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); |
67 | demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); | 67 | demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); |
68 | mbar->insertItem( "Demonstrate", demo ); | 68 | mbar->insertItem( "Demonstrate", demo ); |
69 | 69 | ||
70 | build(); | 70 | build(); |
71 | 71 | ||
72 | } | 72 | } |
73 | 73 | ||
74 | OpieUIDemo::~OpieUIDemo() | 74 | OpieUIDemo::~OpieUIDemo() |
75 | { | 75 | { |
76 | } | 76 | } |
77 | 77 | ||
78 | void OpieUIDemo::build() | 78 | void OpieUIDemo::build() |
79 | { | 79 | { |
80 | main = new QTabWidget( this, "tabwidget" ); | 80 | main = new QTabWidget( this, "tabwidget" ); |
81 | setCentralWidget( main ); | 81 | setCentralWidget( main ); |
82 | main->show(); | 82 | main->show(); |
83 | 83 | ||
84 | main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); | 84 | main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | void OpieUIDemo::demo( int d ) | 88 | void OpieUIDemo::demo( int d ) |
89 | { | 89 | { |
90 | switch (d) | 90 | switch (d) |
91 | { | 91 | { |
92 | case ocompletionbox: demoOCompletionBox(); break; | 92 | case ocompletionbox: demoOCompletionBox(); break; |
93 | case olineedit: demoOLineEdit(); break; | 93 | case olineedit: demoOLineEdit(); break; |
94 | case ocombobox: demoOComboBox(); break; | 94 | case ocombobox: demoOComboBox(); break; |
95 | case oeditlistbox: demoOEditListBox(); break; | 95 | case oeditlistbox: demoOEditListBox(); break; |
96 | case oselector: demoOSelector(); break; | 96 | case oselector: demoOSelector(); break; |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | void OpieUIDemo::demoOCompletionBox() | 102 | void OpieUIDemo::demoOCompletionBox() |
103 | { | 103 | { |
104 | qDebug( "ocompletionbox" ); | 104 | qDebug( "ocompletionbox" ); |
105 | 105 | ||
106 | OCompletionBox* box = new OCompletionBox( 0 ); | 106 | OCompletionBox* box = new OCompletionBox( 0 ); |
107 | box->insertItem( "This CompletionBox" ); | 107 | box->insertItem( "This CompletionBox" ); |
108 | box->insertItem( "Says 'Hello World'" ); | 108 | box->insertItem( "Says 'Hello World'" ); |
109 | box->insertItem( "Here are some" ); | 109 | box->insertItem( "Here are some" ); |
110 | box->insertItem( "Additional Items" ); | 110 | box->insertItem( "Additional Items" ); |
111 | box->insertItem( "Complete Completion Box" ); | 111 | box->insertItem( "Complete Completion Box" ); |
112 | 112 | ||
113 | connect( box, SIGNAL( activated( const QString& ) ), this, SLOT( messageBox( const QString& ) ) ); | 113 | connect( box, SIGNAL( activated(const QString&) ), this, SLOT( messageBox(const QString&) ) ); |
114 | box->popup(); | 114 | box->popup(); |
115 | 115 | ||
116 | } | 116 | } |
117 | 117 | ||
118 | void OpieUIDemo::demoOLineEdit() | 118 | void OpieUIDemo::demoOLineEdit() |
119 | { | 119 | { |
120 | qDebug( "olineedit" ); | 120 | qDebug( "olineedit" ); |
121 | 121 | ||
122 | OLineEdit *edit = new OLineEdit( 0, "lineedit" ); | 122 | OLineEdit *edit = new OLineEdit( 0, "lineedit" ); |
123 | 123 | ||
124 | edit->setCompletionMode( OGlobalSettings::CompletionPopup ); | 124 | edit->setCompletionMode( OGlobalSettings::CompletionPopup ); |
125 | OCompletion* comp = edit->completionObject(); | 125 | OCompletion* comp = edit->completionObject(); |
126 | 126 | ||
127 | QStringList list; | 127 | QStringList list; |
128 | list << "mickeyl@handhelds.org"; | 128 | list << "mickeyl@handhelds.org"; |
129 | list << "mickey@tm.informatik.uni-frankfurt.de"; | 129 | list << "mickey@tm.informatik.uni-frankfurt.de"; |
130 | list << "mickey@vanille.de"; | 130 | list << "mickey@vanille.de"; |
131 | 131 | ||
132 | comp->setItems( list ); | 132 | comp->setItems( list ); |
133 | 133 | ||
134 | edit->show(); | 134 | edit->show(); |
135 | 135 | ||
136 | } | 136 | } |
137 | 137 | ||
138 | void OpieUIDemo::demoOComboBox() | 138 | void OpieUIDemo::demoOComboBox() |
139 | { | 139 | { |
140 | qDebug( "ocombobox" ); | 140 | qDebug( "ocombobox" ); |
141 | 141 | ||
142 | OComboBox *combo = new OComboBox( true, 0, "combobox" ); | 142 | OComboBox *combo = new OComboBox( true, 0, "combobox" ); |
143 | 143 | ||
144 | combo->setCompletionMode( OGlobalSettings::CompletionPopup ); | 144 | combo->setCompletionMode( OGlobalSettings::CompletionPopup ); |
145 | OCompletion* comp = combo->completionObject(); | 145 | OCompletion* comp = combo->completionObject(); |
146 | 146 | ||
147 | QStringList ilist; | 147 | QStringList ilist; |
148 | ilist << "kergoth@handhelds.org"; | 148 | ilist << "kergoth@handhelds.org"; |
149 | ilist << "harlekin@handhelds.org"; | 149 | ilist << "harlekin@handhelds.org"; |
150 | ilist << "groucho@handhelds.org"; | 150 | ilist << "groucho@handhelds.org"; |
151 | combo->insertStringList( ilist ); | 151 | combo->insertStringList( ilist ); |
152 | 152 | ||
153 | QStringList clist; | 153 | QStringList clist; |
154 | clist << "mickeyl@handhelds.org"; | 154 | clist << "mickeyl@handhelds.org"; |
155 | clist << "mickey@tm.informatik.uni-frankfurt.de"; | 155 | clist << "mickey@tm.informatik.uni-frankfurt.de"; |
156 | clist << "mickey@vanille.de"; | 156 | clist << "mickey@vanille.de"; |
157 | comp->setItems( clist ); | 157 | comp->setItems( clist ); |
158 | 158 | ||
159 | combo->show(); | 159 | combo->show(); |
160 | 160 | ||
161 | } | 161 | } |
162 | 162 | ||
163 | void OpieUIDemo::demoOEditListBox() | 163 | void OpieUIDemo::demoOEditListBox() |
164 | { | 164 | { |
165 | qDebug( "oeditlistbox" ); | 165 | qDebug( "oeditlistbox" ); |
166 | 166 | ||
167 | OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" ); | 167 | OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" ); |
168 | 168 | ||
169 | edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup ); | 169 | edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup ); |
170 | OCompletion* comp = edit->lineEdit()->completionObject(); | 170 | OCompletion* comp = edit->lineEdit()->completionObject(); |
171 | QStringList clist; | 171 | QStringList clist; |
172 | clist << "Completion everywhere"; | 172 | clist << "Completion everywhere"; |
173 | clist << "Cool Completion everywhere"; | 173 | clist << "Cool Completion everywhere"; |
174 | clist << "History History History"; | 174 | clist << "History History History"; |
175 | comp->setItems( clist ); | 175 | comp->setItems( clist ); |
176 | 176 | ||
177 | QStringList list; | 177 | QStringList list; |
178 | list << "kergoth@handhelds.org"; | 178 | list << "kergoth@handhelds.org"; |
179 | list << "harlekin@handhelds.org"; | 179 | list << "harlekin@handhelds.org"; |
180 | list << "groucho@handhelds.org"; | 180 | list << "groucho@handhelds.org"; |
181 | list << "mickeyl@handhelds.org"; | 181 | list << "mickeyl@handhelds.org"; |
182 | edit->insertStringList( list ); | 182 | edit->insertStringList( list ); |
183 | 183 | ||
184 | edit->show(); | 184 | edit->show(); |
185 | 185 | ||
186 | } | 186 | } |
187 | 187 | ||
188 | void OpieUIDemo::demoOSelector() | 188 | void OpieUIDemo::demoOSelector() |
189 | { | 189 | { |
190 | qDebug( "oselector" ); | 190 | qDebug( "oselector" ); |
191 | 191 | ||
192 | OHSSelector* sel = new OHSSelector( 0, "gradientselector" ); | 192 | OHSSelector* sel = new OHSSelector( 0, "gradientselector" ); |
193 | //#sel->resize( QSize( 200, 30 ) ); | 193 | //#sel->resize( QSize( 200, 30 ) ); |
194 | //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) ); | 194 | //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) ); |
195 | //#sel->setText( "Dark", "Light" ); | 195 | //#sel->setText( "Dark", "Light" ); |
196 | 196 | ||
197 | sel->show(); | 197 | sel->show(); |
198 | } | 198 | } |
199 | 199 | ||
200 | void OpieUIDemo::messageBox( const QString& text ) | 200 | void OpieUIDemo::messageBox( const QString& text ) |
201 | { | 201 | { |
202 | QString info; | 202 | QString info; |
203 | info = "You have selected '" + text + "'"; | 203 | info = "You have selected '" + text + "'"; |
204 | QMessageBox::information( this, "OpieUIDemo", info ); | 204 | QMessageBox::information( this, "OpieUIDemo", info ); |
205 | } | 205 | } |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp index cf1e443..9db4e62 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp | |||
@@ -1,158 +1,158 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (C) 2003 Michael 'Mickey' Lauer | 4 | Copyright (C) 2003 Michael 'Mickey' Lauer |
5 | <mickey@tm.informatik.uni-frankfurt.de> | 5 | <mickey@tm.informatik.uni-frankfurt.de> |
6 | =. | 6 | =. |
7 | .=l. | 7 | .=l. |
8 | .>+-= | 8 | .>+-= |
9 | _;:, .> :=|. This program is free software; you can | 9 | _;:, .> :=|. This program is free software; you can |
10 | .> <`_, > . <= redistribute it and/or modify it under | 10 | .> <`_, > . <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
12 | .="- .-=="i, .._ License as published by the Free Software | 12 | .="- .-=="i, .._ License as published by the Free Software |
13 | - . .-<_> .<> Foundation; either version 2 of the License, | 13 | - . .-<_> .<> Foundation; either version 2 of the License, |
14 | ._= =} : or (at your option) any later version. | 14 | ._= =} : or (at your option) any later version. |
15 | .%`+i> _;_. | 15 | .%`+i> _;_. |
16 | .i_,=:_. -<s. This program is distributed in the hope that | 16 | .i_,=:_. -<s. This program is distributed in the hope that |
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
18 | : .. .:, . . . without even the implied warranty of | 18 | : .. .:, . . . without even the implied warranty of |
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= = ; Library General Public License for more | 21 | ..}^=.= = ; Library General Public License for more |
22 | ++= -. .` .: details. | 22 | ++= -. .` .: details. |
23 | : = ...= . :.=- | 23 | : = ...= . :.=- |
24 | -. .:....=;==+<; You should have received a copy of the GNU | 24 | -. .:....=;==+<; You should have received a copy of the GNU |
25 | -_. . . )=. = Library General Public License along with | 25 | -_. . . )=. = Library General Public License along with |
26 | -- :-=` this library; see the file COPYING.LIB. | 26 | -- :-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include "oversatileviewdemo.h" | 33 | #include "oversatileviewdemo.h" |
34 | #include <opie2/oversatileview.h> | 34 | #include <opie2/oversatileview.h> |
35 | #include <opie2/oversatileviewitem.h> | 35 | #include <opie2/oversatileviewitem.h> |
36 | 36 | ||
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qpixmap.h> | 38 | #include <qpixmap.h> |
39 | #include <qlistview.h> | 39 | #include <qlistview.h> |
40 | 40 | ||
41 | OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) | 41 | OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) |
42 | :QVBox( parent, name, f ) | 42 | :QVBox( parent, name, f ) |
43 | { | 43 | { |
44 | vv = new OVersatileView( this ); | 44 | vv = new OVersatileView( this ); |
45 | 45 | ||
46 | vv->addColumn( "First" ); | 46 | vv->addColumn( "First" ); |
47 | vv->addColumn( "2nd" ); | 47 | vv->addColumn( "2nd" ); |
48 | vv->addColumn( "IIIrd" ); | 48 | vv->addColumn( "IIIrd" ); |
49 | 49 | ||
50 | QString counter; | 50 | QString counter; |
51 | 51 | ||
52 | QPixmap leaf( "leaf.png" ); | 52 | QPixmap leaf( "leaf.png" ); |
53 | QPixmap opened( "folder_opened.png" ); | 53 | QPixmap opened( "folder_opened.png" ); |
54 | QPixmap closed( "folder_closed.png" ); | 54 | QPixmap closed( "folder_closed.png" ); |
55 | 55 | ||
56 | QPixmap leaf32( "leaf32.png" ); | 56 | QPixmap leaf32( "leaf32.png" ); |
57 | QPixmap opened32( "folder_opened32.png" ); | 57 | QPixmap opened32( "folder_opened32.png" ); |
58 | QPixmap closed32( "folder_closed32.png" ); | 58 | QPixmap closed32( "folder_closed32.png" ); |
59 | 59 | ||
60 | vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed ); | 60 | vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed ); |
61 | vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 ); | 61 | vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 ); |
62 | 62 | ||
63 | OVersatileViewItem* item; | 63 | OVersatileViewItem* item; |
64 | OVersatileViewItem* item2; | 64 | OVersatileViewItem* item2; |
65 | 65 | ||
66 | for ( int i = 0; i < 5; ++i ) | 66 | for ( int i = 0; i < 5; ++i ) |
67 | { | 67 | { |
68 | counter.sprintf( "%d", i ); | 68 | counter.sprintf( "%d", i ); |
69 | item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter ); | 69 | item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter ); |
70 | item->setRenameEnabled( true ); | 70 | item->setRenameEnabled( true ); |
71 | item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter ); | 71 | item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter ); |
72 | item2->setRenameEnabled( true ); | 72 | item2->setRenameEnabled( true ); |
73 | 73 | ||
74 | } | 74 | } |
75 | 75 | ||
76 | connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); | 76 | connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); |
77 | connect( vv, SIGNAL( selectionChanged( OVersatileViewItem * ) ), this, SLOT( selectionChanged( OVersatileViewItem * ) ) ); | 77 | connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) ); |
78 | connect( vv, SIGNAL( currentChanged( OVersatileViewItem * ) ), this, SLOT( currentChanged( OVersatileViewItem * ) ) ); | 78 | connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) ); |
79 | connect( vv, SIGNAL( clicked( OVersatileViewItem * ) ), this, SLOT( clicked( OVersatileViewItem * ) ) ); | 79 | connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) ); |
80 | connect( vv, SIGNAL( pressed( OVersatileViewItem * ) ), this, SLOT( pressed( OVersatileViewItem * ) ) ); | 80 | connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) ); |
81 | 81 | ||
82 | connect( vv, SIGNAL( doubleClicked( OVersatileViewItem * ) ), this, SLOT( doubleClicked( OVersatileViewItem * ) ) ); | 82 | connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) ); |
83 | connect( vv, SIGNAL( returnPressed( OVersatileViewItem * ) ), this, SLOT( returnPressed( OVersatileViewItem * ) ) ); | 83 | connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) ); |
84 | 84 | ||
85 | connect( vv, SIGNAL( onItem( OVersatileViewItem * ) ), this, SLOT( onItem( OVersatileViewItem * ) ) ); | 85 | connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) ); |
86 | connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) ); | 86 | connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) ); |
87 | 87 | ||
88 | connect( vv, SIGNAL( expanded( OVersatileViewItem * ) ), this, SLOT( expanded( OVersatileViewItem * ) ) ); | 88 | connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) ); |
89 | connect( vv, SIGNAL( collapsed( OVersatileViewItem * ) ), this, SLOT( collapsed( OVersatileViewItem * ) ) ); | 89 | connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) ); |
90 | 90 | ||
91 | connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) ); | 91 | connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) ); |
92 | 92 | ||
93 | connect( vv, SIGNAL( contextMenuRequested( OVersatileViewItem *, const QPoint&, int ) ), this, SLOT( contextMenuRequested( OVersatileViewItem *, const QPoint&, int ) ) ); | 93 | connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) ); |
94 | 94 | ||
95 | } | 95 | } |
96 | 96 | ||
97 | OVersatileViewDemo::~OVersatileViewDemo() | 97 | OVersatileViewDemo::~OVersatileViewDemo() |
98 | { | 98 | { |
99 | } | 99 | } |
100 | 100 | ||
101 | void OVersatileViewDemo::selectionChanged() | 101 | void OVersatileViewDemo::selectionChanged() |
102 | { | 102 | { |
103 | qDebug( "received signal selectionChanged()" ); | 103 | qDebug( "received signal selectionChanged()" ); |
104 | } | 104 | } |
105 | void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item ) | 105 | void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item ) |
106 | { | 106 | { |
107 | qDebug( "received signal selectionChanged(OVersatileViewItem*)" ); | 107 | qDebug( "received signal selectionChanged(OVersatileViewItem*)" ); |
108 | } | 108 | } |
109 | void OVersatileViewDemo::currentChanged( OVersatileViewItem * item ) | 109 | void OVersatileViewDemo::currentChanged( OVersatileViewItem * item ) |
110 | { | 110 | { |
111 | qDebug( "received signal currentChanged( OVersatileViewItem * )" ); | 111 | qDebug( "received signal currentChanged( OVersatileViewItem * )" ); |
112 | } | 112 | } |
113 | void OVersatileViewDemo::clicked( OVersatileViewItem * item ) | 113 | void OVersatileViewDemo::clicked( OVersatileViewItem * item ) |
114 | { | 114 | { |
115 | qDebug( "received signal clicked( OVersatileViewItem * )" ); | 115 | qDebug( "received signal clicked( OVersatileViewItem * )" ); |
116 | } | 116 | } |
117 | void OVersatileViewDemo::pressed( OVersatileViewItem * item ) | 117 | void OVersatileViewDemo::pressed( OVersatileViewItem * item ) |
118 | { | 118 | { |
119 | qDebug( "received signal pressed( OVersatileViewItem * )" ); | 119 | qDebug( "received signal pressed( OVersatileViewItem * )" ); |
120 | } | 120 | } |
121 | 121 | ||
122 | void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item ) | 122 | void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item ) |
123 | { | 123 | { |
124 | qDebug( "received signal doubleClicked( OVersatileViewItem *item )" ); | 124 | qDebug( "received signal doubleClicked( OVersatileViewItem *item )" ); |
125 | } | 125 | } |
126 | void OVersatileViewDemo::returnPressed( OVersatileViewItem *item ) | 126 | void OVersatileViewDemo::returnPressed( OVersatileViewItem *item ) |
127 | { | 127 | { |
128 | qDebug( "received signal returnPressed( OVersatileViewItem *item )" ); | 128 | qDebug( "received signal returnPressed( OVersatileViewItem *item )" ); |
129 | } | 129 | } |
130 | 130 | ||
131 | void OVersatileViewDemo::onItem( OVersatileViewItem *item ) | 131 | void OVersatileViewDemo::onItem( OVersatileViewItem *item ) |
132 | { | 132 | { |
133 | qDebug( "received signal onItem( OVersatileViewItem *item )" ); | 133 | qDebug( "received signal onItem( OVersatileViewItem *item )" ); |
134 | } | 134 | } |
135 | void OVersatileViewDemo::onViewport() | 135 | void OVersatileViewDemo::onViewport() |
136 | { | 136 | { |
137 | qDebug( "received signal onViewport()" ); | 137 | qDebug( "received signal onViewport()" ); |
138 | } | 138 | } |
139 | 139 | ||
140 | void OVersatileViewDemo::expanded( OVersatileViewItem *item ) | 140 | void OVersatileViewDemo::expanded( OVersatileViewItem *item ) |
141 | { | 141 | { |
142 | qDebug( "received signal expanded( OVersatileViewItem *item )" ); | 142 | qDebug( "received signal expanded( OVersatileViewItem *item )" ); |
143 | } | 143 | } |
144 | 144 | ||
145 | void OVersatileViewDemo::collapsed( OVersatileViewItem *item ) | 145 | void OVersatileViewDemo::collapsed( OVersatileViewItem *item ) |
146 | { | 146 | { |
147 | qDebug( "received signal collapsed( OVersatileViewItem *item )" ); | 147 | qDebug( "received signal collapsed( OVersatileViewItem *item )" ); |
148 | } | 148 | } |
149 | 149 | ||
150 | void OVersatileViewDemo::moved() | 150 | void OVersatileViewDemo::moved() |
151 | { | 151 | { |
152 | qDebug( "received signal moved( OVersatileViewItem *item )" ); | 152 | qDebug( "received signal moved( OVersatileViewItem *item )" ); |
153 | } | 153 | } |
154 | 154 | ||
155 | void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col ) | 155 | void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col ) |
156 | { | 156 | { |
157 | qDebug( "received signal contextMenuRequested( OVersatileViewItem *item )" ); | 157 | qDebug( "received signal contextMenuRequested( OVersatileViewItem *item )" ); |
158 | } | 158 | } |
diff --git a/libopie2/opiecore/device/odevice.cpp b/libopie2/opiecore/device/odevice.cpp index b8d48fe..27b0e53 100644 --- a/libopie2/opiecore/device/odevice.cpp +++ b/libopie2/opiecore/device/odevice.cpp | |||
@@ -52,193 +52,193 @@ _;:, .> :=|. This program is free software; you can | |||
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | #include <signal.h> | 53 | #include <signal.h> |
54 | #include <sys/ioctl.h> | 54 | #include <sys/ioctl.h> |
55 | #include <sys/time.h> | 55 | #include <sys/time.h> |
56 | #include <unistd.h> | 56 | #include <unistd.h> |
57 | #ifndef QT_NO_SOUND | 57 | #ifndef QT_NO_SOUND |
58 | #include <linux/soundcard.h> | 58 | #include <linux/soundcard.h> |
59 | #endif | 59 | #endif |
60 | 60 | ||
61 | const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; | 61 | const char* PATH_PROC_CPUINFO = "/proc/cpuinfo"; |
62 | 62 | ||
63 | using namespace Opie; | 63 | using namespace Opie; |
64 | 64 | ||
65 | ODevice *ODevice::inst() | 65 | ODevice *ODevice::inst() |
66 | { | 66 | { |
67 | static ODevice *dev = 0; | 67 | static ODevice *dev = 0; |
68 | 68 | ||
69 | // rewrite this to only use /proc/cpuinfo or so | 69 | // rewrite this to only use /proc/cpuinfo or so |
70 | 70 | ||
71 | if ( !dev ) | 71 | if ( !dev ) |
72 | { | 72 | { |
73 | QFile f( PATH_PROC_CPUINFO ); | 73 | QFile f( PATH_PROC_CPUINFO ); |
74 | if ( f.open( IO_ReadOnly ) ) | 74 | if ( f.open( IO_ReadOnly ) ) |
75 | { | 75 | { |
76 | QTextStream s( &f ); | 76 | QTextStream s( &f ); |
77 | while ( !s.atEnd() ) | 77 | while ( !s.atEnd() ) |
78 | { | 78 | { |
79 | QString line; | 79 | QString line; |
80 | line = s.readLine(); | 80 | line = s.readLine(); |
81 | if ( line.startsWith( "Hardware" ) ) | 81 | if ( line.startsWith( "Hardware" ) ) |
82 | { | 82 | { |
83 | qDebug( "ODevice() - found '%s'", (const char*) line ); | 83 | qDebug( "ODevice() - found '%s'", (const char*) line ); |
84 | if ( line.contains( "sharp", false ) ) dev = new Zaurus(); | 84 | if ( line.contains( "sharp", false ) ) dev = new Zaurus(); |
85 | else if ( line.contains( "ipaq", false ) ) dev = new iPAQ(); | 85 | else if ( line.contains( "ipaq", false ) ) dev = new iPAQ(); |
86 | else if ( line.contains( "simpad", false ) ) dev = new SIMpad(); | 86 | else if ( line.contains( "simpad", false ) ) dev = new SIMpad(); |
87 | else if ( line.contains( "jornada", false ) ) dev = new Jornada(); | 87 | else if ( line.contains( "jornada", false ) ) dev = new Jornada(); |
88 | else if ( line.contains( "ramses", false ) ) dev = new Ramses(); | 88 | else if ( line.contains( "ramses", false ) ) dev = new Ramses(); |
89 | else qWarning( "ODevice() - unknown hardware - using default." ); | 89 | else qWarning( "ODevice() - unknown hardware - using default." ); |
90 | break; | 90 | break; |
91 | } | 91 | } |
92 | } | 92 | } |
93 | } | 93 | } |
94 | else | 94 | else |
95 | { | 95 | { |
96 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." ); | 96 | qWarning( "ODevice() - can't open '%s' - unknown hardware - using default." ); |
97 | } | 97 | } |
98 | if ( !dev ) dev = new ODevice(); | 98 | if ( !dev ) dev = new ODevice(); |
99 | dev->init(); | 99 | dev->init(); |
100 | } | 100 | } |
101 | return dev; | 101 | return dev; |
102 | } | 102 | } |
103 | 103 | ||
104 | ODevice::ODevice() | 104 | ODevice::ODevice() |
105 | { | 105 | { |
106 | d = new ODeviceData; | 106 | d = new ODeviceData; |
107 | 107 | ||
108 | d->m_modelstr = "Unknown"; | 108 | d->m_modelstr = "Unknown"; |
109 | d->m_model = Model_Unknown; | 109 | d->m_model = Model_Unknown; |
110 | d->m_vendorstr = "Unknown"; | 110 | d->m_vendorstr = "Unknown"; |
111 | d->m_vendor = Vendor_Unknown; | 111 | d->m_vendor = Vendor_Unknown; |
112 | d->m_systemstr = "Unknown"; | 112 | d->m_systemstr = "Unknown"; |
113 | d->m_system = System_Unknown; | 113 | d->m_system = System_Unknown; |
114 | d->m_sysverstr = "0.0"; | 114 | d->m_sysverstr = "0.0"; |
115 | d->m_rotation = Rot0; | 115 | d->m_rotation = Rot0; |
116 | d->m_direction = CW; | 116 | d->m_direction = CW; |
117 | 117 | ||
118 | d->m_holdtime = 1000; // 1000ms | 118 | d->m_holdtime = 1000; // 1000ms |
119 | d->m_buttons = 0; | 119 | d->m_buttons = 0; |
120 | d->m_cpu_frequencies = new QStrList; | 120 | d->m_cpu_frequencies = new QStrList; |
121 | } | 121 | } |
122 | 122 | ||
123 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 123 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
124 | { | 124 | { |
125 | if ( msg == "deviceButtonMappingChanged()" ) { | 125 | if ( msg == "deviceButtonMappingChanged()" ) { |
126 | reloadButtonMapping(); | 126 | reloadButtonMapping(); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | void ODevice::init() | 130 | void ODevice::init() |
131 | { | 131 | { |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * This method initialises the button mapping | 135 | * This method initialises the button mapping |
136 | */ | 136 | */ |
137 | void ODevice::initButtons() | 137 | void ODevice::initButtons() |
138 | { | 138 | { |
139 | if ( d->m_buttons ) | 139 | if ( d->m_buttons ) |
140 | return; | 140 | return; |
141 | 141 | ||
142 | qDebug ( "init Buttons" ); | 142 | qDebug ( "init Buttons" ); |
143 | d->m_buttons = new QValueList <ODeviceButton>; | 143 | d->m_buttons = new QValueList <ODeviceButton>; |
144 | 144 | ||
145 | reloadButtonMapping(); | 145 | reloadButtonMapping(); |
146 | 146 | ||
147 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 147 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
148 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 148 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
149 | } | 149 | } |
150 | 150 | ||
151 | ODevice::~ODevice() | 151 | ODevice::~ODevice() |
152 | { | 152 | { |
153 | // we leak m_devicebuttons and m_cpu_frequency | 153 | // we leak m_devicebuttons and m_cpu_frequency |
154 | // but it's a singleton and it is not so importantant | 154 | // but it's a singleton and it is not so importantant |
155 | // -zecke | 155 | // -zecke |
156 | delete d; | 156 | delete d; |
157 | } | 157 | } |
158 | 158 | ||
159 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 159 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
160 | { | 160 | { |
161 | return false; | 161 | return false; |
162 | } | 162 | } |
163 | 163 | ||
164 | //#include <linux/apm_bios.h> | 164 | //#include <linux/apm_bios.h> |
165 | 165 | ||
166 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 166 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
167 | 167 | ||
168 | /** | 168 | /** |
169 | * This method will try to suspend the device | 169 | * This method will try to suspend the device |
170 | * It only works if the user is the QWS Server and the apm application | 170 | * It only works if the user is the QWS Server and the apm application |
171 | * is installed. | 171 | * is installed. |
172 | * It tries to suspend and then waits some time cause some distributions | 172 | * It tries to suspend and then waits some time cause some distributions |
173 | * do have asynchronus apm implementations. | 173 | * do have asynchronus apm implementations. |
174 | * This method will either fail and return false or it'll suspend the | 174 | * This method will either fail and return false or it'll suspend the |
175 | * device and return once the device got woken up | 175 | * device and return once the device got woken up |
176 | * | 176 | * |
177 | * @return if the device got suspended | 177 | * @return if the device got suspended |
178 | */ | 178 | */ |
179 | bool ODevice::suspend() | 179 | bool ODevice::suspend() |
180 | { | 180 | { |
181 | qDebug("ODevice::suspend"); | 181 | qDebug("ODevice::suspend"); |
182 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend | 182 | if ( !isQWS( ) ) // only qwsserver is allowed to suspend |
183 | return false; | 183 | return false; |
184 | 184 | ||
185 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 185 | if ( d->m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
186 | return false; | 186 | return false; |
187 | 187 | ||
188 | bool res = false; | 188 | bool res = false; |
189 | ODevice::sendSuspendmsg(); | 189 | ODevice::sendSuspendmsg(); |
190 | 190 | ||
191 | struct timeval tvs, tvn; | 191 | struct timeval tvs, tvn; |
192 | ::gettimeofday ( &tvs, 0 ); | 192 | ::gettimeofday ( &tvs, 0 ); |
193 | 193 | ||
194 | ::sync(); // flush fs caches | 194 | ::sync(); // flush fs caches |
195 | res = ( ::system ( "apm --suspend" ) == 0 ); | 195 | res = ( ::system ( "apm --suspend" ) == 0 ); |
196 | 196 | ||
197 | // This is needed because the iPAQ apm implementation is asynchronous and we | 197 | // This is needed because the iPAQ apm implementation is asynchronous and we |
198 | // can not be sure when exactly the device is really suspended | 198 | // can not be sure when exactly the device is really suspended |
199 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 199 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
200 | 200 | ||
201 | if ( res ) { | 201 | if ( res ) { |
202 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 202 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
203 | ::usleep ( 200 * 1000 ); | 203 | ::usleep ( 200 * 1000 ); |
204 | ::gettimeofday ( &tvn, 0 ); | 204 | ::gettimeofday ( &tvn, 0 ); |
205 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 205 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
206 | } | 206 | } |
207 | 207 | ||
208 | return res; | 208 | return res; |
209 | } | 209 | } |
210 | 210 | ||
211 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 211 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
212 | 212 | ||
213 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 213 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
214 | 214 | ||
215 | /* VESA Blanking Levels */ | 215 | /* VESA Blanking Levels */ |
216 | #define VESA_NO_BLANKING 0 | 216 | #define VESA_NO_BLANKING 0 |
217 | #define VESA_VSYNC_SUSPEND 1 | 217 | #define VESA_VSYNC_SUSPEND 1 |
218 | #define VESA_HSYNC_SUSPEND 2 | 218 | #define VESA_HSYNC_SUSPEND 2 |
219 | #define VESA_POWERDOWN 3 | 219 | #define VESA_POWERDOWN 3 |
220 | 220 | ||
221 | /** | 221 | /** |
222 | * This sets the display on or off | 222 | * This sets the display on or off |
223 | */ | 223 | */ |
224 | bool ODevice::setDisplayStatus ( bool on ) | 224 | bool ODevice::setDisplayStatus ( bool on ) |
225 | { | 225 | { |
226 | qDebug("ODevice::setDisplayStatus(%d)", on); | 226 | qDebug("ODevice::setDisplayStatus(%d)", on); |
227 | 227 | ||
228 | if ( d->m_model == Model_Unknown ) | 228 | if ( d->m_model == Model_Unknown ) |
229 | return false; | 229 | return false; |
230 | 230 | ||
231 | bool res = false; | 231 | bool res = false; |
232 | int fd; | 232 | int fd; |
233 | 233 | ||
234 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 234 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
235 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 235 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
236 | ::close ( fd ); | 236 | ::close ( fd ); |
237 | } | 237 | } |
238 | return res; | 238 | return res; |
239 | } | 239 | } |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * This sets the display brightness | 242 | * This sets the display brightness |
243 | * | 243 | * |
244 | * @param p The brightness to be set on a scale from 0 to 255 | 244 | * @param p The brightness to be set on a scale from 0 to 255 |
diff --git a/libopie2/opiecore/device/odevice_ipaq.cpp b/libopie2/opiecore/device/odevice_ipaq.cpp index cc4b01a..8ecea1b 100644 --- a/libopie2/opiecore/device/odevice_ipaq.cpp +++ b/libopie2/opiecore/device/odevice_ipaq.cpp | |||
@@ -119,193 +119,193 @@ void iPAQ::init() | |||
119 | 119 | ||
120 | if ( f. open ( IO_ReadOnly )) { | 120 | if ( f. open ( IO_ReadOnly )) { |
121 | QTextStream ts ( &f ); | 121 | QTextStream ts ( &f ); |
122 | 122 | ||
123 | d->m_modelstr = "H" + ts. readLine(); | 123 | d->m_modelstr = "H" + ts. readLine(); |
124 | 124 | ||
125 | if ( d->m_modelstr == "H3100" ) | 125 | if ( d->m_modelstr == "H3100" ) |
126 | d->m_model = Model_iPAQ_H31xx; | 126 | d->m_model = Model_iPAQ_H31xx; |
127 | else if ( d->m_modelstr == "H3600" ) | 127 | else if ( d->m_modelstr == "H3600" ) |
128 | d->m_model = Model_iPAQ_H36xx; | 128 | d->m_model = Model_iPAQ_H36xx; |
129 | else if ( d->m_modelstr == "H3700" ) | 129 | else if ( d->m_modelstr == "H3700" ) |
130 | d->m_model = Model_iPAQ_H37xx; | 130 | d->m_model = Model_iPAQ_H37xx; |
131 | else if ( d->m_modelstr == "H3800" ) | 131 | else if ( d->m_modelstr == "H3800" ) |
132 | d->m_model = Model_iPAQ_H38xx; | 132 | d->m_model = Model_iPAQ_H38xx; |
133 | else if ( d->m_modelstr == "H3900" ) | 133 | else if ( d->m_modelstr == "H3900" ) |
134 | d->m_model = Model_iPAQ_H39xx; | 134 | d->m_model = Model_iPAQ_H39xx; |
135 | else if ( d->m_modelstr == "H5400" ) | 135 | else if ( d->m_modelstr == "H5400" ) |
136 | d->m_model = Model_iPAQ_H5xxx; | 136 | d->m_model = Model_iPAQ_H5xxx; |
137 | else | 137 | else |
138 | d->m_model = Model_Unknown; | 138 | d->m_model = Model_Unknown; |
139 | 139 | ||
140 | f. close(); | 140 | f. close(); |
141 | } | 141 | } |
142 | 142 | ||
143 | switch ( d->m_model ) { | 143 | switch ( d->m_model ) { |
144 | case Model_iPAQ_H31xx: | 144 | case Model_iPAQ_H31xx: |
145 | case Model_iPAQ_H38xx: | 145 | case Model_iPAQ_H38xx: |
146 | d->m_rotation = Rot90; | 146 | d->m_rotation = Rot90; |
147 | break; | 147 | break; |
148 | case Model_iPAQ_H36xx: | 148 | case Model_iPAQ_H36xx: |
149 | case Model_iPAQ_H37xx: | 149 | case Model_iPAQ_H37xx: |
150 | case Model_iPAQ_H39xx: | 150 | case Model_iPAQ_H39xx: |
151 | 151 | ||
152 | default: | 152 | default: |
153 | d->m_rotation = Rot270; | 153 | d->m_rotation = Rot270; |
154 | break; | 154 | break; |
155 | case Model_iPAQ_H5xxx: | 155 | case Model_iPAQ_H5xxx: |
156 | d->m_rotation = Rot0; | 156 | d->m_rotation = Rot0; |
157 | } | 157 | } |
158 | 158 | ||
159 | f. setName ( "/etc/familiar-version" ); | 159 | f. setName ( "/etc/familiar-version" ); |
160 | if ( f. open ( IO_ReadOnly )) { | 160 | if ( f. open ( IO_ReadOnly )) { |
161 | d->m_systemstr = "Familiar"; | 161 | d->m_systemstr = "Familiar"; |
162 | d->m_system = System_Familiar; | 162 | d->m_system = System_Familiar; |
163 | 163 | ||
164 | QTextStream ts ( &f ); | 164 | QTextStream ts ( &f ); |
165 | d->m_sysverstr = ts. readLine(). mid ( 10 ); | 165 | d->m_sysverstr = ts. readLine(). mid ( 10 ); |
166 | 166 | ||
167 | f. close(); | 167 | f. close(); |
168 | } else { | 168 | } else { |
169 | f. setName ( "/etc/oz_version" ); | 169 | f. setName ( "/etc/oz_version" ); |
170 | 170 | ||
171 | if ( f. open ( IO_ReadOnly )) { | 171 | if ( f. open ( IO_ReadOnly )) { |
172 | d->m_systemstr = "OpenEmbedded/iPaq"; | 172 | d->m_systemstr = "OpenEmbedded/iPaq"; |
173 | d->m_system = System_Familiar; | 173 | d->m_system = System_Familiar; |
174 | 174 | ||
175 | QTextStream ts ( &f ); | 175 | QTextStream ts ( &f ); |
176 | ts.setDevice ( &f ); | 176 | ts.setDevice ( &f ); |
177 | d->m_sysverstr = ts. readLine(); | 177 | d->m_sysverstr = ts. readLine(); |
178 | f. close(); | 178 | f. close(); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | 181 | ||
182 | m_leds [0] = m_leds [1] = Led_Off; | 182 | m_leds [0] = m_leds [1] = Led_Off; |
183 | 183 | ||
184 | m_power_timer = 0; | 184 | m_power_timer = 0; |
185 | 185 | ||
186 | } | 186 | } |
187 | 187 | ||
188 | void iPAQ::initButtons() | 188 | void iPAQ::initButtons() |
189 | { | 189 | { |
190 | if ( d->m_buttons ) | 190 | if ( d->m_buttons ) |
191 | return; | 191 | return; |
192 | 192 | ||
193 | if ( isQWS( ) ) | 193 | if ( isQWS( ) ) |
194 | QWSServer::setKeyboardFilter ( this ); | 194 | QWSServer::setKeyboardFilter ( this ); |
195 | 195 | ||
196 | d->m_buttons = new QValueList <ODeviceButton>; | 196 | d->m_buttons = new QValueList <ODeviceButton>; |
197 | 197 | ||
198 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 198 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
199 | i_button *ib = ipaq_buttons + i; | 199 | i_button *ib = ipaq_buttons + i; |
200 | ODeviceButton b; | 200 | ODeviceButton b; |
201 | 201 | ||
202 | if (( ib->model & d->m_model ) == d->m_model ) { | 202 | if (( ib->model & d->m_model ) == d->m_model ) { |
203 | b. setKeycode ( ib->code ); | 203 | b. setKeycode ( ib->code ); |
204 | b. setUserText ( QObject::tr ( "Button", ib->utext )); | 204 | b. setUserText ( QObject::tr ( "Button", ib->utext )); |
205 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); | 205 | b. setPixmap ( Resource::loadPixmap ( ib->pix )); |
206 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); | 206 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib->fpressedservice ), ib->fpressedaction )); |
207 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); | 207 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib->fheldservice ), ib->fheldaction )); |
208 | 208 | ||
209 | d->m_buttons->append ( b ); | 209 | d->m_buttons->append ( b ); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | reloadButtonMapping(); | 212 | reloadButtonMapping(); |
213 | 213 | ||
214 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 214 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
215 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 215 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
216 | } | 216 | } |
217 | 217 | ||
218 | QValueList <OLed> iPAQ::ledList() const | 218 | QValueList <OLed> iPAQ::ledList() const |
219 | { | 219 | { |
220 | QValueList <OLed> vl; | 220 | QValueList <OLed> vl; |
221 | vl << Led_Power; | 221 | vl << Led_Power; |
222 | 222 | ||
223 | if ( d->m_model == Model_iPAQ_H38xx ) | 223 | if ( d->m_model == Model_iPAQ_H38xx ) |
224 | vl << Led_BlueTooth; | 224 | vl << Led_BlueTooth; |
225 | return vl; | 225 | return vl; |
226 | } | 226 | } |
227 | 227 | ||
228 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const | 228 | QValueList <OLedState> iPAQ::ledStateList ( OLed l ) const |
229 | { | 229 | { |
230 | QValueList <OLedState> vl; | 230 | QValueList <OLedState> vl; |
231 | 231 | ||
232 | if ( l == Led_Power ) | 232 | if ( l == Led_Power ) |
233 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; | 233 | vl << Led_Off << Led_On << Led_BlinkSlow << Led_BlinkFast; |
234 | else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) | 234 | else if ( l == Led_BlueTooth && d->m_model == Model_iPAQ_H38xx ) |
235 | vl << Led_Off; // << Led_On << ??? | 235 | vl << Led_Off; // << Led_On << ??? |
236 | 236 | ||
237 | return vl; | 237 | return vl; |
238 | } | 238 | } |
239 | 239 | ||
240 | OLedState iPAQ::ledState ( OLed l ) const | 240 | OLedState iPAQ::ledState ( OLed l ) const |
241 | { | 241 | { |
242 | switch ( l ) { | 242 | switch ( l ) { |
243 | case Led_Power: | 243 | case Led_Power: |
244 | return m_leds [0]; | 244 | return m_leds [0]; |
245 | case Led_BlueTooth: | 245 | case Led_BlueTooth: |
246 | return m_leds [1]; | 246 | return m_leds [1]; |
247 | default: | 247 | default: |
248 | return Led_Off; | 248 | return Led_Off; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | bool iPAQ::setLedState ( OLed l, OLedState st ) | 252 | bool iPAQ::setLedState ( OLed l, OLedState st ) |
253 | { | 253 | { |
254 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); | 254 | static int fd = ::open ( "/dev/touchscreen/0", O_RDWR | O_NONBLOCK ); |
255 | 255 | ||
256 | if ( l == Led_Power ) { | 256 | if ( l == Led_Power ) { |
257 | if ( fd >= 0 ) { | 257 | if ( fd >= 0 ) { |
258 | LED_IN leds; | 258 | LED_IN leds; |
259 | ::memset ( &leds, 0, sizeof( leds )); | 259 | ::memset ( &leds, 0, sizeof( leds )); |
260 | leds. TotalTime = 0; | 260 | leds. TotalTime = 0; |
261 | leds. OnTime = 0; | 261 | leds. OnTime = 0; |
262 | leds. OffTime = 1; | 262 | leds. OffTime = 1; |
263 | leds. OffOnBlink = 2; | 263 | leds. OffOnBlink = 2; |
264 | 264 | ||
265 | switch ( st ) { | 265 | switch ( st ) { |
266 | case Led_Off : leds. OffOnBlink = 0; break; | 266 | case Led_Off : leds. OffOnBlink = 0; break; |
267 | case Led_On : leds. OffOnBlink = 1; break; | 267 | case Led_On : leds. OffOnBlink = 1; break; |
268 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; | 268 | case Led_BlinkSlow: leds. OnTime = 10; leds. OffTime = 10; break; |
269 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; | 269 | case Led_BlinkFast: leds. OnTime = 5; leds. OffTime = 5; break; |
270 | } | 270 | } |
271 | 271 | ||
272 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { | 272 | if ( ::ioctl ( fd, LED_ON, &leds ) >= 0 ) { |
273 | m_leds [0] = st; | 273 | m_leds [0] = st; |
274 | return true; | 274 | return true; |
275 | } | 275 | } |
276 | } | 276 | } |
277 | } | 277 | } |
278 | return false; | 278 | return false; |
279 | } | 279 | } |
280 | 280 | ||
281 | 281 | ||
282 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 282 | bool iPAQ::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
283 | { | 283 | { |
284 | int newkeycode = keycode; | 284 | int newkeycode = keycode; |
285 | 285 | ||
286 | switch ( keycode ) { | 286 | switch ( keycode ) { |
287 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key | 287 | // H38xx/H39xx have no "Q" key anymore - this is now the Mail key |
288 | case HardKey_Menu: { | 288 | case HardKey_Menu: { |
289 | if (( d->m_model == Model_iPAQ_H38xx ) || | 289 | if (( d->m_model == Model_iPAQ_H38xx ) || |
290 | ( d->m_model == Model_iPAQ_H39xx ) || | 290 | ( d->m_model == Model_iPAQ_H39xx ) || |
291 | ( d->m_model == Model_iPAQ_H5xxx)) { | 291 | ( d->m_model == Model_iPAQ_H5xxx)) { |
292 | newkeycode = HardKey_Mail; | 292 | newkeycode = HardKey_Mail; |
293 | } | 293 | } |
294 | break; | 294 | break; |
295 | } | 295 | } |
296 | 296 | ||
297 | // Rotate cursor keys 180° or 270° | 297 | // Rotate cursor keys 180° or 270° |
298 | case Key_Left : | 298 | case Key_Left : |
299 | case Key_Right: | 299 | case Key_Right: |
300 | case Key_Up : | 300 | case Key_Up : |
301 | case Key_Down : { | 301 | case Key_Down : { |
302 | if (( d->m_model == Model_iPAQ_H31xx ) || | 302 | if (( d->m_model == Model_iPAQ_H31xx ) || |
303 | ( d->m_model == Model_iPAQ_H38xx )) { | 303 | ( d->m_model == Model_iPAQ_H38xx )) { |
304 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; | 304 | newkeycode = Key_Left + ( keycode - Key_Left + 2 ) % 4; |
305 | } | 305 | } |
306 | // Rotate the cursor keys by 270° | 306 | // Rotate the cursor keys by 270° |
307 | // keycode - Key_Left = position of the button starting from left clockwise | 307 | // keycode - Key_Left = position of the button starting from left clockwise |
308 | // add the rotation to it and modolo. No we've the original offset | 308 | // add the rotation to it and modolo. No we've the original offset |
309 | // add the offset to the Key_Left key | 309 | // add the offset to the Key_Left key |
310 | if ( d-> m_model == Model_iPAQ_H5xxx ) | 310 | if ( d-> m_model == Model_iPAQ_H5xxx ) |
311 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; | 311 | newkeycode = Key_Left + ( keycode - Key_Left + 3 ) % 4; |
diff --git a/libopie2/opiecore/device/odevice_simpad.cpp b/libopie2/opiecore/device/odevice_simpad.cpp index 31b9297..90aca2f 100644 --- a/libopie2/opiecore/device/odevice_simpad.cpp +++ b/libopie2/opiecore/device/odevice_simpad.cpp | |||
@@ -96,193 +96,193 @@ struct s_button simpad_buttons [] = { | |||
96 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), | 96 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Upper+Left"), |
97 | "devicebuttons/simpad_upper_left", | 97 | "devicebuttons/simpad_upper_left", |
98 | "QPE/Rotation", "flip()", | 98 | "QPE/Rotation", "flip()", |
99 | "QPE/Rotation", "flip()" }, | 99 | "QPE/Rotation", "flip()" }, |
100 | /* | 100 | /* |
101 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 101 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
102 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 102 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
103 | "devicebuttons/simpad_lower_upper", | 103 | "devicebuttons/simpad_lower_upper", |
104 | "QPE/Launcher", "home()", | 104 | "QPE/Launcher", "home()", |
105 | "buttonsettings", "raise()" }, | 105 | "buttonsettings", "raise()" }, |
106 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, | 106 | { Model_SIMpad_CL4 | Model_SIMpad_SL4 | Model_SIMpad_SLC | Model_SIMpad_TSinus, |
107 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), | 107 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Lower+Upper"), |
108 | "devicebuttons/simpad_upper_lower", | 108 | "devicebuttons/simpad_upper_lower", |
109 | "QPE/Launcher", "home()", | 109 | "QPE/Launcher", "home()", |
110 | "buttonsettings", "raise()" }, | 110 | "buttonsettings", "raise()" }, |
111 | */ | 111 | */ |
112 | }; | 112 | }; |
113 | 113 | ||
114 | void SIMpad::init() | 114 | void SIMpad::init() |
115 | { | 115 | { |
116 | d->m_vendorstr = "SIEMENS"; | 116 | d->m_vendorstr = "SIEMENS"; |
117 | d->m_vendor = Vendor_SIEMENS; | 117 | d->m_vendor = Vendor_SIEMENS; |
118 | 118 | ||
119 | QFile f ( "/proc/hal/model" ); | 119 | QFile f ( "/proc/hal/model" ); |
120 | 120 | ||
121 | //TODO Implement model checking | 121 | //TODO Implement model checking |
122 | //FIXME For now we assume an SL4 | 122 | //FIXME For now we assume an SL4 |
123 | 123 | ||
124 | d->m_modelstr = "SL4"; | 124 | d->m_modelstr = "SL4"; |
125 | d->m_model = Model_SIMpad_SL4; | 125 | d->m_model = Model_SIMpad_SL4; |
126 | 126 | ||
127 | switch ( d->m_model ) { | 127 | switch ( d->m_model ) { |
128 | default: | 128 | default: |
129 | d->m_rotation = Rot0; | 129 | d->m_rotation = Rot0; |
130 | d->m_direction = CCW; | 130 | d->m_direction = CCW; |
131 | d->m_holdtime = 1000; // 1000ms | 131 | d->m_holdtime = 1000; // 1000ms |
132 | 132 | ||
133 | break; | 133 | break; |
134 | } | 134 | } |
135 | 135 | ||
136 | f. setName ( "/etc/familiar-version" ); | 136 | f. setName ( "/etc/familiar-version" ); |
137 | if ( f. open ( IO_ReadOnly )) { | 137 | if ( f. open ( IO_ReadOnly )) { |
138 | d->m_systemstr = "Familiar"; | 138 | d->m_systemstr = "Familiar"; |
139 | d->m_system = System_Familiar; | 139 | d->m_system = System_Familiar; |
140 | 140 | ||
141 | QTextStream ts ( &f ); | 141 | QTextStream ts ( &f ); |
142 | d->m_sysverstr = ts. readLine(). mid ( 10 ); | 142 | d->m_sysverstr = ts. readLine(). mid ( 10 ); |
143 | 143 | ||
144 | f. close(); | 144 | f. close(); |
145 | } else { | 145 | } else { |
146 | f. setName ( "/etc/oz_version" ); | 146 | f. setName ( "/etc/oz_version" ); |
147 | 147 | ||
148 | if ( f. open ( IO_ReadOnly )) { | 148 | if ( f. open ( IO_ReadOnly )) { |
149 | d->m_systemstr = "OpenEmbedded/SIMpad"; | 149 | d->m_systemstr = "OpenEmbedded/SIMpad"; |
150 | d->m_system = System_OpenZaurus; | 150 | d->m_system = System_OpenZaurus; |
151 | 151 | ||
152 | QTextStream ts ( &f ); | 152 | QTextStream ts ( &f ); |
153 | ts.setDevice ( &f ); | 153 | ts.setDevice ( &f ); |
154 | d->m_sysverstr = ts. readLine(); | 154 | d->m_sysverstr = ts. readLine(); |
155 | f. close(); | 155 | f. close(); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | m_leds [0] = m_leds [1] = Led_Off; | 159 | m_leds [0] = m_leds [1] = Led_Off; |
160 | 160 | ||
161 | m_power_timer = 0; | 161 | m_power_timer = 0; |
162 | 162 | ||
163 | } | 163 | } |
164 | 164 | ||
165 | void SIMpad::initButtons() | 165 | void SIMpad::initButtons() |
166 | { | 166 | { |
167 | if ( d->m_buttons ) | 167 | if ( d->m_buttons ) |
168 | return; | 168 | return; |
169 | 169 | ||
170 | if ( isQWS( ) ) | 170 | if ( isQWS( ) ) |
171 | QWSServer::setKeyboardFilter ( this ); | 171 | QWSServer::setKeyboardFilter ( this ); |
172 | 172 | ||
173 | d->m_buttons = new QValueList <ODeviceButton>; | 173 | d->m_buttons = new QValueList <ODeviceButton>; |
174 | 174 | ||
175 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { | 175 | for ( uint i = 0; i < ( sizeof( simpad_buttons ) / sizeof( s_button )); i++ ) { |
176 | s_button *sb = simpad_buttons + i; | 176 | s_button *sb = simpad_buttons + i; |
177 | ODeviceButton b; | 177 | ODeviceButton b; |
178 | 178 | ||
179 | if (( sb->model & d->m_model ) == d->m_model ) { | 179 | if (( sb->model & d->m_model ) == d->m_model ) { |
180 | b. setKeycode ( sb->code ); | 180 | b. setKeycode ( sb->code ); |
181 | b. setUserText ( QObject::tr ( "Button", sb->utext )); | 181 | b. setUserText ( QObject::tr ( "Button", sb->utext )); |
182 | b. setPixmap ( Resource::loadPixmap ( sb->pix )); | 182 | b. setPixmap ( Resource::loadPixmap ( sb->pix )); |
183 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction )); | 183 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( sb->fpressedservice ), sb->fpressedaction )); |
184 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction )); | 184 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( sb->fheldservice ), sb->fheldaction )); |
185 | 185 | ||
186 | d->m_buttons->append ( b ); | 186 | d->m_buttons->append ( b ); |
187 | } | 187 | } |
188 | } | 188 | } |
189 | reloadButtonMapping(); | 189 | reloadButtonMapping(); |
190 | 190 | ||
191 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 191 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
192 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 192 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
193 | } | 193 | } |
194 | 194 | ||
195 | // SIMpad boardcontrol register CS3 | 195 | // SIMpad boardcontrol register CS3 |
196 | #define SIMPAD_BOARDCONTROL "/proc/cs3" | 196 | #define SIMPAD_BOARDCONTROL "/proc/cs3" |
197 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA | 197 | #define SIMPAD_VCC_5V_EN 0x0001 // For 5V PCMCIA |
198 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA | 198 | #define SIMPAD_VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA |
199 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's | 199 | #define SIMPAD_EN1 0x0004 // This is only for EPROM's |
200 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V | 200 | #define SIMPAD_EN0 0x0008 // Both should be enable for 3.3V or 5V |
201 | #define SIMPAD_DISPLAY_ON 0x0010 | 201 | #define SIMPAD_DISPLAY_ON 0x0010 |
202 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 | 202 | #define SIMPAD_PCMCIA_BUFF_DIS 0x0020 |
203 | #define SIMPAD_MQ_RESET 0x0040 | 203 | #define SIMPAD_MQ_RESET 0x0040 |
204 | #define SIMPAD_PCMCIA_RESET 0x0080 | 204 | #define SIMPAD_PCMCIA_RESET 0x0080 |
205 | #define SIMPAD_DECT_POWER_ON 0x0100 | 205 | #define SIMPAD_DECT_POWER_ON 0x0100 |
206 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave | 206 | #define SIMPAD_IRDA_SD 0x0200 // Shutdown for powersave |
207 | #define SIMPAD_RS232_ON 0x0400 | 207 | #define SIMPAD_RS232_ON 0x0400 |
208 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave | 208 | #define SIMPAD_SD_MEDIAQ 0x0800 // Shutdown for powersave |
209 | #define SIMPAD_LED2_ON 0x1000 | 209 | #define SIMPAD_LED2_ON 0x1000 |
210 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode | 210 | #define SIMPAD_IRDA_MODE 0x2000 // Fast/Slow IrDA mode |
211 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit | 211 | #define SIMPAD_ENABLE_5V 0x4000 // Enable 5V circuit |
212 | #define SIMPAD_RESET_SIMCARD 0x8000 | 212 | #define SIMPAD_RESET_SIMCARD 0x8000 |
213 | 213 | ||
214 | //SIMpad touchscreen backlight strength control | 214 | //SIMpad touchscreen backlight strength control |
215 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" | 215 | #define SIMPAD_BACKLIGHT_CONTROL "/proc/driver/mq200/registers/PWM_CONTROL" |
216 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 | 216 | #define SIMPAD_BACKLIGHT_MASK 0x00a10044 |
217 | 217 | ||
218 | QValueList <OLed> SIMpad::ledList() const | 218 | QValueList <OLed> SIMpad::ledList() const |
219 | { | 219 | { |
220 | QValueList <OLed> vl; | 220 | QValueList <OLed> vl; |
221 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? | 221 | vl << Led_Power; //FIXME which LED is LED2 ? The green one or the amber one? |
222 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway | 222 | //vl << Led_Mail; //TODO find out if LED1 is accessible anyway |
223 | return vl; | 223 | return vl; |
224 | } | 224 | } |
225 | 225 | ||
226 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const | 226 | QValueList <OLedState> SIMpad::ledStateList ( OLed l ) const |
227 | { | 227 | { |
228 | QValueList <OLedState> vl; | 228 | QValueList <OLedState> vl; |
229 | 229 | ||
230 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? | 230 | if ( l == Led_Power ) //FIXME which LED is LED2 ? The green one or the amber one? |
231 | vl << Led_Off << Led_On; | 231 | vl << Led_Off << Led_On; |
232 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway | 232 | //else if ( l == Led_Mail ) //TODO find out if LED1 is accessible anyway |
233 | //vl << Led_Off; | 233 | //vl << Led_Off; |
234 | return vl; | 234 | return vl; |
235 | } | 235 | } |
236 | 236 | ||
237 | OLedState SIMpad::ledState ( OLed l ) const | 237 | OLedState SIMpad::ledState ( OLed l ) const |
238 | { | 238 | { |
239 | switch ( l ) { | 239 | switch ( l ) { |
240 | case Led_Power: | 240 | case Led_Power: |
241 | return m_leds [0]; | 241 | return m_leds [0]; |
242 | //case Led_Mail: | 242 | //case Led_Mail: |
243 | //return m_leds [1]; | 243 | //return m_leds [1]; |
244 | default: | 244 | default: |
245 | return Led_Off; | 245 | return Led_Off; |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | bool SIMpad::setLedState ( OLed l, OLedState st ) | 249 | bool SIMpad::setLedState ( OLed l, OLedState st ) |
250 | { | 250 | { |
251 | #if 0 | 251 | #if 0 |
252 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); | 252 | static int fd = ::open ( SIMPAD_BOARDCONTROL, O_RDWR | O_NONBLOCK ); |
253 | 253 | ||
254 | /*TODO Implement this like that: | 254 | /*TODO Implement this like that: |
255 | read from cs3 | 255 | read from cs3 |
256 | && with SIMPAD_LED2_ON | 256 | && with SIMPAD_LED2_ON |
257 | write to cs3 */ | 257 | write to cs3 */ |
258 | m_leds [0] = st; | 258 | m_leds [0] = st; |
259 | return true; | 259 | return true; |
260 | } | 260 | } |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | #endif | 264 | #endif |
265 | return false; | 265 | return false; |
266 | } | 266 | } |
267 | 267 | ||
268 | 268 | ||
269 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) | 269 | bool SIMpad::filter ( int /*unicode*/, int keycode, int modifiers, bool isPress, bool autoRepeat ) |
270 | { | 270 | { |
271 | //TODO | 271 | //TODO |
272 | return false; | 272 | return false; |
273 | } | 273 | } |
274 | 274 | ||
275 | void SIMpad::timerEvent ( QTimerEvent * ) | 275 | void SIMpad::timerEvent ( QTimerEvent * ) |
276 | { | 276 | { |
277 | killTimer ( m_power_timer ); | 277 | killTimer ( m_power_timer ); |
278 | m_power_timer = 0; | 278 | m_power_timer = 0; |
279 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); | 279 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, true, false ); |
280 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); | 280 | QWSServer::sendKeyEvent ( -1, HardKey_Backlight, 0, false, false ); |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | void SIMpad::playAlarmSound() | 284 | void SIMpad::playAlarmSound() |
285 | { | 285 | { |
286 | #ifndef QT_NO_SOUND | 286 | #ifndef QT_NO_SOUND |
287 | static Sound snd ( "alarm" ); | 287 | static Sound snd ( "alarm" ); |
288 | int fd; | 288 | int fd; |
diff --git a/libopie2/opiecore/device/odevice_yopy.cpp b/libopie2/opiecore/device/odevice_yopy.cpp index a76f90b..d241db8 100644 --- a/libopie2/opiecore/device/odevice_yopy.cpp +++ b/libopie2/opiecore/device/odevice_yopy.cpp | |||
@@ -26,138 +26,138 @@ _;:, .> :=|. This program is free software; you can | |||
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_yopy.h" | 30 | #include "odevice_yopy.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie; | 56 | using namespace Opie; |
57 | 57 | ||
58 | struct yopy_button yopy_buttons [] = { | 58 | struct yopy_button yopy_buttons [] = { |
59 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), | 59 | { Qt::Key_F10, QT_TRANSLATE_NOOP( "Button", "Action Button" ), |
60 | "devicebuttons/yopy_action", | 60 | "devicebuttons/yopy_action", |
61 | "datebook", "nextView()", | 61 | "datebook", "nextView()", |
62 | "today", "raise()" }, | 62 | "today", "raise()" }, |
63 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), | 63 | { Qt::Key_F11, QT_TRANSLATE_NOOP( "Button", "OK Button" ), |
64 | "devicebuttons/yopy_ok", | 64 | "devicebuttons/yopy_ok", |
65 | "addressbook", "raise()", | 65 | "addressbook", "raise()", |
66 | "addressbook", "beamBusinessCard()" }, | 66 | "addressbook", "beamBusinessCard()" }, |
67 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), | 67 | { Qt::Key_F12, QT_TRANSLATE_NOOP( "Button", "End Button" ), |
68 | "devicebuttons/yopy_end", | 68 | "devicebuttons/yopy_end", |
69 | "QPE/Launcher", "home()", | 69 | "QPE/Launcher", "home()", |
70 | "buttonsettings", "raise()" }, | 70 | "buttonsettings", "raise()" }, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | void Yopy::init() | 73 | void Yopy::init() |
74 | { | 74 | { |
75 | d->m_vendorstr = "G.Mate"; | 75 | d->m_vendorstr = "G.Mate"; |
76 | d->m_vendor = Vendor_GMate; | 76 | d->m_vendor = Vendor_GMate; |
77 | d->m_modelstr = "Yopy3700"; | 77 | d->m_modelstr = "Yopy3700"; |
78 | d->m_model = Model_Yopy_3700; | 78 | d->m_model = Model_Yopy_3700; |
79 | d->m_rotation = Rot0; | 79 | d->m_rotation = Rot0; |
80 | 80 | ||
81 | d->m_systemstr = "Linupy"; | 81 | d->m_systemstr = "Linupy"; |
82 | d->m_system = System_Linupy; | 82 | d->m_system = System_Linupy; |
83 | 83 | ||
84 | QFile f ( "/etc/issue" ); | 84 | QFile f ( "/etc/issue" ); |
85 | if ( f. open ( IO_ReadOnly ) ) | 85 | if ( f. open ( IO_ReadOnly ) ) |
86 | { | 86 | { |
87 | QTextStream ts ( &f ); | 87 | QTextStream ts ( &f ); |
88 | ts.readLine(); | 88 | ts.readLine(); |
89 | d->m_sysverstr = ts. readLine(); | 89 | d->m_sysverstr = ts. readLine(); |
90 | f. close(); | 90 | f. close(); |
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | 94 | ||
95 | void Yopy::initButtons() | 95 | void Yopy::initButtons() |
96 | { | 96 | { |
97 | if ( d->m_buttons ) | 97 | if ( d->m_buttons ) |
98 | return ; | 98 | return ; |
99 | 99 | ||
100 | d->m_buttons = new QValueList <ODeviceButton>; | 100 | d->m_buttons = new QValueList <ODeviceButton>; |
101 | 101 | ||
102 | for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) | 102 | for ( uint i = 0; i < ( sizeof( yopy_buttons ) / sizeof( yopy_button ) ); i++ ) |
103 | { | 103 | { |
104 | 104 | ||
105 | yopy_button *ib = yopy_buttons + i; | 105 | yopy_button *ib = yopy_buttons + i; |
106 | 106 | ||
107 | ODeviceButton b; | 107 | ODeviceButton b; |
108 | 108 | ||
109 | b. setKeycode ( ib->code ); | 109 | b. setKeycode ( ib->code ); |
110 | b. setUserText ( QObject::tr ( "Button", ib->utext ) ); | 110 | b. setUserText ( QObject::tr ( "Button", ib->utext ) ); |
111 | b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); | 111 | b. setPixmap ( Resource::loadPixmap ( ib->pix ) ); |
112 | b. setFactoryPresetPressedAction | 112 | b. setFactoryPresetPressedAction |
113 | ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); | 113 | ( OQCopMessage( makeChannel( ib->fpressedservice ), ib->fpressedaction ) ); |
114 | b. setFactoryPresetHeldAction | 114 | b. setFactoryPresetHeldAction |
115 | ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); | 115 | ( OQCopMessage( makeChannel( ib->fheldservice ), ib->fheldaction ) ); |
116 | 116 | ||
117 | d->m_buttons->append ( b ); | 117 | d->m_buttons->append ( b ); |
118 | } | 118 | } |
119 | reloadButtonMapping(); | 119 | reloadButtonMapping(); |
120 | 120 | ||
121 | QCopChannel *sysch = new QCopChannel( "QPE/System", this ); | 121 | QCopChannel *sysch = new QCopChannel( "QPE/System", this ); |
122 | connect( sysch, SIGNAL( received( const QCString &, const QByteArray & ) ), | 122 | connect( sysch, SIGNAL( received(const QCString&,const QByteArray&) ), |
123 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 123 | this, SLOT( systemMessage(const QCString&,const QByteArray&) ) ); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | bool Yopy::suspend() | 127 | bool Yopy::suspend() |
128 | { | 128 | { |
129 | /* Opie for Yopy does not implement its own power management at the | 129 | /* Opie for Yopy does not implement its own power management at the |
130 | moment. The public version runs parallel to X, and relies on the | 130 | moment. The public version runs parallel to X, and relies on the |
131 | existing power management features. */ | 131 | existing power management features. */ |
132 | return false; | 132 | return false; |
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | bool Yopy::setDisplayBrightness( int bright ) | 136 | bool Yopy::setDisplayBrightness( int bright ) |
137 | { | 137 | { |
138 | /* The code here works, but is disabled as the current version runs | 138 | /* The code here works, but is disabled as the current version runs |
139 | parallel to X, and relies on the existing backlight demon. */ | 139 | parallel to X, and relies on the existing backlight demon. */ |
140 | #if 0 | 140 | #if 0 |
141 | if ( QFile::exists( "/proc/sys/pm/light" ) ) | 141 | if ( QFile::exists( "/proc/sys/pm/light" ) ) |
142 | { | 142 | { |
143 | int fd = ::open( "/proc/sys/pm/light", O_WRONLY ); | 143 | int fd = ::open( "/proc/sys/pm/light", O_WRONLY ); |
144 | if ( fd >= 0 ) | 144 | if ( fd >= 0 ) |
145 | { | 145 | { |
146 | if ( bright ) | 146 | if ( bright ) |
147 | ::write( fd, "1\n", 2 ); | 147 | ::write( fd, "1\n", 2 ); |
148 | else | 148 | else |
149 | ::write( fd, "0\n", 2 ); | 149 | ::write( fd, "0\n", 2 ); |
150 | ::close( fd ); | 150 | ::close( fd ); |
151 | return true; | 151 | return true; |
152 | } | 152 | } |
153 | } | 153 | } |
154 | #endif | 154 | #endif |
155 | return false; | 155 | return false; |
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | int Yopy::displayBrightnessResolution() const | 159 | int Yopy::displayBrightnessResolution() const |
160 | { | 160 | { |
161 | return 2; | 161 | return 2; |
162 | } | 162 | } |
163 | 163 | ||
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 9d23a12..8ab3cbe 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -159,194 +159,194 @@ void Zaurus::init() | |||
159 | } | 159 | } |
160 | else { | 160 | else { |
161 | d->m_systemstr = "Zaurus"; | 161 | d->m_systemstr = "Zaurus"; |
162 | d->m_system = System_Zaurus; | 162 | d->m_system = System_Zaurus; |
163 | } | 163 | } |
164 | 164 | ||
165 | f. setName ( "/proc/cpuinfo" ); | 165 | f. setName ( "/proc/cpuinfo" ); |
166 | if ( f. open ( IO_ReadOnly ) ) { | 166 | if ( f. open ( IO_ReadOnly ) ) { |
167 | QTextStream ts ( &f ); | 167 | QTextStream ts ( &f ); |
168 | QString line; | 168 | QString line; |
169 | while( line = ts. readLine() ) { | 169 | while( line = ts. readLine() ) { |
170 | if ( line. left ( 8 ) == "Hardware" ) | 170 | if ( line. left ( 8 ) == "Hardware" ) |
171 | break; | 171 | break; |
172 | } | 172 | } |
173 | int loc = line. find ( ":" ); | 173 | int loc = line. find ( ":" ); |
174 | if ( loc != -1 ) | 174 | if ( loc != -1 ) |
175 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); | 175 | model = line. mid ( loc + 2 ). simplifyWhiteSpace( ); |
176 | } | 176 | } |
177 | 177 | ||
178 | if ( model == "SHARP Corgi" ) { | 178 | if ( model == "SHARP Corgi" ) { |
179 | d->m_model = Model_Zaurus_SLC7x0; | 179 | d->m_model = Model_Zaurus_SLC7x0; |
180 | d->m_modelstr = "Zaurus SL-C700"; | 180 | d->m_modelstr = "Zaurus SL-C700"; |
181 | } else if ( model == "SHARP Shepherd" ) { | 181 | } else if ( model == "SHARP Shepherd" ) { |
182 | d->m_model = Model_Zaurus_SLC7x0; | 182 | d->m_model = Model_Zaurus_SLC7x0; |
183 | d->m_modelstr = "Zaurus SL-C750"; | 183 | d->m_modelstr = "Zaurus SL-C750"; |
184 | } else if ( model == "SHARP Husky" ) { | 184 | } else if ( model == "SHARP Husky" ) { |
185 | d->m_model = Model_Zaurus_SLC7x0; | 185 | d->m_model = Model_Zaurus_SLC7x0; |
186 | d->m_modelstr = "Zaurus SL-C760"; | 186 | d->m_modelstr = "Zaurus SL-C760"; |
187 | } else if ( model == "SHARP Poodle" ) { | 187 | } else if ( model == "SHARP Poodle" ) { |
188 | d->m_model = Model_Zaurus_SLB600; | 188 | d->m_model = Model_Zaurus_SLB600; |
189 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; | 189 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; |
190 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 190 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
191 | d->m_model = Model_Zaurus_SL5500; | 191 | d->m_model = Model_Zaurus_SL5500; |
192 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 192 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
193 | } else { | 193 | } else { |
194 | d->m_model = Model_Zaurus_SL5500; | 194 | d->m_model = Model_Zaurus_SL5500; |
195 | d->m_modelstr = "Zaurus (Model unknown)"; | 195 | d->m_modelstr = "Zaurus (Model unknown)"; |
196 | } | 196 | } |
197 | 197 | ||
198 | bool flipstate = false; | 198 | bool flipstate = false; |
199 | switch ( d->m_model ) { | 199 | switch ( d->m_model ) { |
200 | case Model_Zaurus_SLA300: | 200 | case Model_Zaurus_SLA300: |
201 | d->m_rotation = Rot0; | 201 | d->m_rotation = Rot0; |
202 | break; | 202 | break; |
203 | case Model_Zaurus_SLC7x0: | 203 | case Model_Zaurus_SLC7x0: |
204 | d->m_rotation = rotation(); | 204 | d->m_rotation = rotation(); |
205 | d->m_direction = direction(); | 205 | d->m_direction = direction(); |
206 | break; | 206 | break; |
207 | case Model_Zaurus_SLB600: | 207 | case Model_Zaurus_SLB600: |
208 | case Model_Zaurus_SL5500: | 208 | case Model_Zaurus_SL5500: |
209 | case Model_Zaurus_SL5000: | 209 | case Model_Zaurus_SL5000: |
210 | default: | 210 | default: |
211 | d->m_rotation = Rot270; | 211 | d->m_rotation = Rot270; |
212 | break; | 212 | break; |
213 | } | 213 | } |
214 | m_leds [0] = Led_Off; | 214 | m_leds [0] = Led_Off; |
215 | } | 215 | } |
216 | 216 | ||
217 | void Zaurus::initButtons() | 217 | void Zaurus::initButtons() |
218 | { | 218 | { |
219 | if ( d->m_buttons ) | 219 | if ( d->m_buttons ) |
220 | return; | 220 | return; |
221 | 221 | ||
222 | d->m_buttons = new QValueList <ODeviceButton>; | 222 | d->m_buttons = new QValueList <ODeviceButton>; |
223 | 223 | ||
224 | struct z_button * pz_buttons; | 224 | struct z_button * pz_buttons; |
225 | int buttoncount; | 225 | int buttoncount; |
226 | switch ( d->m_model ) { | 226 | switch ( d->m_model ) { |
227 | case Model_Zaurus_SLC7x0: | 227 | case Model_Zaurus_SLC7x0: |
228 | pz_buttons = z_buttons_c700; | 228 | pz_buttons = z_buttons_c700; |
229 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 229 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
230 | break; | 230 | break; |
231 | default: | 231 | default: |
232 | pz_buttons = z_buttons; | 232 | pz_buttons = z_buttons; |
233 | buttoncount = ARRAY_SIZE(z_buttons); | 233 | buttoncount = ARRAY_SIZE(z_buttons); |
234 | break; | 234 | break; |
235 | } | 235 | } |
236 | 236 | ||
237 | for ( int i = 0; i < buttoncount; i++ ) { | 237 | for ( int i = 0; i < buttoncount; i++ ) { |
238 | struct z_button *zb = pz_buttons + i; | 238 | struct z_button *zb = pz_buttons + i; |
239 | ODeviceButton b; | 239 | ODeviceButton b; |
240 | 240 | ||
241 | b. setKeycode ( zb->code ); | 241 | b. setKeycode ( zb->code ); |
242 | b. setUserText ( QObject::tr ( "Button", zb->utext )); | 242 | b. setUserText ( QObject::tr ( "Button", zb->utext )); |
243 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); | 243 | b. setPixmap ( Resource::loadPixmap ( zb->pix )); |
244 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), | 244 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( zb->fpressedservice ), |
245 | zb->fpressedaction )); | 245 | zb->fpressedaction )); |
246 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), | 246 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( zb->fheldservice ), |
247 | zb->fheldaction )); | 247 | zb->fheldaction )); |
248 | 248 | ||
249 | d->m_buttons->append ( b ); | 249 | d->m_buttons->append ( b ); |
250 | } | 250 | } |
251 | 251 | ||
252 | reloadButtonMapping(); | 252 | reloadButtonMapping(); |
253 | 253 | ||
254 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 254 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
255 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), | 255 | connect ( sysch, SIGNAL( received(const QCString&,const QByteArray&)), |
256 | this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 256 | this, SLOT( systemMessage(const QCString&,const QByteArray&))); |
257 | } | 257 | } |
258 | 258 | ||
259 | #include <unistd.h> | 259 | #include <unistd.h> |
260 | #include <fcntl.h> | 260 | #include <fcntl.h> |
261 | #include <sys/ioctl.h> | 261 | #include <sys/ioctl.h> |
262 | 262 | ||
263 | //#include <asm/sharp_char.h> // including kernel headers is evil ... | 263 | //#include <asm/sharp_char.h> // including kernel headers is evil ... |
264 | 264 | ||
265 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 | 265 | #define SHARP_DEV_IOCTL_COMMAND_START 0x5680 |
266 | 266 | ||
267 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 267 | #defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
268 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 268 | #define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
269 | 269 | ||
270 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 270 | #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
271 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 271 | #define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
272 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 272 | #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
273 | 273 | ||
274 | /* --- for SHARP_BUZZER device --- */ | 274 | /* --- for SHARP_BUZZER device --- */ |
275 | 275 | ||
276 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 276 | //#defineSHARP_BUZZER_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
277 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) | 277 | //#define SHARP_BUZZER_MAKESOUND (SHARP_BUZZER_IOCTL_START) |
278 | 278 | ||
279 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) | 279 | #define SHARP_BUZZER_SETVOLUME (SHARP_BUZZER_IOCTL_START+1) |
280 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) | 280 | #define SHARP_BUZZER_GETVOLUME (SHARP_BUZZER_IOCTL_START+2) |
281 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) | 281 | #define SHARP_BUZZER_ISSUPPORTED (SHARP_BUZZER_IOCTL_START+3) |
282 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) | 282 | #define SHARP_BUZZER_SETMUTE (SHARP_BUZZER_IOCTL_START+4) |
283 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) | 283 | #define SHARP_BUZZER_STOPSOUND (SHARP_BUZZER_IOCTL_START+5) |
284 | 284 | ||
285 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ | 285 | //#define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */ |
286 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ | 286 | //#define SHARP_BUZ_KEYSOUND 2 /* key sound */ |
287 | 287 | ||
288 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ | 288 | //#define SHARP_PDA_ILLCLICKSOUND 3 /* illegal click */ |
289 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ | 289 | //#define SHARP_PDA_WARNSOUND 4 /* warning occurred */ |
290 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ | 290 | //#define SHARP_PDA_ERRORSOUND 5 /* error occurred */ |
291 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ | 291 | //#define SHARP_PDA_CRITICALSOUND 6 /* critical error occurred */ |
292 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ | 292 | //#define SHARP_PDA_SYSSTARTSOUND 7 /* system start */ |
293 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ | 293 | //#define SHARP_PDA_SYSTEMENDSOUND 8 /* system shutdown */ |
294 | //#define SHARP_PDA_APPSTART 9 /* application start */ | 294 | //#define SHARP_PDA_APPSTART 9 /* application start */ |
295 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ | 295 | //#define SHARP_PDA_APPQUIT 10 /* application ends */ |
296 | 296 | ||
297 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ | 297 | //#define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */ |
298 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ | 298 | //#define SHARP_BUZ_DAILY_ALARM 12 /* daily alarm */ |
299 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ | 299 | //#define SHARP_BUZ_GOT_PHONE_CALL 13 /* phone call sound */ |
300 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ | 300 | //#define SHARP_BUZ_GOT_MAIL 14 /* mail sound */ |
301 | // | 301 | // |
302 | 302 | ||
303 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) | 303 | #defineSHARP_LED_IOCTL_START (SHARP_DEV_IOCTL_COMMAND_START) |
304 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) | 304 | #define SHARP_LED_SETSTATUS (SHARP_LED_IOCTL_START+1) |
305 | 305 | ||
306 | #define SHARP_IOCTL_GET_ROTATION 0x413c | 306 | #define SHARP_IOCTL_GET_ROTATION 0x413c |
307 | 307 | ||
308 | typedef struct sharp_led_status { | 308 | typedef struct sharp_led_status { |
309 | int which; /* select which LED status is wanted. */ | 309 | int which; /* select which LED status is wanted. */ |
310 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 310 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
311 | } sharp_led_status; | 311 | } sharp_led_status; |
312 | 312 | ||
313 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ | 313 | #define SHARP_LED_MAIL_EXISTS 9 /* mail status (exists or not) */ |
314 | 314 | ||
315 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ | 315 | #define LED_MAIL_NO_UNREAD_MAIL 0 /* for SHARP_LED_MAIL_EXISTS */ |
316 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ | 316 | #define LED_MAIL_NEWMAIL_EXISTS 1 /* for SHARP_LED_MAIL_EXISTS */ |
317 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ | 317 | #define LED_MAIL_UNREAD_MAIL_EX 2 /* for SHARP_LED_MAIL_EXISTS */ |
318 | 318 | ||
319 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... | 319 | // #include <asm/sharp_apm.h> // including kernel headers is evil ... |
320 | 320 | ||
321 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) | 321 | #define APM_IOCGEVTSRC OD_IOR( 'A', 203, int ) |
322 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) | 322 | #define APM_IOCSEVTSRC OD_IORW( 'A', 204, int ) |
323 | #define APM_EVT_POWER_BUTTON (1 << 0) | 323 | #define APM_EVT_POWER_BUTTON (1 << 0) |
324 | 324 | ||
325 | #define FL_IOCTL_STEP_CONTRAST 100 | 325 | #define FL_IOCTL_STEP_CONTRAST 100 |
326 | 326 | ||
327 | 327 | ||
328 | void Zaurus::buzzer ( int sound ) | 328 | void Zaurus::buzzer ( int sound ) |
329 | { | 329 | { |
330 | #ifndef QT_NO_SOUND | 330 | #ifndef QT_NO_SOUND |
331 | QString soundname; | 331 | QString soundname; |
332 | 332 | ||
333 | // Not all devices have real sound | 333 | // Not all devices have real sound |
334 | if ( d->m_model == Model_Zaurus_SLC7x0 | 334 | if ( d->m_model == Model_Zaurus_SLC7x0 |
335 | || d->m_model == Model_Zaurus_SLB600 ){ | 335 | || d->m_model == Model_Zaurus_SLB600 ){ |
336 | 336 | ||
337 | switch ( sound ){ | 337 | switch ( sound ){ |
338 | case SHARP_BUZ_SCHEDULE_ALARM: | 338 | case SHARP_BUZ_SCHEDULE_ALARM: |
339 | soundname = "alarm"; | 339 | soundname = "alarm"; |
340 | break; | 340 | break; |
341 | case SHARP_BUZ_TOUCHSOUND: | 341 | case SHARP_BUZ_TOUCHSOUND: |
342 | soundname = "touchsound"; | 342 | soundname = "touchsound"; |
343 | break; | 343 | break; |
344 | case SHARP_BUZ_KEYSOUND: | 344 | case SHARP_BUZ_KEYSOUND: |
345 | soundname = "keysound"; | 345 | soundname = "keysound"; |
346 | break; | 346 | break; |
347 | default: | 347 | default: |
348 | soundname = "alarm"; | 348 | soundname = "alarm"; |
349 | 349 | ||
350 | } | 350 | } |
351 | } | 351 | } |
352 | 352 | ||
diff --git a/libopie2/opiecore/oprocess.cpp b/libopie2/opiecore/oprocess.cpp index 0a361a1..6349c83 100644 --- a/libopie2/opiecore/oprocess.cpp +++ b/libopie2/opiecore/oprocess.cpp | |||
@@ -579,214 +579,214 @@ void OProcess::slotSendData( int ) | |||
579 | void OProcess::processHasExited( int state ) | 579 | void OProcess::processHasExited( int state ) |
580 | { | 580 | { |
581 | if ( runs ) | 581 | if ( runs ) |
582 | { | 582 | { |
583 | runs = false; | 583 | runs = false; |
584 | status = state; | 584 | status = state; |
585 | 585 | ||
586 | commClose(); // cleanup communication sockets | 586 | commClose(); // cleanup communication sockets |
587 | 587 | ||
588 | // also emit a signal if the process was run Blocking | 588 | // also emit a signal if the process was run Blocking |
589 | if ( DontCare != run_mode ) | 589 | if ( DontCare != run_mode ) |
590 | { | 590 | { |
591 | emit processExited( this ); | 591 | emit processExited( this ); |
592 | } | 592 | } |
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
596 | int OProcess::childOutput( int fdno ) | 596 | int OProcess::childOutput( int fdno ) |
597 | { | 597 | { |
598 | if ( communication & NoRead ) | 598 | if ( communication & NoRead ) |
599 | { | 599 | { |
600 | int len = -1; | 600 | int len = -1; |
601 | emit receivedStdout( fdno, len ); | 601 | emit receivedStdout( fdno, len ); |
602 | errno = 0; // Make sure errno doesn't read "EAGAIN" | 602 | errno = 0; // Make sure errno doesn't read "EAGAIN" |
603 | return len; | 603 | return len; |
604 | } | 604 | } |
605 | else | 605 | else |
606 | { | 606 | { |
607 | char buffer[ 1024 ]; | 607 | char buffer[ 1024 ]; |
608 | int len; | 608 | int len; |
609 | 609 | ||
610 | len = ::read( fdno, buffer, 1024 ); | 610 | len = ::read( fdno, buffer, 1024 ); |
611 | 611 | ||
612 | if ( 0 < len ) | 612 | if ( 0 < len ) |
613 | { | 613 | { |
614 | emit receivedStdout( this, buffer, len ); | 614 | emit receivedStdout( this, buffer, len ); |
615 | } | 615 | } |
616 | return len; | 616 | return len; |
617 | } | 617 | } |
618 | } | 618 | } |
619 | 619 | ||
620 | int OProcess::childError( int fdno ) | 620 | int OProcess::childError( int fdno ) |
621 | { | 621 | { |
622 | char buffer[ 1024 ]; | 622 | char buffer[ 1024 ]; |
623 | int len; | 623 | int len; |
624 | 624 | ||
625 | len = ::read( fdno, buffer, 1024 ); | 625 | len = ::read( fdno, buffer, 1024 ); |
626 | 626 | ||
627 | if ( 0 < len ) | 627 | if ( 0 < len ) |
628 | emit receivedStderr( this, buffer, len ); | 628 | emit receivedStderr( this, buffer, len ); |
629 | return len; | 629 | return len; |
630 | } | 630 | } |
631 | 631 | ||
632 | int OProcess::setupCommunication( Communication comm ) | 632 | int OProcess::setupCommunication( Communication comm ) |
633 | { | 633 | { |
634 | int ok; | 634 | int ok; |
635 | 635 | ||
636 | communication = comm; | 636 | communication = comm; |
637 | 637 | ||
638 | ok = 1; | 638 | ok = 1; |
639 | if ( comm & Stdin ) | 639 | if ( comm & Stdin ) |
640 | ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, in ) >= 0; | 640 | ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, in ) >= 0; |
641 | 641 | ||
642 | if ( comm & Stdout ) | 642 | if ( comm & Stdout ) |
643 | ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, out ) >= 0; | 643 | ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, out ) >= 0; |
644 | 644 | ||
645 | if ( comm & Stderr ) | 645 | if ( comm & Stderr ) |
646 | ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, err ) >= 0; | 646 | ok &= socketpair( AF_UNIX, SOCK_STREAM, 0, err ) >= 0; |
647 | 647 | ||
648 | return ok; | 648 | return ok; |
649 | } | 649 | } |
650 | 650 | ||
651 | int OProcess::commSetupDoneP() | 651 | int OProcess::commSetupDoneP() |
652 | { | 652 | { |
653 | int ok = 1; | 653 | int ok = 1; |
654 | 654 | ||
655 | if ( communication != NoCommunication ) | 655 | if ( communication != NoCommunication ) |
656 | { | 656 | { |
657 | if ( communication & Stdin ) | 657 | if ( communication & Stdin ) |
658 | close( in[ 0 ] ); | 658 | close( in[ 0 ] ); |
659 | if ( communication & Stdout ) | 659 | if ( communication & Stdout ) |
660 | close( out[ 1 ] ); | 660 | close( out[ 1 ] ); |
661 | if ( communication & Stderr ) | 661 | if ( communication & Stderr ) |
662 | close( err[ 1 ] ); | 662 | close( err[ 1 ] ); |
663 | 663 | ||
664 | // Don't create socket notifiers and set the sockets non-blocking if | 664 | // Don't create socket notifiers and set the sockets non-blocking if |
665 | // blocking is requested. | 665 | // blocking is requested. |
666 | if ( run_mode == Block ) | 666 | if ( run_mode == Block ) |
667 | return ok; | 667 | return ok; |
668 | 668 | ||
669 | if ( communication & Stdin ) | 669 | if ( communication & Stdin ) |
670 | { | 670 | { |
671 | // ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK)); | 671 | // ok &= (-1 != fcntl(in[1], F_SETFL, O_NONBLOCK)); |
672 | innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this ); | 672 | innot = new QSocketNotifier( in[ 1 ], QSocketNotifier::Write, this ); |
673 | CHECK_PTR( innot ); | 673 | CHECK_PTR( innot ); |
674 | innot->setEnabled( false ); // will be enabled when data has to be sent | 674 | innot->setEnabled( false ); // will be enabled when data has to be sent |
675 | QObject::connect( innot, SIGNAL( activated( int ) ), | 675 | QObject::connect( innot, SIGNAL( activated(int) ), |
676 | this, SLOT( slotSendData( int ) ) ); | 676 | this, SLOT( slotSendData(int) ) ); |
677 | } | 677 | } |
678 | 678 | ||
679 | if ( communication & Stdout ) | 679 | if ( communication & Stdout ) |
680 | { | 680 | { |
681 | // ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK)); | 681 | // ok &= (-1 != fcntl(out[0], F_SETFL, O_NONBLOCK)); |
682 | outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this ); | 682 | outnot = new QSocketNotifier( out[ 0 ], QSocketNotifier::Read, this ); |
683 | CHECK_PTR( outnot ); | 683 | CHECK_PTR( outnot ); |
684 | QObject::connect( outnot, SIGNAL( activated( int ) ), | 684 | QObject::connect( outnot, SIGNAL( activated(int) ), |
685 | this, SLOT( slotChildOutput( int ) ) ); | 685 | this, SLOT( slotChildOutput(int) ) ); |
686 | if ( communication & NoRead ) | 686 | if ( communication & NoRead ) |
687 | suspend(); | 687 | suspend(); |
688 | } | 688 | } |
689 | 689 | ||
690 | if ( communication & Stderr ) | 690 | if ( communication & Stderr ) |
691 | { | 691 | { |
692 | // ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK)); | 692 | // ok &= (-1 != fcntl(err[0], F_SETFL, O_NONBLOCK)); |
693 | errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this ); | 693 | errnot = new QSocketNotifier( err[ 0 ], QSocketNotifier::Read, this ); |
694 | CHECK_PTR( errnot ); | 694 | CHECK_PTR( errnot ); |
695 | QObject::connect( errnot, SIGNAL( activated( int ) ), | 695 | QObject::connect( errnot, SIGNAL( activated(int) ), |
696 | this, SLOT( slotChildError( int ) ) ); | 696 | this, SLOT( slotChildError(int) ) ); |
697 | } | 697 | } |
698 | } | 698 | } |
699 | return ok; | 699 | return ok; |
700 | } | 700 | } |
701 | 701 | ||
702 | int OProcess::commSetupDoneC() | 702 | int OProcess::commSetupDoneC() |
703 | { | 703 | { |
704 | int ok = 1; | 704 | int ok = 1; |
705 | struct linger so; | 705 | struct linger so; |
706 | memset( &so, 0, sizeof( so ) ); | 706 | memset( &so, 0, sizeof( so ) ); |
707 | 707 | ||
708 | if ( communication & Stdin ) | 708 | if ( communication & Stdin ) |
709 | close( in[ 1 ] ); | 709 | close( in[ 1 ] ); |
710 | if ( communication & Stdout ) | 710 | if ( communication & Stdout ) |
711 | close( out[ 0 ] ); | 711 | close( out[ 0 ] ); |
712 | if ( communication & Stderr ) | 712 | if ( communication & Stderr ) |
713 | close( err[ 0 ] ); | 713 | close( err[ 0 ] ); |
714 | 714 | ||
715 | if ( communication & Stdin ) | 715 | if ( communication & Stdin ) |
716 | ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1; | 716 | ok &= dup2( in[ 0 ], STDIN_FILENO ) != -1; |
717 | else | 717 | else |
718 | { | 718 | { |
719 | int null_fd = open( "/dev/null", O_RDONLY ); | 719 | int null_fd = open( "/dev/null", O_RDONLY ); |
720 | ok &= dup2( null_fd, STDIN_FILENO ) != -1; | 720 | ok &= dup2( null_fd, STDIN_FILENO ) != -1; |
721 | close( null_fd ); | 721 | close( null_fd ); |
722 | } | 722 | } |
723 | if ( communication & Stdout ) | 723 | if ( communication & Stdout ) |
724 | { | 724 | { |
725 | ok &= dup2( out[ 1 ], STDOUT_FILENO ) != -1; | 725 | ok &= dup2( out[ 1 ], STDOUT_FILENO ) != -1; |
726 | ok &= !setsockopt( out[ 1 ], SOL_SOCKET, SO_LINGER, ( char* ) & so, sizeof( so ) ); | 726 | ok &= !setsockopt( out[ 1 ], SOL_SOCKET, SO_LINGER, ( char* ) & so, sizeof( so ) ); |
727 | } | 727 | } |
728 | else | 728 | else |
729 | { | 729 | { |
730 | int null_fd = open( "/dev/null", O_WRONLY ); | 730 | int null_fd = open( "/dev/null", O_WRONLY ); |
731 | ok &= dup2( null_fd, STDOUT_FILENO ) != -1; | 731 | ok &= dup2( null_fd, STDOUT_FILENO ) != -1; |
732 | close( null_fd ); | 732 | close( null_fd ); |
733 | } | 733 | } |
734 | if ( communication & Stderr ) | 734 | if ( communication & Stderr ) |
735 | { | 735 | { |
736 | ok &= dup2( err[ 1 ], STDERR_FILENO ) != -1; | 736 | ok &= dup2( err[ 1 ], STDERR_FILENO ) != -1; |
737 | ok &= !setsockopt( err[ 1 ], SOL_SOCKET, SO_LINGER, reinterpret_cast<char *>( &so ), sizeof( so ) ); | 737 | ok &= !setsockopt( err[ 1 ], SOL_SOCKET, SO_LINGER, reinterpret_cast<char *>( &so ), sizeof( so ) ); |
738 | } | 738 | } |
739 | else | 739 | else |
740 | { | 740 | { |
741 | int null_fd = open( "/dev/null", O_WRONLY ); | 741 | int null_fd = open( "/dev/null", O_WRONLY ); |
742 | ok &= dup2( null_fd, STDERR_FILENO ) != -1; | 742 | ok &= dup2( null_fd, STDERR_FILENO ) != -1; |
743 | close( null_fd ); | 743 | close( null_fd ); |
744 | } | 744 | } |
745 | return ok; | 745 | return ok; |
746 | } | 746 | } |
747 | 747 | ||
748 | void OProcess::commClose() | 748 | void OProcess::commClose() |
749 | { | 749 | { |
750 | if ( NoCommunication != communication ) | 750 | if ( NoCommunication != communication ) |
751 | { | 751 | { |
752 | bool b_in = ( communication & Stdin ); | 752 | bool b_in = ( communication & Stdin ); |
753 | bool b_out = ( communication & Stdout ); | 753 | bool b_out = ( communication & Stdout ); |
754 | bool b_err = ( communication & Stderr ); | 754 | bool b_err = ( communication & Stderr ); |
755 | if ( b_in ) | 755 | if ( b_in ) |
756 | delete innot; | 756 | delete innot; |
757 | 757 | ||
758 | if ( b_out || b_err ) | 758 | if ( b_out || b_err ) |
759 | { | 759 | { |
760 | // If both channels are being read we need to make sure that one socket buffer | 760 | // If both channels are being read we need to make sure that one socket buffer |
761 | // doesn't fill up whilst we are waiting for data on the other (causing a deadlock). | 761 | // doesn't fill up whilst we are waiting for data on the other (causing a deadlock). |
762 | // Hence we need to use select. | 762 | // Hence we need to use select. |
763 | 763 | ||
764 | // Once one or other of the channels has reached EOF (or given an error) go back | 764 | // Once one or other of the channels has reached EOF (or given an error) go back |
765 | // to the usual mechanism. | 765 | // to the usual mechanism. |
766 | 766 | ||
767 | int fds_ready = 1; | 767 | int fds_ready = 1; |
768 | fd_set rfds; | 768 | fd_set rfds; |
769 | 769 | ||
770 | int max_fd = 0; | 770 | int max_fd = 0; |
771 | if ( b_out ) | 771 | if ( b_out ) |
772 | { | 772 | { |
773 | fcntl( out[ 0 ], F_SETFL, O_NONBLOCK ); | 773 | fcntl( out[ 0 ], F_SETFL, O_NONBLOCK ); |
774 | if ( out[ 0 ] > max_fd ) | 774 | if ( out[ 0 ] > max_fd ) |
775 | max_fd = out[ 0 ]; | 775 | max_fd = out[ 0 ]; |
776 | delete outnot; | 776 | delete outnot; |
777 | outnot = 0; | 777 | outnot = 0; |
778 | } | 778 | } |
779 | if ( b_err ) | 779 | if ( b_err ) |
780 | { | 780 | { |
781 | fcntl( err[ 0 ], F_SETFL, O_NONBLOCK ); | 781 | fcntl( err[ 0 ], F_SETFL, O_NONBLOCK ); |
782 | if ( err[ 0 ] > max_fd ) | 782 | if ( err[ 0 ] > max_fd ) |
783 | max_fd = err[ 0 ]; | 783 | max_fd = err[ 0 ]; |
784 | delete errnot; | 784 | delete errnot; |
785 | errnot = 0; | 785 | errnot = 0; |
786 | } | 786 | } |
787 | 787 | ||
788 | 788 | ||
789 | while ( b_out || b_err ) | 789 | while ( b_out || b_err ) |
790 | { | 790 | { |
791 | // * If the process is still running we block until we | 791 | // * If the process is still running we block until we |
792 | // receive data. (p_timeout = 0, no timeout) | 792 | // receive data. (p_timeout = 0, no timeout) |
diff --git a/libopie2/opiepim/core/ocontactaccess.cpp b/libopie2/opiepim/core/ocontactaccess.cpp index c12e138..4f9b504 100644 --- a/libopie2/opiepim/core/ocontactaccess.cpp +++ b/libopie2/opiepim/core/ocontactaccess.cpp | |||
@@ -1,152 +1,152 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) The Main Author <main-author@whereever.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | /* | 29 | /* |
30 | * ===================================================================== | 30 | * ===================================================================== |
31 | * ToDo: XML-Backend: Automatic reload if something was changed... | 31 | * ToDo: XML-Backend: Automatic reload if something was changed... |
32 | * | 32 | * |
33 | * | 33 | * |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "ocontactaccess.h" | 36 | #include "ocontactaccess.h" |
37 | #include "obackendfactory.h" | 37 | #include "obackendfactory.h" |
38 | 38 | ||
39 | #include <qasciidict.h> | 39 | #include <qasciidict.h> |
40 | #include <qdatetime.h> | 40 | #include <qdatetime.h> |
41 | #include <qfile.h> | 41 | #include <qfile.h> |
42 | #include <qregexp.h> | 42 | #include <qregexp.h> |
43 | #include <qlist.h> | 43 | #include <qlist.h> |
44 | #include <qcopchannel_qws.h> | 44 | #include <qcopchannel_qws.h> |
45 | 45 | ||
46 | //#include <qpe/qcopenvelope_qws.h> | 46 | //#include <qpe/qcopenvelope_qws.h> |
47 | #include <qpe/global.h> | 47 | #include <qpe/global.h> |
48 | 48 | ||
49 | #include <errno.h> | 49 | #include <errno.h> |
50 | #include <fcntl.h> | 50 | #include <fcntl.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | 53 | ||
54 | #include <opie2/ocontactaccessbackend_xml.h> | 54 | #include <opie2/ocontactaccessbackend_xml.h> |
55 | 55 | ||
56 | namespace Opie { | 56 | namespace Opie { |
57 | 57 | ||
58 | OPimContactAccess::OPimContactAccess ( const QString appname, const QString , | 58 | OPimContactAccess::OPimContactAccess ( const QString appname, const QString , |
59 | OPimContactAccessBackend* end, bool autosync ): | 59 | OPimContactAccessBackend* end, bool autosync ): |
60 | OPimAccessTemplate<OPimContact>( end ) | 60 | OPimAccessTemplate<OPimContact>( end ) |
61 | { | 61 | { |
62 | /* take care of the backend. If there is no one defined, we | 62 | /* take care of the backend. If there is no one defined, we |
63 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). | 63 | * will use the XML-Backend as default (until we have a cute SQL-Backend..). |
64 | */ | 64 | */ |
65 | if( end == 0 ) { | 65 | if( end == 0 ) { |
66 | qWarning ("Using BackendFactory !"); | 66 | qWarning ("Using BackendFactory !"); |
67 | end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname ); | 67 | end = OBackendFactory<OPimContactAccessBackend>::Default( "contact", appname ); |
68 | } | 68 | } |
69 | // Set backend locally and in template | 69 | // Set backend locally and in template |
70 | m_backEnd = end; | 70 | m_backEnd = end; |
71 | OPimAccessTemplate<OPimContact>::setBackEnd (end); | 71 | OPimAccessTemplate<OPimContact>::setBackEnd (end); |
72 | 72 | ||
73 | 73 | ||
74 | /* Connect signal of external db change to function */ | 74 | /* Connect signal of external db change to function */ |
75 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); | 75 | QCopChannel *dbchannel = new QCopChannel( "QPE/PIM", this ); |
76 | connect( dbchannel, SIGNAL(received(const QCString &, const QByteArray &)), | 76 | connect( dbchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
77 | this, SLOT(copMessage( const QCString &, const QByteArray &)) ); | 77 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
78 | if ( autosync ){ | 78 | if ( autosync ){ |
79 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); | 79 | QCopChannel *syncchannel = new QCopChannel( "QPE/Sync", this ); |
80 | connect( syncchannel, SIGNAL(received(const QCString &, const QByteArray &)), | 80 | connect( syncchannel, SIGNAL(received(const QCString&,const QByteArray&)), |
81 | this, SLOT(copMessage( const QCString &, const QByteArray &)) ); | 81 | this, SLOT(copMessage(const QCString&,const QByteArray&)) ); |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | } | 85 | } |
86 | OPimContactAccess::~OPimContactAccess () | 86 | OPimContactAccess::~OPimContactAccess () |
87 | { | 87 | { |
88 | /* The user may forget to save the changed database, therefore try to | 88 | /* The user may forget to save the changed database, therefore try to |
89 | * do it for him.. | 89 | * do it for him.. |
90 | */ | 90 | */ |
91 | save(); | 91 | save(); |
92 | // delete m_backEnd; is done by template.. | 92 | // delete m_backEnd; is done by template.. |
93 | } | 93 | } |
94 | 94 | ||
95 | 95 | ||
96 | bool OPimContactAccess::save () | 96 | bool OPimContactAccess::save () |
97 | { | 97 | { |
98 | /* If the database was changed externally, we could not save the | 98 | /* If the database was changed externally, we could not save the |
99 | * Data. This will remove added items which is unacceptable ! | 99 | * Data. This will remove added items which is unacceptable ! |
100 | * Therefore: Reload database and merge the data... | 100 | * Therefore: Reload database and merge the data... |
101 | */ | 101 | */ |
102 | if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() ) | 102 | if ( OPimAccessTemplate<OPimContact>::wasChangedExternally() ) |
103 | reload(); | 103 | reload(); |
104 | 104 | ||
105 | bool status = OPimAccessTemplate<OPimContact>::save(); | 105 | bool status = OPimAccessTemplate<OPimContact>::save(); |
106 | if ( !status ) return false; | 106 | if ( !status ) return false; |
107 | 107 | ||
108 | /* Now tell everyone that new data is available. | 108 | /* Now tell everyone that new data is available. |
109 | */ | 109 | */ |
110 | QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); | 110 | QCopEnvelope e( "QPE/PIM", "addressbookUpdated()" ); |
111 | 111 | ||
112 | return true; | 112 | return true; |
113 | } | 113 | } |
114 | 114 | ||
115 | const uint OPimContactAccess::querySettings() | 115 | const uint OPimContactAccess::querySettings() |
116 | { | 116 | { |
117 | return ( m_backEnd->querySettings() ); | 117 | return ( m_backEnd->querySettings() ); |
118 | } | 118 | } |
119 | 119 | ||
120 | bool OPimContactAccess::hasQuerySettings ( int querySettings ) const | 120 | bool OPimContactAccess::hasQuerySettings ( int querySettings ) const |
121 | { | 121 | { |
122 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); | 122 | return ( m_backEnd->hasQuerySettings ( querySettings ) ); |
123 | } | 123 | } |
124 | OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const | 124 | OPimRecordList<OPimContact> OPimContactAccess::sorted( bool ascending, int sortOrder, int sortFilter, int cat ) const |
125 | { | 125 | { |
126 | QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); | 126 | QArray<int> matchingContacts = m_backEnd -> sorted( ascending, sortOrder, sortFilter, cat ); |
127 | return ( OPimRecordList<OPimContact>(matchingContacts, this) ); | 127 | return ( OPimRecordList<OPimContact>(matchingContacts, this) ); |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | bool OPimContactAccess::wasChangedExternally()const | 131 | bool OPimContactAccess::wasChangedExternally()const |
132 | { | 132 | { |
133 | return ( m_backEnd->wasChangedExternally() ); | 133 | return ( m_backEnd->wasChangedExternally() ); |
134 | } | 134 | } |
135 | 135 | ||
136 | 136 | ||
137 | void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) | 137 | void OPimContactAccess::copMessage( const QCString &msg, const QByteArray & ) |
138 | { | 138 | { |
139 | if ( msg == "addressbookUpdated()" ){ | 139 | if ( msg == "addressbookUpdated()" ){ |
140 | qWarning ("OPimContactAccess: Received addressbokUpdated()"); | 140 | qWarning ("OPimContactAccess: Received addressbokUpdated()"); |
141 | emit signalChanged ( this ); | 141 | emit signalChanged ( this ); |
142 | } else if ( msg == "flush()" ) { | 142 | } else if ( msg == "flush()" ) { |
143 | qWarning ("OPimContactAccess: Received flush()"); | 143 | qWarning ("OPimContactAccess: Received flush()"); |
144 | save (); | 144 | save (); |
145 | } else if ( msg == "reload()" ) { | 145 | } else if ( msg == "reload()" ) { |
146 | qWarning ("OPimContactAccess: Received reload()"); | 146 | qWarning ("OPimContactAccess: Received reload()"); |
147 | reload (); | 147 | reload (); |
148 | emit signalChanged ( this ); | 148 | emit signalChanged ( this ); |
149 | } | 149 | } |
150 | } | 150 | } |
151 | 151 | ||
152 | } | 152 | } |
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp index 10ed743..40dc297 100644 --- a/libopie2/opiepim/ui/opimmainwindow.cpp +++ b/libopie2/opiepim/ui/opimmainwindow.cpp | |||
@@ -1,149 +1,149 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) | 3 | Copyright (C) Stefan Eilers (Eilers.Stefan@epost.de) |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | #include <qapplication.h> | 29 | #include <qapplication.h> |
30 | #include <qdatetime.h> | 30 | #include <qdatetime.h> |
31 | #include <qcopchannel_qws.h> | 31 | #include <qcopchannel_qws.h> |
32 | 32 | ||
33 | #include <qpe/sound.h> | 33 | #include <qpe/sound.h> |
34 | #include <qpe/qcopenvelope_qws.h> | 34 | #include <qpe/qcopenvelope_qws.h> |
35 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
36 | 36 | ||
37 | #include <opie2/opimresolver.h> | 37 | #include <opie2/opimresolver.h> |
38 | #include "opimmainwindow.h" | 38 | #include "opimmainwindow.h" |
39 | 39 | ||
40 | namespace Opie { | 40 | namespace Opie { |
41 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, | 41 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, |
42 | const char* name, WFlags flag ) | 42 | const char* name, WFlags flag ) |
43 | : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { | 43 | : QMainWindow( parent, name, flag ), m_rtti(-1), m_service( service ), m_fallBack(0l) { |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * let's generate our QCopChannel | 46 | * let's generate our QCopChannel |
47 | */ | 47 | */ |
48 | m_str = QString("QPE/"+m_service).local8Bit(); | 48 | m_str = QString("QPE/"+m_service).local8Bit(); |
49 | m_channel= new QCopChannel(m_str, this ); | 49 | m_channel= new QCopChannel(m_str, this ); |
50 | connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), | 50 | connect(m_channel, SIGNAL(received(const QCString&,const QByteArray&) ), |
51 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 51 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
52 | connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), | 52 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&) ), |
53 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 53 | this, SLOT( appMessage(const QCString&,const QByteArray&) ) ); |
54 | 54 | ||
55 | /* connect flush and reload */ | 55 | /* connect flush and reload */ |
56 | connect(qApp, SIGNAL(flush() ), | 56 | connect(qApp, SIGNAL(flush() ), |
57 | this, SLOT(flush() ) ); | 57 | this, SLOT(flush() ) ); |
58 | connect(qApp, SIGNAL(reload() ), | 58 | connect(qApp, SIGNAL(reload() ), |
59 | this, SLOT(reload() ) ); | 59 | this, SLOT(reload() ) ); |
60 | } | 60 | } |
61 | OPimMainWindow::~OPimMainWindow() { | 61 | OPimMainWindow::~OPimMainWindow() { |
62 | delete m_channel; | 62 | delete m_channel; |
63 | } | 63 | } |
64 | QCopChannel* OPimMainWindow::channel() { | 64 | QCopChannel* OPimMainWindow::channel() { |
65 | return m_channel; | 65 | return m_channel; |
66 | } | 66 | } |
67 | void OPimMainWindow::doSetDocument( const QString& ) { | 67 | void OPimMainWindow::doSetDocument( const QString& ) { |
68 | 68 | ||
69 | } | 69 | } |
70 | void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { | 70 | void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) { |
71 | bool needShow = false; | 71 | bool needShow = false; |
72 | /* | 72 | /* |
73 | * create demands to create | 73 | * create demands to create |
74 | * a new record... | 74 | * a new record... |
75 | */ | 75 | */ |
76 | QDataStream stream(array, IO_ReadOnly); | 76 | QDataStream stream(array, IO_ReadOnly); |
77 | if ( cmd == "create()" ) { | 77 | if ( cmd == "create()" ) { |
78 | raise(); | 78 | raise(); |
79 | int uid = create(); | 79 | int uid = create(); |
80 | QCopEnvelope e(m_str, "created(int)" ); | 80 | QCopEnvelope e(m_str, "created(int)" ); |
81 | e << uid; | 81 | e << uid; |
82 | needShow = true; | 82 | needShow = true; |
83 | }else if ( cmd == "remove(int)" ) { | 83 | }else if ( cmd == "remove(int)" ) { |
84 | int uid; | 84 | int uid; |
85 | stream >> uid; | 85 | stream >> uid; |
86 | bool rem = remove( uid ); | 86 | bool rem = remove( uid ); |
87 | QCopEnvelope e(m_str, "removed(bool)" ); | 87 | QCopEnvelope e(m_str, "removed(bool)" ); |
88 | e << rem; | 88 | e << rem; |
89 | needShow = true; | 89 | needShow = true; |
90 | }else if ( cmd == "beam(int)" ) { | 90 | }else if ( cmd == "beam(int)" ) { |
91 | int uid; | 91 | int uid; |
92 | stream >> uid; | 92 | stream >> uid; |
93 | beam( uid); | 93 | beam( uid); |
94 | }else if ( cmd == "show(int)" ) { | 94 | }else if ( cmd == "show(int)" ) { |
95 | raise(); | 95 | raise(); |
96 | int uid; | 96 | int uid; |
97 | stream >> uid; | 97 | stream >> uid; |
98 | show( uid ); | 98 | show( uid ); |
99 | needShow = true; | 99 | needShow = true; |
100 | }else if ( cmd == "edit(int)" ) { | 100 | }else if ( cmd == "edit(int)" ) { |
101 | raise(); | 101 | raise(); |
102 | int uid; | 102 | int uid; |
103 | stream >> uid; | 103 | stream >> uid; |
104 | edit( uid ); | 104 | edit( uid ); |
105 | }else if ( cmd == "add(int,QByteArray)" ) { | 105 | }else if ( cmd == "add(int,QByteArray)" ) { |
106 | int rtti; | 106 | int rtti; |
107 | QByteArray array; | 107 | QByteArray array; |
108 | stream >> rtti; | 108 | stream >> rtti; |
109 | stream >> array; | 109 | stream >> array; |
110 | m_fallBack = record(rtti, array ); | 110 | m_fallBack = record(rtti, array ); |
111 | if (!m_fallBack) return; | 111 | if (!m_fallBack) return; |
112 | add( *m_fallBack ); | 112 | add( *m_fallBack ); |
113 | delete m_fallBack; | 113 | delete m_fallBack; |
114 | }else if ( cmd == "alarm(QDateTime,int)" ) { | 114 | }else if ( cmd == "alarm(QDateTime,int)" ) { |
115 | raise(); | 115 | raise(); |
116 | QDateTime dt; int uid; | 116 | QDateTime dt; int uid; |
117 | stream >> dt; | 117 | stream >> dt; |
118 | stream >> uid; | 118 | stream >> uid; |
119 | qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid ); | 119 | qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid ); |
120 | QDateTime current = QDateTime::currentDateTime(); | 120 | QDateTime current = QDateTime::currentDateTime(); |
121 | if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() ) | 121 | if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() ) |
122 | return; | 122 | return; |
123 | doAlarm( dt, uid ); | 123 | doAlarm( dt, uid ); |
124 | needShow = true; | 124 | needShow = true; |
125 | } | 125 | } |
126 | 126 | ||
127 | if (needShow ) | 127 | if (needShow ) |
128 | QPEApplication::setKeepRunning(); | 128 | QPEApplication::setKeepRunning(); |
129 | } | 129 | } |
130 | /* implement the url scripting here */ | 130 | /* implement the url scripting here */ |
131 | void OPimMainWindow::setDocument( const QString& str) { | 131 | void OPimMainWindow::setDocument( const QString& str) { |
132 | doSetDocument( str ); | 132 | doSetDocument( str ); |
133 | } | 133 | } |
134 | /* | 134 | /* |
135 | * we now try to get the array demarshalled | 135 | * we now try to get the array demarshalled |
136 | * check if the rtti matches this one | 136 | * check if the rtti matches this one |
137 | */ | 137 | */ |
138 | OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) { | 138 | OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) { |
139 | if ( service() != rtti ) | 139 | if ( service() != rtti ) |
140 | return 0l; | 140 | return 0l; |
141 | 141 | ||
142 | OPimRecord* record = OPimResolver::self()->record( rtti ); | 142 | OPimRecord* record = OPimResolver::self()->record( rtti ); |
143 | QDataStream str(array, IO_ReadOnly ); | 143 | QDataStream str(array, IO_ReadOnly ); |
144 | if ( !record || !record->loadFromStream(str) ) { | 144 | if ( !record || !record->loadFromStream(str) ) { |
145 | delete record; | 145 | delete record; |
146 | record = 0l; | 146 | record = 0l; |
147 | } | 147 | } |
148 | 148 | ||
149 | return record; | 149 | return record; |
diff --git a/libopie2/opiepim/ui/opimrecurrencewidget.cpp b/libopie2/opiepim/ui/opimrecurrencewidget.cpp index 569bdd5..90c1a5f 100644 --- a/libopie2/opiepim/ui/opimrecurrencewidget.cpp +++ b/libopie2/opiepim/ui/opimrecurrencewidget.cpp | |||
@@ -459,176 +459,176 @@ void OPimRecurrenceWidget::setupDaily() { | |||
459 | spinFreq->setValue( 1 ); | 459 | spinFreq->setValue( 1 ); |
460 | lblFreq->setText( tr("day(s)") ); | 460 | lblFreq->setText( tr("day(s)") ); |
461 | lblVar2->show(); | 461 | lblVar2->show(); |
462 | showRepeatStuff(); | 462 | showRepeatStuff(); |
463 | lblRepeat->setText( strDayTemplate ); | 463 | lblRepeat->setText( strDayTemplate ); |
464 | setupRepeatLabel( 1 ); | 464 | setupRepeatLabel( 1 ); |
465 | } | 465 | } |
466 | void OPimRecurrenceWidget::setupWeekly() { | 466 | void OPimRecurrenceWidget::setupWeekly() { |
467 | // reshow the buttons... | 467 | // reshow the buttons... |
468 | fraExtra->setTitle( tr("Repeat On") ); | 468 | fraExtra->setTitle( tr("Repeat On") ); |
469 | fraExtra->setExclusive( FALSE ); | 469 | fraExtra->setExclusive( FALSE ); |
470 | fraExtra->show(); | 470 | fraExtra->show(); |
471 | if ( startWeekOnMonday ) { | 471 | if ( startWeekOnMonday ) { |
472 | cmdExtra1->setText( tr("Mon") ); | 472 | cmdExtra1->setText( tr("Mon") ); |
473 | cmdExtra2->setText( tr("Tue") ); | 473 | cmdExtra2->setText( tr("Tue") ); |
474 | cmdExtra3->setText( tr("Wed") ); | 474 | cmdExtra3->setText( tr("Wed") ); |
475 | cmdExtra4->setText( tr("Thu") ); | 475 | cmdExtra4->setText( tr("Thu") ); |
476 | cmdExtra5->setText( tr("Fri") ); | 476 | cmdExtra5->setText( tr("Fri") ); |
477 | cmdExtra6->setText( tr("Sat") ); | 477 | cmdExtra6->setText( tr("Sat") ); |
478 | cmdExtra7->setText( tr("Sun") ); | 478 | cmdExtra7->setText( tr("Sun") ); |
479 | } else { | 479 | } else { |
480 | cmdExtra1->setText( tr("Sun") ); | 480 | cmdExtra1->setText( tr("Sun") ); |
481 | cmdExtra2->setText( tr("Mon") ); | 481 | cmdExtra2->setText( tr("Mon") ); |
482 | cmdExtra3->setText( tr("Tue") ); | 482 | cmdExtra3->setText( tr("Tue") ); |
483 | cmdExtra4->setText( tr("Wed") ); | 483 | cmdExtra4->setText( tr("Wed") ); |
484 | cmdExtra5->setText( tr("Thu") ); | 484 | cmdExtra5->setText( tr("Thu") ); |
485 | cmdExtra6->setText( tr("Fri") ); | 485 | cmdExtra6->setText( tr("Fri") ); |
486 | cmdExtra7->setText( tr("Sat") ); | 486 | cmdExtra7->setText( tr("Sat") ); |
487 | } | 487 | } |
488 | // I hope clustering these improve performance.... | 488 | // I hope clustering these improve performance.... |
489 | cmdExtra1->setOn( FALSE ); | 489 | cmdExtra1->setOn( FALSE ); |
490 | cmdExtra2->setOn( FALSE ); | 490 | cmdExtra2->setOn( FALSE ); |
491 | cmdExtra3->setOn( FALSE ); | 491 | cmdExtra3->setOn( FALSE ); |
492 | cmdExtra4->setOn( FALSE ); | 492 | cmdExtra4->setOn( FALSE ); |
493 | cmdExtra5->setOn( FALSE ); | 493 | cmdExtra5->setOn( FALSE ); |
494 | cmdExtra6->setOn( FALSE ); | 494 | cmdExtra6->setOn( FALSE ); |
495 | cmdExtra7->setOn( FALSE ); | 495 | cmdExtra7->setOn( FALSE ); |
496 | 496 | ||
497 | cmdExtra1->show(); | 497 | cmdExtra1->show(); |
498 | cmdExtra2->show(); | 498 | cmdExtra2->show(); |
499 | cmdExtra3->show(); | 499 | cmdExtra3->show(); |
500 | cmdExtra4->show(); | 500 | cmdExtra4->show(); |
501 | cmdExtra5->show(); | 501 | cmdExtra5->show(); |
502 | cmdExtra6->show(); | 502 | cmdExtra6->show(); |
503 | cmdExtra7->show(); | 503 | cmdExtra7->show(); |
504 | 504 | ||
505 | lblWeekVar->show(); | 505 | lblWeekVar->show(); |
506 | spinFreq->setValue( 1 ); | 506 | spinFreq->setValue( 1 ); |
507 | // might as well set the day too... | 507 | // might as well set the day too... |
508 | if ( startWeekOnMonday ) { | 508 | if ( startWeekOnMonday ) { |
509 | fraExtra->setButton( start.dayOfWeek() - 1 ); | 509 | fraExtra->setButton( start.dayOfWeek() - 1 ); |
510 | } else { | 510 | } else { |
511 | fraExtra->setButton( start.dayOfWeek() % 7 ); | 511 | fraExtra->setButton( start.dayOfWeek() % 7 ); |
512 | } | 512 | } |
513 | lblFreq->setText( tr("week(s)") ); | 513 | lblFreq->setText( tr("week(s)") ); |
514 | lblVar2->show(); | 514 | lblVar2->show(); |
515 | showRepeatStuff(); | 515 | showRepeatStuff(); |
516 | setupRepeatLabel( 1 ); | 516 | setupRepeatLabel( 1 ); |
517 | } | 517 | } |
518 | void OPimRecurrenceWidget::setupMonthly() { | 518 | void OPimRecurrenceWidget::setupMonthly() { |
519 | hideExtras(); | 519 | hideExtras(); |
520 | lblWeekVar->hide(); | 520 | lblWeekVar->hide(); |
521 | fraExtra->setTitle( tr("Repeat By") ); | 521 | fraExtra->setTitle( tr("Repeat By") ); |
522 | fraExtra->setExclusive( TRUE ); | 522 | fraExtra->setExclusive( TRUE ); |
523 | fraExtra->show(); | 523 | fraExtra->show(); |
524 | cmdExtra1->setText( tr("Day") ); | 524 | cmdExtra1->setText( tr("Day") ); |
525 | cmdExtra1->show(); | 525 | cmdExtra1->show(); |
526 | cmdExtra2->setText( tr("Date") ); | 526 | cmdExtra2->setText( tr("Date") ); |
527 | cmdExtra2->show(); | 527 | cmdExtra2->show(); |
528 | spinFreq->setValue( 1 ); | 528 | spinFreq->setValue( 1 ); |
529 | lblFreq->setText( tr("month(s)") ); | 529 | lblFreq->setText( tr("month(s)") ); |
530 | lblVar2->show(); | 530 | lblVar2->show(); |
531 | showRepeatStuff(); | 531 | showRepeatStuff(); |
532 | setupRepeatLabel( 1 ); | 532 | setupRepeatLabel( 1 ); |
533 | } | 533 | } |
534 | void OPimRecurrenceWidget::setupYearly() { | 534 | void OPimRecurrenceWidget::setupYearly() { |
535 | hideExtras(); | 535 | hideExtras(); |
536 | lblWeekVar->hide(); | 536 | lblWeekVar->hide(); |
537 | spinFreq->setValue( 1 ); | 537 | spinFreq->setValue( 1 ); |
538 | lblFreq->setText( tr("year(s)") ); | 538 | lblFreq->setText( tr("year(s)") ); |
539 | lblFreq->show(); | 539 | lblFreq->show(); |
540 | lblFreq->show(); | 540 | lblFreq->show(); |
541 | showRepeatStuff(); | 541 | showRepeatStuff(); |
542 | lblVar2->show(); | 542 | lblVar2->show(); |
543 | QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); | 543 | QString strEvery = strYearTemplate.arg( start.monthName(start.month()) ).arg( numberPlacing(start.day()) ); |
544 | lblRepeat->setText( strEvery ); | 544 | lblRepeat->setText( strEvery ); |
545 | setupRepeatLabel( 1 ); | 545 | setupRepeatLabel( 1 ); |
546 | 546 | ||
547 | } | 547 | } |
548 | void OPimRecurrenceWidget::init() { | 548 | void OPimRecurrenceWidget::init() { |
549 | QPopupMenu *m1 = new QPopupMenu( this ); | 549 | QPopupMenu *m1 = new QPopupMenu( this ); |
550 | repeatPicker = new DateBookMonth( m1, 0, TRUE ); | 550 | repeatPicker = new DateBookMonth( m1, 0, TRUE ); |
551 | m1->insertItem( repeatPicker ); | 551 | m1->insertItem( repeatPicker ); |
552 | cmdEnd->setPopup( m1 ); | 552 | cmdEnd->setPopup( m1 ); |
553 | cmdEnd->setPopupDelay( 0 ); | 553 | cmdEnd->setPopupDelay( 0 ); |
554 | 554 | ||
555 | QObject::connect( repeatPicker, SIGNAL(dateClicked(int, int, int)), | 555 | QObject::connect( repeatPicker, SIGNAL(dateClicked(int,int,int)), |
556 | this, SLOT(endDateChanged(int, int, int)) ); | 556 | this, SLOT(endDateChanged(int,int,int)) ); |
557 | QObject::connect( qApp, SIGNAL(weekChanged(bool)), | 557 | QObject::connect( qApp, SIGNAL(weekChanged(bool)), |
558 | this, SLOT(slotChangeStartOfWeek(bool)) ); | 558 | this, SLOT(slotChangeStartOfWeek(bool)) ); |
559 | 559 | ||
560 | listRTypeButtons.setAutoDelete( TRUE ); | 560 | listRTypeButtons.setAutoDelete( TRUE ); |
561 | listRTypeButtons.append( cmdNone ); | 561 | listRTypeButtons.append( cmdNone ); |
562 | listRTypeButtons.append( cmdDay ); | 562 | listRTypeButtons.append( cmdDay ); |
563 | listRTypeButtons.append( cmdWeek ); | 563 | listRTypeButtons.append( cmdWeek ); |
564 | listRTypeButtons.append( cmdMonth ); | 564 | listRTypeButtons.append( cmdMonth ); |
565 | listRTypeButtons.append( cmdYear ); | 565 | listRTypeButtons.append( cmdYear ); |
566 | 566 | ||
567 | listExtra.setAutoDelete( TRUE ); | 567 | listExtra.setAutoDelete( TRUE ); |
568 | listExtra.append( cmdExtra1 ); | 568 | listExtra.append( cmdExtra1 ); |
569 | listExtra.append( cmdExtra2 ); | 569 | listExtra.append( cmdExtra2 ); |
570 | listExtra.append( cmdExtra3 ); | 570 | listExtra.append( cmdExtra3 ); |
571 | listExtra.append( cmdExtra4 ); | 571 | listExtra.append( cmdExtra4 ); |
572 | listExtra.append( cmdExtra5 ); | 572 | listExtra.append( cmdExtra5 ); |
573 | listExtra.append( cmdExtra6 ); | 573 | listExtra.append( cmdExtra6 ); |
574 | listExtra.append( cmdExtra7 ); | 574 | listExtra.append( cmdExtra7 ); |
575 | } | 575 | } |
576 | void OPimRecurrenceWidget::hideExtras() { | 576 | void OPimRecurrenceWidget::hideExtras() { |
577 | // hide the extra buttons... | 577 | // hide the extra buttons... |
578 | fraExtra->hide(); | 578 | fraExtra->hide(); |
579 | chkNoEnd->hide(); | 579 | chkNoEnd->hide(); |
580 | QListIterator<QToolButton> it( listExtra ); | 580 | QListIterator<QToolButton> it( listExtra ); |
581 | for ( ; *it; ++it ) { | 581 | for ( ; *it; ++it ) { |
582 | (*it)->hide(); | 582 | (*it)->hide(); |
583 | (*it)->setOn( FALSE ); | 583 | (*it)->setOn( FALSE ); |
584 | } | 584 | } |
585 | } | 585 | } |
586 | void OPimRecurrenceWidget::showRepeatStuff() { | 586 | void OPimRecurrenceWidget::showRepeatStuff() { |
587 | cmdEnd->show(); | 587 | cmdEnd->show(); |
588 | chkNoEnd->show(); | 588 | chkNoEnd->show(); |
589 | lblFreq->show(); | 589 | lblFreq->show(); |
590 | lblEvery->show(); | 590 | lblEvery->show(); |
591 | lblFreq->show(); | 591 | lblFreq->show(); |
592 | spinFreq->show(); | 592 | spinFreq->show(); |
593 | lblEnd->show(); | 593 | lblEnd->show(); |
594 | lblRepeat->setText( tr("Every") ); | 594 | lblRepeat->setText( tr("Every") ); |
595 | } | 595 | } |
596 | 596 | ||
597 | 597 | ||
598 | static int week( const QDate &start ) | 598 | static int week( const QDate &start ) |
599 | { | 599 | { |
600 | // figure out the week... | 600 | // figure out the week... |
601 | int stop = start.day(), | 601 | int stop = start.day(), |
602 | sentinel = start.dayOfWeek(), | 602 | sentinel = start.dayOfWeek(), |
603 | dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(), | 603 | dayOfWeek = QDate( start.year(), start.month(), 1 ).dayOfWeek(), |
604 | week = 1, | 604 | week = 1, |
605 | i; | 605 | i; |
606 | for ( i = 1; i < stop; i++ ) { | 606 | for ( i = 1; i < stop; i++ ) { |
607 | if ( dayOfWeek++ == sentinel ) | 607 | if ( dayOfWeek++ == sentinel ) |
608 | week++; | 608 | week++; |
609 | if ( dayOfWeek > 7 ) | 609 | if ( dayOfWeek > 7 ) |
610 | dayOfWeek = 0; | 610 | dayOfWeek = 0; |
611 | } | 611 | } |
612 | return week; | 612 | return week; |
613 | } | 613 | } |
614 | 614 | ||
615 | static QString numberPlacing( int x ) | 615 | static QString numberPlacing( int x ) |
616 | { | 616 | { |
617 | // I hope this works in other languages besides english... | 617 | // I hope this works in other languages besides english... |
618 | QString str = QString::number( x ); | 618 | QString str = QString::number( x ); |
619 | switch ( x % 10 ) { | 619 | switch ( x % 10 ) { |
620 | case 1: | 620 | case 1: |
621 | str += QWidget::tr( "st" ); | 621 | str += QWidget::tr( "st" ); |
622 | break; | 622 | break; |
623 | case 2: | 623 | case 2: |
624 | str += QWidget::tr( "nd" ); | 624 | str += QWidget::tr( "nd" ); |
625 | break; | 625 | break; |
626 | case 3: | 626 | case 3: |
627 | str += QWidget::tr( "rd" ); | 627 | str += QWidget::tr( "rd" ); |
628 | break; | 628 | break; |
629 | default: | 629 | default: |
630 | str += QWidget::tr( "th" ); | 630 | str += QWidget::tr( "th" ); |
631 | break; | 631 | break; |
632 | } | 632 | } |
633 | return str; | 633 | return str; |
634 | } | 634 | } |
diff --git a/libopie2/opieui/fileselector/ofiledialog.cpp b/libopie2/opieui/fileselector/ofiledialog.cpp index 2a89c5d..e7daead 100644 --- a/libopie2/opieui/fileselector/ofiledialog.cpp +++ b/libopie2/opieui/fileselector/ofiledialog.cpp | |||
@@ -18,194 +18,194 @@ | |||
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | 29 | ||
30 | /* OPIE */ | 30 | /* OPIE */ |
31 | #include <opie2/ofiledialog.h> | 31 | #include <opie2/ofiledialog.h> |
32 | #include <qpe/applnk.h> | 32 | #include <qpe/applnk.h> |
33 | #include <qpe/config.h> | 33 | #include <qpe/config.h> |
34 | #include <qpe/qpeapplication.h> | 34 | #include <qpe/qpeapplication.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qfileinfo.h> | 37 | #include <qfileinfo.h> |
38 | #include <qstring.h> | 38 | #include <qstring.h> |
39 | #include <qapplication.h> | 39 | #include <qapplication.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | 41 | ||
42 | using namespace Opie; | 42 | using namespace Opie; |
43 | 43 | ||
44 | namespace | 44 | namespace |
45 | { | 45 | { |
46 | /* | 46 | /* |
47 | * helper functions to load the start dir | 47 | * helper functions to load the start dir |
48 | * and to save it | 48 | * and to save it |
49 | * helper to extract the dir out of a file name | 49 | * helper to extract the dir out of a file name |
50 | */ | 50 | */ |
51 | /** | 51 | /** |
52 | * This method will use Config( argv[0] ); | 52 | * This method will use Config( argv[0] ); |
53 | * @param key The group key used | 53 | * @param key The group key used |
54 | */ | 54 | */ |
55 | QString lastUsedDir( const QString& key ) | 55 | QString lastUsedDir( const QString& key ) |
56 | { | 56 | { |
57 | if ( qApp->argc() < 1 ) | 57 | if ( qApp->argc() < 1 ) |
58 | return QString::null; | 58 | return QString::null; |
59 | 59 | ||
60 | Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname | 60 | Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); // appname |
61 | cfg.setGroup( key ); | 61 | cfg.setGroup( key ); |
62 | return cfg.readEntry("LastDir", QPEApplication::documentDir() ); | 62 | return cfg.readEntry("LastDir", QPEApplication::documentDir() ); |
63 | } | 63 | } |
64 | 64 | ||
65 | void saveLastDir( const QString& key, const QString& file ) | 65 | void saveLastDir( const QString& key, const QString& file ) |
66 | { | 66 | { |
67 | if ( qApp->argc() < 1 ) | 67 | if ( qApp->argc() < 1 ) |
68 | return; | 68 | return; |
69 | 69 | ||
70 | Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); | 70 | Config cfg( QFileInfo(qApp->argv()[0]).fileName() ); |
71 | cfg.setGroup( key ); | 71 | cfg.setGroup( key ); |
72 | QFileInfo inf( file ); | 72 | QFileInfo inf( file ); |
73 | cfg.writeEntry("LastDir", inf.dirPath( true ) ); | 73 | cfg.writeEntry("LastDir", inf.dirPath( true ) ); |
74 | } | 74 | } |
75 | }; | 75 | }; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * This constructs a modal dialog | 78 | * This constructs a modal dialog |
79 | * | 79 | * |
80 | * @param caption The caption of the dialog | 80 | * @param caption The caption of the dialog |
81 | * @param wid The parent widget | 81 | * @param wid The parent widget |
82 | * @param mode The mode of the OFileSelector @see OFileSelector | 82 | * @param mode The mode of the OFileSelector @see OFileSelector |
83 | * @param selector The selector of the OFileSelector | 83 | * @param selector The selector of the OFileSelector |
84 | * @param dirName the dir or resource to start from | 84 | * @param dirName the dir or resource to start from |
85 | * @param fileName a proposed or existing filename | 85 | * @param fileName a proposed or existing filename |
86 | * @param mimetypes The mimeTypes | 86 | * @param mimetypes The mimeTypes |
87 | */ | 87 | */ |
88 | OFileDialog::OFileDialog(const QString &caption, | 88 | OFileDialog::OFileDialog(const QString &caption, |
89 | QWidget *wid, int mode, int selector, | 89 | QWidget *wid, int mode, int selector, |
90 | const QString &dirName, | 90 | const QString &dirName, |
91 | const QString &fileName, | 91 | const QString &fileName, |
92 | const QMap<QString,QStringList>& mimetypes ) | 92 | const QMap<QString,QStringList>& mimetypes ) |
93 | : QDialog( wid, "OFileDialog", true ) | 93 | : QDialog( wid, "OFileDialog", true ) |
94 | { | 94 | { |
95 | // QVBoxLayout *lay = new QVBoxLayout(this); | 95 | // QVBoxLayout *lay = new QVBoxLayout(this); |
96 | //showMaximized(); | 96 | //showMaximized(); |
97 | QVBoxLayout *lay = new QVBoxLayout(this ); | 97 | QVBoxLayout *lay = new QVBoxLayout(this ); |
98 | file = new OFileSelector(this , mode, selector, | 98 | file = new OFileSelector(this , mode, selector, |
99 | dirName, fileName, | 99 | dirName, fileName, |
100 | mimetypes ); | 100 | mimetypes ); |
101 | lay->addWidget( file ); | 101 | lay->addWidget( file ); |
102 | 102 | ||
103 | //lay->addWidget( file ); | 103 | //lay->addWidget( file ); |
104 | //showFullScreen(); | 104 | //showFullScreen(); |
105 | setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); | 105 | setCaption( caption.isEmpty() ? tr("FileDialog") : caption ); |
106 | connect(file, SIGNAL(fileSelected(const QString&) ), | 106 | connect(file, SIGNAL(fileSelected(const QString&) ), |
107 | this, SLOT(slotFileSelected(const QString&) ) ); | 107 | this, SLOT(slotFileSelected(const QString&) ) ); |
108 | connect(file, SIGNAL(ok() ), | 108 | connect(file, SIGNAL(ok() ), |
109 | this, SLOT(slotSelectorOk()) ) ; | 109 | this, SLOT(slotSelectorOk()) ) ; |
110 | 110 | ||
111 | connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) ); | 111 | connect(file, SIGNAL(dirSelected(const QString&) ), this, SLOT(slotDirSelected(const QString&) ) ); |
112 | 112 | ||
113 | #if 0 | 113 | #if 0 |
114 | connect(file, SIGNAL(dirSelected(const QString &) ), | 114 | connect(file, SIGNAL(dirSelected(const QString&) ), |
115 | this, SLOT(slotDirSelected(const QString &) ) ); | 115 | this, SLOT(slotDirSelected(const QString&) ) ); |
116 | #endif | 116 | #endif |
117 | } | 117 | } |
118 | /** | 118 | /** |
119 | * @returns the mimetype of the selected | 119 | * @returns the mimetype of the selected |
120 | * currently it return QString::null | 120 | * currently it return QString::null |
121 | */ | 121 | */ |
122 | QString OFileDialog::mimetype()const | 122 | QString OFileDialog::mimetype()const |
123 | { | 123 | { |
124 | return QString::null; | 124 | return QString::null; |
125 | } | 125 | } |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * @return the fileName | 128 | * @return the fileName |
129 | */ | 129 | */ |
130 | QString OFileDialog::fileName()const | 130 | QString OFileDialog::fileName()const |
131 | { | 131 | { |
132 | return file->selectedName(); | 132 | return file->selectedName(); |
133 | } | 133 | } |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * return a DocLnk to the current file | 136 | * return a DocLnk to the current file |
137 | */ | 137 | */ |
138 | DocLnk OFileDialog::selectedDocument()const | 138 | DocLnk OFileDialog::selectedDocument()const |
139 | { | 139 | { |
140 | return file->selectedDocument(); | 140 | return file->selectedDocument(); |
141 | } | 141 | } |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * This opens up a filedialog in Open mode | 144 | * This opens up a filedialog in Open mode |
145 | * | 145 | * |
146 | * @param selector the Selector Mode | 146 | * @param selector the Selector Mode |
147 | * @param startDir Where to start from | 147 | * @param startDir Where to start from |
148 | * @param file A proposed filename | 148 | * @param file A proposed filename |
149 | * @param mimes A list of MimeTypes | 149 | * @param mimes A list of MimeTypes |
150 | * @param wid the parent | 150 | * @param wid the parent |
151 | * @param caption of the dialog if QString::null tr("Open") will be used | 151 | * @param caption of the dialog if QString::null tr("Open") will be used |
152 | * @return the fileName or QString::null | 152 | * @return the fileName or QString::null |
153 | */ | 153 | */ |
154 | QString OFileDialog::getOpenFileName(int selector, | 154 | QString OFileDialog::getOpenFileName(int selector, |
155 | const QString &_startDir, | 155 | const QString &_startDir, |
156 | const QString &file, | 156 | const QString &file, |
157 | const MimeTypes &mimes, | 157 | const MimeTypes &mimes, |
158 | QWidget *wid, | 158 | QWidget *wid, |
159 | const QString &caption ) | 159 | const QString &caption ) |
160 | { | 160 | { |
161 | QString ret; | 161 | QString ret; |
162 | QString startDir = _startDir; | 162 | QString startDir = _startDir; |
163 | if (startDir.isEmpty() ) | 163 | if (startDir.isEmpty() ) |
164 | startDir = lastUsedDir( "FileDialog-OPEN" ); | 164 | startDir = lastUsedDir( "FileDialog-OPEN" ); |
165 | 165 | ||
166 | 166 | ||
167 | OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, | 167 | OFileDialog dlg( caption.isEmpty() ? tr("Open") : caption, |
168 | wid, OFileSelector::Open, selector, startDir, file, mimes); | 168 | wid, OFileSelector::Open, selector, startDir, file, mimes); |
169 | dlg.showMaximized(); | 169 | dlg.showMaximized(); |
170 | if( dlg.exec() ) | 170 | if( dlg.exec() ) |
171 | { | 171 | { |
172 | ret = dlg.fileName(); | 172 | ret = dlg.fileName(); |
173 | saveLastDir( "FileDialog-OPEN", ret ); | 173 | saveLastDir( "FileDialog-OPEN", ret ); |
174 | } | 174 | } |
175 | 175 | ||
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * This opens up a file dialog in save mode | 180 | * This opens up a file dialog in save mode |
181 | * @see getOpenFileName | 181 | * @see getOpenFileName |
182 | */ | 182 | */ |
183 | QString OFileDialog::getSaveFileName(int selector, | 183 | QString OFileDialog::getSaveFileName(int selector, |
184 | const QString &_startDir, | 184 | const QString &_startDir, |
185 | const QString &file, | 185 | const QString &file, |
186 | const MimeTypes &mimes, | 186 | const MimeTypes &mimes, |
187 | QWidget *wid, | 187 | QWidget *wid, |
188 | const QString &caption ) | 188 | const QString &caption ) |
189 | { | 189 | { |
190 | QString ret; | 190 | QString ret; |
191 | QString startDir = _startDir; | 191 | QString startDir = _startDir; |
192 | if (startDir.isEmpty() ) | 192 | if (startDir.isEmpty() ) |
193 | startDir = lastUsedDir( "FileDialog-SAVE" ); | 193 | startDir = lastUsedDir( "FileDialog-SAVE" ); |
194 | 194 | ||
195 | OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, | 195 | OFileDialog dlg( caption.isEmpty() ? tr("Save") : caption, |
196 | wid, OFileSelector::Save, selector, startDir, file, mimes); | 196 | wid, OFileSelector::Save, selector, startDir, file, mimes); |
197 | dlg.showMaximized(); | 197 | dlg.showMaximized(); |
198 | if( dlg.exec() ) | 198 | if( dlg.exec() ) |
199 | { | 199 | { |
200 | ret = dlg.fileName(); | 200 | ret = dlg.fileName(); |
201 | saveLastDir( "FileDialog-SAVE", ret ); | 201 | saveLastDir( "FileDialog-SAVE", ret ); |
202 | } | 202 | } |
203 | 203 | ||
204 | return ret; | 204 | return ret; |
205 | } | 205 | } |
206 | 206 | ||
207 | void OFileDialog::slotFileSelected(const QString & ) | 207 | void OFileDialog::slotFileSelected(const QString & ) |
208 | { | 208 | { |
209 | accept(); | 209 | accept(); |
210 | } | 210 | } |
211 | 211 | ||
diff --git a/libopie2/opieui/fileselector/ofileselector.cpp b/libopie2/opieui/fileselector/ofileselector.cpp index 600daff..15cadd4 100644 --- a/libopie2/opieui/fileselector/ofileselector.cpp +++ b/libopie2/opieui/fileselector/ofileselector.cpp | |||
@@ -117,198 +117,198 @@ void OFileViewInterface::ok() | |||
117 | void OFileViewInterface::cancel() | 117 | void OFileViewInterface::cancel() |
118 | { | 118 | { |
119 | emit selector()->cancel(); | 119 | emit selector()->cancel(); |
120 | } | 120 | } |
121 | 121 | ||
122 | void OFileViewInterface::closeMe() | 122 | void OFileViewInterface::closeMe() |
123 | { | 123 | { |
124 | emit selector()->closeMe(); | 124 | emit selector()->closeMe(); |
125 | } | 125 | } |
126 | 126 | ||
127 | void OFileViewInterface::fileSelected( const QString& str) | 127 | void OFileViewInterface::fileSelected( const QString& str) |
128 | { | 128 | { |
129 | emit selector()->fileSelected( str); | 129 | emit selector()->fileSelected( str); |
130 | } | 130 | } |
131 | 131 | ||
132 | void OFileViewInterface::fileSelected( const DocLnk& lnk) | 132 | void OFileViewInterface::fileSelected( const DocLnk& lnk) |
133 | { | 133 | { |
134 | emit selector()->fileSelected( lnk ); | 134 | emit selector()->fileSelected( lnk ); |
135 | } | 135 | } |
136 | 136 | ||
137 | void OFileViewInterface::setCurrentFileName( const QString& str ) | 137 | void OFileViewInterface::setCurrentFileName( const QString& str ) |
138 | { | 138 | { |
139 | selector()->m_lneEdit->setText( str ); | 139 | selector()->m_lneEdit->setText( str ); |
140 | } | 140 | } |
141 | 141 | ||
142 | QString OFileViewInterface::currentFileName()const | 142 | QString OFileViewInterface::currentFileName()const |
143 | { | 143 | { |
144 | return selector()->m_lneEdit->text(); | 144 | return selector()->m_lneEdit->text(); |
145 | } | 145 | } |
146 | 146 | ||
147 | QString OFileViewInterface::startDirectory()const | 147 | QString OFileViewInterface::startDirectory()const |
148 | { | 148 | { |
149 | return selector()->m_startDir; | 149 | return selector()->m_startDir; |
150 | } | 150 | } |
151 | 151 | ||
152 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) | 152 | ODocumentFileView::ODocumentFileView( OFileSelector* selector ) |
153 | :OFileViewInterface( selector ) | 153 | :OFileViewInterface( selector ) |
154 | { | 154 | { |
155 | m_selector = 0; | 155 | m_selector = 0; |
156 | setName( QObject::tr("Documents") ); | 156 | setName( QObject::tr("Documents") ); |
157 | } | 157 | } |
158 | 158 | ||
159 | ODocumentFileView::~ODocumentFileView() | 159 | ODocumentFileView::~ODocumentFileView() |
160 | { | 160 | { |
161 | } | 161 | } |
162 | 162 | ||
163 | QString ODocumentFileView::selectedName()const | 163 | QString ODocumentFileView::selectedName()const |
164 | { | 164 | { |
165 | if (!m_selector) | 165 | if (!m_selector) |
166 | return QString::null; | 166 | return QString::null; |
167 | 167 | ||
168 | return m_selector->selectedDocument().file(); | 168 | return m_selector->selectedDocument().file(); |
169 | } | 169 | } |
170 | 170 | ||
171 | QString ODocumentFileView::selectedPath()const | 171 | QString ODocumentFileView::selectedPath()const |
172 | { | 172 | { |
173 | return QPEApplication::documentDir(); | 173 | return QPEApplication::documentDir(); |
174 | } | 174 | } |
175 | 175 | ||
176 | QString ODocumentFileView::directory()const | 176 | QString ODocumentFileView::directory()const |
177 | { | 177 | { |
178 | return selectedPath(); | 178 | return selectedPath(); |
179 | } | 179 | } |
180 | 180 | ||
181 | void ODocumentFileView::reread() | 181 | void ODocumentFileView::reread() |
182 | { | 182 | { |
183 | if (!m_selector) | 183 | if (!m_selector) |
184 | return; | 184 | return; |
185 | 185 | ||
186 | m_selector->setNewVisible( showNew() ); | 186 | m_selector->setNewVisible( showNew() ); |
187 | m_selector->setCloseVisible( showClose() ); | 187 | m_selector->setCloseVisible( showClose() ); |
188 | m_selector->filter = currentMimeType().join(";"); | 188 | m_selector->filter = currentMimeType().join(";"); |
189 | m_selector->reread(); | 189 | m_selector->reread(); |
190 | } | 190 | } |
191 | 191 | ||
192 | int ODocumentFileView::fileCount()const | 192 | int ODocumentFileView::fileCount()const |
193 | { | 193 | { |
194 | if (!m_selector) | 194 | if (!m_selector) |
195 | return -1; | 195 | return -1; |
196 | 196 | ||
197 | return m_selector->fileCount(); | 197 | return m_selector->fileCount(); |
198 | } | 198 | } |
199 | 199 | ||
200 | DocLnk ODocumentFileView::selectedDocument()const | 200 | DocLnk ODocumentFileView::selectedDocument()const |
201 | { | 201 | { |
202 | if (!m_selector) | 202 | if (!m_selector) |
203 | return DocLnk(); | 203 | return DocLnk(); |
204 | 204 | ||
205 | return m_selector->selectedDocument(); | 205 | return m_selector->selectedDocument(); |
206 | } | 206 | } |
207 | 207 | ||
208 | QWidget* ODocumentFileView::widget( QWidget* parent ) | 208 | QWidget* ODocumentFileView::widget( QWidget* parent ) |
209 | { | 209 | { |
210 | if (!m_selector ) | 210 | if (!m_selector ) |
211 | { | 211 | { |
212 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); | 212 | m_selector = new FileSelector(currentMimeType().join(";"), parent, "fileselector", showNew(), showClose() ); |
213 | QObject::connect(m_selector, SIGNAL(fileSelected( const DocLnk& ) ), | 213 | QObject::connect(m_selector, SIGNAL(fileSelected(const DocLnk&) ), |
214 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); | 214 | selector(), SLOT(slotDocLnkBridge(const DocLnk&) ) ); |
215 | QObject::connect(m_selector, SIGNAL(closeMe() ), | 215 | QObject::connect(m_selector, SIGNAL(closeMe() ), |
216 | selector(), SIGNAL(closeMe() ) ); | 216 | selector(), SIGNAL(closeMe() ) ); |
217 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk& ) ), | 217 | QObject::connect(m_selector, SIGNAL(newSelected(const DocLnk&) ), |
218 | selector(), SIGNAL(newSelected(const DocLnk& ) ) ); | 218 | selector(), SIGNAL(newSelected(const DocLnk&) ) ); |
219 | } | 219 | } |
220 | 220 | ||
221 | return m_selector; | 221 | return m_selector; |
222 | } | 222 | } |
223 | 223 | ||
224 | /* | 224 | /* |
225 | * This is the file system view used | 225 | * This is the file system view used |
226 | * we use a QListView + QListViewItems for it | 226 | * we use a QListView + QListViewItems for it |
227 | */ | 227 | */ |
228 | 228 | ||
229 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, | 229 | OFileSelectorItem::OFileSelectorItem( QListView* view, const QPixmap& pixmap, |
230 | const QString& path, const QString& date, | 230 | const QString& path, const QString& date, |
231 | const QString& size, const QString& dir, | 231 | const QString& size, const QString& dir, |
232 | bool isLocked, bool isDir ) | 232 | bool isLocked, bool isDir ) |
233 | : QListViewItem( view ) | 233 | : QListViewItem( view ) |
234 | { | 234 | { |
235 | setPixmap(0, pixmap ); | 235 | setPixmap(0, pixmap ); |
236 | setText(1, path ); | 236 | setText(1, path ); |
237 | setText(2, size ); | 237 | setText(2, size ); |
238 | setText(3, date ); | 238 | setText(3, date ); |
239 | m_isDir = isDir; | 239 | m_isDir = isDir; |
240 | m_dir = dir; | 240 | m_dir = dir; |
241 | m_locked = isLocked; | 241 | m_locked = isLocked; |
242 | } | 242 | } |
243 | 243 | ||
244 | OFileSelectorItem::~OFileSelectorItem() | 244 | OFileSelectorItem::~OFileSelectorItem() |
245 | { | 245 | { |
246 | } | 246 | } |
247 | 247 | ||
248 | bool OFileSelectorItem::isLocked()const | 248 | bool OFileSelectorItem::isLocked()const |
249 | { | 249 | { |
250 | return m_locked; | 250 | return m_locked; |
251 | } | 251 | } |
252 | 252 | ||
253 | QString OFileSelectorItem::directory()const | 253 | QString OFileSelectorItem::directory()const |
254 | { | 254 | { |
255 | return m_dir; | 255 | return m_dir; |
256 | } | 256 | } |
257 | 257 | ||
258 | bool OFileSelectorItem::isDir()const | 258 | bool OFileSelectorItem::isDir()const |
259 | { | 259 | { |
260 | return m_isDir; | 260 | return m_isDir; |
261 | } | 261 | } |
262 | 262 | ||
263 | QString OFileSelectorItem::path()const | 263 | QString OFileSelectorItem::path()const |
264 | { | 264 | { |
265 | return text( 1 ); | 265 | return text( 1 ); |
266 | } | 266 | } |
267 | 267 | ||
268 | QString OFileSelectorItem::key( int id, bool )const | 268 | QString OFileSelectorItem::key( int id, bool )const |
269 | { | 269 | { |
270 | QString ke; | 270 | QString ke; |
271 | if( id == 0 || id == 1 ) | 271 | if( id == 0 || id == 1 ) |
272 | { // name | 272 | { // name |
273 | if( m_isDir ) | 273 | if( m_isDir ) |
274 | { | 274 | { |
275 | ke.append("0" ); | 275 | ke.append("0" ); |
276 | ke.append( text(1) ); | 276 | ke.append( text(1) ); |
277 | } | 277 | } |
278 | else | 278 | else |
279 | { | 279 | { |
280 | ke.append("1" ); | 280 | ke.append("1" ); |
281 | ke.append( text(1) ); | 281 | ke.append( text(1) ); |
282 | } | 282 | } |
283 | return ke; | 283 | return ke; |
284 | } | 284 | } |
285 | else | 285 | else |
286 | return text( id ); | 286 | return text( id ); |
287 | 287 | ||
288 | } | 288 | } |
289 | 289 | ||
290 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) | 290 | OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& startDir, OFileSelector* sel) |
291 | :QWidget( parent ), m_sel( sel ) | 291 | :QWidget( parent ), m_sel( sel ) |
292 | { | 292 | { |
293 | m_all = false; | 293 | m_all = false; |
294 | QVBoxLayout* lay = new QVBoxLayout( this ); | 294 | QVBoxLayout* lay = new QVBoxLayout( this ); |
295 | m_currentDir = startDir; | 295 | m_currentDir = startDir; |
296 | 296 | ||
297 | /* | 297 | /* |
298 | * now we add a special bar | 298 | * now we add a special bar |
299 | * One Button For Up | 299 | * One Button For Up |
300 | * Home | 300 | * Home |
301 | * Doc | 301 | * Doc |
302 | * And a dropdown menu with FileSystems | 302 | * And a dropdown menu with FileSystems |
303 | * FUTURE: one to change dir with lineedit | 303 | * FUTURE: one to change dir with lineedit |
304 | * Bookmarks | 304 | * Bookmarks |
305 | * Create Dir | 305 | * Create Dir |
306 | */ | 306 | */ |
307 | QHBox* box = new QHBox(this ); | 307 | QHBox* box = new QHBox(this ); |
308 | box->setBackgroundMode( PaletteButton ); | 308 | box->setBackgroundMode( PaletteButton ); |
309 | box->setSpacing( 0 ); | 309 | box->setSpacing( 0 ); |
310 | 310 | ||
311 | QToolButton *btn = new QToolButton( box ); | 311 | QToolButton *btn = new QToolButton( box ); |
312 | btn->setIconSet( Resource::loadIconSet("up") ); | 312 | btn->setIconSet( Resource::loadIconSet("up") ); |
313 | connect(btn, SIGNAL(clicked() ), | 313 | connect(btn, SIGNAL(clicked() ), |
314 | this, SLOT( cdUP() ) ); | 314 | this, SLOT( cdUP() ) ); |
@@ -431,194 +431,194 @@ void OFileViewFileListView::reread( bool all ) | |||
431 | const QFileInfoList *list = dir.entryInfoList(); | 431 | const QFileInfoList *list = dir.entryInfoList(); |
432 | if (!list) | 432 | if (!list) |
433 | { | 433 | { |
434 | cdUP(); | 434 | cdUP(); |
435 | return; | 435 | return; |
436 | } | 436 | } |
437 | 437 | ||
438 | QFileInfoListIterator it( *list ); | 438 | QFileInfoListIterator it( *list ); |
439 | QFileInfo *fi; | 439 | QFileInfo *fi; |
440 | while( (fi=it.current() ) ) | 440 | while( (fi=it.current() ) ) |
441 | { | 441 | { |
442 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) | 442 | if( fi->fileName() == QString::fromLatin1("..") || fi->fileName() == QString::fromLatin1(".") ) |
443 | { | 443 | { |
444 | ++it; | 444 | ++it; |
445 | continue; | 445 | continue; |
446 | } | 446 | } |
447 | 447 | ||
448 | /* | 448 | /* |
449 | * It is a symlink we try to resolve it now but don't let us attack by DOS | 449 | * It is a symlink we try to resolve it now but don't let us attack by DOS |
450 | * | 450 | * |
451 | */ | 451 | */ |
452 | if( fi->isSymLink() ) | 452 | if( fi->isSymLink() ) |
453 | { | 453 | { |
454 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); | 454 | QString file = fi->dirPath( true ) + "/" + fi->readLink(); |
455 | for( int i = 0; i<=4; i++) | 455 | for( int i = 0; i<=4; i++) |
456 | { // 5 tries to prevent dos | 456 | { // 5 tries to prevent dos |
457 | QFileInfo info( file ); | 457 | QFileInfo info( file ); |
458 | if( !info.exists() ) | 458 | if( !info.exists() ) |
459 | { | 459 | { |
460 | addSymlink( fi, TRUE ); | 460 | addSymlink( fi, TRUE ); |
461 | break; | 461 | break; |
462 | } | 462 | } |
463 | else if( info.isDir() ) | 463 | else if( info.isDir() ) |
464 | { | 464 | { |
465 | addDir( fi, TRUE ); | 465 | addDir( fi, TRUE ); |
466 | break; | 466 | break; |
467 | } | 467 | } |
468 | else if( info.isFile() ) | 468 | else if( info.isFile() ) |
469 | { | 469 | { |
470 | addFile( fi, TRUE ); | 470 | addFile( fi, TRUE ); |
471 | break; | 471 | break; |
472 | } | 472 | } |
473 | else if( info.isSymLink() ) | 473 | else if( info.isSymLink() ) |
474 | { | 474 | { |
475 | file = info.dirPath(true ) + "/" + info.readLink() ; | 475 | file = info.dirPath(true ) + "/" + info.readLink() ; |
476 | break; | 476 | break; |
477 | } | 477 | } |
478 | else if( i == 4) | 478 | else if( i == 4) |
479 | { // couldn't resolve symlink add it as symlink | 479 | { // couldn't resolve symlink add it as symlink |
480 | addSymlink( fi ); | 480 | addSymlink( fi ); |
481 | } | 481 | } |
482 | } // off for loop for symlink resolving | 482 | } // off for loop for symlink resolving |
483 | } | 483 | } |
484 | else if( fi->isDir() ) | 484 | else if( fi->isDir() ) |
485 | addDir( fi ); | 485 | addDir( fi ); |
486 | else if( fi->isFile() ) | 486 | else if( fi->isFile() ) |
487 | addFile( fi ); | 487 | addFile( fi ); |
488 | 488 | ||
489 | ++it; | 489 | ++it; |
490 | } // of while loop | 490 | } // of while loop |
491 | m_view->sort(); | 491 | m_view->sort(); |
492 | 492 | ||
493 | } | 493 | } |
494 | int OFileViewFileListView::fileCount()const | 494 | int OFileViewFileListView::fileCount()const |
495 | { | 495 | { |
496 | return m_view->childCount(); | 496 | return m_view->childCount(); |
497 | } | 497 | } |
498 | 498 | ||
499 | QString OFileViewFileListView::currentDir()const | 499 | QString OFileViewFileListView::currentDir()const |
500 | { | 500 | { |
501 | return m_currentDir; | 501 | return m_currentDir; |
502 | } | 502 | } |
503 | 503 | ||
504 | OFileSelector* OFileViewFileListView::selector() | 504 | OFileSelector* OFileViewFileListView::selector() |
505 | { | 505 | { |
506 | return m_sel; | 506 | return m_sel; |
507 | } | 507 | } |
508 | 508 | ||
509 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) | 509 | bool OFileViewFileListView::eventFilter (QObject *o, QEvent *e) |
510 | { | 510 | { |
511 | if ( e->type() == QEvent::KeyPress ) | 511 | if ( e->type() == QEvent::KeyPress ) |
512 | { | 512 | { |
513 | QKeyEvent *k = (QKeyEvent *)e; | 513 | QKeyEvent *k = (QKeyEvent *)e; |
514 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) | 514 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) |
515 | { | 515 | { |
516 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); | 516 | slotClicked( Qt::LeftButton,m_view->currentItem(),QPoint(0,0),0); |
517 | return true; | 517 | return true; |
518 | } | 518 | } |
519 | } | 519 | } |
520 | return false; | 520 | return false; |
521 | } | 521 | } |
522 | 522 | ||
523 | void OFileViewFileListView::connectSlots() | 523 | void OFileViewFileListView::connectSlots() |
524 | { | 524 | { |
525 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), | 525 | connect(m_view, SIGNAL(clicked(QListViewItem*) ), |
526 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); | 526 | this, SLOT(slotCurrentChanged(QListViewItem*) ) ); |
527 | connect(m_view, SIGNAL(mouseButtonClicked(int, QListViewItem*, const QPoint&, int ) ), | 527 | connect(m_view, SIGNAL(mouseButtonClicked(int,QListViewItem*,const QPoint&,int) ), |
528 | this, SLOT(slotClicked(int, QListViewItem*, const QPoint&, int ) ) ); | 528 | this, SLOT(slotClicked(int,QListViewItem*,const QPoint&,int) ) ); |
529 | } | 529 | } |
530 | 530 | ||
531 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) | 531 | void OFileViewFileListView::slotCurrentChanged( QListViewItem* item) |
532 | { | 532 | { |
533 | if (!item) | 533 | if (!item) |
534 | return; | 534 | return; |
535 | #if 0 | 535 | #if 0 |
536 | 536 | ||
537 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 537 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
538 | 538 | ||
539 | if (!sel->isDir() ) | 539 | if (!sel->isDir() ) |
540 | { | 540 | { |
541 | selector()->m_lneEdit->setText( sel->text(1) ); | 541 | selector()->m_lneEdit->setText( sel->text(1) ); |
542 | // if in fileselector mode we will emit selected | 542 | // if in fileselector mode we will emit selected |
543 | if ( selector()->mode() == OFileSelector::FileSelector ) | 543 | if ( selector()->mode() == OFileSelector::FileSelector ) |
544 | { | 544 | { |
545 | qWarning("slot Current Changed"); | 545 | qWarning("slot Current Changed"); |
546 | QStringList str = QStringList::split("->", sel->text(1) ); | 546 | QStringList str = QStringList::split("->", sel->text(1) ); |
547 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 547 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
548 | emit selector()->fileSelected( path ); | 548 | emit selector()->fileSelected( path ); |
549 | DocLnk lnk( path ); | 549 | DocLnk lnk( path ); |
550 | emit selector()->fileSelected( lnk ); | 550 | emit selector()->fileSelected( lnk ); |
551 | } | 551 | } |
552 | } | 552 | } |
553 | #endif | 553 | #endif |
554 | } | 554 | } |
555 | 555 | ||
556 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) | 556 | void OFileViewFileListView::slotClicked(int button , QListViewItem* item, const QPoint&, int ) |
557 | { | 557 | { |
558 | if (!item || ( button != Qt::LeftButton) ) | 558 | if (!item || ( button != Qt::LeftButton) ) |
559 | return; | 559 | return; |
560 | 560 | ||
561 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); | 561 | OFileSelectorItem *sel = static_cast<OFileSelectorItem*>(item); |
562 | if (!sel->isLocked() ) | 562 | if (!sel->isLocked() ) |
563 | { | 563 | { |
564 | QStringList str = QStringList::split("->", sel->text(1) ); | 564 | QStringList str = QStringList::split("->", sel->text(1) ); |
565 | if (sel->isDir() ) | 565 | if (sel->isDir() ) |
566 | { | 566 | { |
567 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); | 567 | m_currentDir = sel->directory() + "/" + str[0].stripWhiteSpace(); |
568 | emit selector()->dirSelected( m_currentDir ); | 568 | emit selector()->dirSelected( m_currentDir ); |
569 | reread( m_all ); | 569 | reread( m_all ); |
570 | } | 570 | } |
571 | else | 571 | else |
572 | { // file | 572 | { // file |
573 | qWarning("slot Clicked"); | 573 | qWarning("slot Clicked"); |
574 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); | 574 | selector()->m_lneEdit->setText( str[0].stripWhiteSpace() ); |
575 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); | 575 | QString path = sel->directory() + "/" + str[0].stripWhiteSpace(); |
576 | emit selector()->fileSelected( path ); | 576 | emit selector()->fileSelected( path ); |
577 | DocLnk lnk( path ); | 577 | DocLnk lnk( path ); |
578 | emit selector()->fileSelected( lnk ); | 578 | emit selector()->fileSelected( lnk ); |
579 | } | 579 | } |
580 | } // not locked | 580 | } // not locked |
581 | } | 581 | } |
582 | 582 | ||
583 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) | 583 | void OFileViewFileListView::addFile( QFileInfo* info, bool symlink ) |
584 | { | 584 | { |
585 | MimeType type( info->absFilePath() ); | 585 | MimeType type( info->absFilePath() ); |
586 | if (!compliesMime( type.id() ) ) | 586 | if (!compliesMime( type.id() ) ) |
587 | return; | 587 | return; |
588 | 588 | ||
589 | QPixmap pix = type.pixmap(); | 589 | QPixmap pix = type.pixmap(); |
590 | QString dir, name; bool locked; | 590 | QString dir, name; bool locked; |
591 | if ( pix.isNull() ) | 591 | if ( pix.isNull() ) |
592 | { | 592 | { |
593 | QWMatrix matrix; | 593 | QWMatrix matrix; |
594 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); | 594 | QPixmap pixer(Resource::loadPixmap("UnknownDocument") ); |
595 | matrix.scale( .4, .4 ); | 595 | matrix.scale( .4, .4 ); |
596 | pix = pixer.xForm( matrix ); | 596 | pix = pixer.xForm( matrix ); |
597 | } | 597 | } |
598 | dir = info->dirPath( true ); | 598 | dir = info->dirPath( true ); |
599 | locked = false; | 599 | locked = false; |
600 | if ( symlink ) | 600 | if ( symlink ) |
601 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); | 601 | name = info->fileName() + " -> " + info->dirPath() + "/" + info->readLink(); |
602 | else | 602 | else |
603 | { | 603 | { |
604 | name = info->fileName(); | 604 | name = info->fileName(); |
605 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || | 605 | if ( ( (selector()->mode() == OFileSelector::Open)&& !info->isReadable() ) || |
606 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) | 606 | ( (selector()->mode() == OFileSelector::Save)&& !info->isWritable() ) ) |
607 | { | 607 | { |
608 | locked = true; pix = Resource::loadPixmap("locked"); | 608 | locked = true; pix = Resource::loadPixmap("locked"); |
609 | } | 609 | } |
610 | } | 610 | } |
611 | (void)new OFileSelectorItem( m_view, pix, name, | 611 | (void)new OFileSelectorItem( m_view, pix, name, |
612 | info->lastModified().toString(), QString::number( info->size() ), | 612 | info->lastModified().toString(), QString::number( info->size() ), |
613 | dir, locked ); | 613 | dir, locked ); |
614 | } | 614 | } |
615 | 615 | ||
616 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) | 616 | void OFileViewFileListView::addDir( QFileInfo* info, bool symlink ) |
617 | { | 617 | { |
618 | bool locked = false; QString name; QPixmap pix; | 618 | bool locked = false; QString name; QPixmap pix; |
619 | 619 | ||
620 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || | 620 | if ( ( ( selector()->mode() == OFileSelector::Open ) && !info->isReadable() ) || |
621 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) | 621 | ( ( selector()->mode() == OFileSelector::Save ) && !info->isWritable() ) ) |
622 | { | 622 | { |
623 | locked = true; | 623 | locked = true; |
624 | if ( symlink ) | 624 | if ( symlink ) |
@@ -886,194 +886,194 @@ OFileSelector::OFileSelector( QWidget* parent, int mode, int sel, | |||
886 | * This a convience c'tor to just substitute the use of FileSelector | 886 | * This a convience c'tor to just substitute the use of FileSelector |
887 | */ | 887 | */ |
888 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, | 888 | OFileSelector::OFileSelector( const QString& mimeFilter, QWidget* parent, const char* name, |
889 | bool showNew, bool showClose ) | 889 | bool showNew, bool showClose ) |
890 | : QWidget( parent, name ) | 890 | : QWidget( parent, name ) |
891 | { | 891 | { |
892 | m_current = 0; | 892 | m_current = 0; |
893 | m_shNew = showNew; | 893 | m_shNew = showNew; |
894 | m_shClose = showClose; | 894 | m_shClose = showClose; |
895 | m_startDir = QPEApplication::documentDir(); | 895 | m_startDir = QPEApplication::documentDir(); |
896 | 896 | ||
897 | if (!mimeFilter.isEmpty() ) | 897 | if (!mimeFilter.isEmpty() ) |
898 | m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); | 898 | m_mimeType.insert(mimeFilter, QStringList::split(";", mimeFilter ) ); |
899 | 899 | ||
900 | m_mode = OFileSelector::FileSelector; | 900 | m_mode = OFileSelector::FileSelector; |
901 | m_selector = OFileSelector::Normal; | 901 | m_selector = OFileSelector::Normal; |
902 | 902 | ||
903 | initUI(); | 903 | initUI(); |
904 | initMime(); | 904 | initMime(); |
905 | initViews(); | 905 | initViews(); |
906 | m_cmbView->setCurrentItem( 0 ); | 906 | m_cmbView->setCurrentItem( 0 ); |
907 | slotViewChange( QObject::tr("Documents") ); | 907 | slotViewChange( QObject::tr("Documents") ); |
908 | } | 908 | } |
909 | 909 | ||
910 | /* | 910 | /* |
911 | * INIT UI will set up the basic GUI | 911 | * INIT UI will set up the basic GUI |
912 | * Layout: Simple VBoxLayout | 912 | * Layout: Simple VBoxLayout |
913 | * On top a WidgetStack containing the Views... | 913 | * On top a WidgetStack containing the Views... |
914 | * - List View | 914 | * - List View |
915 | * - Document View | 915 | * - Document View |
916 | * Below we will have a Label + LineEdit | 916 | * Below we will have a Label + LineEdit |
917 | * Below we will have two ComoBoxes one for choosing the view one for | 917 | * Below we will have two ComoBoxes one for choosing the view one for |
918 | * choosing the mimetype | 918 | * choosing the mimetype |
919 | */ | 919 | */ |
920 | void OFileSelector::initUI() | 920 | void OFileSelector::initUI() |
921 | { | 921 | { |
922 | QVBoxLayout* lay = new QVBoxLayout( this ); | 922 | QVBoxLayout* lay = new QVBoxLayout( this ); |
923 | 923 | ||
924 | m_stack = new QWidgetStack( this ); | 924 | m_stack = new QWidgetStack( this ); |
925 | lay->addWidget( m_stack, 1000 ); | 925 | lay->addWidget( m_stack, 1000 ); |
926 | 926 | ||
927 | m_nameBox = new QHBox( this ); | 927 | m_nameBox = new QHBox( this ); |
928 | (void)new QLabel( tr("Name:"), m_nameBox ); | 928 | (void)new QLabel( tr("Name:"), m_nameBox ); |
929 | m_lneEdit = new QLineEdit( m_nameBox ); | 929 | m_lneEdit = new QLineEdit( m_nameBox ); |
930 | m_lneEdit ->installEventFilter(this); | 930 | m_lneEdit ->installEventFilter(this); |
931 | lay->addWidget( m_nameBox ); | 931 | lay->addWidget( m_nameBox ); |
932 | 932 | ||
933 | m_cmbBox = new QHBox( this ); | 933 | m_cmbBox = new QHBox( this ); |
934 | m_cmbView = new QComboBox( m_cmbBox ); | 934 | m_cmbView = new QComboBox( m_cmbBox ); |
935 | m_cmbMime = new QComboBox( m_cmbBox ); | 935 | m_cmbMime = new QComboBox( m_cmbBox ); |
936 | lay->addWidget( m_cmbBox ); | 936 | lay->addWidget( m_cmbBox ); |
937 | } | 937 | } |
938 | 938 | ||
939 | /* | 939 | /* |
940 | * This will make sure that the return key in the name edit causes dialogs to close | 940 | * This will make sure that the return key in the name edit causes dialogs to close |
941 | */ | 941 | */ |
942 | 942 | ||
943 | bool OFileSelector::eventFilter (QObject *o, QEvent *e) | 943 | bool OFileSelector::eventFilter (QObject *o, QEvent *e) |
944 | { | 944 | { |
945 | if ( e->type() == QEvent::KeyPress ) | 945 | if ( e->type() == QEvent::KeyPress ) |
946 | { | 946 | { |
947 | QKeyEvent *k = (QKeyEvent *)e; | 947 | QKeyEvent *k = (QKeyEvent *)e; |
948 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) | 948 | if ( (k->key()==Key_Enter) || (k->key()==Key_Return)) |
949 | { | 949 | { |
950 | emit ok(); | 950 | emit ok(); |
951 | return true; | 951 | return true; |
952 | } | 952 | } |
953 | } | 953 | } |
954 | return false; | 954 | return false; |
955 | } | 955 | } |
956 | 956 | ||
957 | /* | 957 | /* |
958 | * This will insert the MimeTypes into the Combo Box | 958 | * This will insert the MimeTypes into the Combo Box |
959 | * And also connect the changed signal | 959 | * And also connect the changed signal |
960 | * | 960 | * |
961 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes | 961 | * AutoMimeTyping is disabled for now. It used to reparse a dir and then set available mimetypes |
962 | */ | 962 | */ |
963 | void OFileSelector::initMime() | 963 | void OFileSelector::initMime() |
964 | { | 964 | { |
965 | MimeTypes::Iterator it; | 965 | MimeTypes::Iterator it; |
966 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) | 966 | for ( it = m_mimeType.begin(); it != m_mimeType.end(); ++it ) |
967 | { | 967 | { |
968 | m_cmbMime->insertItem( it.key() ); | 968 | m_cmbMime->insertItem( it.key() ); |
969 | } | 969 | } |
970 | m_cmbMime->setCurrentItem( 0 ); | 970 | m_cmbMime->setCurrentItem( 0 ); |
971 | 971 | ||
972 | connect( m_cmbMime, SIGNAL(activated(int) ), | 972 | connect( m_cmbMime, SIGNAL(activated(int) ), |
973 | this, SLOT(slotMimeTypeChanged() ) ); | 973 | this, SLOT(slotMimeTypeChanged() ) ); |
974 | 974 | ||
975 | } | 975 | } |
976 | 976 | ||
977 | void OFileSelector::initViews() | 977 | void OFileSelector::initViews() |
978 | { | 978 | { |
979 | m_cmbView->insertItem( QObject::tr("Documents") ); | 979 | m_cmbView->insertItem( QObject::tr("Documents") ); |
980 | m_cmbView->insertItem( QObject::tr("Files") ); | 980 | m_cmbView->insertItem( QObject::tr("Files") ); |
981 | m_cmbView->insertItem( QObject::tr("All Files") ); | 981 | m_cmbView->insertItem( QObject::tr("All Files") ); |
982 | connect(m_cmbView, SIGNAL(activated( const QString& ) ), | 982 | connect(m_cmbView, SIGNAL(activated(const QString&) ), |
983 | this, SLOT(slotViewChange( const QString& ) ) ); | 983 | this, SLOT(slotViewChange(const QString&) ) ); |
984 | 984 | ||
985 | 985 | ||
986 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); | 986 | m_views.insert( QObject::tr("Documents"), new ODocumentFileView(this) ); |
987 | 987 | ||
988 | /* see above why add both */ | 988 | /* see above why add both */ |
989 | OFileViewInterface* in = new OFileViewFileSystem( this ); | 989 | OFileViewInterface* in = new OFileViewFileSystem( this ); |
990 | m_views.insert( QObject::tr("Files"), in ); | 990 | m_views.insert( QObject::tr("Files"), in ); |
991 | m_views.insert( QObject::tr("All Files"), in ); | 991 | m_views.insert( QObject::tr("All Files"), in ); |
992 | } | 992 | } |
993 | 993 | ||
994 | /** | 994 | /** |
995 | * d'tor | 995 | * d'tor |
996 | */ | 996 | */ |
997 | OFileSelector::~OFileSelector() | 997 | OFileSelector::~OFileSelector() |
998 | { | 998 | { |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | 1001 | ||
1002 | 1002 | ||
1003 | /** | 1003 | /** |
1004 | * Convience function for the fileselector | 1004 | * Convience function for the fileselector |
1005 | * make sure to delete the DocLnk | 1005 | * make sure to delete the DocLnk |
1006 | * | 1006 | * |
1007 | * @see DocLnk | 1007 | * @see DocLnk |
1008 | * @todo remove in ODP | 1008 | * @todo remove in ODP |
1009 | */ | 1009 | */ |
1010 | const DocLnk* OFileSelector::selected() | 1010 | const DocLnk* OFileSelector::selected() |
1011 | { | 1011 | { |
1012 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); | 1012 | DocLnk* lnk = new DocLnk( currentView()->selectedDocument() ); |
1013 | return lnk; | 1013 | return lnk; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | /** | 1016 | /** |
1017 | * | 1017 | * |
1018 | * @return the name of the selected file | 1018 | * @return the name of the selected file |
1019 | */ | 1019 | */ |
1020 | QString OFileSelector::selectedName()const | 1020 | QString OFileSelector::selectedName()const |
1021 | { | 1021 | { |
1022 | return currentView()->selectedName(); | 1022 | return currentView()->selectedName(); |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | 1025 | ||
1026 | /** | 1026 | /** |
1027 | * @return the selected path | 1027 | * @return the selected path |
1028 | */ | 1028 | */ |
1029 | QString OFileSelector::selectedPath()const | 1029 | QString OFileSelector::selectedPath()const |
1030 | { | 1030 | { |
1031 | return currentView()->selectedPath(); | 1031 | return currentView()->selectedPath(); |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | /** | 1034 | /** |
1035 | * @return the directory name | 1035 | * @return the directory name |
1036 | */ | 1036 | */ |
1037 | QString OFileSelector::directory()const | 1037 | QString OFileSelector::directory()const |
1038 | { | 1038 | { |
1039 | return currentView()->directory(); | 1039 | return currentView()->directory(); |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | /** | 1042 | /** |
1043 | * @return a DocLnk for the selected document | 1043 | * @return a DocLnk for the selected document |
1044 | */ | 1044 | */ |
1045 | DocLnk OFileSelector::selectedDocument()const | 1045 | DocLnk OFileSelector::selectedDocument()const |
1046 | { | 1046 | { |
1047 | return currentView()->selectedDocument(); | 1047 | return currentView()->selectedDocument(); |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | /** | 1050 | /** |
1051 | * @return the number of items for the current view | 1051 | * @return the number of items for the current view |
1052 | */ | 1052 | */ |
1053 | int OFileSelector::fileCount()const | 1053 | int OFileSelector::fileCount()const |
1054 | { | 1054 | { |
1055 | return currentView()->fileCount(); | 1055 | return currentView()->fileCount(); |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | /** | 1058 | /** |
1059 | * @return reparse the file content | 1059 | * @return reparse the file content |
1060 | */ | 1060 | */ |
1061 | void OFileSelector::reread() | 1061 | void OFileSelector::reread() |
1062 | { | 1062 | { |
1063 | return currentView()->reread(); | 1063 | return currentView()->reread(); |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | OFileViewInterface* OFileSelector::currentView()const | 1066 | OFileViewInterface* OFileSelector::currentView()const |
1067 | { | 1067 | { |
1068 | return m_current; | 1068 | return m_current; |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | bool OFileSelector::showNew()const | 1071 | bool OFileSelector::showNew()const |
1072 | { | 1072 | { |
1073 | return m_shNew; | 1073 | return m_shNew; |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | bool OFileSelector::showClose()const | 1076 | bool OFileSelector::showClose()const |
1077 | { | 1077 | { |
1078 | return m_shClose; | 1078 | return m_shClose; |
1079 | } | 1079 | } |
diff --git a/libopie2/opieui/ofontselector.cpp b/libopie2/opieui/ofontselector.cpp index 49ddeb6..f93781f 100644 --- a/libopie2/opieui/ofontselector.cpp +++ b/libopie2/opieui/ofontselector.cpp | |||
@@ -39,207 +39,207 @@ | |||
39 | #include <qmultilineedit.h> | 39 | #include <qmultilineedit.h> |
40 | 40 | ||
41 | using namespace Opie; | 41 | using namespace Opie; |
42 | 42 | ||
43 | namespace Opie | 43 | namespace Opie |
44 | { | 44 | { |
45 | 45 | ||
46 | class OFontSelectorPrivate | 46 | class OFontSelectorPrivate |
47 | { | 47 | { |
48 | public: | 48 | public: |
49 | QListBox * m_font_family_list; | 49 | QListBox * m_font_family_list; |
50 | QComboBox * m_font_style_list; | 50 | QComboBox * m_font_style_list; |
51 | QComboBox * m_font_size_list; | 51 | QComboBox * m_font_size_list; |
52 | QMultiLineEdit *m_preview; | 52 | QMultiLineEdit *m_preview; |
53 | 53 | ||
54 | bool m_pointbug : 1; | 54 | bool m_pointbug : 1; |
55 | 55 | ||
56 | FontDatabase m_fdb; | 56 | FontDatabase m_fdb; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | }; | 59 | }; |
60 | 60 | ||
61 | namespace | 61 | namespace |
62 | { | 62 | { |
63 | 63 | ||
64 | class FontListItem : public QListBoxText | 64 | class FontListItem : public QListBoxText |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() | 67 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText() |
68 | { | 68 | { |
69 | m_name = t; | 69 | m_name = t; |
70 | m_styles = styles; | 70 | m_styles = styles; |
71 | m_sizes = sizes; | 71 | m_sizes = sizes; |
72 | 72 | ||
73 | QString str = t; | 73 | QString str = t; |
74 | str [0] = str [0]. upper(); | 74 | str [0] = str [0]. upper(); |
75 | setText ( str ); | 75 | setText ( str ); |
76 | } | 76 | } |
77 | 77 | ||
78 | QString family() const | 78 | QString family() const |
79 | { | 79 | { |
80 | return m_name; | 80 | return m_name; |
81 | } | 81 | } |
82 | 82 | ||
83 | const QStringList &styles() const | 83 | const QStringList &styles() const |
84 | { | 84 | { |
85 | return m_styles; | 85 | return m_styles; |
86 | } | 86 | } |
87 | 87 | ||
88 | const QValueList<int> &sizes() const | 88 | const QValueList<int> &sizes() const |
89 | { | 89 | { |
90 | return m_sizes; | 90 | return m_sizes; |
91 | } | 91 | } |
92 | 92 | ||
93 | private: | 93 | private: |
94 | QStringList m_styles; | 94 | QStringList m_styles; |
95 | QValueList<int> m_sizes; | 95 | QValueList<int> m_sizes; |
96 | QString m_name; | 96 | QString m_name; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | 99 | ||
100 | static int findItemCB( QComboBox *box, const QString &str ) | 100 | static int findItemCB( QComboBox *box, const QString &str ) |
101 | { | 101 | { |
102 | for ( int i = 0; i < box->count(); i++ ) | 102 | for ( int i = 0; i < box->count(); i++ ) |
103 | { | 103 | { |
104 | if ( box->text ( i ) == str ) | 104 | if ( box->text ( i ) == str ) |
105 | return i; | 105 | return i; |
106 | } | 106 | } |
107 | return -1; | 107 | return -1; |
108 | } | 108 | } |
109 | 109 | ||
110 | } | 110 | } |
111 | /* static same as anon. namespace */ | 111 | /* static same as anon. namespace */ |
112 | static int qt_version() | 112 | static int qt_version() |
113 | { | 113 | { |
114 | const char *qver = qVersion(); | 114 | const char *qver = qVersion(); |
115 | 115 | ||
116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 116 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
117 | } | 117 | } |
118 | 118 | ||
119 | /** | 119 | /** |
120 | * Constructs the Selector object | 120 | * Constructs the Selector object |
121 | * @param withpreview If a font preview should be given | 121 | * @param withpreview If a font preview should be given |
122 | * @param parent The parent of the Font Selector | 122 | * @param parent The parent of the Font Selector |
123 | * @param name The name of the object | 123 | * @param name The name of the object |
124 | * @param fl WidgetFlags | 124 | * @param fl WidgetFlags |
125 | */ | 125 | */ |
126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 126 | OFontSelector::OFontSelector( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
127 | { | 127 | { |
128 | d = new OFontSelectorPrivate(); | 128 | d = new OFontSelectorPrivate(); |
129 | 129 | ||
130 | QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); | 130 | QGridLayout *gridLayout = new QGridLayout( this, 0, 0, 4, 4 ); |
131 | gridLayout->setRowStretch( 4, 10 ); | 131 | gridLayout->setRowStretch( 4, 10 ); |
132 | 132 | ||
133 | d->m_font_family_list = new QListBox( this, "FontListBox" ); | 133 | d->m_font_family_list = new QListBox( this, "FontListBox" ); |
134 | gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); | 134 | gridLayout->addMultiCellWidget( d->m_font_family_list, 0, 4, 0, 0 ); |
135 | connect( d->m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); | 135 | connect( d->m_font_family_list, SIGNAL( highlighted(int) ), this, SLOT( fontFamilyClicked(int) ) ); |
136 | 136 | ||
137 | QLabel *label = new QLabel( tr( "Style" ), this ); | 137 | QLabel *label = new QLabel( tr( "Style" ), this ); |
138 | gridLayout->addWidget( label, 0, 1 ); | 138 | gridLayout->addWidget( label, 0, 1 ); |
139 | 139 | ||
140 | d->m_font_style_list = new QComboBox( this, "StyleListBox" ); | 140 | d->m_font_style_list = new QComboBox( this, "StyleListBox" ); |
141 | connect( d->m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); | 141 | connect( d->m_font_style_list, SIGNAL( activated(int) ), this, SLOT( fontStyleClicked(int) ) ); |
142 | gridLayout->addWidget( d->m_font_style_list, 1, 1 ); | 142 | gridLayout->addWidget( d->m_font_style_list, 1, 1 ); |
143 | 143 | ||
144 | label = new QLabel( tr( "Size" ), this ); | 144 | label = new QLabel( tr( "Size" ), this ); |
145 | gridLayout->addWidget( label, 2, 1 ); | 145 | gridLayout->addWidget( label, 2, 1 ); |
146 | 146 | ||
147 | d->m_font_size_list = new QComboBox( this, "SizeListBox" ); | 147 | d->m_font_size_list = new QComboBox( this, "SizeListBox" ); |
148 | connect( d->m_font_size_list, SIGNAL( activated( int ) ), | 148 | connect( d->m_font_size_list, SIGNAL( activated(int) ), |
149 | this, SLOT( fontSizeClicked( int ) ) ); | 149 | this, SLOT( fontSizeClicked(int) ) ); |
150 | gridLayout->addWidget( d->m_font_size_list, 3, 1 ); | 150 | gridLayout->addWidget( d->m_font_size_list, 3, 1 ); |
151 | 151 | ||
152 | d->m_pointbug = ( qt_version() <= 233 ); | 152 | d->m_pointbug = ( qt_version() <= 233 ); |
153 | 153 | ||
154 | if ( withpreview ) | 154 | if ( withpreview ) |
155 | { | 155 | { |
156 | d->m_preview = new QMultiLineEdit ( this, "Preview" ); | 156 | d->m_preview = new QMultiLineEdit ( this, "Preview" ); |
157 | d->m_preview->setAlignment ( AlignCenter ); | 157 | d->m_preview->setAlignment ( AlignCenter ); |
158 | d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); | 158 | d->m_preview->setWordWrap ( QMultiLineEdit::WidgetWidth ); |
159 | d->m_preview->setMargin ( 3 ); | 159 | d->m_preview->setMargin ( 3 ); |
160 | d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); | 160 | d->m_preview->setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); |
161 | gridLayout->addRowSpacing ( 5, 4 ); | 161 | gridLayout->addRowSpacing ( 5, 4 ); |
162 | gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); | 162 | gridLayout->addMultiCellWidget ( d->m_preview, 6, 6, 0, 1 ); |
163 | gridLayout->setRowStretch ( 6, 5 ); | 163 | gridLayout->setRowStretch ( 6, 5 ); |
164 | } | 164 | } |
165 | else | 165 | else |
166 | d->m_preview = 0; | 166 | d->m_preview = 0; |
167 | 167 | ||
168 | loadFonts ( d->m_font_family_list ); | 168 | loadFonts ( d->m_font_family_list ); |
169 | } | 169 | } |
170 | 170 | ||
171 | OFontSelector::~OFontSelector() | 171 | OFontSelector::~OFontSelector() |
172 | { | 172 | { |
173 | delete d; | 173 | delete d; |
174 | } | 174 | } |
175 | 175 | ||
176 | /** | 176 | /** |
177 | * This methods tries to set the font | 177 | * This methods tries to set the font |
178 | * @param f The wishes font | 178 | * @param f The wishes font |
179 | * @return success or failure | 179 | * @return success or failure |
180 | */ | 180 | */ |
181 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 181 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
182 | { | 182 | { |
183 | return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); | 183 | return setSelectedFont ( f. family(), d->m_fdb. styleString ( f ), f. pointSize(), QFont::encodingName ( f. charSet())); |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | /** | 187 | /** |
188 | * This is an overloaded method @see setSelectedFont | 188 | * This is an overloaded method @see setSelectedFont |
189 | * @param familyStr The family of the font | 189 | * @param familyStr The family of the font |
190 | * @param styleStr The style of the font | 190 | * @param styleStr The style of the font |
191 | * @param sizeVal The size of font | 191 | * @param sizeVal The size of font |
192 | * @param charset The charset to be used. Will be deprecated by QT3 | 192 | * @param charset The charset to be used. Will be deprecated by QT3 |
193 | */ | 193 | */ |
194 | bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | 194 | bool OFontSelector::setSelectedFont( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) |
195 | { | 195 | { |
196 | QString sizeStr = QString::number ( sizeVal ); | 196 | QString sizeStr = QString::number ( sizeVal ); |
197 | 197 | ||
198 | QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); | 198 | QListBoxItem *family = d->m_font_family_list->findItem ( familyStr ); |
199 | if ( !family ) | 199 | if ( !family ) |
200 | family = d->m_font_family_list->findItem ( "Helvetica" ); | 200 | family = d->m_font_family_list->findItem ( "Helvetica" ); |
201 | if ( !family ) | 201 | if ( !family ) |
202 | family = d->m_font_family_list->firstItem(); | 202 | family = d->m_font_family_list->firstItem(); |
203 | d->m_font_family_list->setCurrentItem ( family ); | 203 | d->m_font_family_list->setCurrentItem ( family ); |
204 | fontFamilyClicked ( d->m_font_family_list->index ( family )); | 204 | fontFamilyClicked ( d->m_font_family_list->index ( family )); |
205 | 205 | ||
206 | int style = findItemCB ( d->m_font_style_list, styleStr ); | 206 | int style = findItemCB ( d->m_font_style_list, styleStr ); |
207 | if ( style < 0 ) | 207 | if ( style < 0 ) |
208 | style = findItemCB ( d->m_font_style_list, "Regular" ); | 208 | style = findItemCB ( d->m_font_style_list, "Regular" ); |
209 | if ( style < 0 && d->m_font_style_list->count() > 0 ) | 209 | if ( style < 0 && d->m_font_style_list->count() > 0 ) |
210 | style = 0; | 210 | style = 0; |
211 | d->m_font_style_list->setCurrentItem ( style ); | 211 | d->m_font_style_list->setCurrentItem ( style ); |
212 | fontStyleClicked ( style ); | 212 | fontStyleClicked ( style ); |
213 | 213 | ||
214 | int size = findItemCB ( d->m_font_size_list, sizeStr ); | 214 | int size = findItemCB ( d->m_font_size_list, sizeStr ); |
215 | if ( size < 0 ) | 215 | if ( size < 0 ) |
216 | size = findItemCB ( d->m_font_size_list, "10" ); | 216 | size = findItemCB ( d->m_font_size_list, "10" ); |
217 | if ( size < 0 && d->m_font_size_list->count() > 0 ) | 217 | if ( size < 0 && d->m_font_size_list->count() > 0 ) |
218 | size = 0; | 218 | size = 0; |
219 | d->m_font_size_list->setCurrentItem ( size ); | 219 | d->m_font_size_list->setCurrentItem ( size ); |
220 | fontSizeClicked ( size ); | 220 | fontSizeClicked ( size ); |
221 | 221 | ||
222 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); | 222 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | 225 | /** |
226 | * This method returns the name, style and size of the currently selected | 226 | * This method returns the name, style and size of the currently selected |
227 | * font or false if no font is selected | 227 | * font or false if no font is selected |
228 | * @param family The font family will be written there | 228 | * @param family The font family will be written there |
229 | * @param style The style will be written there | 229 | * @param style The style will be written there |
230 | * @param size The size will be written there | 230 | * @param size The size will be written there |
231 | * @return success or failure | 231 | * @return success or failure |
232 | */ | 232 | */ |
233 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) | 233 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) |
234 | { | 234 | { |
235 | QString dummy; | 235 | QString dummy; |
236 | return selectedFont ( family, style, size, dummy ); | 236 | return selectedFont ( family, style, size, dummy ); |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
240 | /** | 240 | /** |
241 | * This method does return the font family or QString::null if there is | 241 | * This method does return the font family or QString::null if there is |
242 | * no font item selected | 242 | * no font item selected |
243 | * @return the font family | 243 | * @return the font family |
244 | */ | 244 | */ |
245 | QString OFontSelector::fontFamily() const | 245 | QString OFontSelector::fontFamily() const |
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp index ec6af9d..f47c90b 100644 --- a/libopie2/opieui/otabwidget.cpp +++ b/libopie2/opieui/otabwidget.cpp | |||
@@ -1,177 +1,177 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> | 4 | Copyright (c) 2002 Dan Williams <williamsdr@acm.org> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <opie2/otabwidget.h> | 32 | #include <opie2/otabwidget.h> |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <qpe/applnk.h> | 35 | #include <qpe/applnk.h> |
36 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
37 | #include <qpe/resource.h> | 37 | #include <qpe/resource.h> |
38 | #include <opie2/otabbar.h> | 38 | #include <opie2/otabbar.h> |
39 | 39 | ||
40 | /* QT */ | 40 | /* QT */ |
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | #include <qwidgetstack.h> | 42 | #include <qwidgetstack.h> |
43 | 43 | ||
44 | using namespace Opie; | 44 | using namespace Opie; |
45 | 45 | ||
46 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) | 46 | OTabWidget::OTabWidget( QWidget *parent, const char *name, TabStyle s, TabPosition p ) |
47 | : QWidget( parent, name ) | 47 | : QWidget( parent, name ) |
48 | { | 48 | { |
49 | if ( s == Global ) | 49 | if ( s == Global ) |
50 | { | 50 | { |
51 | Config config( "qpe" ); | 51 | Config config( "qpe" ); |
52 | config.setGroup( "Appearance" ); | 52 | config.setGroup( "Appearance" ); |
53 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); | 53 | s = ( TabStyle ) config.readNumEntry( "TabStyle", (int) IconTab ); |
54 | if ( s <= Global || s > IconList) | 54 | if ( s <= Global || s > IconList) |
55 | { | 55 | { |
56 | s = IconTab; | 56 | s = IconTab; |
57 | } | 57 | } |
58 | QString pos = config.readEntry( "TabPosition", "Top"); | 58 | QString pos = config.readEntry( "TabPosition", "Top"); |
59 | if ( pos == "Bottom" ) | 59 | if ( pos == "Bottom" ) |
60 | { | 60 | { |
61 | p = Bottom; | 61 | p = Bottom; |
62 | } | 62 | } |
63 | else | 63 | else |
64 | { | 64 | { |
65 | p = Top; | 65 | p = Top; |
66 | } | 66 | } |
67 | } | 67 | } |
68 | 68 | ||
69 | widgetStack = new QWidgetStack( this, "widgetstack" ); | 69 | widgetStack = new QWidgetStack( this, "widgetstack" ); |
70 | widgetStack->setFrameStyle( QFrame::NoFrame ); | 70 | widgetStack->setFrameStyle( QFrame::NoFrame ); |
71 | widgetStack->setLineWidth( style().defaultFrameWidth() ); | 71 | widgetStack->setLineWidth( style().defaultFrameWidth() ); |
72 | 72 | ||
73 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); | 73 | tabBarStack = new QWidgetStack( this, "tabbarstack" ); |
74 | 74 | ||
75 | tabBar = new OTabBar( tabBarStack, "tabbar" ); | 75 | tabBar = new OTabBar( tabBarStack, "tabbar" ); |
76 | tabBarStack->addWidget( tabBar, 0 ); | 76 | tabBarStack->addWidget( tabBar, 0 ); |
77 | connect( tabBar, SIGNAL( selected( int ) ), this, SLOT( slotTabBarSelected( int ) ) ); | 77 | connect( tabBar, SIGNAL( selected(int) ), this, SLOT( slotTabBarSelected(int) ) ); |
78 | 78 | ||
79 | tabList = new QComboBox( false, tabBarStack, "tablist" ); | 79 | tabList = new QComboBox( false, tabBarStack, "tablist" ); |
80 | tabBarStack->addWidget( tabList, 1 ); | 80 | tabBarStack->addWidget( tabList, 1 ); |
81 | connect( tabList, SIGNAL( activated( int ) ), this, SLOT( slotTabListSelected( int ) ) ); | 81 | connect( tabList, SIGNAL( activated(int) ), this, SLOT( slotTabListSelected(int) ) ); |
82 | 82 | ||
83 | tabBarPosition = p; | 83 | tabBarPosition = p; |
84 | setTabStyle( s ); | 84 | setTabStyle( s ); |
85 | setTabPosition( p ); | 85 | setTabPosition( p ); |
86 | 86 | ||
87 | currTab= 0x0; | 87 | currTab= 0x0; |
88 | } | 88 | } |
89 | 89 | ||
90 | OTabWidget::~OTabWidget() | 90 | OTabWidget::~OTabWidget() |
91 | {} | 91 | {} |
92 | 92 | ||
93 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) | 93 | void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &label ) |
94 | { | 94 | { |
95 | QPixmap iconset = loadSmooth( icon ); | 95 | QPixmap iconset = loadSmooth( icon ); |
96 | 96 | ||
97 | QTab *tab = new QTab(); | 97 | QTab *tab = new QTab(); |
98 | if ( tabBarStyle == IconTab ) | 98 | if ( tabBarStyle == IconTab ) |
99 | { | 99 | { |
100 | tab->label = QString::null; | 100 | tab->label = QString::null; |
101 | } | 101 | } |
102 | else | 102 | else |
103 | { | 103 | { |
104 | tab->label = label; | 104 | tab->label = label; |
105 | } | 105 | } |
106 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 106 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
107 | { | 107 | { |
108 | tab->iconset = new QIconSet( iconset ); | 108 | tab->iconset = new QIconSet( iconset ); |
109 | } | 109 | } |
110 | int tabid = tabBar->addTab( tab ); | 110 | int tabid = tabBar->addTab( tab ); |
111 | 111 | ||
112 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) | 112 | if ( tabBarStyle == IconTab || tabBarStyle == IconList ) |
113 | { | 113 | { |
114 | tabList->insertItem( iconset, label, -1 ); | 114 | tabList->insertItem( iconset, label, -1 ); |
115 | } | 115 | } |
116 | else | 116 | else |
117 | { | 117 | { |
118 | tabList->insertItem( label ); | 118 | tabList->insertItem( label ); |
119 | } | 119 | } |
120 | 120 | ||
121 | widgetStack->addWidget( child, tabid ); | 121 | widgetStack->addWidget( child, tabid ); |
122 | widgetStack->raiseWidget( child ); | 122 | widgetStack->raiseWidget( child ); |
123 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); | 123 | widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); |
124 | 124 | ||
125 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); | 125 | OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); |
126 | tabs.append( tabinfo ); | 126 | tabs.append( tabinfo ); |
127 | selectTab( tabinfo ); | 127 | selectTab( tabinfo ); |
128 | } | 128 | } |
129 | 129 | ||
130 | void OTabWidget::removePage( QWidget *childwidget ) | 130 | void OTabWidget::removePage( QWidget *childwidget ) |
131 | { | 131 | { |
132 | if ( childwidget ) | 132 | if ( childwidget ) |
133 | { | 133 | { |
134 | OTabInfo *tab = tabs.first(); | 134 | OTabInfo *tab = tabs.first(); |
135 | while ( tab && tab->control() != childwidget ) | 135 | while ( tab && tab->control() != childwidget ) |
136 | { | 136 | { |
137 | tab = tabs.next(); | 137 | tab = tabs.next(); |
138 | } | 138 | } |
139 | if ( tab && tab->control() == childwidget ) | 139 | if ( tab && tab->control() == childwidget ) |
140 | { | 140 | { |
141 | tabBar->setTabEnabled( tab->id(), FALSE ); | 141 | tabBar->setTabEnabled( tab->id(), FALSE ); |
142 | tabBar->removeTab( tabBar->tab( tab->id() ) ); | 142 | tabBar->removeTab( tabBar->tab( tab->id() ) ); |
143 | int i = 0; | 143 | int i = 0; |
144 | while ( i < tabList->count() && tabList->text( i ) != tab->label() ) | 144 | while ( i < tabList->count() && tabList->text( i ) != tab->label() ) |
145 | { | 145 | { |
146 | i++; | 146 | i++; |
147 | } | 147 | } |
148 | if ( tabList->text( i ) == tab->label() ) | 148 | if ( tabList->text( i ) == tab->label() ) |
149 | { | 149 | { |
150 | tabList->removeItem( i ); | 150 | tabList->removeItem( i ); |
151 | } | 151 | } |
152 | widgetStack->removeWidget( childwidget ); | 152 | widgetStack->removeWidget( childwidget ); |
153 | tabs.remove( tab ); | 153 | tabs.remove( tab ); |
154 | delete tab; | 154 | delete tab; |
155 | currTab = tabs.current(); | 155 | currTab = tabs.current(); |
156 | if ( !currTab ) | 156 | if ( !currTab ) |
157 | { | 157 | { |
158 | widgetStack->setFrameStyle( QFrame::NoFrame ); | 158 | widgetStack->setFrameStyle( QFrame::NoFrame ); |
159 | } | 159 | } |
160 | 160 | ||
161 | setUpLayout(); | 161 | setUpLayout(); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label) | 166 | void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label) |
167 | { | 167 | { |
168 | OTabInfo *currtab = tabs.first(); | 168 | OTabInfo *currtab = tabs.first(); |
169 | while ( currtab && currtab->control() != widget ) | 169 | while ( currtab && currtab->control() != widget ) |
170 | { | 170 | { |
171 | currtab = tabs.next(); | 171 | currtab = tabs.next(); |
172 | } | 172 | } |
173 | if ( currtab && currtab->control() == widget ) | 173 | if ( currtab && currtab->control() == widget ) |
174 | { | 174 | { |
175 | QTab *tab = tabBar->tab( currtab->id() ); | 175 | QTab *tab = tabBar->tab( currtab->id() ); |
176 | QPixmap icon( loadSmooth( iconset ) ); | 176 | QPixmap icon( loadSmooth( iconset ) ); |
177 | tab->setText( label ); | 177 | tab->setText( label ); |
diff --git a/libopie2/opieui/otimepicker.cpp b/libopie2/opieui/otimepicker.cpp index d4712a4..66f9ce0 100644 --- a/libopie2/opieui/otimepicker.cpp +++ b/libopie2/opieui/otimepicker.cpp | |||
@@ -128,165 +128,165 @@ void OTimePicker::slotHour(bool b) | |||
128 | void OTimePicker::slotMinute(bool b) | 128 | void OTimePicker::slotMinute(bool b) |
129 | { | 129 | { |
130 | 130 | ||
131 | OClickableLabel *r = (OClickableLabel *) sender(); | 131 | OClickableLabel *r = (OClickableLabel *) sender(); |
132 | 132 | ||
133 | if (b) | 133 | if (b) |
134 | { | 134 | { |
135 | QValueListIterator<OClickableLabel *> it; | 135 | QValueListIterator<OClickableLabel *> it; |
136 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) | 136 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) |
137 | { | 137 | { |
138 | if (*it != r) (*it)->setOn(false); | 138 | if (*it != r) (*it)->setOn(false); |
139 | else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); | 139 | else tm.setHMS(tm.hour(),(*it)->text().toInt(), 0); |
140 | } | 140 | } |
141 | emit timeChanged(tm); | 141 | emit timeChanged(tm); |
142 | } | 142 | } |
143 | else | 143 | else |
144 | { | 144 | { |
145 | r->setOn(true); | 145 | r->setOn(true); |
146 | } | 146 | } |
147 | 147 | ||
148 | } | 148 | } |
149 | 149 | ||
150 | /** | 150 | /** |
151 | * Method to set the time. No signal gets emitted during this method call | 151 | * Method to set the time. No signal gets emitted during this method call |
152 | * Minutes must be within 5 minutes step starting at 0 ( 0,5,10,15,20... ) | 152 | * Minutes must be within 5 minutes step starting at 0 ( 0,5,10,15,20... ) |
153 | * @param t The time to be set | 153 | * @param t The time to be set |
154 | */ | 154 | */ |
155 | void OTimePicker::setTime( const QTime& t) | 155 | void OTimePicker::setTime( const QTime& t) |
156 | { | 156 | { |
157 | setTime( t.hour(), t.minute() ); | 157 | setTime( t.hour(), t.minute() ); |
158 | } | 158 | } |
159 | 159 | ||
160 | /** | 160 | /** |
161 | * Method to set the time. No signal gets emitted during this method call | 161 | * Method to set the time. No signal gets emitted during this method call |
162 | * @param h The hour | 162 | * @param h The hour |
163 | * @param m The minute. Minutes need to set by 5 minute steps | 163 | * @param m The minute. Minutes need to set by 5 minute steps |
164 | */ | 164 | */ |
165 | void OTimePicker::setTime( int h, int m ) | 165 | void OTimePicker::setTime( int h, int m ) |
166 | { | 166 | { |
167 | setHour(h); | 167 | setHour(h); |
168 | setMinute(m); | 168 | setMinute(m); |
169 | } | 169 | } |
170 | 170 | ||
171 | /* | 171 | /* |
172 | * FIXME round minutes to the 5 minute arrangement -zecke | 172 | * FIXME round minutes to the 5 minute arrangement -zecke |
173 | */ | 173 | */ |
174 | /** | 174 | /** |
175 | * Method to set the minutes | 175 | * Method to set the minutes |
176 | * @param m minutes | 176 | * @param m minutes |
177 | */ | 177 | */ |
178 | void OTimePicker::setMinute(int m) | 178 | void OTimePicker::setMinute(int m) |
179 | { | 179 | { |
180 | 180 | ||
181 | QString minute; | 181 | QString minute; |
182 | minute.sprintf("%.2d",m); | 182 | minute.sprintf("%.2d",m); |
183 | 183 | ||
184 | QValueListIterator<OClickableLabel *> it; | 184 | QValueListIterator<OClickableLabel *> it; |
185 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) | 185 | for (it=minuteLst.begin(); it!=minuteLst.end(); it++) |
186 | { | 186 | { |
187 | if ((*it)->text() == minute) (*it)->setOn(true); | 187 | if ((*it)->text() == minute) (*it)->setOn(true); |
188 | else (*it)->setOn(false); | 188 | else (*it)->setOn(false); |
189 | } | 189 | } |
190 | 190 | ||
191 | tm.setHMS(tm.hour(),m,0); | 191 | tm.setHMS(tm.hour(),m,0); |
192 | } | 192 | } |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Method to set the hour | 195 | * Method to set the hour |
196 | */ | 196 | */ |
197 | void OTimePicker::setHour(int h) | 197 | void OTimePicker::setHour(int h) |
198 | { | 198 | { |
199 | 199 | ||
200 | QString hour; | 200 | QString hour; |
201 | hour.sprintf("%.2d",h); | 201 | hour.sprintf("%.2d",h); |
202 | 202 | ||
203 | QValueListIterator<OClickableLabel *> it; | 203 | QValueListIterator<OClickableLabel *> it; |
204 | for (it=hourLst.begin(); it!=hourLst.end(); it++) | 204 | for (it=hourLst.begin(); it!=hourLst.end(); it++) |
205 | { | 205 | { |
206 | if ((*it)->text() == hour) (*it)->setOn(true); | 206 | if ((*it)->text() == hour) (*it)->setOn(true); |
207 | else (*it)->setOn(false); | 207 | else (*it)->setOn(false); |
208 | } | 208 | } |
209 | tm.setHMS(h,tm.minute(),0); | 209 | tm.setHMS(h,tm.minute(),0); |
210 | } | 210 | } |
211 | 211 | ||
212 | 212 | ||
213 | /** | 213 | /** |
214 | * This is a modal Dialog. | 214 | * This is a modal Dialog. |
215 | * | 215 | * |
216 | * @param parent The parent widget | 216 | * @param parent The parent widget |
217 | * @param name The name of the object | 217 | * @param name The name of the object |
218 | * @param fl Possible window flags | 218 | * @param fl Possible window flags |
219 | */ | 219 | */ |
220 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) | 220 | OTimePickerDialog::OTimePickerDialog ( QWidget* parent, const char* name, WFlags fl ) |
221 | : OTimePickerDialogBase (parent , name, true , fl) | 221 | : OTimePickerDialogBase (parent , name, true , fl) |
222 | { | 222 | { |
223 | 223 | ||
224 | connect ( m_timePicker, SIGNAL( timeChanged( const QTime& ) ), | 224 | connect ( m_timePicker, SIGNAL( timeChanged(const QTime&) ), |
225 | this, SLOT( setTime ( const QTime& ) ) ); | 225 | this, SLOT( setTime(const QTime&) ) ); |
226 | connect ( minuteField, SIGNAL( textChanged ( const QString& ) ), | 226 | connect ( minuteField, SIGNAL( textChanged(const QString&) ), |
227 | this, SLOT ( setMinute ( const QString& ) ) ); | 227 | this, SLOT ( setMinute(const QString&) ) ); |
228 | connect ( hourField, SIGNAL( textChanged ( const QString& ) ), | 228 | connect ( hourField, SIGNAL( textChanged(const QString&) ), |
229 | this, SLOT ( setHour ( const QString& ) ) ); | 229 | this, SLOT ( setHour(const QString&) ) ); |
230 | 230 | ||
231 | } | 231 | } |
232 | 232 | ||
233 | /** | 233 | /** |
234 | * @return the time | 234 | * @return the time |
235 | */ | 235 | */ |
236 | QTime OTimePickerDialog::time()const | 236 | QTime OTimePickerDialog::time()const |
237 | { | 237 | { |
238 | return m_time; | 238 | return m_time; |
239 | } | 239 | } |
240 | 240 | ||
241 | /** | 241 | /** |
242 | * Set the time to time | 242 | * Set the time to time |
243 | * @param time The time to be set | 243 | * @param time The time to be set |
244 | */ | 244 | */ |
245 | void OTimePickerDialog::setTime( const QTime& time ) | 245 | void OTimePickerDialog::setTime( const QTime& time ) |
246 | { | 246 | { |
247 | m_time = time; | 247 | m_time = time; |
248 | 248 | ||
249 | m_timePicker->setHour ( time.hour() ); | 249 | m_timePicker->setHour ( time.hour() ); |
250 | m_timePicker->setMinute( time.minute() ); | 250 | m_timePicker->setMinute( time.minute() ); |
251 | 251 | ||
252 | // Set Textfields | 252 | // Set Textfields |
253 | if ( time.hour() < 10 ) | 253 | if ( time.hour() < 10 ) |
254 | hourField->setText( "0" + QString::number( time.hour() ) ); | 254 | hourField->setText( "0" + QString::number( time.hour() ) ); |
255 | else | 255 | else |
256 | hourField->setText( QString::number( time.hour() ) ); | 256 | hourField->setText( QString::number( time.hour() ) ); |
257 | 257 | ||
258 | if ( time.minute() < 10 ) | 258 | if ( time.minute() < 10 ) |
259 | minuteField->setText( "0" + QString::number( time.minute() ) ); | 259 | minuteField->setText( "0" + QString::number( time.minute() ) ); |
260 | else | 260 | else |
261 | minuteField->setText( QString::number( time.minute() ) ); | 261 | minuteField->setText( QString::number( time.minute() ) ); |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * This method takes the current minute and tries to set hour | 266 | * This method takes the current minute and tries to set hour |
267 | * to hour. This succeeds if the resulting date is valid | 267 | * to hour. This succeeds if the resulting date is valid |
268 | * @param hour The hour as a string | 268 | * @param hour The hour as a string |
269 | */ | 269 | */ |
270 | void OTimePickerDialog::setHour ( const QString& hour ) | 270 | void OTimePickerDialog::setHour ( const QString& hour ) |
271 | { | 271 | { |
272 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ) | 272 | if ( QTime::isValid ( hour.toInt(), m_time.minute() , 00 ) ) |
273 | { | 273 | { |
274 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); | 274 | m_time.setHMS ( hour.toInt(), m_time.minute() , 00 ); |
275 | setTime ( m_time ); | 275 | setTime ( m_time ); |
276 | } | 276 | } |
277 | 277 | ||
278 | } | 278 | } |
279 | 279 | ||
280 | /** | 280 | /** |
281 | * Method to set a new minute. It tries to convert the string to int and | 281 | * Method to set a new minute. It tries to convert the string to int and |
282 | * if the resulting date is valid a new date is set. | 282 | * if the resulting date is valid a new date is set. |
283 | * @see setHour | 283 | * @see setHour |
284 | */ | 284 | */ |
285 | void OTimePickerDialog::setMinute ( const QString& minute ) | 285 | void OTimePickerDialog::setMinute ( const QString& minute ) |
286 | { | 286 | { |
287 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ) | 287 | if ( QTime::isValid ( m_time.hour(), minute.toInt(), 00 ) ) |
288 | { | 288 | { |
289 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); | 289 | m_time.setHMS ( m_time.hour(), minute.toInt(), 00 ); |
290 | setTime ( m_time ); | 290 | setTime ( m_time ); |
291 | } | 291 | } |
292 | } | 292 | } |
diff --git a/libopie2/opieui/oversatileview.cpp b/libopie2/opieui/oversatileview.cpp index 8839456..78154b7 100644 --- a/libopie2/opieui/oversatileview.cpp +++ b/libopie2/opieui/oversatileview.cpp | |||
@@ -77,238 +77,238 @@ static const char * view_icon_xpm[] = { | |||
77 | " "}; | 77 | " "}; |
78 | 78 | ||
79 | /* XPM */ | 79 | /* XPM */ |
80 | static const char * view_tree_xpm[] = { | 80 | static const char * view_tree_xpm[] = { |
81 | "16 16 17 1", | 81 | "16 16 17 1", |
82 | " c None", | 82 | " c None", |
83 | ".c #3A3A3A", | 83 | ".c #3A3A3A", |
84 | "+c #87BD88", | 84 | "+c #87BD88", |
85 | "@c #8BBE8B", | 85 | "@c #8BBE8B", |
86 | "#c #81BA81", | 86 | "#c #81BA81", |
87 | "$c #6DAF6D", | 87 | "$c #6DAF6D", |
88 | "%c #87BD87", | 88 | "%c #87BD87", |
89 | "&c #FCFDFC", | 89 | "&c #FCFDFC", |
90 | "*c #AED0AE", | 90 | "*c #AED0AE", |
91 | "=c #4E9C4C", | 91 | "=c #4E9C4C", |
92 | "-c #91BD91", | 92 | "-c #91BD91", |
93 | ";c #72B172", | 93 | ";c #72B172", |
94 | ">c #448643", | 94 | ">c #448643", |
95 | ",c #686868", | 95 | ",c #686868", |
96 | "'c #519F50", | 96 | "'c #519F50", |
97 | ")c #499247", | 97 | ")c #499247", |
98 | "!c #356A35", | 98 | "!c #356A35", |
99 | " . ", | 99 | " . ", |
100 | " . ", | 100 | " . ", |
101 | " . +@#$ ", | 101 | " . +@#$ ", |
102 | " . %&*= ", | 102 | " . %&*= ", |
103 | " .. #-;> ,, ,,,", | 103 | " .. #-;> ,, ,,,", |
104 | " . $')! ", | 104 | " . $')! ", |
105 | " . ", | 105 | " . ", |
106 | " . ", | 106 | " . ", |
107 | " . ", | 107 | " . ", |
108 | " . +@#$ ", | 108 | " . +@#$ ", |
109 | " . %&*= ", | 109 | " . %&*= ", |
110 | " .. #-;> ,, ,,,", | 110 | " .. #-;> ,, ,,,", |
111 | " $')! ", | 111 | " $')! ", |
112 | " ", | 112 | " ", |
113 | " ", | 113 | " ", |
114 | " "}; | 114 | " "}; |
115 | 115 | ||
116 | OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode ) | 116 | OVersatileView::OVersatileView( QWidget* parent, const char* name, int mode ) |
117 | :QWidgetStack( parent, name ), | 117 | :QWidgetStack( parent, name ), |
118 | _viewmode( mode ), _warningpolicy( None ), | 118 | _viewmode( mode ), _warningpolicy( None ), |
119 | _treeleaf(), _treeopened(), _treeclosed(), | 119 | _treeleaf(), _treeopened(), _treeclosed(), |
120 | _iconleaf(), _iconopened(), _iconclosed() | 120 | _iconleaf(), _iconopened(), _iconclosed() |
121 | { | 121 | { |
122 | // | 122 | // |
123 | // Create child widgets and set some reasonable default styles | 123 | // Create child widgets and set some reasonable default styles |
124 | // | 124 | // |
125 | 125 | ||
126 | _listview = new OListView( this, "oversatileview embedded listview" ); | 126 | _listview = new OListView( this, "oversatileview embedded listview" ); |
127 | _iconview = new QIconView( this, "oversatileview embedded iconview" ); | 127 | _iconview = new QIconView( this, "oversatileview embedded iconview" ); |
128 | 128 | ||
129 | _listview->setAllColumnsShowFocus( true ); | 129 | _listview->setAllColumnsShowFocus( true ); |
130 | _listview->setRootIsDecorated( true ); | 130 | _listview->setRootIsDecorated( true ); |
131 | _listview->setShowSortIndicator( true ); | 131 | _listview->setShowSortIndicator( true ); |
132 | _iconview->setGridX( 90 ); | 132 | _iconview->setGridX( 90 ); |
133 | _iconview->setGridY( 42 ); | 133 | _iconview->setGridY( 42 ); |
134 | _iconview->setAutoArrange( true ); | 134 | _iconview->setAutoArrange( true ); |
135 | 135 | ||
136 | #ifdef QWS // TODO: Let this depend on current geometry (rotation) | 136 | #ifdef QWS // TODO: Let this depend on current geometry (rotation) |
137 | _iconview->setArrangement( QIconView::TopToBottom ); | 137 | _iconview->setArrangement( QIconView::TopToBottom ); |
138 | #else | 138 | #else |
139 | _iconview->setArrangement( QIconView::LeftToRight ); | 139 | _iconview->setArrangement( QIconView::LeftToRight ); |
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | _iconview->setResizeMode( QIconView::Adjust ); | 142 | _iconview->setResizeMode( QIconView::Adjust ); |
143 | 143 | ||
144 | // qt-embedded: map stylus right on hold to right button press | 144 | // qt-embedded: map stylus right on hold to right button press |
145 | 145 | ||
146 | #ifdef QWS | 146 | #ifdef QWS |
147 | ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); | 147 | ( (QPEApplication*) qApp)->setStylusOperation( _iconview->viewport(), QPEApplication::RightOnHold ); |
148 | ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); | 148 | ( (QPEApplication*) qApp)->setStylusOperation( _listview->viewport(), QPEApplication::RightOnHold ); |
149 | #endif | 149 | #endif |
150 | 150 | ||
151 | setViewMode( mode ); // TODO: Read last style from config | 151 | setViewMode( mode ); // TODO: Read last style from config |
152 | // setSynchronization( true ); // TODO: Implement this | 152 | // setSynchronization( true ); // TODO: Implement this |
153 | 153 | ||
154 | // create context menu allowing to switch between the views | 154 | // create context menu allowing to switch between the views |
155 | 155 | ||
156 | _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); | 156 | _contextmenu = new QPopupMenu( 0, "oversatileview contextmenu" ); |
157 | _contextmenu->setCaption( "Style" ); | 157 | _contextmenu->setCaption( "Style" ); |
158 | _contextmenu->setCheckable( true ); | 158 | _contextmenu->setCheckable( true ); |
159 | QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); | 159 | QActionGroup* ag = new QActionGroup( _contextmenu, "style option group" ); |
160 | QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), | 160 | QAction* a1 = new QAction( "View Items in Icon Style", QIconSet( QPixmap( view_icon_xpm ) ), |
161 | "View Icons", 0, ag, "viewicon action", true ); | 161 | "View Icons", 0, ag, "viewicon action", true ); |
162 | QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), | 162 | QAction* a2 = new QAction( "View Items in Tree Style", QIconSet( QPixmap( view_tree_xpm ) ), |
163 | "View Tree", 0, ag, "viewtree action", true ); | 163 | "View Tree", 0, ag, "viewtree action", true ); |
164 | ag->addTo( _contextmenu ); | 164 | ag->addTo( _contextmenu ); |
165 | if ( mode == Icons ) | 165 | if ( mode == Icons ) |
166 | a1->setOn( true ); | 166 | a1->setOn( true ); |
167 | else if ( mode == Tree ) | 167 | else if ( mode == Tree ) |
168 | a2->setOn( true ); | 168 | a2->setOn( true ); |
169 | connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); | 169 | connect( a1, SIGNAL( activated() ), this, SLOT( setIconViewMode() ) ); |
170 | connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); | 170 | connect( a2, SIGNAL( activated() ), this, SLOT( setTreeViewMode() ) ); |
171 | 171 | ||
172 | #if (QT_VERSION >= 0x030000) | 172 | #if (QT_VERSION >= 0x030000) |
173 | connect( _listview, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); | 173 | connect( _listview, SIGNAL( contextMenuRequested(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
174 | connect( _iconview, SIGNAL( contextMenuRequested( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); | 174 | connect( _iconview, SIGNAL( contextMenuRequested(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); |
175 | #else | 175 | #else |
176 | connect( _listview, SIGNAL( rightButtonPressed( QListViewItem*, const QPoint&, int ) ), this, SLOT( contextMenuRequested( QListViewItem*, const QPoint&, int ) ) ); | 176 | connect( _listview, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); |
177 | connect( _iconview, SIGNAL( rightButtonPressed( QIconViewItem*, const QPoint& ) ), this, SLOT( contextMenuRequested( QIconViewItem*, const QPoint& ) ) ); | 177 | connect( _iconview, SIGNAL( rightButtonPressed(QIconViewItem*,const QPoint&) ), this, SLOT( contextMenuRequested(QIconViewItem*,const QPoint&) ) ); |
178 | #endif | 178 | #endif |
179 | 179 | ||
180 | // | 180 | // |
181 | // signal forwarders | 181 | // signal forwarders |
182 | // | 182 | // |
183 | // unfortunately we can't short-circuit all the QListView and QIconView signals | 183 | // unfortunately we can't short-circuit all the QListView and QIconView signals |
184 | // to OVersatileView signals, because the signal/slot mechanism doesn't allow | 184 | // to OVersatileView signals, because the signal/slot mechanism doesn't allow |
185 | // type-conversion :-( | 185 | // type-conversion :-( |
186 | 186 | ||
187 | // common signals for listview | 187 | // common signals for listview |
188 | 188 | ||
189 | connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); | 189 | connect( _listview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); |
190 | connect( _listview, SIGNAL( selectionChanged( QListViewItem * ) ), this, SLOT( selectionChanged( QListViewItem * ) ) ); | 190 | connect( _listview, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( selectionChanged(QListViewItem*) ) ); |
191 | connect( _listview, SIGNAL( currentChanged( QListViewItem * ) ), this, SLOT( currentChanged( QListViewItem * ) ) ); | 191 | connect( _listview, SIGNAL( currentChanged(QListViewItem*) ), this, SLOT( currentChanged(QListViewItem*) ) ); |
192 | connect( _listview, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( clicked( QListViewItem * ) ) ); | 192 | connect( _listview, SIGNAL( clicked(QListViewItem*) ), this, SLOT( clicked(QListViewItem*) ) ); |
193 | connect( _listview, SIGNAL( pressed( QListViewItem * ) ), this, SLOT( pressed( QListViewItem * ) ) ); | 193 | connect( _listview, SIGNAL( pressed(QListViewItem*) ), this, SLOT( pressed(QListViewItem*) ) ); |
194 | 194 | ||
195 | connect( _listview, SIGNAL( doubleClicked( QListViewItem * ) ), this, SLOT( doubleClicked( QListViewItem * ) ) ); | 195 | connect( _listview, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( doubleClicked(QListViewItem*) ) ); |
196 | connect( _listview, SIGNAL( returnPressed( QListViewItem * ) ), this, SLOT( returnPressed( QListViewItem * ) ) ); | 196 | connect( _listview, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( returnPressed(QListViewItem*) ) ); |
197 | 197 | ||
198 | connect( _listview, SIGNAL( onItem( QListViewItem * ) ), this, SLOT( onItem( QListViewItem * ) ) ); | 198 | connect( _listview, SIGNAL( onItem(QListViewItem*) ), this, SLOT( onItem(QListViewItem*) ) ); |
199 | connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); | 199 | connect( _listview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); |
200 | 200 | ||
201 | // common signals for iconview | 201 | // common signals for iconview |
202 | 202 | ||
203 | connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); | 203 | connect( _iconview, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) ); |
204 | connect( _iconview, SIGNAL( selectionChanged( QIconViewItem * ) ), this, SLOT( selectionChanged( QIconViewItem * ) ) ); | 204 | connect( _iconview, SIGNAL( selectionChanged(QIconViewItem*) ), this, SLOT( selectionChanged(QIconViewItem*) ) ); |
205 | connect( _iconview, SIGNAL( currentChanged( QIconViewItem * ) ), this, SLOT( currentChanged( QIconViewItem * ) ) ); | 205 | connect( _iconview, SIGNAL( currentChanged(QIconViewItem*) ), this, SLOT( currentChanged(QIconViewItem*) ) ); |
206 | connect( _iconview, SIGNAL( clicked( QIconViewItem * ) ), this, SLOT( clicked( QIconViewItem * ) ) ); | 206 | connect( _iconview, SIGNAL( clicked(QIconViewItem*) ), this, SLOT( clicked(QIconViewItem*) ) ); |
207 | connect( _iconview, SIGNAL( pressed( QIconViewItem * ) ), this, SLOT( pressed( QIconViewItem * ) ) ); | 207 | connect( _iconview, SIGNAL( pressed(QIconViewItem*) ), this, SLOT( pressed(QIconViewItem*) ) ); |
208 | 208 | ||
209 | connect( _iconview, SIGNAL( doubleClicked( QIconViewItem * ) ), this, SLOT( doubleClicked( QIconViewItem * ) ) ); | 209 | connect( _iconview, SIGNAL( doubleClicked(QIconViewItem*) ), this, SLOT( doubleClicked(QIconViewItem*) ) ); |
210 | connect( _iconview, SIGNAL( returnPressed( QIconViewItem * ) ), this, SLOT( returnPressed( QIconViewItem * ) ) ); | 210 | connect( _iconview, SIGNAL( returnPressed(QIconViewItem*) ), this, SLOT( returnPressed(QIconViewItem*) ) ); |
211 | 211 | ||
212 | connect( _iconview, SIGNAL( onItem( QIconViewItem * ) ), this, SLOT( onItem( QIconViewItem * ) ) ); | 212 | connect( _iconview, SIGNAL( onItem(QIconViewItem*) ), this, SLOT( onItem(QIconViewItem*) ) ); |
213 | connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); | 213 | connect( _iconview, SIGNAL( onViewport() ), this, SIGNAL( onViewport() ) ); |
214 | 214 | ||
215 | // listview only signals | 215 | // listview only signals |
216 | 216 | ||
217 | connect( _listview, SIGNAL( expanded( QListViewItem * ) ), this, SLOT( expanded( QListViewItem * ) ) ); | 217 | connect( _listview, SIGNAL( expanded(QListViewItem*) ), this, SLOT( expanded(QListViewItem*) ) ); |
218 | connect( _listview, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( collapsed( QListViewItem * ) ) ); | 218 | connect( _listview, SIGNAL( collapsed(QListViewItem*) ), this, SLOT( collapsed(QListViewItem*) ) ); |
219 | 219 | ||
220 | // iconview only signals | 220 | // iconview only signals |
221 | 221 | ||
222 | connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); | 222 | connect( _iconview, SIGNAL( moved() ), this, SIGNAL( moved() ) ); |
223 | } | 223 | } |
224 | 224 | ||
225 | OVersatileView::~OVersatileView() | 225 | OVersatileView::~OVersatileView() |
226 | { | 226 | { |
227 | } | 227 | } |
228 | 228 | ||
229 | QPopupMenu* OVersatileView::contextMenu() const | 229 | QPopupMenu* OVersatileView::contextMenu() const |
230 | { | 230 | { |
231 | return _contextmenu; | 231 | return _contextmenu; |
232 | } | 232 | } |
233 | 233 | ||
234 | void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) | 234 | void OVersatileView::contextMenuRequested( QListViewItem* item, const QPoint& pos, int col ) |
235 | { | 235 | { |
236 | // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, | 236 | // can't use QObject::inherits here, because ListViewItems, beit Q, O or K, |
237 | // do not inherit from QObject - assuming here the programmer is | 237 | // do not inherit from QObject - assuming here the programmer is |
238 | // disciplined enough to only add OVersatileViewItems to an OVersatileView | 238 | // disciplined enough to only add OVersatileViewItems to an OVersatileView |
239 | popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); | 239 | popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, col ); |
240 | } | 240 | } |
241 | 241 | ||
242 | void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) | 242 | void OVersatileView::contextMenuRequested( QIconViewItem* item, const QPoint& pos ) |
243 | { | 243 | { |
244 | // see above | 244 | // see above |
245 | popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); | 245 | popupContextMenu( static_cast<OVersatileViewItem*>( item ), pos, -1 ); |
246 | } | 246 | } |
247 | 247 | ||
248 | void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) | 248 | void OVersatileView::popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col ) |
249 | { | 249 | { |
250 | if ( !item ) | 250 | if ( !item ) |
251 | _contextmenu->exec( pos ); | 251 | _contextmenu->exec( pos ); |
252 | else | 252 | else |
253 | emit( contextMenuRequested( item, pos, col ) ); | 253 | emit( contextMenuRequested( item, pos, col ) ); |
254 | } | 254 | } |
255 | 255 | ||
256 | void OVersatileView::setSynchronization( bool sync ) | 256 | void OVersatileView::setSynchronization( bool sync ) |
257 | { | 257 | { |
258 | _synchronization = sync; | 258 | _synchronization = sync; |
259 | } | 259 | } |
260 | 260 | ||
261 | bool OVersatileView::synchronization() | 261 | bool OVersatileView::synchronization() |
262 | { | 262 | { |
263 | return _synchronization; | 263 | return _synchronization; |
264 | } | 264 | } |
265 | 265 | ||
266 | void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) | 266 | void OVersatileView::setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ) |
267 | { | 267 | { |
268 | if ( mode == Tree ) | 268 | if ( mode == Tree ) |
269 | { | 269 | { |
270 | _treeleaf = leaf; | 270 | _treeleaf = leaf; |
271 | _treeopened = opened; | 271 | _treeopened = opened; |
272 | _treeclosed = closed; | 272 | _treeclosed = closed; |
273 | } | 273 | } |
274 | else if ( mode == Icons ) | 274 | else if ( mode == Icons ) |
275 | { | 275 | { |
276 | _iconleaf = leaf; | 276 | _iconleaf = leaf; |
277 | _iconopened = opened; | 277 | _iconopened = opened; |
278 | _iconclosed = closed; | 278 | _iconclosed = closed; |
279 | } | 279 | } |
280 | else | 280 | else |
281 | { | 281 | { |
282 | odebug << "OVersatileView::setDefaultPixmaps(): invalid mode" << oendl; | 282 | odebug << "OVersatileView::setDefaultPixmaps(): invalid mode" << oendl; |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
286 | QIconView* OVersatileView::iconView() const | 286 | QIconView* OVersatileView::iconView() const |
287 | { | 287 | { |
288 | return _iconview; | 288 | return _iconview; |
289 | } | 289 | } |
290 | 290 | ||
291 | OListView* OVersatileView::listView() const | 291 | OListView* OVersatileView::listView() const |
292 | { | 292 | { |
293 | return _listview; | 293 | return _listview; |
294 | } | 294 | } |
295 | 295 | ||
296 | void OVersatileView::setViewMode( int mode ) | 296 | void OVersatileView::setViewMode( int mode ) |
297 | { | 297 | { |
298 | if ( mode == Tree ) | 298 | if ( mode == Tree ) |
299 | { | 299 | { |
300 | _viewmode = mode; | 300 | _viewmode = mode; |
301 | raiseWidget( _listview ); | 301 | raiseWidget( _listview ); |
302 | } | 302 | } |
303 | else if ( mode == Icons ) | 303 | else if ( mode == Icons ) |
304 | { | 304 | { |
305 | _viewmode = mode; | 305 | _viewmode = mode; |
306 | raiseWidget( _iconview ); | 306 | raiseWidget( _iconview ); |
307 | } | 307 | } |
308 | else | 308 | else |
309 | { | 309 | { |
310 | odebug << "OVersatileView::setViewMode(): invalid mode" << oendl; | 310 | odebug << "OVersatileView::setViewMode(): invalid mode" << oendl; |
311 | } | 311 | } |
312 | } | 312 | } |
313 | 313 | ||
314 | void OVersatileView::setIconViewMode() | 314 | void OVersatileView::setIconViewMode() |