-rw-r--r-- | libopie2/examples/opieui/osplitter_example/osplitter_example.cpp | 1 | ||||
-rw-r--r-- | libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp | 1 | ||||
-rw-r--r-- | libopie2/opiecore/oprocess.h | 12 | ||||
-rw-r--r-- | libopie2/opienet/opcap.h | 2 | ||||
-rw-r--r-- | libopie2/opieui/opopupmenu.h | 2 | ||||
-rw-r--r-- | libopie2/opieui/otimepicker.h | 3 | ||||
-rw-r--r-- | libopie2/opieui/oversatileview.h | 48 |
7 files changed, 34 insertions, 35 deletions
diff --git a/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp b/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp index 4a1468d..07c7e51 100644 --- a/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp +++ b/libopie2/examples/opieui/osplitter_example/osplitter_example.cpp | |||
@@ -1,33 +1,34 @@ | |||
1 | #include "osplitter_example.h" | 1 | #include "osplitter_example.h" |
2 | 2 | ||
3 | /* OPIE */ | 3 | /* OPIE */ |
4 | 4 | ||
5 | #include <opie2/osplitter.h> | 5 | #include <opie2/osplitter.h> |
6 | #include <opie2/ofileselector.h> | 6 | #include <opie2/ofileselector.h> |
7 | #include <qpe/qpeapplication.h> | 7 | #include <qpe/qpeapplication.h> |
8 | #include <opie2/oapplicationfactory.h> | 8 | #include <opie2/oapplicationfactory.h> |
9 | 9 | ||
10 | /* QT*/ | 10 | /* QT*/ |
11 | #include <qdir.h> | 11 | #include <qdir.h> |
12 | #include <qlayout.h> | 12 | #include <qlayout.h> |
13 | 13 | ||
14 | using namespace Opie::Ui; | 14 | using namespace Opie::Ui; |
15 | using namespace Opie::Core; | ||
15 | 16 | ||
16 | OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> ) | 17 | OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> ) |
17 | 18 | ||
18 | OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f ) | 19 | OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f ) |
19 | : QWidget( w, n, f ){ | 20 | : QWidget( w, n, f ){ |
20 | QVBoxLayout * lay = new QVBoxLayout(this); | 21 | QVBoxLayout * lay = new QVBoxLayout(this); |
21 | OSplitter * splitter = new OSplitter( Horizontal, this ); | 22 | OSplitter * splitter = new OSplitter( Horizontal, this ); |
22 | lay->addWidget( splitter ); | 23 | lay->addWidget( splitter ); |
23 | 24 | ||
24 | OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector, | 25 | OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector, |
25 | OFileSelector::Normal, QDir::homeDirPath(), | 26 | OFileSelector::Normal, QDir::homeDirPath(), |
26 | QString::null ); | 27 | QString::null ); |
27 | splitter->addWidget( selector, "zoom", tr("Selector 1") ); | 28 | splitter->addWidget( selector, "zoom", tr("Selector 1") ); |
28 | 29 | ||
29 | selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal, | 30 | selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal, |
30 | QDir::homeDirPath(), QString::null ); | 31 | QDir::homeDirPath(), QString::null ); |
31 | splitter->addWidget( selector, "zoom", tr("Selector 2") ); | 32 | splitter->addWidget( selector, "zoom", tr("Selector 2") ); |
32 | 33 | ||
33 | } | 34 | } |
diff --git a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp index 50cc11b..272e42b 100644 --- a/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp +++ b/libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp | |||
@@ -1,132 +1,133 @@ | |||
1 | /* | 1 | /* |
2 | * You may use, modify and distribute this example without any limitation | 2 | * You may use, modify and distribute this example without any limitation |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include "owidgetstack_example.h" | 5 | #include "owidgetstack_example.h" |
6 | 6 | ||
7 | /* OPIE */ | 7 | /* OPIE */ |
8 | #include <opie2/oapplicationfactory.h> | 8 | #include <opie2/oapplicationfactory.h> |
9 | #include <opie2/owidgetstack.h> | 9 | #include <opie2/owidgetstack.h> |
10 | #include <qpe/resource.h> | 10 | #include <qpe/resource.h> |
11 | 11 | ||
12 | /* QT */ | 12 | /* QT */ |
13 | #include <qaction.h> | 13 | #include <qaction.h> |
14 | #include <qtoolbar.h> | 14 | #include <qtoolbar.h> |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qmenubar.h> | 16 | #include <qmenubar.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qlabel.h> | 18 | #include <qlabel.h> |
19 | #include <qpushbutton.h> | 19 | #include <qpushbutton.h> |
20 | #include <qsignalmapper.h> | 20 | #include <qsignalmapper.h> |
21 | 21 | ||
22 | using namespace Opie::Core; | ||
22 | using namespace Opie::Ui; | 23 | using namespace Opie::Ui; |
23 | 24 | ||
24 | OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) | 25 | OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) |
25 | 26 | ||
26 | StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) | 27 | StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) |
27 | : QMainWindow( parent, name, fl ) | 28 | : QMainWindow( parent, name, fl ) |
28 | { | 29 | { |
29 | m_stack = new OWidgetStack( this ); | 30 | m_stack = new OWidgetStack( this ); |
30 | setCentralWidget( m_stack ); | 31 | setCentralWidget( m_stack ); |
31 | 32 | ||
32 | /* nice Signal Mapper ;) */ | 33 | /* nice Signal Mapper ;) */ |
33 | QSignalMapper *sm = new QSignalMapper(this); | 34 | QSignalMapper *sm = new QSignalMapper(this); |
34 | connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); | 35 | connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); |
35 | 36 | ||
36 | /* toolbar first but this should be known from the other examples */ | 37 | /* toolbar first but this should be known from the other examples */ |
37 | setToolBarsMovable( false ); | 38 | setToolBarsMovable( false ); |
38 | 39 | ||
39 | /* only a menubar here */ | 40 | /* only a menubar here */ |
40 | QToolBar* holder = new QToolBar( this ); | 41 | QToolBar* holder = new QToolBar( this ); |
41 | holder->setHorizontalStretchable( true ); | 42 | holder->setHorizontalStretchable( true ); |
42 | 43 | ||
43 | QMenuBar *bar = new QMenuBar( holder ); | 44 | QMenuBar *bar = new QMenuBar( holder ); |
44 | QPopupMenu *menu = new QPopupMenu( this ); | 45 | QPopupMenu *menu = new QPopupMenu( this ); |
45 | 46 | ||
46 | QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"), | 47 | QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"), |
47 | QString::null, 0, this, 0 ); | 48 | QString::null, 0, this, 0 ); |
48 | sm->setMapping(a, 1 ); | 49 | sm->setMapping(a, 1 ); |
49 | connect(a, SIGNAL(activated() ), | 50 | connect(a, SIGNAL(activated() ), |
50 | sm, SLOT(map() ) ); | 51 | sm, SLOT(map() ) ); |
51 | a->addTo( menu ); | 52 | a->addTo( menu ); |
52 | 53 | ||
53 | a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"), | 54 | a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"), |
54 | QString::null, 0, this, 0 ); | 55 | QString::null, 0, this, 0 ); |
55 | sm->setMapping(a, 2 ); | 56 | sm->setMapping(a, 2 ); |
56 | connect(a, SIGNAL(activated() ), | 57 | connect(a, SIGNAL(activated() ), |
57 | sm, SLOT(map() ) ); | 58 | sm, SLOT(map() ) ); |
58 | a->addTo( menu ); | 59 | a->addTo( menu ); |
59 | 60 | ||
60 | a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"), | 61 | a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"), |
61 | QString::null, 0, this, 0 ); | 62 | QString::null, 0, this, 0 ); |
62 | sm->setMapping(a, 3 ); | 63 | sm->setMapping(a, 3 ); |
63 | connect(a, SIGNAL(activated() ), | 64 | connect(a, SIGNAL(activated() ), |
64 | sm, SLOT(map() ) ); | 65 | sm, SLOT(map() ) ); |
65 | a->addTo( menu ); | 66 | a->addTo( menu ); |
66 | 67 | ||
67 | a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"), | 68 | a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"), |
68 | QString::null, 0, this, 0 ); | 69 | QString::null, 0, this, 0 ); |
69 | sm->setMapping(a, 4 ); | 70 | sm->setMapping(a, 4 ); |
70 | connect(a, SIGNAL(activated() ), | 71 | connect(a, SIGNAL(activated() ), |
71 | sm, SLOT(map() ) ); | 72 | sm, SLOT(map() ) ); |
72 | 73 | ||
73 | bar->insertItem( tr("Actions"), menu ); | 74 | bar->insertItem( tr("Actions"), menu ); |
74 | 75 | ||
75 | /* now the gui */ | 76 | /* now the gui */ |
76 | 77 | ||
77 | /* first widget, main widget */ | 78 | /* first widget, main widget */ |
78 | QWidget * wid = new QWidget( m_stack ); | 79 | QWidget * wid = new QWidget( m_stack ); |
79 | QGridLayout *grid = new QGridLayout(wid, 2, 2 ); | 80 | QGridLayout *grid = new QGridLayout(wid, 2, 2 ); |
80 | 81 | ||
81 | QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" ); | 82 | QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" ); |
82 | sm->setMapping(btn, 2 ); | 83 | sm->setMapping(btn, 2 ); |
83 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | 84 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); |
84 | grid->addWidget( btn, 0, 0 ); | 85 | grid->addWidget( btn, 0, 0 ); |
85 | 86 | ||
86 | btn = new QPushButton( tr("Show Details Medium"), wid, "details2"); | 87 | btn = new QPushButton( tr("Show Details Medium"), wid, "details2"); |
87 | sm->setMapping(btn, 3 ); | 88 | sm->setMapping(btn, 3 ); |
88 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | 89 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); |
89 | grid->addWidget( btn, 0, 1 ); | 90 | grid->addWidget( btn, 0, 1 ); |
90 | 91 | ||
91 | btn = new QPushButton( tr("Show Details All"), wid, "details3"); | 92 | btn = new QPushButton( tr("Show Details All"), wid, "details3"); |
92 | sm->setMapping(btn, 4 ); | 93 | sm->setMapping(btn, 4 ); |
93 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | 94 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); |
94 | grid->addWidget( btn, 1, 1 ); | 95 | grid->addWidget( btn, 1, 1 ); |
95 | 96 | ||
96 | m_stack->addWidget( wid, 1 ); | 97 | m_stack->addWidget( wid, 1 ); |
97 | m_main = wid; | 98 | m_main = wid; |
98 | 99 | ||
99 | QLabel *lbl = new QLabel(m_stack ); | 100 | QLabel *lbl = new QLabel(m_stack ); |
100 | lbl->setText(tr("Only small Details are shown here. Määh") ); | 101 | lbl->setText(tr("Only small Details are shown here. Määh") ); |
101 | m_stack->addWidget( lbl, 2 ); | 102 | m_stack->addWidget( lbl, 2 ); |
102 | 103 | ||
103 | lbl = new QLabel( m_stack ); | 104 | lbl = new QLabel( m_stack ); |
104 | lbl->setText( tr("Some more details....Wo ist das Schaf?") ); | 105 | lbl->setText( tr("Some more details....Wo ist das Schaf?") ); |
105 | m_stack->addWidget( lbl, 3 ); | 106 | m_stack->addWidget( lbl, 3 ); |
106 | 107 | ||
107 | lbl = new QLabel( m_stack ); | 108 | lbl = new QLabel( m_stack ); |
108 | lbl->setText( tr("<qt>Ne nicht in Bayerisch Gmain sondern in Berlin<br>Vermiss und meine Augen werden nicht eckig, da mein Bildschirm abgerundet ist<br>Es lebe Hamburg Süd,weiss du, verstehst du? ;)<br>Susi ist dOOf, es lebe die Ofenecke...", "hard to translate that") ); | 109 | lbl->setText( tr("<qt>Ne nicht in Bayerisch Gmain sondern in Berlin<br>Vermiss und meine Augen werden nicht eckig, da mein Bildschirm abgerundet ist<br>Es lebe Hamburg Süd,weiss du, verstehst du? ;)<br>Susi ist dOOf, es lebe die Ofenecke...", "hard to translate that") ); |
109 | m_stack->addWidget( lbl, 4 ); | 110 | m_stack->addWidget( lbl, 4 ); |
110 | 111 | ||
111 | 112 | ||
112 | /* THE signal mapper does all the magic */ | 113 | /* THE signal mapper does all the magic */ |
113 | m_stack->raiseWidget( m_main ); | 114 | m_stack->raiseWidget( m_main ); |
114 | } | 115 | } |
115 | 116 | ||
116 | 117 | ||
117 | StackExample::~StackExample() { | 118 | StackExample::~StackExample() { |
118 | 119 | ||
119 | } | 120 | } |
120 | 121 | ||
121 | 122 | ||
122 | 123 | ||
123 | void StackExample::closeEvent( QCloseEvent* ev) { | 124 | void StackExample::closeEvent( QCloseEvent* ev) { |
124 | /* if the close even came when we displayed a details */ | 125 | /* if the close even came when we displayed a details */ |
125 | if (m_stack->visibleWidget() != m_main ) { | 126 | if (m_stack->visibleWidget() != m_main ) { |
126 | m_stack->raiseWidget( m_main ); | 127 | m_stack->raiseWidget( m_main ); |
127 | ev->ignore(); | 128 | ev->ignore(); |
128 | return; | 129 | return; |
129 | } | 130 | } |
130 | 131 | ||
131 | ev->accept(); | 132 | ev->accept(); |
132 | } | 133 | } |
diff --git a/libopie2/opiecore/oprocess.h b/libopie2/opiecore/oprocess.h index eb56b03..e23f98c 100644 --- a/libopie2/opiecore/oprocess.h +++ b/libopie2/opiecore/oprocess.h | |||
@@ -1,233 +1,233 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org> | 3 | Copyright (C) 2003-2004 Holger Freyther <zecke@handhelds.org> |
4 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) | 5 | =. Based on KProcess (C) 1997 Christian Czezatke (e9025461@student.tuwien.ac.at) |
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 | #ifndef OPROCESS_H | 31 | #ifndef OPROCESS_H |
32 | #define OPROCESS_H | 32 | #define OPROCESS_H |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | #include <qcstring.h> | 35 | #include <qcstring.h> |
36 | #include <qobject.h> | 36 | #include <qobject.h> |
37 | #include <qvaluelist.h> | 37 | #include <qvaluelist.h> |
38 | 38 | ||
39 | /* STD */ | 39 | /* STD */ |
40 | #include <sys/types.h> // for pid_t | 40 | #include <sys/types.h> // for pid_t |
41 | #include <sys/wait.h> | 41 | #include <sys/wait.h> |
42 | #include <signal.h> | 42 | #include <signal.h> |
43 | #include <unistd.h> | 43 | #include <unistd.h> |
44 | 44 | ||
45 | class QSocketNotifier; | 45 | class QSocketNotifier; |
46 | 46 | ||
47 | namespace Opie { | 47 | namespace Opie { |
48 | namespace Core { | 48 | namespace Core { |
49 | namespace Private { | 49 | namespace Private { |
50 | class OProcessController; | 50 | class OProcessController; |
51 | class OProcessPrivate; | 51 | class OProcessPrivate; |
52 | } | 52 | } |
53 | 53 | ||
54 | /** | 54 | /** |
55 | * Child process invocation, monitoring and control. | 55 | * Child process invocation, monitoring and control. |
56 | * | 56 | * |
57 | * @sect General usage and features | 57 | * @sect General usage and features |
58 | * | 58 | * |
59 | *This class allows a KDE and OPIE application to start child processes without having | 59 | *This class allows a KDE and OPIE application to start child processes without having |
60 | *to worry about UN*X signal handling issues and zombie process reaping. | 60 | *to worry about UN*X signal handling issues and zombie process reaping. |
61 | * | 61 | * |
62 | *@see KProcIO | 62 | *@see KProcIO |
63 | * | 63 | * |
64 | *Basically, this class distinguishes three different ways of running | 64 | *Basically, this class distinguishes three different ways of running |
65 | *child processes: | 65 | *child processes: |
66 | * | 66 | * |
67 | *@li OProcess::DontCare -- The child process is invoked and both the child | 67 | *@li OProcess::DontCare -- The child process is invoked and both the child |
68 | *process and the parent process continue concurrently. | 68 | *process and the parent process continue concurrently. |
69 | * | 69 | * |
70 | *Starting a DontCare child process means that the application is | 70 | *Starting a DontCare child process means that the application is |
71 | *not interested in any notification to determine whether the | 71 | *not interested in any notification to determine whether the |
72 | *child process has already exited or not. | 72 | *child process has already exited or not. |
73 | * | 73 | * |
74 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the | 74 | *@li OProcess::NotifyOnExit -- The child process is invoked and both the |
75 | *child and the parent process run concurrently. | 75 | *child and the parent process run concurrently. |
76 | * | 76 | * |
77 | *When the child process exits, the OProcess instance | 77 | *When the child process exits, the OProcess instance |
78 | *corresponding to it emits the Qt signal @ref processExited(). | 78 | *corresponding to it emits the Qt signal @ref processExited(). |
79 | * | 79 | * |
80 | *Since this signal is @em not emitted from within a UN*X | 80 | *Since this signal is @em not emitted from within a UN*X |
81 | *signal handler, arbitrary function calls can be made. | 81 | *signal handler, arbitrary function calls can be made. |
82 | * | 82 | * |
83 | *Be aware: When the OProcess objects gets destructed, the child | 83 | *Be aware: When the OProcess objects gets destructed, the child |
84 | *process will be killed if it is still running! | 84 | *process will be killed if it is still running! |
85 | *This means in particular, that you cannot use a OProcess on the stack | 85 | *This means in particular, that you cannot use a OProcess on the stack |
86 | *with OProcess::NotifyOnExit. | 86 | *with OProcess::NotifyOnExit. |
87 | * | 87 | * |
88 | *@li OProcess::Block -- The child process starts and the parent process | 88 | *@li OProcess::Block -- The child process starts and the parent process |
89 | *is suspended until the child process exits. (@em Really not recommended | 89 | *is suspended until the child process exits. (@em Really not recommended |
90 | *for programs with a GUI.) | 90 | *for programs with a GUI.) |
91 | * | 91 | * |
92 | *OProcess also provides several functions for determining the exit status | 92 | *OProcess also provides several functions for determining the exit status |
93 | *and the pid of the child process it represents. | 93 | *and the pid of the child process it represents. |
94 | * | 94 | * |
95 | *Furthermore it is possible to supply command-line arguments to the process | 95 | *Furthermore it is possible to supply command-line arguments to the process |
96 | *in a clean fashion (no null -- terminated stringlists and such...) | 96 | *in a clean fashion (no null -- terminated stringlists and such...) |
97 | * | 97 | * |
98 | *A small usage example: | 98 | *A small usage example: |
99 | *<pre> | 99 | *<pre> |
100 | *OProcess *proc = new OProcess; | 100 | *OProcess *proc = new OProcess; |
101 | * | 101 | * |
102 | **proc << "my_executable"; | 102 | **proc << "my_executable"; |
103 | **proc << "These" << "are" << "the" << "command" << "line" << "args"; | 103 | **proc << "These" << "are" << "the" << "command" << "line" << "args"; |
104 | *QApplication::connect(proc, SIGNAL(processExited(OProcess *)), | 104 | *QApplication::connect(proc, SIGNAL(processExited(Opie::Core::OProcess *)), |
105 | * pointer_to_my_object, SLOT(my_objects_slot(OProcess *))); | 105 | * pointer_to_my_object, SLOT(my_objects_slot(Opie::Core::OProcess *))); |
106 | *proc->start(); | 106 | *proc->start(); |
107 | *</pre> | 107 | *</pre> |
108 | * | 108 | * |
109 | *This will start "my_executable" with the commandline arguments "These"... | 109 | *This will start "my_executable" with the commandline arguments "These"... |
110 | * | 110 | * |
111 | *When the child process exits, the respective Qt signal will be emitted. | 111 | *When the child process exits, the respective Qt signal will be emitted. |
112 | * | 112 | * |
113 | *@sect Communication with the child process | 113 | *@sect Communication with the child process |
114 | * | 114 | * |
115 | *OProcess supports communication with the child process through | 115 | *OProcess supports communication with the child process through |
116 | *stdin/stdout/stderr. | 116 | *stdin/stdout/stderr. |
117 | * | 117 | * |
118 | *The following functions are provided for getting data from the child | 118 | *The following functions are provided for getting data from the child |
119 | *process or sending data to the child's stdin (For more information, | 119 | *process or sending data to the child's stdin (For more information, |
120 | *have a look at the documentation of each function): | 120 | *have a look at the documentation of each function): |
121 | * | 121 | * |
122 | *@li bool @ref writeStdin(char *buffer, int buflen); | 122 | *@li bool @ref writeStdin(char *buffer, int buflen); |
123 | *@li -- Transmit data to the child process's stdin. | 123 | *@li -- Transmit data to the child process's stdin. |
124 | * | 124 | * |
125 | *@li bool @ref closeStdin(); | 125 | *@li bool @ref closeStdin(); |
126 | *@li -- Closes the child process's stdin (which causes it to see an feof(stdin)). | 126 | *@li -- Closes the child process's stdin (which causes it to see an feof(stdin)). |
127 | *Returns false if you try to close stdin for a process that has been started | 127 | *Returns false if you try to close stdin for a process that has been started |
128 | *without a communication channel to stdin. | 128 | *without a communication channel to stdin. |
129 | * | 129 | * |
130 | *@li bool @ref closeStdout(); | 130 | *@li bool @ref closeStdout(); |
131 | *@li -- Closes the child process's stdout. | 131 | *@li -- Closes the child process's stdout. |
132 | *Returns false if you try to close stdout for a process that has been started | 132 | *Returns false if you try to close stdout for a process that has been started |
133 | *without a communication channel to stdout. | 133 | *without a communication channel to stdout. |
134 | * | 134 | * |
135 | *@li bool @ref closeStderr(); | 135 | *@li bool @ref closeStderr(); |
136 | *@li -- Closes the child process's stderr. | 136 | *@li -- Closes the child process's stderr. |
137 | *Returns false if you try to close stderr for a process that has been started | 137 | *Returns false if you try to close stderr for a process that has been started |
138 | *without a communication channel to stderr. | 138 | *without a communication channel to stderr. |
139 | * | 139 | * |
140 | * | 140 | * |
141 | *@sect QT signals: | 141 | *@sect QT signals: |
142 | * | 142 | * |
143 | *@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen); | 143 | *@li void @ref receivedStdout(OProcess *proc, char *buffer, int buflen); |
144 | *@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen); | 144 | *@li void @ref receivedStderr(OProcess *proc, char *buffer, int buflen); |
145 | *@li -- Indicates that new data has arrived from either the | 145 | *@li -- Indicates that new data has arrived from either the |
146 | *child process's stdout or stderr. | 146 | *child process's stdout or stderr. |
147 | * | 147 | * |
148 | *@li void @ref wroteStdin(OProcess *proc); | 148 | *@li void @ref wroteStdin(OProcess *proc); |
149 | *@li -- Indicates that all data that has been sent to the child process | 149 | *@li -- Indicates that all data that has been sent to the child process |
150 | *by a prior call to @ref writeStdin() has actually been transmitted to the | 150 | *by a prior call to @ref writeStdin() has actually been transmitted to the |
151 | *client . | 151 | *client . |
152 | * | 152 | * |
153 | *@author Christian Czezakte e9025461@student.tuwien.ac.at | 153 | *@author Christian Czezakte e9025461@student.tuwien.ac.at |
154 | *@author Holger Freyther (Opie Port) | 154 | *@author Holger Freyther (Opie Port) |
155 | * | 155 | * |
156 | **/ | 156 | **/ |
157 | class OProcess : public QObject | 157 | class OProcess : public QObject |
158 | { | 158 | { |
159 | Q_OBJECT | 159 | Q_OBJECT |
160 | 160 | ||
161 | public: | 161 | public: |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Modes in which the communication channel can be opened. | 164 | * Modes in which the communication channel can be opened. |
165 | * | 165 | * |
166 | * If communication for more than one channel is required, | 166 | * If communication for more than one channel is required, |
167 | * the values have to be or'ed together, for example to get | 167 | * the values have to be or'ed together, for example to get |
168 | * communication with stdout as well as with stdin, you would | 168 | * communication with stdout as well as with stdin, you would |
169 | * specify @p Stdin @p | @p Stdout | 169 | * specify @p Stdin @p | @p Stdout |
170 | * | 170 | * |
171 | * If @p NoRead is specified in conjunction with @p Stdout, | 171 | * If @p NoRead is specified in conjunction with @p Stdout, |
172 | * no data is actually read from @p Stdout but only | 172 | * no data is actually read from @p Stdout but only |
173 | * the signal @ref childOutput(int fd) is emitted. | 173 | * the signal @ref childOutput(int fd) is emitted. |
174 | */ | 174 | */ |
175 | enum Communication { NoCommunication = 0, Stdin = 1, Stdout = 2, Stderr = 4, | 175 | enum Communication { NoCommunication = 0, Stdin = 1, Stdout = 2, Stderr = 4, |
176 | AllOutput = 6, All = 7, | 176 | AllOutput = 6, All = 7, |
177 | NoRead }; | 177 | NoRead }; |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * Run-modes for a child process. | 180 | * Run-modes for a child process. |
181 | */ | 181 | */ |
182 | enum RunMode { | 182 | enum RunMode { |
183 | /** | 183 | /** |
184 | * The application does not receive notifications from the subprocess when | 184 | * The application does not receive notifications from the subprocess when |
185 | * it is finished or aborted. | 185 | * it is finished or aborted. |
186 | */ | 186 | */ |
187 | DontCare, | 187 | DontCare, |
188 | /** | 188 | /** |
189 | * The application is notified when the subprocess dies. | 189 | * The application is notified when the subprocess dies. |
190 | */ | 190 | */ |
191 | NotifyOnExit, | 191 | NotifyOnExit, |
192 | /** | 192 | /** |
193 | * The application is suspended until the started process is finished. | 193 | * The application is suspended until the started process is finished. |
194 | */ | 194 | */ |
195 | Block }; | 195 | Block }; |
196 | 196 | ||
197 | /** | 197 | /** |
198 | * Constructor | 198 | * Constructor |
199 | */ | 199 | */ |
200 | OProcess( QObject *parent = 0, const char *name = 0 ); | 200 | OProcess( QObject *parent = 0, const char *name = 0 ); |
201 | /** | 201 | /** |
202 | * Constructor | 202 | * Constructor |
203 | */ | 203 | */ |
204 | OProcess( const QString &arg0, QObject *parent = 0, const char *name = 0 ); | 204 | OProcess( const QString &arg0, QObject *parent = 0, const char *name = 0 ); |
205 | /** | 205 | /** |
206 | * Constructor | 206 | * Constructor |
207 | */ | 207 | */ |
208 | OProcess( const QStringList &args, QObject *parent = 0, const char *name = 0 ); | 208 | OProcess( const QStringList &args, QObject *parent = 0, const char *name = 0 ); |
209 | 209 | ||
210 | /** | 210 | /** |
211 | *Destructor: | 211 | *Destructor: |
212 | * | 212 | * |
213 | * If the process is running when the destructor for this class | 213 | * If the process is running when the destructor for this class |
214 | * is called, the child process is killed with a SIGKILL, but | 214 | * is called, the child process is killed with a SIGKILL, but |
215 | * only if the run mode is not of type @p DontCare. | 215 | * only if the run mode is not of type @p DontCare. |
216 | * Processes started as @p DontCare keep running anyway. | 216 | * Processes started as @p DontCare keep running anyway. |
217 | */ | 217 | */ |
218 | virtual ~OProcess(); | 218 | virtual ~OProcess(); |
219 | 219 | ||
220 | /** | 220 | /** |
221 | @deprecated | 221 | @deprecated |
222 | 222 | ||
223 | The use of this function is now deprecated. -- Please use the | 223 | The use of this function is now deprecated. -- Please use the |
224 | "operator<<" instead of "setExecutable". | 224 | "operator<<" instead of "setExecutable". |
225 | 225 | ||
226 | Sets the executable to be started with this OProcess object. | 226 | Sets the executable to be started with this OProcess object. |
227 | Returns false if the process is currently running (in that | 227 | Returns false if the process is currently running (in that |
228 | case the executable remains unchanged.) | 228 | case the executable remains unchanged.) |
229 | 229 | ||
230 | @see operator<< | 230 | @see operator<< |
231 | 231 | ||
232 | */ | 232 | */ |
233 | bool setExecutable( const QString& proc ); | 233 | bool setExecutable( const QString& proc ); |
@@ -355,314 +355,314 @@ public: | |||
355 | * | 355 | * |
356 | * @li Communication to stdin has not been requested in the @ref start() call. | 356 | * @li Communication to stdin has not been requested in the @ref start() call. |
357 | * | 357 | * |
358 | * @li Transmission of data to the child process by a previous call to | 358 | * @li Transmission of data to the child process by a previous call to |
359 | * @ref writeStdin() is still in progress. | 359 | * @ref writeStdin() is still in progress. |
360 | * | 360 | * |
361 | * Please note that the data is sent to the client asynchronously, | 361 | * Please note that the data is sent to the client asynchronously, |
362 | * so when this function returns, the data might not have been | 362 | * so when this function returns, the data might not have been |
363 | * processed by the child process. | 363 | * processed by the child process. |
364 | * | 364 | * |
365 | * If all the data has been sent to the client, the signal | 365 | * If all the data has been sent to the client, the signal |
366 | * @ref wroteStdin() will be emitted. | 366 | * @ref wroteStdin() will be emitted. |
367 | * | 367 | * |
368 | * Please note that you must not free "buffer" or call @ref writeStdin() | 368 | * Please note that you must not free "buffer" or call @ref writeStdin() |
369 | * again until either a @ref wroteStdin() signal indicates that the | 369 | * again until either a @ref wroteStdin() signal indicates that the |
370 | * data has been sent or a @ref processHasExited() signal shows that | 370 | * data has been sent or a @ref processHasExited() signal shows that |
371 | * the child process is no longer alive... | 371 | * the child process is no longer alive... |
372 | **/ | 372 | **/ |
373 | bool writeStdin( const char *buffer, int buflen ); | 373 | bool writeStdin( const char *buffer, int buflen ); |
374 | 374 | ||
375 | void flushStdin(); | 375 | void flushStdin(); |
376 | 376 | ||
377 | /** | 377 | /** |
378 | * This causes the stdin file descriptor of the child process to be | 378 | * This causes the stdin file descriptor of the child process to be |
379 | * closed indicating an "EOF" to the child. | 379 | * closed indicating an "EOF" to the child. |
380 | * | 380 | * |
381 | * @return @p false if no communication to the process's stdin | 381 | * @return @p false if no communication to the process's stdin |
382 | * had been specified in the call to @ref start(). | 382 | * had been specified in the call to @ref start(). |
383 | */ | 383 | */ |
384 | bool closeStdin(); | 384 | bool closeStdin(); |
385 | 385 | ||
386 | /** | 386 | /** |
387 | * This causes the stdout file descriptor of the child process to be | 387 | * This causes the stdout file descriptor of the child process to be |
388 | * closed. | 388 | * closed. |
389 | * | 389 | * |
390 | * @return @p false if no communication to the process's stdout | 390 | * @return @p false if no communication to the process's stdout |
391 | * had been specified in the call to @ref start(). | 391 | * had been specified in the call to @ref start(). |
392 | */ | 392 | */ |
393 | bool closeStdout(); | 393 | bool closeStdout(); |
394 | 394 | ||
395 | /** | 395 | /** |
396 | * This causes the stderr file descriptor of the child process to be | 396 | * This causes the stderr file descriptor of the child process to be |
397 | * closed. | 397 | * closed. |
398 | * | 398 | * |
399 | * @return @p false if no communication to the process's stderr | 399 | * @return @p false if no communication to the process's stderr |
400 | * had been specified in the call to @ref start(). | 400 | * had been specified in the call to @ref start(). |
401 | */ | 401 | */ |
402 | bool closeStderr(); | 402 | bool closeStderr(); |
403 | 403 | ||
404 | /** | 404 | /** |
405 | * Lets you see what your arguments are for debugging. | 405 | * Lets you see what your arguments are for debugging. |
406 | * \todo make const | 406 | * \todo make const |
407 | */ | 407 | */ |
408 | 408 | ||
409 | const QValueList<QCString> &args() | 409 | const QValueList<QCString> &args() |
410 | { | 410 | { |
411 | return arguments; | 411 | return arguments; |
412 | } | 412 | } |
413 | 413 | ||
414 | /** | 414 | /** |
415 | * Controls whether the started process should drop any | 415 | * Controls whether the started process should drop any |
416 | * setuid/segid privileges or whether it should keep them | 416 | * setuid/segid privileges or whether it should keep them |
417 | * | 417 | * |
418 | * The default is @p false : drop privileges | 418 | * The default is @p false : drop privileges |
419 | */ | 419 | */ |
420 | void setRunPrivileged( bool keepPrivileges ); | 420 | void setRunPrivileged( bool keepPrivileges ); |
421 | 421 | ||
422 | /** | 422 | /** |
423 | * Returns whether the started process will drop any | 423 | * Returns whether the started process will drop any |
424 | * setuid/segid privileges or whether it will keep them | 424 | * setuid/segid privileges or whether it will keep them |
425 | */ | 425 | */ |
426 | bool runPrivileged() const; | 426 | bool runPrivileged() const; |
427 | 427 | ||
428 | /** | 428 | /** |
429 | * Modifies the environment of the process to be started. | 429 | * Modifies the environment of the process to be started. |
430 | * This function must be called before starting the process. | 430 | * This function must be called before starting the process. |
431 | */ | 431 | */ |
432 | void setEnvironment( const QString &name, const QString &value ); | 432 | void setEnvironment( const QString &name, const QString &value ); |
433 | 433 | ||
434 | /** | 434 | /** |
435 | * Changes the current working directory (CWD) of the process | 435 | * Changes the current working directory (CWD) of the process |
436 | * to be started. | 436 | * to be started. |
437 | * This function must be called before starting the process. | 437 | * This function must be called before starting the process. |
438 | */ | 438 | */ |
439 | void setWorkingDirectory( const QString &dir ); | 439 | void setWorkingDirectory( const QString &dir ); |
440 | 440 | ||
441 | /** | 441 | /** |
442 | * Specify whether to start the command via a shell or directly. | 442 | * Specify whether to start the command via a shell or directly. |
443 | * The default is to start the command directly. | 443 | * The default is to start the command directly. |
444 | * If @p useShell is true @p shell will be used as shell, or | 444 | * If @p useShell is true @p shell will be used as shell, or |
445 | * if shell is empty, the standard shell is used. | 445 | * if shell is empty, the standard shell is used. |
446 | * @p quote A flag indicating whether to quote the arguments. | 446 | * @p quote A flag indicating whether to quote the arguments. |
447 | * | 447 | * |
448 | * When using a shell, the caller should make sure that all filenames etc. | 448 | * When using a shell, the caller should make sure that all filenames etc. |
449 | * are properly quoted when passed as argument. | 449 | * are properly quoted when passed as argument. |
450 | * @see quote() | 450 | * @see quote() |
451 | */ | 451 | */ |
452 | void setUseShell( bool useShell, const char *shell = 0 ); | 452 | void setUseShell( bool useShell, const char *shell = 0 ); |
453 | 453 | ||
454 | /** | 454 | /** |
455 | * This function can be used to quote an argument string such that | 455 | * This function can be used to quote an argument string such that |
456 | * the shell processes it properly. This is e. g. necessary for | 456 | * the shell processes it properly. This is e. g. necessary for |
457 | * user-provided file names which may contain spaces or quotes. | 457 | * user-provided file names which may contain spaces or quotes. |
458 | * It also prevents expansion of wild cards and environment variables. | 458 | * It also prevents expansion of wild cards and environment variables. |
459 | */ | 459 | */ |
460 | static QString quote( const QString &arg ); | 460 | static QString quote( const QString &arg ); |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * Detaches OProcess from child process. All communication is closed. | 463 | * Detaches OProcess from child process. All communication is closed. |
464 | * No exit notification is emitted any more for the child process. | 464 | * No exit notification is emitted any more for the child process. |
465 | * Deleting the OProcess will no longer kill the child process. | 465 | * Deleting the OProcess will no longer kill the child process. |
466 | * Note that the current process remains the parent process of the | 466 | * Note that the current process remains the parent process of the |
467 | * child process. | 467 | * child process. |
468 | */ | 468 | */ |
469 | void detach(); | 469 | void detach(); |
470 | 470 | ||
471 | /** | 471 | /** |
472 | * @return the PID of @a process, or -1 if the process is not running | 472 | * @return the PID of @a process, or -1 if the process is not running |
473 | */ | 473 | */ |
474 | static int processPID( const QString& process ); | 474 | static int processPID( const QString& process ); |
475 | 475 | ||
476 | signals: | 476 | signals: |
477 | 477 | ||
478 | /** | 478 | /** |
479 | * Emitted after the process has terminated when | 479 | * Emitted after the process has terminated when |
480 | * the process was run in the @p NotifyOnExit (==default option to | 480 | * the process was run in the @p NotifyOnExit (==default option to |
481 | * @ref start()) or the @ref Block mode. | 481 | * @ref start()) or the @ref Block mode. |
482 | **/ | 482 | **/ |
483 | void processExited( OProcess *proc ); | 483 | void processExited( Opie::Core::OProcess *proc ); |
484 | 484 | ||
485 | 485 | ||
486 | /** | 486 | /** |
487 | * Emitted, when output from the child process has | 487 | * Emitted, when output from the child process has |
488 | * been received on stdout. | 488 | * been received on stdout. |
489 | * | 489 | * |
490 | * To actually get | 490 | * To actually get |
491 | * these signals, the respective communication link (stdout/stderr) | 491 | * these signals, the respective communication link (stdout/stderr) |
492 | * has to be turned on in @ref start(). | 492 | * has to be turned on in @ref start(). |
493 | * | 493 | * |
494 | * @param buffer The data received. | 494 | * @param buffer The data received. |
495 | * @param buflen The number of bytes that are available. | 495 | * @param buflen The number of bytes that are available. |
496 | * | 496 | * |
497 | * You should copy the information contained in @p buffer to your private | 497 | * You should copy the information contained in @p buffer to your private |
498 | * data structures before returning from this slot. | 498 | * data structures before returning from this slot. |
499 | **/ | 499 | **/ |
500 | void receivedStdout( OProcess *proc, char *buffer, int buflen ); | 500 | void receivedStdout( Opie::Core::OProcess *proc, char *buffer, int buflen ); |
501 | 501 | ||
502 | /** | 502 | /** |
503 | * Emitted when output from the child process has | 503 | * Emitted when output from the child process has |
504 | * been received on stdout. | 504 | * been received on stdout. |
505 | * | 505 | * |
506 | * To actually get these signals, the respective communications link | 506 | * To actually get these signals, the respective communications link |
507 | * (stdout/stderr) has to be turned on in @ref start() and the | 507 | * (stdout/stderr) has to be turned on in @ref start() and the |
508 | * @p NoRead flag should have been passed. | 508 | * @p NoRead flag should have been passed. |
509 | * | 509 | * |
510 | * You will need to explicitly call resume() after your call to start() | 510 | * You will need to explicitly call resume() after your call to start() |
511 | * to begin processing data from the child process's stdout. This is | 511 | * to begin processing data from the child process's stdout. This is |
512 | * to ensure that this signal is not emitted when no one is connected | 512 | * to ensure that this signal is not emitted when no one is connected |
513 | * to it, otherwise this signal will not be emitted. | 513 | * to it, otherwise this signal will not be emitted. |
514 | * | 514 | * |
515 | * The data still has to be read from file descriptor @p fd. | 515 | * The data still has to be read from file descriptor @p fd. |
516 | **/ | 516 | **/ |
517 | void receivedStdout( int fd, int &len ); | 517 | void receivedStdout( int fd, int &len ); |
518 | 518 | ||
519 | 519 | ||
520 | /** | 520 | /** |
521 | * Emitted, when output from the child process has | 521 | * Emitted, when output from the child process has |
522 | * been received on stderr. | 522 | * been received on stderr. |
523 | * To actually get | 523 | * To actually get |
524 | * these signals, the respective communication link (stdout/stderr) | 524 | * these signals, the respective communication link (stdout/stderr) |
525 | * has to be turned on in @ref start(). | 525 | * has to be turned on in @ref start(). |
526 | * | 526 | * |
527 | * @param buffer The data received. | 527 | * @param buffer The data received. |
528 | * @param buflen The number of bytes that are available. | 528 | * @param buflen The number of bytes that are available. |
529 | * | 529 | * |
530 | * You should copy the information contained in @p buffer to your private | 530 | * You should copy the information contained in @p buffer to your private |
531 | * data structures before returning from this slot. | 531 | * data structures before returning from this slot. |
532 | */ | 532 | */ |
533 | void receivedStderr( OProcess *proc, char *buffer, int buflen ); | 533 | void receivedStderr( Opie::Core::OProcess *proc, char *buffer, int buflen ); |
534 | 534 | ||
535 | /** | 535 | /** |
536 | * Emitted after all the data that has been | 536 | * Emitted after all the data that has been |
537 | * specified by a prior call to @ref writeStdin() has actually been | 537 | * specified by a prior call to @ref writeStdin() has actually been |
538 | * written to the child process. | 538 | * written to the child process. |
539 | **/ | 539 | **/ |
540 | void wroteStdin( OProcess *proc ); | 540 | void wroteStdin( Opie::Core::OProcess *proc ); |
541 | 541 | ||
542 | protected slots: | 542 | protected slots: |
543 | 543 | ||
544 | /** | 544 | /** |
545 | * This slot gets activated when data from the child's stdout arrives. | 545 | * This slot gets activated when data from the child's stdout arrives. |
546 | * It usually calls "childOutput" | 546 | * It usually calls "childOutput" |
547 | */ | 547 | */ |
548 | void slotChildOutput( int fdno ); | 548 | void slotChildOutput( int fdno ); |
549 | 549 | ||
550 | /** | 550 | /** |
551 | * This slot gets activated when data from the child's stderr arrives. | 551 | * This slot gets activated when data from the child's stderr arrives. |
552 | * It usually calls "childError" | 552 | * It usually calls "childError" |
553 | */ | 553 | */ |
554 | void slotChildError( int fdno ); | 554 | void slotChildError( int fdno ); |
555 | /* | 555 | /* |
556 | Slot functions for capturing stdout and stderr of the child | 556 | Slot functions for capturing stdout and stderr of the child |
557 | */ | 557 | */ |
558 | 558 | ||
559 | /** | 559 | /** |
560 | * Called when another bulk of data can be sent to the child's | 560 | * Called when another bulk of data can be sent to the child's |
561 | * stdin. If there is no more data to be sent to stdin currently | 561 | * stdin. If there is no more data to be sent to stdin currently |
562 | * available, this function must disable the QSocketNotifier "innot". | 562 | * available, this function must disable the QSocketNotifier "innot". |
563 | */ | 563 | */ |
564 | void slotSendData( int dummy ); | 564 | void slotSendData( int dummy ); |
565 | 565 | ||
566 | protected: | 566 | protected: |
567 | 567 | ||
568 | /** | 568 | /** |
569 | * Sets up the environment according to the data passed via | 569 | * Sets up the environment according to the data passed via |
570 | * setEnvironment(...) | 570 | * setEnvironment(...) |
571 | */ | 571 | */ |
572 | void setupEnvironment(); | 572 | void setupEnvironment(); |
573 | 573 | ||
574 | /** | 574 | /** |
575 | * The list of the process' command line arguments. The first entry | 575 | * The list of the process' command line arguments. The first entry |
576 | * in this list is the executable itself. | 576 | * in this list is the executable itself. |
577 | */ | 577 | */ |
578 | QValueList<QCString> arguments; | 578 | QValueList<QCString> arguments; |
579 | /** | 579 | /** |
580 | * How to run the process (Block, NotifyOnExit, DontCare). You should | 580 | * How to run the process (Block, NotifyOnExit, DontCare). You should |
581 | * not modify this data member directly from derived classes. | 581 | * not modify this data member directly from derived classes. |
582 | */ | 582 | */ |
583 | RunMode run_mode; | 583 | RunMode run_mode; |
584 | /** | 584 | /** |
585 | * true if the process is currently running. You should not | 585 | * true if the process is currently running. You should not |
586 | * modify this data member directly from derived classes. For | 586 | * modify this data member directly from derived classes. For |
587 | * reading the value of this data member, please use "isRunning()" | 587 | * reading the value of this data member, please use "isRunning()" |
588 | * since "runs" will probably be made private in later versions | 588 | * since "runs" will probably be made private in later versions |
589 | * of OProcess. | 589 | * of OProcess. |
590 | */ | 590 | */ |
591 | bool runs; | 591 | bool runs; |
592 | 592 | ||
593 | /** | 593 | /** |
594 | * The PID of the currently running process (see "getPid()"). | 594 | * The PID of the currently running process (see "getPid()"). |
595 | * You should not modify this data member in derived classes. | 595 | * You should not modify this data member in derived classes. |
596 | * Please use "getPid()" instead of directly accessing this | 596 | * Please use "getPid()" instead of directly accessing this |
597 | * member function since it will probably be made private in | 597 | * member function since it will probably be made private in |
598 | * later versions of OProcess. | 598 | * later versions of OProcess. |
599 | */ | 599 | */ |
600 | pid_t pid_; | 600 | pid_t pid_; |
601 | 601 | ||
602 | /** | 602 | /** |
603 | * The process' exit status as returned by "waitpid". You should not | 603 | * The process' exit status as returned by "waitpid". You should not |
604 | * modify the value of this data member from derived classes. You should | 604 | * modify the value of this data member from derived classes. You should |
605 | * rather use @ref exitStatus than accessing this data member directly | 605 | * rather use @ref exitStatus than accessing this data member directly |
606 | * since it will probably be made private in further versions of | 606 | * since it will probably be made private in further versions of |
607 | * OProcess. | 607 | * OProcess. |
608 | */ | 608 | */ |
609 | int status; | 609 | int status; |
610 | 610 | ||
611 | 611 | ||
612 | /** | 612 | /** |
613 | * See setRunPrivileged() | 613 | * See setRunPrivileged() |
614 | */ | 614 | */ |
615 | bool keepPrivs; | 615 | bool keepPrivs; |
616 | 616 | ||
617 | /* | 617 | /* |
618 | Functions for setting up the sockets for communication. | 618 | Functions for setting up the sockets for communication. |
619 | setupCommunication | 619 | setupCommunication |
620 | -- is called from "start" before "fork"ing. | 620 | -- is called from "start" before "fork"ing. |
621 | commSetupDoneP | 621 | commSetupDoneP |
622 | -- completes communication socket setup in the parent | 622 | -- completes communication socket setup in the parent |
623 | commSetupDoneC | 623 | commSetupDoneC |
624 | -- completes communication setup in the child process | 624 | -- completes communication setup in the child process |
625 | commClose | 625 | commClose |
626 | -- frees all allocated communication resources in the parent | 626 | -- frees all allocated communication resources in the parent |
627 | after the process has exited | 627 | after the process has exited |
628 | */ | 628 | */ |
629 | 629 | ||
630 | /** | 630 | /** |
631 | * This function is called from "OProcess::start" right before a "fork" takes | 631 | * This function is called from "OProcess::start" right before a "fork" takes |
632 | * place. According to | 632 | * place. According to |
633 | * the "comm" parameter this function has to initialize the "in", "out" and | 633 | * the "comm" parameter this function has to initialize the "in", "out" and |
634 | * "err" data member of OProcess. | 634 | * "err" data member of OProcess. |
635 | * | 635 | * |
636 | * This function should return 0 if setting the needed communication channels | 636 | * This function should return 0 if setting the needed communication channels |
637 | * was successful. | 637 | * was successful. |
638 | * | 638 | * |
639 | * The default implementation is to create UNIX STREAM sockets for the communication, | 639 | * The default implementation is to create UNIX STREAM sockets for the communication, |
640 | * but you could overload this function and establish a TCP/IP communication for | 640 | * but you could overload this function and establish a TCP/IP communication for |
641 | * network communication, for example. | 641 | * network communication, for example. |
642 | */ | 642 | */ |
643 | virtual int setupCommunication( Communication comm ); | 643 | virtual int setupCommunication( Communication comm ); |
644 | 644 | ||
645 | /** | 645 | /** |
646 | * Called right after a (successful) fork on the parent side. This function | 646 | * Called right after a (successful) fork on the parent side. This function |
647 | * will usually do some communications cleanup, like closing the reading end | 647 | * will usually do some communications cleanup, like closing the reading end |
648 | * of the "stdin" communication channel. | 648 | * of the "stdin" communication channel. |
649 | * | 649 | * |
650 | * Furthermore, it must also create the QSocketNotifiers "innot", "outnot" and | 650 | * Furthermore, it must also create the QSocketNotifiers "innot", "outnot" and |
651 | * "errnot" and connect their Qt slots to the respective OProcess member functions. | 651 | * "errnot" and connect their Qt slots to the respective OProcess member functions. |
652 | * | 652 | * |
653 | * For a more detailed explanation, it is best to have a look at the default | 653 | * For a more detailed explanation, it is best to have a look at the default |
654 | * implementation of "setupCommunication" in kprocess.cpp. | 654 | * implementation of "setupCommunication" in kprocess.cpp. |
655 | */ | 655 | */ |
656 | virtual int commSetupDoneP(); | 656 | virtual int commSetupDoneP(); |
657 | 657 | ||
658 | /** | 658 | /** |
659 | * Called right after a (successful) fork, but before an "exec" on the child | 659 | * Called right after a (successful) fork, but before an "exec" on the child |
660 | * process' side. It usually just closes the unused communication ends of | 660 | * process' side. It usually just closes the unused communication ends of |
661 | * "in", "out" and "err" (like the writing end of the "in" communication | 661 | * "in", "out" and "err" (like the writing end of the "in" communication |
662 | * channel. | 662 | * channel. |
663 | */ | 663 | */ |
664 | virtual int commSetupDoneC(); | 664 | virtual int commSetupDoneC(); |
665 | 665 | ||
666 | 666 | ||
667 | /** | 667 | /** |
668 | * Immediately called after a process has exited. This function normally | 668 | * Immediately called after a process has exited. This function normally |
diff --git a/libopie2/opienet/opcap.h b/libopie2/opienet/opcap.h index dc609a3..72a78de 100644 --- a/libopie2/opienet/opcap.h +++ b/libopie2/opienet/opcap.h | |||
@@ -573,149 +573,149 @@ class ODHCPPacket : public QObject | |||
573 | *======================================================================================*/ | 573 | *======================================================================================*/ |
574 | 574 | ||
575 | class OTCPPacket : public QObject | 575 | class OTCPPacket : public QObject |
576 | { | 576 | { |
577 | Q_OBJECT | 577 | Q_OBJECT |
578 | 578 | ||
579 | public: | 579 | public: |
580 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); | 580 | OTCPPacket( const unsigned char*, const struct tcphdr*, QObject* parent = 0 ); |
581 | virtual ~OTCPPacket(); | 581 | virtual ~OTCPPacket(); |
582 | 582 | ||
583 | int fromPort() const; | 583 | int fromPort() const; |
584 | int toPort() const; | 584 | int toPort() const; |
585 | int seq() const; | 585 | int seq() const; |
586 | int ack() const; | 586 | int ack() const; |
587 | int window() const; | 587 | int window() const; |
588 | int checksum() const; | 588 | int checksum() const; |
589 | 589 | ||
590 | private: | 590 | private: |
591 | const struct tcphdr* _tcphdr; | 591 | const struct tcphdr* _tcphdr; |
592 | class Private; | 592 | class Private; |
593 | Private *d; | 593 | Private *d; |
594 | }; | 594 | }; |
595 | 595 | ||
596 | 596 | ||
597 | /*====================================================================================== | 597 | /*====================================================================================== |
598 | * OPacketCapturer | 598 | * OPacketCapturer |
599 | *======================================================================================*/ | 599 | *======================================================================================*/ |
600 | 600 | ||
601 | /** | 601 | /** |
602 | * @brief A class based wrapper for network packet capturing. | 602 | * @brief A class based wrapper for network packet capturing. |
603 | * | 603 | * |
604 | * This class is the base of a high-level interface to the well known packet capturing | 604 | * This class is the base of a high-level interface to the well known packet capturing |
605 | * library libpcap. | 605 | * library libpcap. |
606 | * @see http://tcpdump.org | 606 | * @see http://tcpdump.org |
607 | */ | 607 | */ |
608 | class OPacketCapturer : public QObject | 608 | class OPacketCapturer : public QObject |
609 | { | 609 | { |
610 | Q_OBJECT | 610 | Q_OBJECT |
611 | 611 | ||
612 | public: | 612 | public: |
613 | /** | 613 | /** |
614 | * Constructor. | 614 | * Constructor. |
615 | */ | 615 | */ |
616 | OPacketCapturer( QObject* parent = 0, const char* name = 0 ); | 616 | OPacketCapturer( QObject* parent = 0, const char* name = 0 ); |
617 | /** | 617 | /** |
618 | * Destructor. | 618 | * Destructor. |
619 | */ | 619 | */ |
620 | ~OPacketCapturer(); | 620 | ~OPacketCapturer(); |
621 | /** | 621 | /** |
622 | * Set the packet capturer to use blocking or non-blocking IO. This can be useful when | 622 | * Set the packet capturer to use blocking or non-blocking IO. This can be useful when |
623 | * not using the socket notifier, e.g. without an application object. | 623 | * not using the socket notifier, e.g. without an application object. |
624 | */ | 624 | */ |
625 | void setBlocking( bool ); | 625 | void setBlocking( bool ); |
626 | /** | 626 | /** |
627 | * @returns true if the packet capturer uses blocking IO calls. | 627 | * @returns true if the packet capturer uses blocking IO calls. |
628 | */ | 628 | */ |
629 | bool blocking() const; | 629 | bool blocking() const; |
630 | /** | 630 | /** |
631 | * Close the packet capturer. This is automatically done in the destructor. | 631 | * Close the packet capturer. This is automatically done in the destructor. |
632 | */ | 632 | */ |
633 | void close(); | 633 | void close(); |
634 | /** | 634 | /** |
635 | * Close the output capture file. | 635 | * Close the output capture file. |
636 | */ | 636 | */ |
637 | void closeDumpFile(); | 637 | void closeDumpFile(); |
638 | /** | 638 | /** |
639 | * @returns the data link type. | 639 | * @returns the data link type. |
640 | * @see <pcap.h> for possible values. | 640 | * @see <pcap.h> for possible values. |
641 | */ | 641 | */ |
642 | int dataLink() const; | 642 | int dataLink() const; |
643 | /** | 643 | /** |
644 | * Dump a packet to the output capture file. | 644 | * Dump a packet to the output capture file. |
645 | */ | 645 | */ |
646 | void dump( OPacket* ); | 646 | void dump( OPacket* ); |
647 | /** | 647 | /** |
648 | * @returns the file descriptor of the packet capturer. This is only useful, if | 648 | * @returns the file descriptor of the packet capturer. This is only useful, if |
649 | * not using the socket notifier, e.g. without an application object. | 649 | * not using the socket notifier, e.g. without an application object. |
650 | */ | 650 | */ |
651 | int fileno() const; | 651 | int fileno() const; |
652 | /** | 652 | /** |
653 | * @returns the next @ref OPacket from the packet capturer. | 653 | * @returns the next @ref OPacket from the packet capturer. |
654 | * @note If blocking mode is true then this call might block. | 654 | * @note If blocking mode is true then this call might block. |
655 | */ | 655 | */ |
656 | OPacket* next(); | 656 | OPacket* next(); |
657 | /** | 657 | /** |
658 | * @returns the next @ref OPacket from the packet capturer, if | 658 | * @returns the next @ref OPacket from the packet capturer, if |
659 | * one arrives within @a time milliseconds. | 659 | * one arrives within @a time milliseconds. |
660 | */ | 660 | */ |
661 | OPacket* next( int time ); | 661 | OPacket* next( int time ); |
662 | /** | 662 | /** |
663 | * Open the packet capturer to capture packets in live-mode from @a interface. | 663 | * Open the packet capturer to capture packets in live-mode from @a interface. |
664 | */ | 664 | */ |
665 | bool open( const QString& interface ); | 665 | bool open( const QString& interface ); |
666 | /** | 666 | /** |
667 | * Open the packet capturer to capture packets in offline-mode from @a file. | 667 | * Open the packet capturer to capture packets in offline-mode from @a file. |
668 | */ | 668 | */ |
669 | bool open( const QFile& file ); | 669 | bool open( const QFile& file ); |
670 | /** | 670 | /** |
671 | * Open a prerecorded tcpdump compatible capture file for use with @ref dump() | 671 | * Open a prerecorded tcpdump compatible capture file for use with @ref dump() |
672 | */ | 672 | */ |
673 | bool openDumpFile( const QString& filename ); | 673 | bool openDumpFile( const QString& filename ); |
674 | /** | 674 | /** |
675 | * @returns true if the packet capturer is open | 675 | * @returns true if the packet capturer is open |
676 | */ | 676 | */ |
677 | bool isOpen() const; | 677 | bool isOpen() const; |
678 | /** | 678 | /** |
679 | * @returns the snapshot length of this packet capturer | 679 | * @returns the snapshot length of this packet capturer |
680 | */ | 680 | */ |
681 | int snapShot() const; | 681 | int snapShot() const; |
682 | /** | 682 | /** |
683 | * @returns true if the input capture file has a different byte-order | 683 | * @returns true if the input capture file has a different byte-order |
684 | * than the byte-order of the running system. | 684 | * than the byte-order of the running system. |
685 | */ | 685 | */ |
686 | bool swapped() const; | 686 | bool swapped() const; |
687 | /** | 687 | /** |
688 | * @returns the libpcap version string used to write the input capture file. | 688 | * @returns the libpcap version string used to write the input capture file. |
689 | */ | 689 | */ |
690 | QString version() const; | 690 | QString version() const; |
691 | /** | 691 | /** |
692 | * @returns the packet statistic database. | 692 | * @returns the packet statistic database. |
693 | * @see QMap | 693 | * @see QMap |
694 | */ | 694 | */ |
695 | const QMap<QString,int>& statistics() const; | 695 | const QMap<QString,int>& statistics() const; |
696 | 696 | ||
697 | signals: | 697 | signals: |
698 | /** | 698 | /** |
699 | * This signal is emitted, when a packet has been received. | 699 | * This signal is emitted, when a packet has been received. |
700 | */ | 700 | */ |
701 | void receivedPacket( OPacket* ); | 701 | void receivedPacket( Opie::Net::OPacket* ); |
702 | 702 | ||
703 | protected slots: | 703 | protected slots: |
704 | void readyToReceive(); | 704 | void readyToReceive(); |
705 | 705 | ||
706 | protected: | 706 | protected: |
707 | QString _name; // devicename | 707 | QString _name; // devicename |
708 | bool _open; // check this before doing pcap calls | 708 | bool _open; // check this before doing pcap calls |
709 | pcap_t* _pch; // pcap library handle | 709 | pcap_t* _pch; // pcap library handle |
710 | pcap_dumper_t* _pcd; // pcap dumper handle | 710 | pcap_dumper_t* _pcd; // pcap dumper handle |
711 | QSocketNotifier* _sn; // socket notifier for main loop | 711 | QSocketNotifier* _sn; // socket notifier for main loop |
712 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap | 712 | mutable char _errbuf[PCAP_ERRBUF_SIZE]; // holds error strings from libpcap |
713 | QMap<QString, int> _stats; // statistics; | 713 | QMap<QString, int> _stats; // statistics; |
714 | class Private; // Private Forward declaration | 714 | class Private; // Private Forward declaration |
715 | Private *d; // if we need to add data | 715 | Private *d; // if we need to add data |
716 | }; | 716 | }; |
717 | } | 717 | } |
718 | } | 718 | } |
719 | 719 | ||
720 | #endif // OPCAP_H | 720 | #endif // OPCAP_H |
721 | 721 | ||
diff --git a/libopie2/opieui/opopupmenu.h b/libopie2/opieui/opopupmenu.h index 419a954..294edcc 100644 --- a/libopie2/opieui/opopupmenu.h +++ b/libopie2/opieui/opopupmenu.h | |||
@@ -109,156 +109,156 @@ private: | |||
109 | OPopupTitlePrivate *d; | 109 | OPopupTitlePrivate *d; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * OPopupMenu is a class for menus with standard title items and keyboard | 113 | * OPopupMenu is a class for menus with standard title items and keyboard |
114 | * accessibility for popups with many options and/or varying options. It acts | 114 | * accessibility for popups with many options and/or varying options. It acts |
115 | * identically to QPopupMenu, with the addition of insertTitle(), | 115 | * identically to QPopupMenu, with the addition of insertTitle(), |
116 | * changeTitle(), setKeyboardShortcutsEnabled() and | 116 | * changeTitle(), setKeyboardShortcutsEnabled() and |
117 | * setKeyboardShortcutsExecute() methods. | 117 | * setKeyboardShortcutsExecute() methods. |
118 | * | 118 | * |
119 | * The titles support a text string, an icon, plus user defined gradients, | 119 | * The titles support a text string, an icon, plus user defined gradients, |
120 | * colors, and background pixmaps. | 120 | * colors, and background pixmaps. |
121 | * | 121 | * |
122 | * The keyboard search algorithm is incremental with additional underlining | 122 | * The keyboard search algorithm is incremental with additional underlining |
123 | * for user feedback. | 123 | * for user feedback. |
124 | * | 124 | * |
125 | * @short A menu with title items. | 125 | * @short A menu with title items. |
126 | * @author Daniel M. Duley <mosfet@kde.org> | 126 | * @author Daniel M. Duley <mosfet@kde.org> |
127 | * @author Hamish Rodda <meddie@yoyo.its.monash.edu.au> | 127 | * @author Hamish Rodda <meddie@yoyo.its.monash.edu.au> |
128 | */ | 128 | */ |
129 | class OPopupMenu : public QPopupMenu { | 129 | class OPopupMenu : public QPopupMenu { |
130 | Q_OBJECT | 130 | Q_OBJECT |
131 | public: | 131 | public: |
132 | /** | 132 | /** |
133 | * Constructs a OPopupMenu. | 133 | * Constructs a OPopupMenu. |
134 | */ | 134 | */ |
135 | OPopupMenu(QWidget *parent=0, const char *name=0); | 135 | OPopupMenu(QWidget *parent=0, const char *name=0); |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Destructs the object | 138 | * Destructs the object |
139 | */ | 139 | */ |
140 | ~OPopupMenu(); | 140 | ~OPopupMenu(); |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Inserts a title item with no icon. | 143 | * Inserts a title item with no icon. |
144 | */ | 144 | */ |
145 | int insertTitle(const QString &text, int id=-1, int index=-1); | 145 | int insertTitle(const QString &text, int id=-1, int index=-1); |
146 | /** | 146 | /** |
147 | * Inserts a title item with the given icon and title. | 147 | * Inserts a title item with the given icon and title. |
148 | */ | 148 | */ |
149 | int insertTitle(const QPixmap &icon, const QString &text, int id=-1, | 149 | int insertTitle(const QPixmap &icon, const QString &text, int id=-1, |
150 | int index=-1); | 150 | int index=-1); |
151 | /** | 151 | /** |
152 | * Changes the title of the item at the specified id. If a icon was | 152 | * Changes the title of the item at the specified id. If a icon was |
153 | * previously set it is cleared. | 153 | * previously set it is cleared. |
154 | */ | 154 | */ |
155 | void changeTitle(int id, const QString &text); | 155 | void changeTitle(int id, const QString &text); |
156 | /** | 156 | /** |
157 | * Changes the title and icon of the title item at the specified id. | 157 | * Changes the title and icon of the title item at the specified id. |
158 | */ | 158 | */ |
159 | void changeTitle(int id, const QPixmap &icon, const QString &text); | 159 | void changeTitle(int id, const QPixmap &icon, const QString &text); |
160 | /** | 160 | /** |
161 | * Returns the title of the title item at the specified id. The default | 161 | * Returns the title of the title item at the specified id. The default |
162 | * id of -1 is for backwards compatibility only, you should always specify | 162 | * id of -1 is for backwards compatibility only, you should always specify |
163 | * the id. | 163 | * the id. |
164 | */ | 164 | */ |
165 | QString title(int id=-1) const; | 165 | QString title(int id=-1) const; |
166 | /** | 166 | /** |
167 | * Returns the icon of the title item at the specified id. | 167 | * Returns the icon of the title item at the specified id. |
168 | */ | 168 | */ |
169 | QPixmap titlePixmap(int id) const; | 169 | QPixmap titlePixmap(int id) const; |
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Enables keyboard navigation by searching for the entered key sequence. | 172 | * Enables keyboard navigation by searching for the entered key sequence. |
173 | * Also underlines the currently selected item, providing feedback on the search. | 173 | * Also underlines the currently selected item, providing feedback on the search. |
174 | * | 174 | * |
175 | * Defaults to off. | 175 | * Defaults to off. |
176 | * | 176 | * |
177 | * WARNING: calls to text() of currently keyboard-selected items will | 177 | * WARNING: calls to text() of currently keyboard-selected items will |
178 | * contain additional ampersand characters. | 178 | * contain additional ampersand characters. |
179 | * | 179 | * |
180 | * WARNING: though pre-existing keyboard shortcuts will not interfere with the | 180 | * WARNING: though pre-existing keyboard shortcuts will not interfere with the |
181 | * operation of this feature, they may be confusing to the user as the existing | 181 | * operation of this feature, they may be confusing to the user as the existing |
182 | * shortcuts will not work. | 182 | * shortcuts will not work. |
183 | * @since 3.1 | 183 | * @since 3.1 |
184 | */ | 184 | */ |
185 | void setKeyboardShortcutsEnabled(bool enable); | 185 | void setKeyboardShortcutsEnabled(bool enable); |
186 | 186 | ||
187 | /** | 187 | /** |
188 | * Enables execution of the menu item once it is uniquely specified. | 188 | * Enables execution of the menu item once it is uniquely specified. |
189 | * Defaults to off. | 189 | * Defaults to off. |
190 | * @since 3.1 | 190 | * @since 3.1 |
191 | */ | 191 | */ |
192 | void setKeyboardShortcutsExecute(bool enable); | 192 | void setKeyboardShortcutsExecute(bool enable); |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Obsolete method provided for backwards compatibility only. Use the | 195 | * Obsolete method provided for backwards compatibility only. Use the |
196 | * normal constructor and insertTitle instead. | 196 | * normal constructor and insertTitle instead. |
197 | */ | 197 | */ |
198 | OPopupMenu(const QString &title, QWidget *parent=0, const char *name=0); | 198 | OPopupMenu(const QString &title, QWidget *parent=0, const char *name=0); |
199 | /** | 199 | /** |
200 | * Obsolete method provided for backwards compatibility only. Use | 200 | * Obsolete method provided for backwards compatibility only. Use |
201 | * insertTitle and changeTitle instead. | 201 | * insertTitle and changeTitle instead. |
202 | */ | 202 | */ |
203 | void setTitle(const QString &title); | 203 | void setTitle(const QString &title); |
204 | 204 | ||
205 | /** | 205 | /** |
206 | * Returns the context menu associated with this menu | 206 | * Returns the context menu associated with this menu |
207 | * @since 3.2 | 207 | * @since 3.2 |
208 | */ | 208 | */ |
209 | QPopupMenu* contextMenu(); | 209 | QPopupMenu* contextMenu(); |
210 | 210 | ||
211 | /** | 211 | /** |
212 | * Hides the context menu if shown | 212 | * Hides the context menu if shown |
213 | * @since 3.2 | 213 | * @since 3.2 |
214 | */ | 214 | */ |
215 | void cancelContextMenuShow(); | 215 | void cancelContextMenuShow(); |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Returns the OPopupMenu associated with the current context menu | 218 | * Returns the OPopupMenu associated with the current context menu |
219 | * @since 3.2 | 219 | * @since 3.2 |
220 | */ | 220 | */ |
221 | static OPopupMenu* contextMenuFocus(); | 221 | static OPopupMenu* contextMenuFocus(); |
222 | 222 | ||
223 | /** | 223 | /** |
224 | * returns the ID of the menuitem associated with the current context menu | 224 | * returns the ID of the menuitem associated with the current context menu |
225 | * @since 3.2 | 225 | * @since 3.2 |
226 | */ | 226 | */ |
227 | static int contextMenuFocusItem(); | 227 | static int contextMenuFocusItem(); |
228 | 228 | ||
229 | signals: | 229 | signals: |
230 | /** | 230 | /** |
231 | * connect to this signal to be notified when a context menu is about to be shown | 231 | * connect to this signal to be notified when a context menu is about to be shown |
232 | * @param menu The menu that the context menu is about to be shown for | 232 | * @param menu The menu that the context menu is about to be shown for |
233 | * @param menuItem The menu item that the context menu is currently on | 233 | * @param menuItem The menu item that the context menu is currently on |
234 | * @param ctxMenu The context menu itself | 234 | * @param ctxMenu The context menu itself |
235 | * @since 3.2 | 235 | * @since 3.2 |
236 | */ | 236 | */ |
237 | void aboutToShowContextMenu(OPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu); | 237 | void aboutToShowContextMenu(Opie::Ui::OPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu); |
238 | 238 | ||
239 | protected: | 239 | protected: |
240 | virtual void closeEvent(QCloseEvent *); | 240 | virtual void closeEvent(QCloseEvent *); |
241 | virtual void keyPressEvent(QKeyEvent* e); | 241 | virtual void keyPressEvent(QKeyEvent* e); |
242 | virtual bool eventFilter(QObject* obj, QEvent* event); | 242 | virtual bool eventFilter(QObject* obj, QEvent* event); |
243 | virtual void hideEvent(QHideEvent*); | 243 | virtual void hideEvent(QHideEvent*); |
244 | 244 | ||
245 | virtual void virtual_hook( int id, void* data ); | 245 | virtual void virtual_hook( int id, void* data ); |
246 | 246 | ||
247 | protected slots: | 247 | protected slots: |
248 | /// @since 3.1 | 248 | /// @since 3.1 |
249 | QString underlineText(const QString& text, uint length); | 249 | QString underlineText(const QString& text, uint length); |
250 | /// @since 3.1 | 250 | /// @since 3.1 |
251 | void resetKeyboardVars(bool noMatches = false); | 251 | void resetKeyboardVars(bool noMatches = false); |
252 | void itemHighlighted(int whichItem); | 252 | void itemHighlighted(int whichItem); |
253 | void showCtxMenu(QPoint pos); | 253 | void showCtxMenu(QPoint pos); |
254 | void ctxMenuHiding(); | 254 | void ctxMenuHiding(); |
255 | 255 | ||
256 | private: | 256 | private: |
257 | class OPopupMenuPrivate; | 257 | class OPopupMenuPrivate; |
258 | OPopupMenuPrivate *d; | 258 | OPopupMenuPrivate *d; |
259 | }; | 259 | }; |
260 | 260 | ||
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | #endif | 264 | #endif |
diff --git a/libopie2/opieui/otimepicker.h b/libopie2/opieui/otimepicker.h index 01bb557..fb20781 100644 --- a/libopie2/opieui/otimepicker.h +++ b/libopie2/opieui/otimepicker.h | |||
@@ -1,132 +1,129 @@ | |||
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 | 29 | ||
30 | #ifndef OTIMEPICKER_H | 30 | #ifndef OTIMEPICKER_H |
31 | #define OTIMEPICKER_H | 31 | #define OTIMEPICKER_H |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/oclickablelabel.h> | 34 | #include <opie2/oclickablelabel.h> |
35 | #include <opie2/otimepickerbase.h> | 35 | #include <opie2/otimepickerbase.h> |
36 | 36 | ||
37 | /* QT */ | 37 | /* QT */ |
38 | #include <qwidget.h> | 38 | #include <qwidget.h> |
39 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qdatetime.h> | 40 | #include <qdatetime.h> |
41 | #include <qdialog.h> | 41 | #include <qdialog.h> |
42 | 42 | ||
43 | 43 | ||
44 | namespace Opie { | 44 | namespace Opie { |
45 | namespace Ui { | 45 | namespace Ui { |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * A class to pick time. It uses clickable labels | 48 | * A class to pick time. It uses clickable labels |
49 | * internally to allow a quick selection of a time. | 49 | * internally to allow a quick selection of a time. |
50 | * A time can be selected by two clicks of a user | 50 | * A time can be selected by two clicks of a user |
51 | * | 51 | * |
52 | * @short A widget to quickly pick a QTime | 52 | * @short A widget to quickly pick a QTime |
53 | * @version 1.0 | 53 | * @version 1.0 |
54 | * @see QWidget | 54 | * @see QWidget |
55 | * @see QTime | 55 | * @see QTime |
56 | * @author Hakan Ardo, Stefan Eilers | 56 | * @author Hakan Ardo, Stefan Eilers |
57 | */ | 57 | */ |
58 | class OTimePicker : public QWidget | 58 | class OTimePicker : public QWidget |
59 | { | 59 | { |
60 | Q_OBJECT | 60 | Q_OBJECT |
61 | 61 | ||
62 | public: | 62 | public: |
63 | OTimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | 63 | OTimePicker(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); |
64 | 64 | ||
65 | public slots: | 65 | public slots: |
66 | void setHour(int h); | 66 | void setHour(int h); |
67 | void setMinute(int m); | 67 | void setMinute(int m); |
68 | void setTime( const QTime& ); | 68 | void setTime( const QTime& ); |
69 | void setTime( int h, int m ); | 69 | void setTime( int h, int m ); |
70 | 70 | ||
71 | public: | 71 | public: |
72 | QTime time()const; | 72 | QTime time()const; |
73 | 73 | ||
74 | private: | 74 | private: |
75 | QValueList<OClickableLabel *> hourLst; | 75 | QValueList<OClickableLabel *> hourLst; |
76 | QValueList<OClickableLabel *> minuteLst; | 76 | QValueList<OClickableLabel *> minuteLst; |
77 | QTime tm; | 77 | QTime tm; |
78 | struct Private; | 78 | struct Private; |
79 | Private *d; | 79 | Private *d; |
80 | 80 | ||
81 | private slots: | 81 | private slots: |
82 | void slotHour(bool b); | 82 | void slotHour(bool b); |
83 | void slotMinute(bool b); | 83 | void slotMinute(bool b); |
84 | 84 | ||
85 | signals: | 85 | signals: |
86 | /** | 86 | /** |
87 | * gets emitted when the time got changed by the user | 87 | * gets emitted when the time got changed by the user |
88 | */ | 88 | */ |
89 | void timeChanged(const QTime &); | 89 | void timeChanged(const QTime &); |
90 | }; | 90 | }; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * | 93 | * |
94 | * @short A small dialog to pick a time | 94 | * @short A small dialog to pick a time |
95 | * @version 1.0 | 95 | * @version 1.0 |
96 | * @author Stefan Eilers | 96 | * @author Stefan Eilers |
97 | * | 97 | * |
98 | **/ | 98 | **/ |
99 | 99 | ||
100 | class OTimePickerDialog: public OTimePickerDialogBase | 100 | class OTimePickerDialog: public OTimePickerDialogBase |
101 | { | 101 | { |
102 | Q_OBJECT | 102 | Q_OBJECT |
103 | 103 | ||
104 | public: | 104 | public: |
105 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); | 105 | OTimePickerDialog ( QWidget* parent = 0, const char* name = NULL, WFlags fl = 0 ); |
106 | ~OTimePickerDialog() { }; | 106 | ~OTimePickerDialog() { }; |
107 | 107 | ||
108 | QTime time()const; | 108 | QTime time()const; |
109 | 109 | ||
110 | public slots: | 110 | public slots: |
111 | void setTime( const QTime& time ); | 111 | void setTime( const QTime& time ); |
112 | void setHour( const QString& hour ); | 112 | void setHour( const QString& hour ); |
113 | void setMinute( const QString& minute ); | 113 | void setMinute( const QString& minute ); |
114 | 114 | ||
115 | private: | 115 | private: |
116 | OTimePicker *m_timePicker; | 116 | OTimePicker *m_timePicker; |
117 | QTime m_time; | 117 | QTime m_time; |
118 | class Private; | 118 | class Private; |
119 | Private* d; | 119 | Private* d; |
120 | }; | 120 | }; |
121 | 121 | ||
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | /* for Qt2 */ | 125 | /* for Qt2 */ |
126 | #if ( QT_VERSION-0 >= 0x030000 ) | 126 | #if ( QT_VERSION-0 >= 0x030000 ) |
127 | #error "Fix the UI File to use namespaces" | 127 | #error "Fix the UI File to use namespaces" |
128 | #else | ||
129 | typedef Opie::Ui::OTimePicker OUIOTimePicker; | ||
130 | #endif | 128 | #endif |
131 | #endif | 129 | #endif |
132 | |||
diff --git a/libopie2/opieui/oversatileview.h b/libopie2/opieui/oversatileview.h index 61b61db..8cba65c 100644 --- a/libopie2/opieui/oversatileview.h +++ b/libopie2/opieui/oversatileview.h | |||
@@ -22,378 +22,378 @@ | |||
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 | #ifndef OVERSATILEVIEW_H | 31 | #ifndef OVERSATILEVIEW_H |
32 | #define OVERSATILEVIEW_H | 32 | #define OVERSATILEVIEW_H |
33 | 33 | ||
34 | /* QT */ | 34 | /* QT */ |
35 | 35 | ||
36 | #include <qwidgetstack.h> | 36 | #include <qwidgetstack.h> |
37 | #include <qiconview.h> | 37 | #include <qiconview.h> |
38 | 38 | ||
39 | /* OPIE */ | 39 | /* OPIE */ |
40 | 40 | ||
41 | #include <opie2/oapplication.h> | 41 | #include <opie2/oapplication.h> |
42 | 42 | ||
43 | /* FORWARDS */ | 43 | /* FORWARDS */ |
44 | 44 | ||
45 | class QHeader; | 45 | class QHeader; |
46 | class QIconSet; | 46 | class QIconSet; |
47 | class QIconViewItem; | 47 | class QIconViewItem; |
48 | class QListViewItem; | 48 | class QListViewItem; |
49 | class QPopupMenu; | 49 | class QPopupMenu; |
50 | class QString; | 50 | class QString; |
51 | 51 | ||
52 | #ifndef QT_NO_DRAGANDDROP | 52 | #ifndef QT_NO_DRAGANDDROP |
53 | class QIconDragItem; | 53 | class QIconDragItem; |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | namespace Opie { | 56 | namespace Opie { |
57 | namespace Ui { | 57 | namespace Ui { |
58 | class OListView; | 58 | class OListView; |
59 | 59 | ||
60 | class OVersatileView : public QWidgetStack | 60 | class OVersatileView : public QWidgetStack |
61 | { | 61 | { |
62 | Q_OBJECT | 62 | Q_OBJECT |
63 | 63 | ||
64 | friend class OVersatileViewItem; | 64 | friend class OVersatileViewItem; |
65 | 65 | ||
66 | //==============================================================================================// | 66 | //==============================================================================================// |
67 | // OVersatileView High Level API | 67 | // OVersatileView High Level API |
68 | //==============================================================================================// | 68 | //==============================================================================================// |
69 | 69 | ||
70 | public: | 70 | public: |
71 | OVersatileView( QWidget* parent = 0, const char* name = 0, int mode = 0 ); | 71 | OVersatileView( QWidget* parent = 0, const char* name = 0, int mode = 0 ); |
72 | ~OVersatileView(); | 72 | ~OVersatileView(); |
73 | 73 | ||
74 | QPopupMenu* contextMenu() const; | 74 | QPopupMenu* contextMenu() const; |
75 | 75 | ||
76 | void setSynchronization( bool sync ); | 76 | void setSynchronization( bool sync ); |
77 | bool synchronization(); | 77 | bool synchronization(); |
78 | 78 | ||
79 | enum ViewMode { Tree = 0, Icons }; | 79 | enum ViewMode { Tree = 0, Icons }; |
80 | int viewMode(); | 80 | int viewMode(); |
81 | 81 | ||
82 | QIconView* iconView() const; | 82 | QIconView* iconView() const; |
83 | OListView* listView() const; | 83 | OListView* listView() const; |
84 | 84 | ||
85 | enum WarningPolicy { None = 0, Warn, WarnReturn }; | 85 | enum WarningPolicy { None = 0, Warn, WarnReturn }; |
86 | 86 | ||
87 | void setWarningPolicy( int ) const; // warn, if calling a method which doesn't apply to the current viewmode | 87 | void setWarningPolicy( int ) const; // warn, if calling a method which doesn't apply to the current viewmode |
88 | bool warningPolicy() const; | 88 | bool warningPolicy() const; |
89 | 89 | ||
90 | void setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ); | 90 | void setDefaultPixmaps( int mode, QPixmap& leaf, QPixmap& opened, QPixmap& closed ); |
91 | 91 | ||
92 | public slots: | 92 | public slots: |
93 | void setViewMode( int mode ); | 93 | void setViewMode( int mode ); |
94 | void setIconViewMode(); | 94 | void setIconViewMode(); |
95 | void setTreeViewMode(); | 95 | void setTreeViewMode(); |
96 | 96 | ||
97 | protected: | 97 | protected: |
98 | virtual bool isValidViewMode( int mode ) const; | 98 | virtual bool isValidViewMode( int mode ) const; |
99 | virtual void popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col = 0 ); | 99 | virtual void popupContextMenu( OVersatileViewItem* item, const QPoint& pos, int col = 0 ); |
100 | 100 | ||
101 | private: | 101 | private: |
102 | int _viewmode; | 102 | int _viewmode; |
103 | bool _synchronization; | 103 | bool _synchronization; |
104 | mutable int _warningpolicy; | 104 | mutable int _warningpolicy; |
105 | 105 | ||
106 | OListView* _listview; | 106 | OListView* _listview; |
107 | QIconView* _iconview; | 107 | QIconView* _iconview; |
108 | 108 | ||
109 | QPixmap _treeleaf; | 109 | QPixmap _treeleaf; |
110 | QPixmap _treeopened; | 110 | QPixmap _treeopened; |
111 | QPixmap _treeclosed; | 111 | QPixmap _treeclosed; |
112 | 112 | ||
113 | QPixmap _iconleaf; | 113 | QPixmap _iconleaf; |
114 | QPixmap _iconopened; | 114 | QPixmap _iconopened; |
115 | QPixmap _iconclosed; | 115 | QPixmap _iconclosed; |
116 | 116 | ||
117 | QPopupMenu* _contextmenu; | 117 | QPopupMenu* _contextmenu; |
118 | 118 | ||
119 | int _iconstyle; | 119 | int _iconstyle; |
120 | int _treestyle; | 120 | int _treestyle; |
121 | 121 | ||
122 | private slots: | 122 | private slots: |
123 | 123 | ||
124 | void contextMenuRequested( QListViewItem*, const QPoint&, int ); | 124 | void contextMenuRequested( QListViewItem*, const QPoint&, int ); |
125 | void contextMenuRequested( QIconViewItem*, const QPoint& ); | 125 | void contextMenuRequested( QIconViewItem*, const QPoint& ); |
126 | 126 | ||
127 | // type converting signal forwarders | 127 | // type converting signal forwarders |
128 | 128 | ||
129 | void selectionChanged( QListViewItem * ); | 129 | void selectionChanged( QListViewItem * ); |
130 | void currentChanged( QListViewItem * ); | 130 | void currentChanged( QListViewItem * ); |
131 | void clicked( QListViewItem * ); | 131 | void clicked( QListViewItem * ); |
132 | void pressed( QListViewItem * ); | 132 | void pressed( QListViewItem * ); |
133 | void doubleClicked( QListViewItem * ); | 133 | void doubleClicked( QListViewItem * ); |
134 | void returnPressed( QListViewItem * ); | 134 | void returnPressed( QListViewItem * ); |
135 | void onItem( QListViewItem * ); | 135 | void onItem( QListViewItem * ); |
136 | 136 | ||
137 | void selectionChanged( QIconViewItem * ); | 137 | void selectionChanged( QIconViewItem * ); |
138 | void currentChanged( QIconViewItem * ); | 138 | void currentChanged( QIconViewItem * ); |
139 | void clicked( QIconViewItem * ); | 139 | void clicked( QIconViewItem * ); |
140 | void pressed( QIconViewItem * ); | 140 | void pressed( QIconViewItem * ); |
141 | void doubleClicked( QIconViewItem * ); | 141 | void doubleClicked( QIconViewItem * ); |
142 | void returnPressed( QIconViewItem * ); | 142 | void returnPressed( QIconViewItem * ); |
143 | void onItem( QIconViewItem * ); | 143 | void onItem( QIconViewItem * ); |
144 | 144 | ||
145 | void expanded( QListViewItem * item ); // QListView | 145 | void expanded( QListViewItem * item ); // QListView |
146 | void collapsed( QListViewItem * item ); // QListView | 146 | void collapsed( QListViewItem * item ); // QListView |
147 | 147 | ||
148 | signals: | 148 | signals: |
149 | 149 | ||
150 | void contextMenuRequested( OVersatileViewItem * item, const QPoint& pos, int col ); | 150 | void contextMenuRequested( Opie::Ui::OVersatileViewItem * item, const QPoint& pos, int col ); |
151 | 151 | ||
152 | /*#ifndef QT_NO_DRAGANDDROP | 152 | /*#ifndef QT_NO_DRAGANDDROP |
153 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView | 153 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView |
154 | #endif | 154 | #endif |
155 | void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView | 155 | void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView |
156 | void itemRenamed( OVersatileViewItem *item ); // QIconView | 156 | void itemRenamed( OVersatileViewItem *item ); // QIconView |
157 | */ | 157 | */ |
158 | 158 | ||
159 | //==============================================================================================// | 159 | //==============================================================================================// |
160 | // "Derived" API - Case 1: Methods existing either only in QListView or only in QIconView | 160 | // "Derived" API - Case 1: Methods existing either only in QListView or only in QIconView |
161 | //==============================================================================================// | 161 | //==============================================================================================// |
162 | 162 | ||
163 | public: | 163 | public: |
164 | 164 | ||
165 | /* | 165 | /* |
166 | enum Arrangement { // QIconView | 166 | enum Arrangement { // QIconView |
167 | LeftToRight = 0, | 167 | LeftToRight = 0, |
168 | TopToBottom | 168 | TopToBottom |
169 | }; | 169 | }; |
170 | enum ResizeMode { // QIconView | 170 | enum ResizeMode { // QIconView |
171 | Fixed = 0, | 171 | Fixed = 0, |
172 | Adjust | 172 | Adjust |
173 | }; | 173 | }; |
174 | enum ItemTextPos { // QIconView | 174 | enum ItemTextPos { // QIconView |
175 | Bottom = 0, | 175 | Bottom = 0, |
176 | Right | 176 | Right |
177 | }; | 177 | }; |
178 | */ | 178 | */ |
179 | 179 | ||
180 | // | 180 | // |
181 | // only in QListView | 181 | // only in QListView |
182 | // | 182 | // |
183 | 183 | ||
184 | int treeStepSize() const; // QListView | 184 | int treeStepSize() const; // QListView |
185 | virtual void setTreeStepSize( int ); // QListView | 185 | virtual void setTreeStepSize( int ); // QListView |
186 | 186 | ||
187 | QHeader * header() const; // QListView | 187 | QHeader * header() const; // QListView |
188 | 188 | ||
189 | virtual int addColumn( const QString &label, int size = -1); // QListView | 189 | virtual int addColumn( const QString &label, int size = -1); // QListView |
190 | virtual int addColumn( const QIconSet& iconset, const QString &label, int size = -1); // QListView | 190 | virtual int addColumn( const QIconSet& iconset, const QString &label, int size = -1); // QListView |
191 | void removeColumn( int index ); // #### make virtual in next major release! // QListView | 191 | void removeColumn( int index ); // #### make virtual in next major release! // QListView |
192 | virtual void setColumnText( int column, const QString &label ); // QListView | 192 | virtual void setColumnText( int column, const QString &label ); // QListView |
193 | virtual void setColumnText( int column, const QIconSet& iconset, const QString &label ); // QListView | 193 | virtual void setColumnText( int column, const QIconSet& iconset, const QString &label ); // QListView |
194 | QString columnText( int column ) const; // QListView | 194 | QString columnText( int column ) const; // QListView |
195 | virtual void setColumnWidth( int column, int width ); // QListView | 195 | virtual void setColumnWidth( int column, int width ); // QListView |
196 | int columnWidth( int column ) const; // QListView | 196 | int columnWidth( int column ) const; // QListView |
197 | enum WidthMode { Manual, Maximum }; // QListView | 197 | enum WidthMode { Manual, Maximum }; // QListView |
198 | virtual void setColumnWidthMode( int column, WidthMode ); // QListView | 198 | virtual void setColumnWidthMode( int column, WidthMode ); // QListView |
199 | WidthMode columnWidthMode( int column ) const; // QListView | 199 | WidthMode columnWidthMode( int column ) const; // QListView |
200 | int columns() const; // QListView | 200 | int columns() const; // QListView |
201 | 201 | ||
202 | virtual void setColumnAlignment( int, int ); // QListView | 202 | virtual void setColumnAlignment( int, int ); // QListView |
203 | int columnAlignment( int ) const; // QListView | 203 | int columnAlignment( int ) const; // QListView |
204 | 204 | ||
205 | OVersatileViewItem * itemAt( const QPoint & screenPos ) const; // QListView | 205 | OVersatileViewItem * itemAt( const QPoint & screenPos ) const; // QListView |
206 | QRect itemRect( const OVersatileViewItem * ) const; // QListView | 206 | QRect itemRect( const OVersatileViewItem * ) const; // QListView |
207 | int itemPos( const OVersatileViewItem * ); // QListView | 207 | int itemPos( const OVersatileViewItem * ); // QListView |
208 | 208 | ||
209 | bool isSelected( const OVersatileViewItem * ) const; // QListView // also in QIconViewItem but not in QIconView *shrug* | 209 | bool isSelected( const OVersatileViewItem * ) const; // QListView // also in QIconViewItem but not in QIconView *shrug* |
210 | 210 | ||
211 | virtual void setMultiSelection( bool enable ); // QListView | 211 | virtual void setMultiSelection( bool enable ); // QListView |
212 | bool isMultiSelection() const; // QListView | 212 | bool isMultiSelection() const; // QListView |
213 | 213 | ||
214 | OVersatileViewItem * selectedItem() const; // QListView | 214 | OVersatileViewItem * selectedItem() const; // QListView |
215 | virtual void setOpen( OVersatileViewItem *, bool ); // QListView | 215 | virtual void setOpen( OVersatileViewItem *, bool ); // QListView |
216 | bool isOpen( const OVersatileViewItem * ) const; // QListView | 216 | bool isOpen( const OVersatileViewItem * ) const; // QListView |
217 | 217 | ||
218 | OVersatileViewItem * firstChild() const; // QListView | 218 | OVersatileViewItem * firstChild() const; // QListView |
219 | int childCount() const; // QListView | 219 | int childCount() const; // QListView |
220 | 220 | ||
221 | virtual void setAllColumnsShowFocus( bool ); // QListView | 221 | virtual void setAllColumnsShowFocus( bool ); // QListView |
222 | bool allColumnsShowFocus() const; // QListView | 222 | bool allColumnsShowFocus() const; // QListView |
223 | 223 | ||
224 | virtual void setItemMargin( int ); // QListView | 224 | virtual void setItemMargin( int ); // QListView |
225 | int itemMargin() const; // QListView | 225 | int itemMargin() const; // QListView |
226 | 226 | ||
227 | virtual void setRootIsDecorated( bool ); // QListView | 227 | virtual void setRootIsDecorated( bool ); // QListView |
228 | bool rootIsDecorated() const; // QListView | 228 | bool rootIsDecorated() const; // QListView |
229 | 229 | ||
230 | void setShowSortIndicator( bool show ); // QListView | 230 | void setShowSortIndicator( bool show ); // QListView |
231 | bool showSortIndicator() const; // QListView | 231 | bool showSortIndicator() const; // QListView |
232 | 232 | ||
233 | int index( const OVersatileViewItem *item ) const; // QIconView | 233 | int index( const OVersatileViewItem *item ) const; // QIconView |
234 | 234 | ||
235 | public slots: | 235 | public slots: |
236 | void triggerUpdate(); // QListView | 236 | void triggerUpdate(); // QListView |
237 | 237 | ||
238 | signals: | 238 | signals: |
239 | void expanded( OVersatileViewItem *item ); // QListView | 239 | void expanded( Opie::Ui::OVersatileViewItem *item ); // QListView |
240 | void collapsed( OVersatileViewItem *item ); // QListView | 240 | void collapsed( Opie::Ui::OVersatileViewItem *item ); // QListView |
241 | 241 | ||
242 | // | 242 | // |
243 | // only in QIconView | 243 | // only in QIconView |
244 | // | 244 | // |
245 | 245 | ||
246 | public: | 246 | public: |
247 | uint count() const; // QIconView | 247 | uint count() const; // QIconView |
248 | 248 | ||
249 | OVersatileViewItem *firstItem() const; // QIconView | 249 | OVersatileViewItem *firstItem() const; // QIconView |
250 | OVersatileViewItem *lastItem() const; // QIconView | 250 | OVersatileViewItem *lastItem() const; // QIconView |
251 | 251 | ||
252 | OVersatileViewItem *findItem( const QPoint &pos ) const; // QIconView | 252 | OVersatileViewItem *findItem( const QPoint &pos ) const; // QIconView |
253 | OVersatileViewItem *findItem( const QString &text ) const; // QIconView | 253 | OVersatileViewItem *findItem( const QString &text ) const; // QIconView |
254 | 254 | ||
255 | OVersatileViewItem* findFirstVisibleItem( const QRect &r ) const; // QIconView | 255 | OVersatileViewItem* findFirstVisibleItem( const QRect &r ) const; // QIconView |
256 | OVersatileViewItem* findLastVisibleItem( const QRect &r ) const; // QIconView | 256 | OVersatileViewItem* findLastVisibleItem( const QRect &r ) const; // QIconView |
257 | 257 | ||
258 | virtual void setGridX( int rx ); // QIconView | 258 | virtual void setGridX( int rx ); // QIconView |
259 | virtual void setGridY( int ry ); // QIconView | 259 | virtual void setGridY( int ry ); // QIconView |
260 | int gridX() const; // QIconView | 260 | int gridX() const; // QIconView |
261 | int gridY() const; // QIconView | 261 | int gridY() const; // QIconView |
262 | virtual void setSpacing( int sp ); // QIconView | 262 | virtual void setSpacing( int sp ); // QIconView |
263 | int spacing() const; // QIconView | 263 | int spacing() const; // QIconView |
264 | virtual void setItemTextPos( QIconView::ItemTextPos pos ); // QIconView | 264 | virtual void setItemTextPos( QIconView::ItemTextPos pos ); // QIconView |
265 | QIconView::ItemTextPos itemTextPos() const; // QIconView | 265 | QIconView::ItemTextPos itemTextPos() const; // QIconView |
266 | virtual void setItemTextBackground( const QBrush &b ); // QIconView | 266 | virtual void setItemTextBackground( const QBrush &b ); // QIconView |
267 | QBrush itemTextBackground() const; // QIconView | 267 | QBrush itemTextBackground() const; // QIconView |
268 | virtual void setArrangement( QIconView::Arrangement am ); // QIconView | 268 | virtual void setArrangement( QIconView::Arrangement am ); // QIconView |
269 | QIconView::Arrangement arrangement() const; // QIconView | 269 | QIconView::Arrangement arrangement() const; // QIconView |
270 | virtual void setResizeMode( QIconView::ResizeMode am ); // QIconView | 270 | virtual void setResizeMode( QIconView::ResizeMode am ); // QIconView |
271 | QIconView::ResizeMode resizeMode() const; // QIconView | 271 | QIconView::ResizeMode resizeMode() const; // QIconView |
272 | virtual void setMaxItemWidth( int w ); // QIconView | 272 | virtual void setMaxItemWidth( int w ); // QIconView |
273 | int maxItemWidth() const; // QIconView | 273 | int maxItemWidth() const; // QIconView |
274 | virtual void setMaxItemTextLength( int w ); // QIconView | 274 | virtual void setMaxItemTextLength( int w ); // QIconView |
275 | int maxItemTextLength() const; // QIconView | 275 | int maxItemTextLength() const; // QIconView |
276 | virtual void setAutoArrange( bool b ); // QIconView | 276 | virtual void setAutoArrange( bool b ); // QIconView |
277 | bool autoArrange() const; // QIconView | 277 | bool autoArrange() const; // QIconView |
278 | virtual void setShowToolTips( bool b ); // QIconView | 278 | virtual void setShowToolTips( bool b ); // QIconView |
279 | bool showToolTips() const; // QIconView | 279 | bool showToolTips() const; // QIconView |
280 | 280 | ||
281 | bool sorting() const; // QIconView | 281 | bool sorting() const; // QIconView |
282 | bool sortDirection() const; // QIconView | 282 | bool sortDirection() const; // QIconView |
283 | 283 | ||
284 | virtual void setItemsMovable( bool b ); // QIconView | 284 | virtual void setItemsMovable( bool b ); // QIconView |
285 | bool itemsMovable() const; // QIconView | 285 | bool itemsMovable() const; // QIconView |
286 | virtual void setWordWrapIconText( bool b ); // QIconView | 286 | virtual void setWordWrapIconText( bool b ); // QIconView |
287 | bool wordWrapIconText() const; // QIconView | 287 | bool wordWrapIconText() const; // QIconView |
288 | 288 | ||
289 | public slots: | 289 | public slots: |
290 | virtual void arrangeItemsInGrid( const QSize &grid, bool update = TRUE ); // QIconView | 290 | virtual void arrangeItemsInGrid( const QSize &grid, bool update = TRUE ); // QIconView |
291 | virtual void arrangeItemsInGrid( bool update = TRUE ); // QIconView | 291 | virtual void arrangeItemsInGrid( bool update = TRUE ); // QIconView |
292 | virtual void updateContents(); // QIconView | 292 | virtual void updateContents(); // QIconView |
293 | 293 | ||
294 | signals: | 294 | signals: |
295 | /*#ifndef QT_NO_DRAGANDDROP | 295 | /*#ifndef QT_NO_DRAGANDDROP |
296 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView | 296 | void dropped( QDropEvent *e, const QValueList<QIconDragItem> &lst ); // QIconView |
297 | #endif | 297 | #endif |
298 | */ | 298 | */ |
299 | void moved(); // QIconView | 299 | void moved(); // QIconView |
300 | void itemRenamed( OVersatileViewItem *item, const QString & ); // QIconView | 300 | void itemRenamed( Opie::Ui::OVersatileViewItem *item, const QString & ); // QIconView |
301 | void itemRenamed( OVersatileViewItem *item ); // QIconView | 301 | void itemRenamed( Opie::Ui::OVersatileViewItem *item ); // QIconView |
302 | 302 | ||
303 | //==============================================================================================// | 303 | //==============================================================================================// |
304 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with the same signatures | 304 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with the same signatures |
305 | //==============================================================================================// | 305 | //==============================================================================================// |
306 | 306 | ||
307 | public: | 307 | public: |
308 | enum SelectionMode { | 308 | enum SelectionMode { |
309 | Single = 0, | 309 | Single = 0, |
310 | Multi, | 310 | Multi, |
311 | Extended, | 311 | Extended, |
312 | NoSelection | 312 | NoSelection |
313 | }; | 313 | }; |
314 | 314 | ||
315 | virtual void clear(); | 315 | virtual void clear(); |
316 | 316 | ||
317 | virtual void setFont( const QFont & ); | 317 | virtual void setFont( const QFont & ); |
318 | virtual void setPalette( const QPalette & ); | 318 | virtual void setPalette( const QPalette & ); |
319 | 319 | ||
320 | virtual void takeItem( OVersatileViewItem * ); | 320 | virtual void takeItem( OVersatileViewItem * ); |
321 | 321 | ||
322 | void setSelectionMode( SelectionMode mode ); | 322 | void setSelectionMode( SelectionMode mode ); |
323 | SelectionMode selectionMode() const; | 323 | SelectionMode selectionMode() const; |
324 | 324 | ||
325 | virtual void selectAll( bool select ); | 325 | virtual void selectAll( bool select ); |
326 | virtual void clearSelection(); | 326 | virtual void clearSelection(); |
327 | virtual void invertSelection(); | 327 | virtual void invertSelection(); |
328 | 328 | ||
329 | void ensureItemVisible( const OVersatileViewItem * ); | 329 | void ensureItemVisible( const OVersatileViewItem * ); |
330 | virtual void repaintItem( const OVersatileViewItem * ) const; | 330 | virtual void repaintItem( const OVersatileViewItem * ) const; |
331 | 331 | ||
332 | virtual void setCurrentItem( OVersatileViewItem * ); | 332 | virtual void setCurrentItem( OVersatileViewItem * ); |
333 | OVersatileViewItem * currentItem() const; | 333 | OVersatileViewItem * currentItem() const; |
334 | 334 | ||
335 | // bool eventFilter( QObject * o, QEvent * ); // use QWidgetStack implementation | 335 | // bool eventFilter( QObject * o, QEvent * ); // use QWidgetStack implementation |
336 | 336 | ||
337 | // QSize minimumSizeHint() const; // use QWidgetStack implementation | 337 | // QSize minimumSizeHint() const; // use QWidgetStack implementation |
338 | // QSizePolicy sizePolicy() const; // use QWidgetStack implementation | 338 | // QSizePolicy sizePolicy() const; // use QWidgetStack implementation |
339 | // QSize sizeHint() const; // use QWidgetStack implementation | 339 | // QSize sizeHint() const; // use QWidgetStack implementation |
340 | 340 | ||
341 | signals: | 341 | signals: |
342 | void selectionChanged(); | 342 | void selectionChanged(); |
343 | void selectionChanged( OVersatileViewItem * ); | 343 | void selectionChanged( Opie::Ui::OVersatileViewItem * ); |
344 | void currentChanged( OVersatileViewItem * ); | 344 | void currentChanged( Opie::Ui::OVersatileViewItem * ); |
345 | void clicked( OVersatileViewItem * ); | 345 | void clicked( Opie::Ui::OVersatileViewItem * ); |
346 | void pressed( OVersatileViewItem * ); | 346 | void pressed( Opie::Ui::OVersatileViewItem * ); |
347 | 347 | ||
348 | void doubleClicked( OVersatileViewItem * ); | 348 | void doubleClicked( Opie::Ui::OVersatileViewItem * ); |
349 | void returnPressed( OVersatileViewItem * ); | 349 | void returnPressed( Opie::Ui::OVersatileViewItem * ); |
350 | 350 | ||
351 | void onItem( OVersatileViewItem * ); | 351 | void onItem( Opie::Ui::OVersatileViewItem * ); |
352 | void onViewport(); | 352 | void onViewport(); |
353 | 353 | ||
354 | //==============================================================================================// | 354 | //==============================================================================================// |
355 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with differing signatures | 355 | // "Derived" API - Case 2: Methods existing in QListView and QIconView with differing signatures |
356 | //==============================================================================================// | 356 | //==============================================================================================// |
357 | 357 | ||
358 | /* | 358 | /* |
359 | 359 | ||
360 | public: | 360 | public: |
361 | virtual void insertItem( OVersatileViewItem * ); // QListView | 361 | virtual void insertItem( OVersatileViewItem * ); // QListView |
362 | virtual void insertItem( OVersatileViewItem *item, OVersatileViewItem *after = 0L ); // QIconView | 362 | virtual void insertItem( OVersatileViewItem *item, OVersatileViewItem *after = 0L ); // QIconView |
363 | 363 | ||
364 | virtual void setSelected( OVersatileViewItem *, bool ); // QListView | 364 | virtual void setSelected( OVersatileViewItem *, bool ); // QListView |
365 | virtual void setSelected( OVersatileViewItem *item, bool s, bool cb = FALSE ); // QIconView | 365 | virtual void setSelected( OVersatileViewItem *item, bool s, bool cb = FALSE ); // QIconView |
366 | 366 | ||
367 | virtual void setSorting( int column, bool increasing = TRUE ); // QListView | 367 | virtual void setSorting( int column, bool increasing = TRUE ); // QListView |
368 | void setSorting( bool sort, bool ascending = TRUE ); // QIconView | 368 | void setSorting( bool sort, bool ascending = TRUE ); // QIconView |
369 | 369 | ||
370 | void sort(); // #### make virtual in next major release // QListView | 370 | void sort(); // #### make virtual in next major release // QListView |
371 | virtual void sort( bool ascending = TRUE ); // QIconView | 371 | virtual void sort( bool ascending = TRUE ); // QIconView |
372 | 372 | ||
373 | */ | 373 | */ |
374 | 374 | ||
375 | signals: | 375 | signals: |
376 | void clicked( OVersatileViewItem *, const QPoint &, int ); // QListView | 376 | void clicked( Opie::Ui::OVersatileViewItem *, const QPoint &, int ); // QListView |
377 | void clicked( OVersatileViewItem *, const QPoint & ); // QIconView | 377 | void clicked( Opie::Ui::OVersatileViewItem *, const QPoint & ); // QIconView |
378 | 378 | ||
379 | void pressed( OVersatileViewItem *, const QPoint &, int ); // QListView | 379 | void pressed( Opie::Ui::OVersatileViewItem *, const QPoint &, int ); // QListView |
380 | void pressed( OVersatileViewItem *, const QPoint & ); // QIconView | 380 | void pressed( Opie::Ui::OVersatileViewItem *, const QPoint & ); // QIconView |
381 | 381 | ||
382 | void rightButtonClicked( OVersatileViewItem* item, const QPoint& pos ); // QIconView | 382 | void rightButtonClicked( Opie::Ui::OVersatileViewItem* item, const QPoint& pos ); // QIconView |
383 | void rightButtonClicked( OVersatileViewItem *, const QPoint&, int ); // QListView | 383 | void rightButtonClicked( Opie::Ui::OVersatileViewItem *, const QPoint&, int ); // QListView |
384 | 384 | ||
385 | void rightButtonPressed( OVersatileViewItem* item, const QPoint& pos ); // QIconView | 385 | void rightButtonPressed( Opie::Ui::OVersatileViewItem* item, const QPoint& pos ); // QIconView |
386 | void rightButtonPressed( OVersatileViewItem *, const QPoint&, int ); // QListView | 386 | void rightButtonPressed( Opie::Ui::OVersatileViewItem *, const QPoint&, int ); // QListView |
387 | 387 | ||
388 | void mouseButtonPressed( int, OVersatileViewItem *, const QPoint& , int ); // QListView | 388 | void mouseButtonPressed( int, Opie::Ui::OVersatileViewItem *, const QPoint& , int ); // QListView |
389 | void mouseButtonPressed( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView | 389 | void mouseButtonPressed( int button, Opie::Ui::OVersatileViewItem* item, const QPoint& pos ); // QIconView |
390 | 390 | ||
391 | void mouseButtonClicked( int, OVersatileViewItem *, const QPoint&, int ); // QListView | 391 | void mouseButtonClicked( int, Opie::Ui::OVersatileViewItem *, const QPoint&, int ); // QListView |
392 | void mouseButtonClicked( int button, OVersatileViewItem* item, const QPoint& pos ); // QIconView | 392 | void mouseButtonClicked( int button, Opie::Ui::OVersatileViewItem* item, const QPoint& pos ); // QIconView |
393 | 393 | ||
394 | }; | 394 | }; |
395 | 395 | ||
396 | } | 396 | } |
397 | } | 397 | } |
398 | #endif | 398 | #endif |
399 | 399 | ||