3 files changed, 13 insertions, 9 deletions
diff --git a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp b/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp index 5c7bac2..6d2c773 100644 --- a/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp +++ b/libopie2/examples/opieui/okeyconfigwidget/testwidget.cpp | |||
@@ -67,62 +67,62 @@ void MainWindow::slotClicked() { | |||
67 | } | 67 | } |
68 | } | 68 | } |
69 | 69 | ||
70 | TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl ) | 70 | TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl ) |
71 | : Opie::Ui::OListView( parent, slot, fl) | 71 | : Opie::Ui::OListView( parent, slot, fl) |
72 | { | 72 | { |
73 | addColumn( tr( "A Doo" ) ); | 73 | addColumn( tr( "A Doo" ) ); |
74 | addColumn( tr( "B Doo" ) ); | 74 | addColumn( tr( "B Doo" ) ); |
75 | 75 | ||
76 | m_config = new Opie::Core::OConfig( "test_config_foo" ); | 76 | m_config = new Opie::Core::OConfig( "test_config_foo" ); |
77 | 77 | ||
78 | /* generate the black list */ | 78 | /* generate the black list */ |
79 | Opie::Core::OKeyPair::List blackList; | 79 | Opie::Core::OKeyPair::List blackList; |
80 | blackList.append( Opie::Core::OKeyPair::leftArrowKey() ); | 80 | blackList.append( Opie::Core::OKeyPair::leftArrowKey() ); |
81 | blackList.append( Opie::Core::OKeyPair::rightArrowKey() ); | 81 | blackList.append( Opie::Core::OKeyPair::rightArrowKey() ); |
82 | blackList.append( Opie::Core::OKeyPair::downArrowKey() ); | 82 | blackList.append( Opie::Core::OKeyPair::downArrowKey() ); |
83 | blackList.append( Opie::Core::OKeyPair::upArrowKey() ); | 83 | blackList.append( Opie::Core::OKeyPair::upArrowKey() ); |
84 | 84 | ||
85 | m_manager = new Opie::Core::OKeyConfigManager( m_config, "Key Group", | 85 | m_manager = new Opie::Core::OKeyConfigManager( m_config, "Key Group", |
86 | blackList, false, this, "Key Manager" ); | 86 | blackList, false, this, "Key Manager" ); |
87 | 87 | ||
88 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), | 88 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(), |
89 | 10, Opie::Core::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this, | 89 | 10, Opie::Core::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this, |
90 | SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); | 90 | SLOT(slotDelete(QWidget*,QKeyEvent*)) ) ); |
91 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(), | 91 | m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(), |
92 | 11, Opie::Core::OKeyPair( Qt::Key_S, Qt::AltButton ) ) ); | 92 | 11, Opie::Core::OKeyPair( Qt::Key_S, Qt::AltButton ) ) ); |
93 | 93 | ||
94 | connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Core::OKeyConfigItem&)), | 94 | connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Core::OKeyConfigItem&)), |
95 | this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem&)) ); | 95 | this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem&)) ); |
96 | // when commenting the line below out the keyPressEvent will work | 96 | // when commenting the line below out the keyPressEvent will work |
97 | m_manager->handleWidget( this ); | 97 | m_manager->handleWidget( this ); |
98 | m_manager->load(); | 98 | m_manager->load(); |
99 | } | 99 | } |
100 | 100 | ||
101 | TestMainWindow::~TestMainWindow() { | 101 | TestMainWindow::~TestMainWindow() { |
102 | m_manager->save(); | 102 | m_manager->save(); |
103 | delete m_config; | 103 | delete m_config; |
104 | } | 104 | } |
105 | 105 | ||
106 | Opie::Core::OKeyConfigManager* TestMainWindow::manager() { | 106 | Opie::Core::OKeyConfigManager* TestMainWindow::manager() { |
107 | return m_manager; | 107 | return m_manager; |
108 | } | 108 | } |
109 | 109 | ||
110 | /* | 110 | /* |
111 | * This only works if we do not handle the even with m_manager->handleWidget( this ) | 111 | * This only works if we do not handle the even with m_manager->handleWidget( this ) |
112 | * So this is only for demo purposes | 112 | * So this is only for demo purposes |
113 | */ | 113 | */ |
114 | void TestMainWindow::keyPressEvent( QKeyEvent* ev ) { | 114 | void TestMainWindow::keyPressEvent( QKeyEvent* ev ) { |
115 | qWarning( "String is "+ m_manager->handleKeyEvent( ev ).text() ); | 115 | owarn << "String is "+ m_manager->handleKeyEvent( ev ).text() << oendl; |
116 | qWarning( "Id was %d %d %d %d", m_manager->handleKeyEventId( ev ),ev->key(),ev->state(), ev->ascii() ); | 116 | owarn << "Id was " << m_manager->handleKeyEventId( ev ) << " " << ev->key() << " " << ev->state() << " " << ev->ascii() << "" << oendl; |
117 | ev->ignore(); | 117 | ev->ignore(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { | 120 | void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) { |
121 | qWarning( "Slot Delete %d %d %d", wid, ev->key(), ev->state() ); | 121 | owarn << "Slot Delete " << wid << " " << ev->key() << " " << ev->state() << "" << oendl; |
122 | } | 122 | } |
123 | 123 | ||
124 | void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Core::OKeyConfigItem& item) { | 124 | void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Core::OKeyConfigItem& item) { |
125 | qWarning( "Slot Action %d %d %d %s %d", wid, ev->key(), ev->state(), item.text().latin1(), item.id() ); | 125 | owarn << "Slot Action " << wid << " " << ev->key() << " " << ev->state() << " " << item.text() << " " << item.id() << "" << oendl; |
126 | } | 126 | } |
127 | 127 | ||
128 | #include "testwidget.moc" | 128 | #include "testwidget.moc" |
diff --git a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp index 7834b3b..4c05620 100644 --- a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp +++ b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.cpp | |||
@@ -1,82 +1,86 @@ | |||
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 "olistviewdemo.h" | 33 | #include "olistviewdemo.h" |
34 | |||
35 | /* OPIE */ | ||
34 | #include <opie2/olistview.h> | 36 | #include <opie2/olistview.h> |
37 | #include <opie2/odebug.h> | ||
35 | 38 | ||
39 | /* QT */ | ||
36 | #include <qstring.h> | 40 | #include <qstring.h> |
37 | #include <qpixmap.h> | 41 | #include <qpixmap.h> |
38 | #include <qlistview.h> | 42 | #include <qlistview.h> |
39 | 43 | ||
40 | using namespace Opie::Ui; | 44 | using namespace Opie::Ui; |
41 | 45 | ||
42 | OListViewDemo::OListViewDemo( QWidget* parent, const char* name, WFlags f ) | 46 | OListViewDemo::OListViewDemo( QWidget* parent, const char* name, WFlags f ) |
43 | :QVBox( parent, name, f ) | 47 | :QVBox( parent, name, f ) |
44 | { | 48 | { |
45 | lv = new ONamedListView( this ); | 49 | lv = new ONamedListView( this ); |
46 | lv->setRootIsDecorated( true ); | 50 | lv->setRootIsDecorated( true ); |
47 | lv->addColumns( QStringList::split( ' ', "Column1 Column2 Column3 Column4" ) ); | 51 | lv->addColumns( QStringList::split( ' ', "Column1 Column2 Column3 Column4" ) ); |
48 | 52 | ||
49 | ONamedListViewItem* item = new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 53 | ONamedListViewItem* item = new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
50 | item->setText( "Column2", "ModifiedText" ); | 54 | item->setText( "Column2", "ModifiedText" ); |
51 | item->setText( "Column5", "ThisColumnDoesNotExits" ); | 55 | item->setText( "Column5", "ThisColumnDoesNotExits" ); |
52 | 56 | ||
53 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 57 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
54 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 58 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
55 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Minni" ) ); | 59 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Minni" ) ); |
56 | item = new ONamedListViewItem( lv, QStringList::split( ' ', "XXX YYY ZZZ ***" ) ); | 60 | item = new ONamedListViewItem( lv, QStringList::split( ' ', "XXX YYY ZZZ ***" ) ); |
57 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 61 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
58 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); | 62 | new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) ); |
59 | 63 | ||
60 | new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); | 64 | new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); |
61 | new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); | 65 | new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); |
62 | new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); | 66 | new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) ); |
63 | item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComes" ) ); | 67 | item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComes" ) ); |
64 | item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComesSoon" ) ); | 68 | item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComesSoon" ) ); |
65 | item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 Mickey" ) ); | 69 | item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 Mickey" ) ); |
66 | 70 | ||
67 | if ( lv->find( 3, "Mickey", 3 ) ) | 71 | if ( lv->find( 3, "Mickey", 3 ) ) |
68 | qDebug( "found Mickey :-)" ); | 72 | odebug << "found Mickey :-)" << oendl; |
69 | else | 73 | else |
70 | qDebug( "did not found Mickey :-(" ); | 74 | odebug << "did not found Mickey :-(" << oendl; |
71 | 75 | ||
72 | if ( lv->find( 3, "Minni", 0 ) ) | 76 | if ( lv->find( 3, "Minni", 0 ) ) |
73 | qDebug( "found Minni :-)" ); | 77 | odebug << "found Minni :-)" << oendl; |
74 | else | 78 | else |
75 | qDebug( "did not found Minni :-(" ); | 79 | odebug << "did not found Minni :-(" << oendl; |
76 | 80 | ||
77 | } | 81 | } |
78 | 82 | ||
79 | OListViewDemo::~OListViewDemo() | 83 | OListViewDemo::~OListViewDemo() |
80 | { | 84 | { |
81 | } | 85 | } |
82 | 86 | ||
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp index 6443dc0..d747bd9 100644 --- a/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp +++ b/libopie2/examples/opieui/osplitter_example/osplitter_mail.cpp | |||
@@ -29,53 +29,53 @@ ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) | |||
29 | lay->addWidget( m_splitter ); | 29 | lay->addWidget( m_splitter ); |
30 | connect(m_splitter, SIGNAL(sizeChanged(bool,Orientation) ), | 30 | connect(m_splitter, SIGNAL(sizeChanged(bool,Orientation) ), |
31 | this, SLOT(slotSizeChange(bool,Orientation) ) ); | 31 | this, SLOT(slotSizeChange(bool,Orientation) ) ); |
32 | 32 | ||
33 | m_overview = new QListView( m_splitter ); | 33 | m_overview = new QListView( m_splitter ); |
34 | m_overview->header()->setClickEnabled( FALSE ); | 34 | m_overview->header()->setClickEnabled( FALSE ); |
35 | m_overview->addColumn( tr("Folder") ); | 35 | m_overview->addColumn( tr("Folder") ); |
36 | // m_overview->setMaximumWidth( 200 ); | 36 | // m_overview->setMaximumWidth( 200 ); |
37 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); | 37 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); |
38 | m_splitter->setSizeChange( 300 ); | 38 | m_splitter->setSizeChange( 300 ); |
39 | 39 | ||
40 | /* OSplitter starts with the small mode */ | 40 | /* OSplitter starts with the small mode */ |
41 | m_messages = 0; | 41 | m_messages = 0; |
42 | m_message = m_attach = 0; | 42 | m_message = m_attach = 0; |
43 | 43 | ||
44 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); | 44 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); |
45 | splitti->setSizeChange( 300 ); | 45 | splitti->setSizeChange( 300 ); |
46 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | 46 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); |
47 | 47 | ||
48 | QLabel *lbl = new QLabel(splitti); | 48 | QLabel *lbl = new QLabel(splitti); |
49 | lbl->setTextFormat ( Qt::RichText ); | 49 | lbl->setTextFormat ( Qt::RichText ); |
50 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); | 50 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); |
51 | 51 | ||
52 | m_messages = new QListView( splitti ); | 52 | m_messages = new QListView( splitti ); |
53 | m_messages->addColumn(" Messages "); | 53 | m_messages->addColumn(" Messages "); |
54 | 54 | ||
55 | folder1 = new QListView( splitti ); | 55 | folder1 = new QListView( splitti ); |
56 | folder1->addColumn( "Messages 2 " ); | 56 | folder1->addColumn( "Messages 2 " ); |
57 | 57 | ||
58 | splitti->addWidget(m_messages, "mail", tr("Mails") ); | 58 | splitti->addWidget(m_messages, "mail", tr("Mails") ); |
59 | splitti->addWidget(folder1, "folder", tr("Folder") ); | 59 | splitti->addWidget(folder1, "folder", tr("Folder") ); |
60 | splitti->addWidget( lbl, "logo", tr("Label") ); | 60 | splitti->addWidget( lbl, "logo", tr("Label") ); |
61 | m_message = lbl; | 61 | m_message = lbl; |
62 | 62 | ||
63 | m_splitter->addWidget( splitti ); | 63 | m_splitter->addWidget( splitti ); |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | ListViews::~ListViews() { | 68 | ListViews::~ListViews() { |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | 72 | ||
73 | bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { | 73 | bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { |
74 | if (!obj->isWidgetType() ) | 74 | if (!obj->isWidgetType() ) |
75 | return false; | 75 | return false; |
76 | if ( ev->type() == QEvent::MouseButtonRelease ) { | 76 | if ( ev->type() == QEvent::MouseButtonRelease ) { |
77 | qWarning(" name %s, class %s", obj->name(), obj->className() ); | 77 | owarn << " name " << obj->name() << ", class " << obj->className() << "" << oendl; |
78 | } | 78 | } |
79 | 79 | ||
80 | return false; | 80 | return false; |
81 | } | 81 | } |