summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/examples/opieui/osplitter_example/osplitter_example.cpp1
-rw-r--r--libopie2/examples/opieui/owidgetstack_example/owidgetstack_example.cpp1
-rw-r--r--libopie2/opiecore/oprocess.h12
-rw-r--r--libopie2/opienet/opcap.h2
-rw-r--r--libopie2/opieui/opopupmenu.h2
-rw-r--r--libopie2/opieui/otimepicker.h3
-rw-r--r--libopie2/opieui/oversatileview.h48
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
14using namespace Opie::Ui; 14using namespace Opie::Ui;
15using namespace Opie::Core;
15 16
16OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> ) 17OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> )
17 18
18OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f ) 19OSplitterExample::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
22using namespace Opie::Core;
22using namespace Opie::Ui; 23using namespace Opie::Ui;
23 24
24OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) 25OPIE_EXPORT_APP( OApplicationFactory<StackExample> )
25 26
26StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) 27StackExample::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
117StackExample::~StackExample() { 118StackExample::~StackExample() {
118 119
119} 120}
120 121
121 122
122 123
123void StackExample::closeEvent( QCloseEvent* ev) { 124void 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,761 +1,761 @@
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
45class QSocketNotifier; 45class QSocketNotifier;
46 46
47namespace Opie { 47namespace Opie {
48namespace Core { 48namespace Core {
49namespace Private { 49namespace Private {
50class OProcessController; 50class OProcessController;
51class OProcessPrivate; 51class 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 **/
157class OProcess : public QObject 157class OProcess : public QObject
158{ 158{
159 Q_OBJECT 159 Q_OBJECT
160 160
161public: 161public:
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 );
234 234
235 235
236 /** 236 /**
237 * Sets the executable and the command line argument list for this process. 237 * Sets the executable and the command line argument list for this process.
238 * 238 *
239 * For example, doing an "ls -l /usr/local/bin" can be achieved by: 239 * For example, doing an "ls -l /usr/local/bin" can be achieved by:
240 * <pre> 240 * <pre>
241 * OProcess p; 241 * OProcess p;
242 * ... 242 * ...
243 * p << "ls" << "-l" << "/usr/local/bin" 243 * p << "ls" << "-l" << "/usr/local/bin"
244 * </pre> 244 * </pre>
245 * 245 *
246 **/ 246 **/
247 OProcess &operator<<( const QString& arg ); 247 OProcess &operator<<( const QString& arg );
248 /** 248 /**
249 * Similar to previous method, takes a char *, supposed to be in locale 8 bit already. 249 * Similar to previous method, takes a char *, supposed to be in locale 8 bit already.
250 */ 250 */
251 OProcess &operator<<( const char * arg ); 251 OProcess &operator<<( const char * arg );
252 /** 252 /**
253 * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already. 253 * Similar to previous method, takes a QCString, supposed to be in locale 8 bit already.
254 */ 254 */
255 OProcess &operator<<( const QCString & arg ); 255 OProcess &operator<<( const QCString & arg );
256 256
257 /** 257 /**
258 * Sets the executable and the command line argument list for this process, 258 * Sets the executable and the command line argument list for this process,
259 * in a single method call, or add a list of arguments. 259 * in a single method call, or add a list of arguments.
260 **/ 260 **/
261 OProcess &operator<<( const QStringList& args ); 261 OProcess &operator<<( const QStringList& args );
262 262
263 /** 263 /**
264 * Clear a command line argument list that has been set by using 264 * Clear a command line argument list that has been set by using
265 * the "operator<<". 265 * the "operator<<".
266 */ 266 */
267 void clearArguments(); 267 void clearArguments();
268 268
269 /** 269 /**
270 * Starts the process. 270 * Starts the process.
271 * For a detailed description of the 271 * For a detailed description of the
272 * various run modes and communication semantics, have a look at the 272 * various run modes and communication semantics, have a look at the
273 * general description of the OProcess class. 273 * general description of the OProcess class.
274 * 274 *
275 * The following problems could cause this function to 275 * The following problems could cause this function to
276 * return false: 276 * return false:
277 * 277 *
278 * @li The process is already running. 278 * @li The process is already running.
279 * @li The command line argument list is empty. 279 * @li The command line argument list is empty.
280 * @li The starting of the process failed (could not fork). 280 * @li The starting of the process failed (could not fork).
281 * @li The executable was not found. 281 * @li The executable was not found.
282 * 282 *
283 * @param comm Specifies which communication links should be 283 * @param comm Specifies which communication links should be
284 * established to the child process (stdin/stdout/stderr). By default, 284 * established to the child process (stdin/stdout/stderr). By default,
285 * no communication takes place and the respective communication 285 * no communication takes place and the respective communication
286 * signals will never get emitted. 286 * signals will never get emitted.
287 * 287 *
288 * @return true on success, false on error 288 * @return true on success, false on error
289 * (see above for error conditions) 289 * (see above for error conditions)
290 **/ 290 **/
291 virtual bool start( RunMode runmode = NotifyOnExit, 291 virtual bool start( RunMode runmode = NotifyOnExit,
292 Communication comm = NoCommunication ); 292 Communication comm = NoCommunication );
293 293
294 /** 294 /**
295 * Stop the process (by sending it a signal). 295 * Stop the process (by sending it a signal).
296 * 296 *
297 * @param signoThe signal to send. The default is SIGTERM. 297 * @param signoThe signal to send. The default is SIGTERM.
298 * @return @p true if the signal was delivered successfully. 298 * @return @p true if the signal was delivered successfully.
299 */ 299 */
300 virtual bool kill( int signo = SIGTERM ); 300 virtual bool kill( int signo = SIGTERM );
301 301
302 /** 302 /**
303 @return @p true if the process is (still) considered to be running 303 @return @p true if the process is (still) considered to be running
304 */ 304 */
305 bool isRunning() const; 305 bool isRunning() const;
306 306
307 /** Returns the process id of the process. 307 /** Returns the process id of the process.
308 * 308 *
309 * If it is called after 309 * If it is called after
310 * the process has exited, it returns the process id of the last 310 * the process has exited, it returns the process id of the last
311 * child process that was created by this instance of OProcess. 311 * child process that was created by this instance of OProcess.
312 * 312 *
313 * Calling it before any child process has been started by this 313 * Calling it before any child process has been started by this
314 * OProcess instance causes pid() to return 0. 314 * OProcess instance causes pid() to return 0.
315 **/ 315 **/
316 pid_t pid() const; 316 pid_t pid() const;
317 317
318 /** 318 /**
319 * Suspend processing of data from stdout of the child process. 319 * Suspend processing of data from stdout of the child process.
320 */ 320 */
321 void suspend(); 321 void suspend();
322 322
323 /** 323 /**
324 * Resume processing of data from stdout of the child process. 324 * Resume processing of data from stdout of the child process.
325 */ 325 */
326 void resume(); 326 void resume();
327 327
328 /** 328 /**
329 * @return @p true if the process has already finished and has exited 329 * @return @p true if the process has already finished and has exited
330 * "voluntarily", ie: it has not been killed by a signal. 330 * "voluntarily", ie: it has not been killed by a signal.
331 * 331 *
332 * Note that you should check @ref OProcess::exitStatus() to determine 332 * Note that you should check @ref OProcess::exitStatus() to determine
333 * whether the process completed its task successful or not. 333 * whether the process completed its task successful or not.
334 */ 334 */
335 bool normalExit() const; 335 bool normalExit() const;
336 336
337 /** 337 /**
338 * Returns the exit status of the process. 338 * Returns the exit status of the process.
339 * 339 *
340 * Please use 340 * Please use
341 * @ref OProcess::normalExit() to check whether the process has exited 341 * @ref OProcess::normalExit() to check whether the process has exited
342 * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling 342 * cleanly (i.e., @ref OProcess::normalExit() returns @p true) before calling
343 * this function because if the process did not exit normally, 343 * this function because if the process did not exit normally,
344 * it does not have a valid exit status. 344 * it does not have a valid exit status.
345 */ 345 */
346 int exitStatus() const; 346 int exitStatus() const;
347 347
348 348
349 /** 349 /**
350 * Transmit data to the child process's stdin. 350 * Transmit data to the child process's stdin.
351 * 351 *
352 * OProcess::writeStdin may return false in the following cases: 352 * OProcess::writeStdin may return false in the following cases:
353 * 353 *
354 * @li The process is not currently running. 354 * @li The process is not currently running.
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
476signals: 476signals:
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
542protected slots: 542protected 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
566protected: 566protected:
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
669 * calls commClose to close all open communication channels to this 669 * calls commClose to close all open communication channels to this
670 * process and emits the "processExited" signal (if the process was 670 * process and emits the "processExited" signal (if the process was
671 * not running in the "DontCare" mode). 671 * not running in the "DontCare" mode).
672 */ 672 */
673 virtual void processHasExited( int state ); 673 virtual void processHasExited( int state );
674 674
675 /** 675 /**
676 * Should clean up the communication links to the child after it has 676 * Should clean up the communication links to the child after it has
677 * exited. Should be called from "processHasExited". 677 * exited. Should be called from "processHasExited".
678 */ 678 */
679 virtual void commClose(); 679 virtual void commClose();
680 680
681 681
682 /** 682 /**
683 * the socket descriptors for stdin/stdout/stderr. 683 * the socket descriptors for stdin/stdout/stderr.
684 */ 684 */
685 int out[ 2 ]; 685 int out[ 2 ];
686 int in[ 2 ]; 686 int in[ 2 ];
687 int err[ 2 ]; 687 int err[ 2 ];
688 688
689 /** 689 /**
690 * The socket notifiers for the above socket descriptors. 690 * The socket notifiers for the above socket descriptors.
691 */ 691 */
692 QSocketNotifier *innot; 692 QSocketNotifier *innot;
693 QSocketNotifier *outnot; 693 QSocketNotifier *outnot;
694 QSocketNotifier *errnot; 694 QSocketNotifier *errnot;
695 695
696 /** 696 /**
697 * Lists the communication links that are activated for the child 697 * Lists the communication links that are activated for the child
698 * process. Should not be modified from derived classes. 698 * process. Should not be modified from derived classes.
699 */ 699 */
700 Communication communication; 700 Communication communication;
701 701
702 /** 702 /**
703 * Called by "slotChildOutput" this function copies data arriving from the 703 * Called by "slotChildOutput" this function copies data arriving from the
704 * child process's stdout to the respective buffer and emits the signal 704 * child process's stdout to the respective buffer and emits the signal
705 * "@ref receivedStderr". 705 * "@ref receivedStderr".
706 */ 706 */
707 int childOutput( int fdno ); 707 int childOutput( int fdno );
708 708
709 /** 709 /**
710 * Called by "slotChildOutput" this function copies data arriving from the 710 * Called by "slotChildOutput" this function copies data arriving from the
711 * child process's stdout to the respective buffer and emits the signal 711 * child process's stdout to the respective buffer and emits the signal
712 * "@ref receivedStderr" 712 * "@ref receivedStderr"
713 */ 713 */
714 int childError( int fdno ); 714 int childError( int fdno );
715 715
716 // information about the data that has to be sent to the child: 716 // information about the data that has to be sent to the child:
717 717
718 const char *input_data; // the buffer holding the data 718 const char *input_data; // the buffer holding the data
719 int input_sent; // # of bytes already transmitted 719 int input_sent; // # of bytes already transmitted
720 int input_total; // total length of input_data 720 int input_total; // total length of input_data
721 721
722 /** 722 /**
723 * @ref OProcessController is a friend of OProcess because it has to have 723 * @ref OProcessController is a friend of OProcess because it has to have
724 * access to various data members. 724 * access to various data members.
725 */ 725 */
726 friend class Private::OProcessController; 726 friend class Private::OProcessController;
727 727
728private: 728private:
729 /** 729 /**
730 * Searches for a valid shell. 730 * Searches for a valid shell.
731 * Here is the algorithm used for finding an executable shell: 731 * Here is the algorithm used for finding an executable shell:
732 * 732 *
733 * @li Try the executable pointed to by the "SHELL" environment 733 * @li Try the executable pointed to by the "SHELL" environment
734 * variable with white spaces stripped off 734 * variable with white spaces stripped off
735 * 735 *
736 * @li If your process runs with uid != euid or gid != egid, a shell 736 * @li If your process runs with uid != euid or gid != egid, a shell
737 * not listed in /etc/shells will not used. 737 * not listed in /etc/shells will not used.
738 * 738 *
739 * @li If no valid shell could be found, "/bin/sh" is used as a last resort. 739 * @li If no valid shell could be found, "/bin/sh" is used as a last resort.
740 */ 740 */
741 QCString searchShell(); 741 QCString searchShell();
742 742
743 /** 743 /**
744 * Used by @ref searchShell in order to find out whether the shell found 744 * Used by @ref searchShell in order to find out whether the shell found
745 * is actually executable at all. 745 * is actually executable at all.
746 */ 746 */
747 bool isExecutable( const QCString &filename ); 747 bool isExecutable( const QCString &filename );
748 748
749 // Disallow assignment and copy-construction 749 // Disallow assignment and copy-construction
750 OProcess( const OProcess& ); 750 OProcess( const OProcess& );
751 OProcess& operator= ( const OProcess& ); 751 OProcess& operator= ( const OProcess& );
752 752
753private: 753private:
754 void init ( ); 754 void init ( );
755 Private::OProcessPrivate *d; 755 Private::OProcessPrivate *d;
756}; 756};
757} 757}
758} 758}
759 759
760#endif 760#endif
761 761
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
@@ -1,721 +1,721 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de> 3              Copyright (C) 2003 by Michael 'Mickey' Lauer <mickey@Vanille.de>
4 =. 4 =.
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef OPCAP_H 31#ifndef OPCAP_H
32#define OPCAP_H 32#define OPCAP_H
33 33
34/* OPIE */ 34/* OPIE */
35#include <opie2/onetutils.h> 35#include <opie2/onetutils.h>
36 36
37/* QT */ 37/* QT */
38#include <qevent.h> 38#include <qevent.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qhostaddress.h> 40#include <qhostaddress.h>
41#include <qobject.h> 41#include <qobject.h>
42#include <qstring.h> 42#include <qstring.h>
43#include <qtextstream.h> 43#include <qtextstream.h>
44#include <qmap.h> 44#include <qmap.h>
45 45
46/* STD */ 46/* STD */
47extern "C" // work around a bpf/pcap conflict in recent headers 47extern "C" // work around a bpf/pcap conflict in recent headers
48{ 48{
49 #include <pcap.h> 49 #include <pcap.h>
50} 50}
51#include <netinet/ether.h> 51#include <netinet/ether.h>
52#include <netinet/ip.h> 52#include <netinet/ip.h>
53#include <netinet/udp.h> 53#include <netinet/udp.h>
54#include <netinet/tcp.h> 54#include <netinet/tcp.h>
55#include <time.h> 55#include <time.h>
56 56
57/* Custom Network Includes (must go here, don't reorder!) */ 57/* Custom Network Includes (must go here, don't reorder!) */
58#include "802_11_user.h" 58#include "802_11_user.h"
59#include "dhcp.h" 59#include "dhcp.h"
60 60
61 61
62/* TYPEDEFS */ 62/* TYPEDEFS */
63typedef struct timeval timevalstruct; 63typedef struct timeval timevalstruct;
64typedef struct pcap_pkthdr packetheaderstruct; 64typedef struct pcap_pkthdr packetheaderstruct;
65 65
66/* FORWARDS */ 66/* FORWARDS */
67class QSocketNotifier; 67class QSocketNotifier;
68namespace Opie { 68namespace Opie {
69namespace Net { 69namespace Net {
70class OPacketCapturer; 70class OPacketCapturer;
71 71
72/*====================================================================================== 72/*======================================================================================
73 * OPacket - A frame on the wire 73 * OPacket - A frame on the wire
74 *======================================================================================*/ 74 *======================================================================================*/
75 75
76/** @brief A class representing a data frame on the wire. 76/** @brief A class representing a data frame on the wire.
77 * 77 *
78 * The whole family of the packet classes are used when capturing frames from a network. 78 * The whole family of the packet classes are used when capturing frames from a network.
79 * Most standard network protocols in use share a common architecture, which mostly is 79 * Most standard network protocols in use share a common architecture, which mostly is
80 * a packet header and then the packet payload. In layered architectures, each lower layer 80 * a packet header and then the packet payload. In layered architectures, each lower layer
81 * encapsulates data from its upper layer - that is it 81 * encapsulates data from its upper layer - that is it
82 * treats the data from its upper layer as payload and prepends an own header to the packet, 82 * treats the data from its upper layer as payload and prepends an own header to the packet,
83 * which - again - is treated as the payload for the layer below. The figure below is an 83 * which - again - is treated as the payload for the layer below. The figure below is an
84 * example for how such a data frame is composed out of packets, e.g. when sending a mail. 84 * example for how such a data frame is composed out of packets, e.g. when sending a mail.
85 * 85 *
86 * <pre> 86 * <pre>
87 * | User Data | == Mail Data 87 * | User Data | == Mail Data
88 * | SMTP Header | User Data | == SMTP 88 * | SMTP Header | User Data | == SMTP
89 * | TCP Header | SMTP Header | User Data | == TCP 89 * | TCP Header | SMTP Header | User Data | == TCP
90 * | IP Header | TCP Header | SMTP Header | User Data | == IP 90 * | IP Header | TCP Header | SMTP Header | User Data | == IP
91 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC 91 * | MAC Header | IP Header | TCP Header | SMTP Header | User Data | == MAC
92 * 92 *
93 * </pre> 93 * </pre>
94 * 94 *
95 * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer 95 * The example is trimmed for simplicity, because the MAC (Medium Access Control) layer
96 * also contains a few more levels of encapsulation. 96 * also contains a few more levels of encapsulation.
97 * Since the type of the payload is more or less independent from the encapsulating protocol, 97 * Since the type of the payload is more or less independent from the encapsulating protocol,
98 * the header must be inspected before attempting to decode the payload. Hence, the 98 * the header must be inspected before attempting to decode the payload. Hence, the
99 * encapsulation level varies and can't be deduced without actually looking into the packets. 99 * encapsulation level varies and can't be deduced without actually looking into the packets.
100 * 100 *
101 * For actually working with captured frames, it's useful to identify the packets via names and 101 * For actually working with captured frames, it's useful to identify the packets via names and
102 * insert them into a parent/child - relationship based on the encapsulation. This is why 102 * insert them into a parent/child - relationship based on the encapsulation. This is why
103 * all packet classes derive from QObject. The amount of overhead caused by the QObject is 103 * all packet classes derive from QObject. The amount of overhead caused by the QObject is
104 * not a problem in this case, because we're talking about a theoratical maximum of about 104 * not a problem in this case, because we're talking about a theoratical maximum of about
105 * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the 105 * 10 packets per captured frame. We need to stuff them into a searchable list anyway and the
106 * QObject also cares about destroying the sub-, (child-) packets. 106 * QObject also cares about destroying the sub-, (child-) packets.
107 * 107 *
108 * This enables us to perform a simple look for packets of a certain type: 108 * This enables us to perform a simple look for packets of a certain type:
109 * @code 109 * @code
110 * OPacketCapturer* pcap = new OPacketCapturer(); 110 * OPacketCapturer* pcap = new OPacketCapturer();
111 * pcap->open( "eth0" ); 111 * pcap->open( "eth0" );
112 * OPacket* p = pcap->next(); 112 * OPacket* p = pcap->next();
113 * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists 113 * OIPPacket* ip = (OIPPacket*) p->child( "IP" ); // returns 0, if no such child exists
114 * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl; 114 * odebug << "got ip packet from " << ip->fromIPAddress().toString() << " to " << ip->toIPAddress().toString() << oendl;
115 * 115 *
116 */ 116 */
117 117
118class OPacket : public QObject 118class OPacket : public QObject
119{ 119{
120 Q_OBJECT 120 Q_OBJECT
121 121
122 friend class OPacketCapturer; 122 friend class OPacketCapturer;
123 friend QTextStream& operator<<( QTextStream& s, const OPacket& p ); 123 friend QTextStream& operator<<( QTextStream& s, const OPacket& p );
124 124
125 public: 125 public:
126 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent ); 126 OPacket( int datalink, packetheaderstruct, const unsigned char*, QObject* parent );
127 virtual ~OPacket(); 127 virtual ~OPacket();
128 128
129 timevalstruct timeval() const; 129 timevalstruct timeval() const;
130 130
131 int caplen() const; 131 int caplen() const;
132 int len() const; 132 int len() const;
133 QString dump( int = 32 ) const; 133 QString dump( int = 32 ) const;
134 134
135 void updateStats( QMap<QString,int>&, QObjectList* ); 135 void updateStats( QMap<QString,int>&, QObjectList* );
136 136
137 private: 137 private:
138 138
139 QString dumpStructure() const; 139 QString dumpStructure() const;
140 QString _dumpStructure( QObjectList* ) const; 140 QString _dumpStructure( QObjectList* ) const;
141 141
142 private: 142 private:
143 const packetheaderstruct _hdr; // pcap packet header 143 const packetheaderstruct _hdr; // pcap packet header
144 const unsigned char* _data; // pcap packet data 144 const unsigned char* _data; // pcap packet data
145 const unsigned char* _end; // end of pcap packet data 145 const unsigned char* _end; // end of pcap packet data
146 private: 146 private:
147 class Private; 147 class Private;
148 Private *d; 148 Private *d;
149}; 149};
150 150
151QTextStream& operator<<( QTextStream& s, const OPacket& p ); 151QTextStream& operator<<( QTextStream& s, const OPacket& p );
152 152
153/*====================================================================================== 153/*======================================================================================
154 * OEthernetPacket - DLT_EN10MB frame 154 * OEthernetPacket - DLT_EN10MB frame
155 *======================================================================================*/ 155 *======================================================================================*/
156 156
157class OEthernetPacket : public QObject 157class OEthernetPacket : public QObject
158{ 158{
159 Q_OBJECT 159 Q_OBJECT
160 160
161 public: 161 public:
162 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 ); 162 OEthernetPacket( const unsigned char*, const struct ether_header*, QObject* parent = 0 );
163 virtual ~OEthernetPacket(); 163 virtual ~OEthernetPacket();
164 164
165 OMacAddress sourceAddress() const; 165 OMacAddress sourceAddress() const;
166 OMacAddress destinationAddress() const; 166 OMacAddress destinationAddress() const;
167 int type() const; 167 int type() const;
168 168
169 private: 169 private:
170 const struct ether_header* _ether; 170 const struct ether_header* _ether;
171 private: 171 private:
172 class Private; 172 class Private;
173 Private *d; 173 Private *d;
174}; 174};
175 175
176/*====================================================================================== 176/*======================================================================================
177 * OPrismHeaderPacket - DLT_PRISM_HEADER frame 177 * OPrismHeaderPacket - DLT_PRISM_HEADER frame
178 *======================================================================================*/ 178 *======================================================================================*/
179 179
180class OPrismHeaderPacket : public QObject 180class OPrismHeaderPacket : public QObject
181{ 181{
182 Q_OBJECT 182 Q_OBJECT
183 183
184 public: 184 public:
185 OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 ); 185 OPrismHeaderPacket( const unsigned char*, const struct prism_hdr*, QObject* parent = 0 );
186 virtual ~OPrismHeaderPacket(); 186 virtual ~OPrismHeaderPacket();
187 187
188 unsigned int signalStrength() const; 188 unsigned int signalStrength() const;
189 189
190 private: 190 private:
191 const struct prism_hdr* _header; 191 const struct prism_hdr* _header;
192 class Private; 192 class Private;
193 Private *d; 193 Private *d;
194}; 194};
195 195
196/*====================================================================================== 196/*======================================================================================
197 * OWaveLanPacket - DLT_IEEE802_11 frame 197 * OWaveLanPacket - DLT_IEEE802_11 frame
198 *======================================================================================*/ 198 *======================================================================================*/
199 199
200class OWaveLanPacket : public QObject 200class OWaveLanPacket : public QObject
201{ 201{
202 Q_OBJECT 202 Q_OBJECT
203 203
204 public: 204 public:
205 OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 ); 205 OWaveLanPacket( const unsigned char*, const struct ieee_802_11_header*, QObject* parent = 0 );
206 virtual ~OWaveLanPacket(); 206 virtual ~OWaveLanPacket();
207 207
208 int duration() const; 208 int duration() const;
209 bool fromDS() const; 209 bool fromDS() const;
210 bool toDS() const; 210 bool toDS() const;
211 virtual OMacAddress macAddress1() const; 211 virtual OMacAddress macAddress1() const;
212 virtual OMacAddress macAddress2() const; 212 virtual OMacAddress macAddress2() const;
213 virtual OMacAddress macAddress3() const; 213 virtual OMacAddress macAddress3() const;
214 virtual OMacAddress macAddress4() const; 214 virtual OMacAddress macAddress4() const;
215 bool usesPowerManagement() const; 215 bool usesPowerManagement() const;
216 int type() const; 216 int type() const;
217 int subType() const; 217 int subType() const;
218 int version() const; 218 int version() const;
219 bool usesWep() const; 219 bool usesWep() const;
220 220
221 private: 221 private:
222 const struct ieee_802_11_header* _wlanhdr; 222 const struct ieee_802_11_header* _wlanhdr;
223 class Private; 223 class Private;
224 Private *d; 224 Private *d;
225}; 225};
226 226
227 227
228/*====================================================================================== 228/*======================================================================================
229 * OWaveLanManagementPacket - type: management (T_MGMT) 229 * OWaveLanManagementPacket - type: management (T_MGMT)
230 *======================================================================================*/ 230 *======================================================================================*/
231 231
232class OWaveLanManagementPacket : public QObject 232class OWaveLanManagementPacket : public QObject
233{ 233{
234 Q_OBJECT 234 Q_OBJECT
235 235
236 public: 236 public:
237 OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 ); 237 OWaveLanManagementPacket( const unsigned char*, const struct ieee_802_11_mgmt_header*, OWaveLanPacket* parent = 0 );
238 virtual ~OWaveLanManagementPacket(); 238 virtual ~OWaveLanManagementPacket();
239 239
240 QString managementType() const; 240 QString managementType() const;
241 241
242 int beaconInterval() const; 242 int beaconInterval() const;
243 int capabilities() const; // generic 243 int capabilities() const; // generic
244 244
245 bool canESS() const; 245 bool canESS() const;
246 bool canIBSS() const; 246 bool canIBSS() const;
247 bool canCFP() const; 247 bool canCFP() const;
248 bool canCFP_REQ() const; 248 bool canCFP_REQ() const;
249 bool canPrivacy() const; 249 bool canPrivacy() const;
250 250
251 private: 251 private:
252 const struct ieee_802_11_mgmt_header* _header; 252 const struct ieee_802_11_mgmt_header* _header;
253 const struct ieee_802_11_mgmt_body* _body; 253 const struct ieee_802_11_mgmt_body* _body;
254 class Private; 254 class Private;
255 Private *d; 255 Private *d;
256}; 256};
257 257
258 258
259/*====================================================================================== 259/*======================================================================================
260 * OWaveLanManagementSSID 260 * OWaveLanManagementSSID
261 *======================================================================================*/ 261 *======================================================================================*/
262 262
263class OWaveLanManagementSSID : public QObject 263class OWaveLanManagementSSID : public QObject
264{ 264{
265 Q_OBJECT 265 Q_OBJECT
266 266
267 public: 267 public:
268 OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 ); 268 OWaveLanManagementSSID( const unsigned char*, const struct ssid_t*, QObject* parent = 0 );
269 virtual ~OWaveLanManagementSSID(); 269 virtual ~OWaveLanManagementSSID();
270 270
271 QString ID( bool decloak = false ) const; 271 QString ID( bool decloak = false ) const;
272 272
273 private: 273 private:
274 const struct ssid_t* _data; 274 const struct ssid_t* _data;
275 class Private; 275 class Private;
276 Private *d; 276 Private *d;
277}; 277};
278 278
279/*====================================================================================== 279/*======================================================================================
280 * OWaveLanManagementRates 280 * OWaveLanManagementRates
281 *======================================================================================*/ 281 *======================================================================================*/
282 282
283class OWaveLanManagementRates : public QObject 283class OWaveLanManagementRates : public QObject
284{ 284{
285 Q_OBJECT 285 Q_OBJECT
286 286
287 public: 287 public:
288 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 ); 288 OWaveLanManagementRates( const unsigned char*, const struct rates_t*, QObject* parent = 0 );
289 virtual ~OWaveLanManagementRates(); 289 virtual ~OWaveLanManagementRates();
290 290
291 private: 291 private:
292 const struct rates_t* _data; 292 const struct rates_t* _data;
293 class Private; 293 class Private;
294 Private *d; 294 Private *d;
295}; 295};
296 296
297/*====================================================================================== 297/*======================================================================================
298 * OWaveLanManagementCF 298 * OWaveLanManagementCF
299 *======================================================================================*/ 299 *======================================================================================*/
300 300
301class OWaveLanManagementCF : public QObject 301class OWaveLanManagementCF : public QObject
302{ 302{
303 Q_OBJECT 303 Q_OBJECT
304 304
305 public: 305 public:
306 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 ); 306 OWaveLanManagementCF( const unsigned char*, const struct cf_t*, QObject* parent = 0 );
307 virtual ~OWaveLanManagementCF(); 307 virtual ~OWaveLanManagementCF();
308 308
309 private: 309 private:
310 const struct cf_t* _data; 310 const struct cf_t* _data;
311 class Private; 311 class Private;
312 Private *d; 312 Private *d;
313}; 313};
314 314
315/*====================================================================================== 315/*======================================================================================
316 * OWaveLanManagementFH 316 * OWaveLanManagementFH
317 *======================================================================================*/ 317 *======================================================================================*/
318 318
319class OWaveLanManagementFH : public QObject 319class OWaveLanManagementFH : public QObject
320{ 320{
321 Q_OBJECT 321 Q_OBJECT
322 322
323 public: 323 public:
324 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 ); 324 OWaveLanManagementFH( const unsigned char*, const struct fh_t*, QObject* parent = 0 );
325 virtual ~OWaveLanManagementFH(); 325 virtual ~OWaveLanManagementFH();
326 326
327 private: 327 private:
328 const struct fh_t* _data; 328 const struct fh_t* _data;
329 class Private; 329 class Private;
330 Private *d; 330 Private *d;
331}; 331};
332 332
333/*====================================================================================== 333/*======================================================================================
334 * OWaveLanManagementDS 334 * OWaveLanManagementDS
335 *======================================================================================*/ 335 *======================================================================================*/
336 336
337class OWaveLanManagementDS : public QObject 337class OWaveLanManagementDS : public QObject
338{ 338{
339 Q_OBJECT 339 Q_OBJECT
340 340
341 public: 341 public:
342 OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 ); 342 OWaveLanManagementDS( const unsigned char*, const struct ds_t*, QObject* parent = 0 );
343 virtual ~OWaveLanManagementDS(); 343 virtual ~OWaveLanManagementDS();
344 344
345 int channel() const; 345 int channel() const;
346 346
347 private: 347 private:
348 const struct ds_t* _data; 348 const struct ds_t* _data;
349 class Private; 349 class Private;
350 Private *d; 350 Private *d;
351}; 351};
352 352
353/*====================================================================================== 353/*======================================================================================
354 * OWaveLanManagementTim 354 * OWaveLanManagementTim
355 *======================================================================================*/ 355 *======================================================================================*/
356 356
357class OWaveLanManagementTim : public QObject 357class OWaveLanManagementTim : public QObject
358{ 358{
359 Q_OBJECT 359 Q_OBJECT
360 360
361 public: 361 public:
362 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 ); 362 OWaveLanManagementTim( const unsigned char*, const struct tim_t*, QObject* parent = 0 );
363 virtual ~OWaveLanManagementTim(); 363 virtual ~OWaveLanManagementTim();
364 364
365 private: 365 private:
366 const struct tim_t* _data; 366 const struct tim_t* _data;
367 class Private; 367 class Private;
368 Private *d; 368 Private *d;
369}; 369};
370 370
371/*====================================================================================== 371/*======================================================================================
372 * OWaveLanManagementIBSS 372 * OWaveLanManagementIBSS
373 *======================================================================================*/ 373 *======================================================================================*/
374 374
375class OWaveLanManagementIBSS : public QObject 375class OWaveLanManagementIBSS : public QObject
376{ 376{
377 Q_OBJECT 377 Q_OBJECT
378 378
379 public: 379 public:
380 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 ); 380 OWaveLanManagementIBSS( const unsigned char*, const struct ibss_t*, QObject* parent = 0 );
381 virtual ~OWaveLanManagementIBSS(); 381 virtual ~OWaveLanManagementIBSS();
382 382
383 private: 383 private:
384 const struct ibss_t* _data; 384 const struct ibss_t* _data;
385 class Private; 385 class Private;
386 Private *d; 386 Private *d;
387}; 387};
388 388
389/*====================================================================================== 389/*======================================================================================
390 * OWaveLanManagementChallenge 390 * OWaveLanManagementChallenge
391 *======================================================================================*/ 391 *======================================================================================*/
392 392
393class OWaveLanManagementChallenge : public QObject 393class OWaveLanManagementChallenge : public QObject
394{ 394{
395 Q_OBJECT 395 Q_OBJECT
396 396
397 public: 397 public:
398 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 ); 398 OWaveLanManagementChallenge( const unsigned char*, const struct challenge_t*, QObject* parent = 0 );
399 virtual ~OWaveLanManagementChallenge(); 399 virtual ~OWaveLanManagementChallenge();
400 400
401 private: 401 private:
402 const struct challenge_t* _data; 402 const struct challenge_t* _data;
403 class Private; 403 class Private;
404 Private *d; 404 Private *d;
405}; 405};
406 406
407/*====================================================================================== 407/*======================================================================================
408 * OWaveLanDataPacket - type: data (T_DATA) 408 * OWaveLanDataPacket - type: data (T_DATA)
409 *======================================================================================*/ 409 *======================================================================================*/
410 410
411class OWaveLanDataPacket : public QObject 411class OWaveLanDataPacket : public QObject
412{ 412{
413 Q_OBJECT 413 Q_OBJECT
414 414
415 public: 415 public:
416 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 ); 416 OWaveLanDataPacket( const unsigned char*, const struct ieee_802_11_data_header*, OWaveLanPacket* parent = 0 );
417 virtual ~OWaveLanDataPacket(); 417 virtual ~OWaveLanDataPacket();
418 418
419 private: 419 private:
420 const struct ieee_802_11_data_header* _header; 420 const struct ieee_802_11_data_header* _header;
421 class Private; 421 class Private;
422 Private *d; 422 Private *d;
423}; 423};
424 424
425/*====================================================================================== 425/*======================================================================================
426 * OWaveLanControlPacket - type: control (T_CTRL) 426 * OWaveLanControlPacket - type: control (T_CTRL)
427 *======================================================================================*/ 427 *======================================================================================*/
428 428
429class OWaveLanControlPacket : public QObject 429class OWaveLanControlPacket : public QObject
430{ 430{
431 Q_OBJECT 431 Q_OBJECT
432 432
433 public: 433 public:
434 OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 ); 434 OWaveLanControlPacket( const unsigned char*, const struct ieee_802_11_control_header*, OWaveLanPacket* parent = 0 );
435 virtual ~OWaveLanControlPacket(); 435 virtual ~OWaveLanControlPacket();
436 436
437 QString controlType() const; 437 QString controlType() const;
438 438
439 private: 439 private:
440 const struct ieee_802_11_control_header* _header; 440 const struct ieee_802_11_control_header* _header;
441 class Private; 441 class Private;
442 Private *d; 442 Private *d;
443}; 443};
444 444
445/*====================================================================================== 445/*======================================================================================
446 * OLLCPacket - IEEE 802.2 Link Level Control 446 * OLLCPacket - IEEE 802.2 Link Level Control
447 *======================================================================================*/ 447 *======================================================================================*/
448 448
449class OLLCPacket : public QObject 449class OLLCPacket : public QObject
450{ 450{
451 Q_OBJECT 451 Q_OBJECT
452 452
453 public: 453 public:
454 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 ); 454 OLLCPacket( const unsigned char*, const struct ieee_802_11_802_2_header* data, QObject* parent = 0 );
455 virtual ~OLLCPacket(); 455 virtual ~OLLCPacket();
456 456
457 private: 457 private:
458 const struct ieee_802_11_802_2_header* _header; 458 const struct ieee_802_11_802_2_header* _header;
459 class Private; 459 class Private;
460 Private *d; 460 Private *d;
461}; 461};
462 462
463/*====================================================================================== 463/*======================================================================================
464 * OIPPacket 464 * OIPPacket
465 *======================================================================================*/ 465 *======================================================================================*/
466 466
467class OIPPacket : public QObject 467class OIPPacket : public QObject
468{ 468{
469 Q_OBJECT 469 Q_OBJECT
470 470
471 public: 471 public:
472 OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 ); 472 OIPPacket( const unsigned char*, const struct iphdr*, QObject* parent = 0 );
473 virtual ~OIPPacket(); 473 virtual ~OIPPacket();
474 474
475 QHostAddress fromIPAddress() const; 475 QHostAddress fromIPAddress() const;
476 QHostAddress toIPAddress() const; 476 QHostAddress toIPAddress() const;
477 477
478 int tos() const; 478 int tos() const;
479 int len() const; 479 int len() const;
480 int id() const; 480 int id() const;
481 int offset() const; 481 int offset() const;
482 int ttl() const; 482 int ttl() const;
483 int protocol() const; 483 int protocol() const;
484 int checksum() const; 484 int checksum() const;
485 485
486 private: 486 private:
487 const struct iphdr* _iphdr; 487 const struct iphdr* _iphdr;
488 class Private; 488 class Private;
489 Private *d; 489 Private *d;
490}; 490};
491 491
492/*====================================================================================== 492/*======================================================================================
493 * OARPPacket 493 * OARPPacket
494 *======================================================================================*/ 494 *======================================================================================*/
495 495
496class OARPPacket : public QObject 496class OARPPacket : public QObject
497{ 497{
498 Q_OBJECT 498 Q_OBJECT
499 499
500 public: 500 public:
501 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 ); 501 OARPPacket( const unsigned char*, const struct myarphdr*, QObject* parent = 0 );
502 virtual ~OARPPacket(); 502 virtual ~OARPPacket();
503 503
504 QHostAddress senderIPV4Address() const; 504 QHostAddress senderIPV4Address() const;
505 OMacAddress senderMacAddress() const; 505 OMacAddress senderMacAddress() const;
506 QHostAddress targetIPV4Address() const; 506 QHostAddress targetIPV4Address() const;
507 OMacAddress targetMacAddress() const; 507 OMacAddress targetMacAddress() const;
508 508
509 //int type() const; 509 //int type() const;
510 QString type() const; 510 QString type() const;
511 511
512 private: 512 private:
513 const struct myarphdr* _arphdr; 513 const struct myarphdr* _arphdr;
514 class Private; 514 class Private;
515 Private *d; 515 Private *d;
516}; 516};
517 517
518/*====================================================================================== 518/*======================================================================================
519 * OUDPPacket 519 * OUDPPacket
520 *======================================================================================*/ 520 *======================================================================================*/
521 521
522class OUDPPacket : public QObject 522class OUDPPacket : public QObject
523{ 523{
524 Q_OBJECT 524 Q_OBJECT
525 525
526 public: 526 public:
527 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 ); 527 OUDPPacket( const unsigned char*, const struct udphdr*, QObject* parent = 0 );
528 virtual ~OUDPPacket(); 528 virtual ~OUDPPacket();
529 529
530 int fromPort() const; 530 int fromPort() const;
531 int toPort() const; 531 int toPort() const;
532 int length() const; 532 int length() const;
533 int checksum() const; 533 int checksum() const;
534 534
535 private: 535 private:
536 const struct udphdr* _udphdr; 536 const struct udphdr* _udphdr;
537 class Private; 537 class Private;
538 Private *d; 538 Private *d;
539}; 539};
540 540
541/*====================================================================================== 541/*======================================================================================
542 * ODHCPPacket 542 * ODHCPPacket
543 *======================================================================================*/ 543 *======================================================================================*/
544 544
545class ODHCPPacket : public QObject 545class ODHCPPacket : public QObject
546{ 546{
547 Q_OBJECT 547 Q_OBJECT
548 548
549 public: 549 public:
550 ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 ); 550 ODHCPPacket( const unsigned char*, const struct dhcp_packet*, QObject* parent = 0 );
551 virtual ~ODHCPPacket(); 551 virtual ~ODHCPPacket();
552 552
553 QHostAddress clientAddress() const; 553 QHostAddress clientAddress() const;
554 QHostAddress yourAddress() const; 554 QHostAddress yourAddress() const;
555 QHostAddress serverAddress() const; 555 QHostAddress serverAddress() const;
556 QHostAddress relayAddress() const; 556 QHostAddress relayAddress() const;
557 557
558 OMacAddress clientMacAddress() const; 558 OMacAddress clientMacAddress() const;
559 559
560 bool isRequest() const; 560 bool isRequest() const;
561 bool isReply() const; 561 bool isReply() const;
562 QString type() const; 562 QString type() const;
563 563
564 private: 564 private:
565 const struct dhcp_packet* _dhcphdr; 565 const struct dhcp_packet* _dhcphdr;
566 unsigned char _type; 566 unsigned char _type;
567 class Private; 567 class Private;
568 Private *d; 568 Private *d;
569}; 569};
570 570
571/*====================================================================================== 571/*======================================================================================
572 * OTCPPacket 572 * OTCPPacket
573 *======================================================================================*/ 573 *======================================================================================*/
574 574
575class OTCPPacket : public QObject 575class 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 */
608class OPacketCapturer : public QObject 608class 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
@@ -1,264 +1,264 @@
1//FIXME what is ODE? ODE Desktop Environemt? -zecke 1//FIXME what is ODE? ODE Desktop Environemt? -zecke
2//FIXME do we need titles? space is limited that is only eyecandy? -zecke 2//FIXME do we need titles? space is limited that is only eyecandy? -zecke
3//FIXME keyboard navigation is also not that popular on a PDA might be with a keyboard (tuxphone) -zecke 3//FIXME keyboard navigation is also not that popular on a PDA might be with a keyboard (tuxphone) -zecke
4/* This file is part of the ODE libraries 4/* This file is part of the ODE libraries
5 Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org> 5 Copyright (C) 2000 Daniel M. Duley <mosfet@kde.org>
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License version 2 as published by the Free Software Foundation. 9 License version 2 as published by the Free Software Foundation.
10 10
11 This library is distributed in the hope that it will be useful, 11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details. 14 Library General Public License for more details.
15 15
16 You should have received a copy of the GNU Library General Public License 16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to 17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. 19 Boston, MA 02111-1307, USA.
20*/ 20*/
21#ifndef _OPOPUP_H 21#ifndef _OPOPUP_H
22#define _OPOPUP_H 22#define _OPOPUP_H
23 23
24#define INCLUDE_MENUITEM_DEF 24#define INCLUDE_MENUITEM_DEF
25 25
26/* QT */ 26/* QT */
27 27
28#include <qpopupmenu.h> 28#include <qpopupmenu.h>
29 29
30/* OPIE */ 30/* OPIE */
31 31
32#include <opie2/opixmapeffect.h> 32#include <opie2/opixmapeffect.h>
33 33
34namespace Opie { 34namespace Opie {
35namespace Ui { 35namespace Ui {
36/** 36/**
37 * Title widget for use in @ref OPopupMenu. 37 * Title widget for use in @ref OPopupMenu.
38 * 38 *
39 * You usually don't have to create this manually since 39 * You usually don't have to create this manually since
40 * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if 40 * @ref OPopupMenu::insertTitle will do it for you, but it is allowed if
41 * you wish to customize it's look. 41 * you wish to customize it's look.
42 * 42 *
43 * @author Daniel M. Duley <mosfet@kde.org> 43 * @author Daniel M. Duley <mosfet@kde.org>
44 * @short OPopupMenu title widget. 44 * @short OPopupMenu title widget.
45 */ 45 */
46class OPopupTitle : public QWidget 46class OPopupTitle : public QWidget
47{ 47{
48 Q_OBJECT 48 Q_OBJECT
49 49
50public: 50public:
51 /** 51 /**
52 * Constructs a title widget with the user specified gradient, pixmap, 52 * Constructs a title widget with the user specified gradient, pixmap,
53 * and colors. 53 * and colors.
54 */ 54 */
55 OPopupTitle(QWidget *parent=0, const char *name=0); 55 OPopupTitle(QWidget *parent=0, const char *name=0);
56 /** 56 /**
57 * @deprecated 57 * @deprecated
58 * Constructs a title widget with the specified gradient and colors. 58 * Constructs a title widget with the specified gradient and colors.
59 */ 59 */
60 OPopupTitle(OPixmapEffect::GradientType gradient, const QColor &color, 60 OPopupTitle(OPixmapEffect::GradientType gradient, const QColor &color,
61 const QColor &textColor, QWidget *parent=0, 61 const QColor &textColor, QWidget *parent=0,
62 const char *name=0); 62 const char *name=0);
63 /** 63 /**
64 * @deprecated 64 * @deprecated
65 * Constructs a title widget with the specified pixmap and colors. 65 * Constructs a title widget with the specified pixmap and colors.
66 */ 66 */
67 OPopupTitle(const OPixmap &background, const QColor &color, 67 OPopupTitle(const OPixmap &background, const QColor &color,
68 const QColor &textColor, QWidget *parent=0, 68 const QColor &textColor, QWidget *parent=0,
69 const char *name=0); 69 const char *name=0);
70 /** 70 /**
71 * Sets the title string and optional icon for the title widget. 71 * Sets the title string and optional icon for the title widget.
72 * 72 *
73 * You will want to call this before inserting into a menu. 73 * You will want to call this before inserting into a menu.
74 */ 74 */
75 void setTitle(const QString &text, const QPixmap *icon=NULL); 75 void setTitle(const QString &text, const QPixmap *icon=NULL);
76 /** 76 /**
77 * Returns the current title. 77 * Returns the current title.
78 */ 78 */
79 QString title() const { return(titleStr); } 79 QString title() const { return(titleStr); }
80 /** 80 /**
81 * Returns the current icon. 81 * Returns the current icon.
82 */ 82 */
83 QPixmap icon() const { return(miniicon); } 83 QPixmap icon() const { return(miniicon); }
84 84
85 QSize sizeHint() const; 85 QSize sizeHint() const;
86 86
87public slots: 87public slots:
88 /// @since 3.1 88 /// @since 3.1
89 void setText( const QString &text ); 89 void setText( const QString &text );
90 /// @since 3.1 90 /// @since 3.1
91 void setIcon( const QPixmap &pix ); 91 void setIcon( const QPixmap &pix );
92 92
93protected: 93protected:
94 void paintEvent(QPaintEvent *ev); 94 void paintEvent(QPaintEvent *ev);
95 95
96 QString titleStr; 96 QString titleStr;
97 QPixmap miniicon; 97 QPixmap miniicon;
98 98
99 // Remove in KDE4 99 // Remove in KDE4
100 OPixmapEffect::GradientType grType; 100 OPixmapEffect::GradientType grType;
101 QPixmap fill; 101 QPixmap fill;
102 QColor fgColor, bgColor, grHigh, grLow; 102 QColor fgColor, bgColor, grHigh, grLow;
103 bool useGradient; 103 bool useGradient;
104 104
105protected: 105protected:
106 virtual void virtual_hook( int id, void* data ); 106 virtual void virtual_hook( int id, void* data );
107private: 107private:
108 class OPopupTitlePrivate; 108 class OPopupTitlePrivate;
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 */
129class OPopupMenu : public QPopupMenu { 129class OPopupMenu : public QPopupMenu {
130 Q_OBJECT 130 Q_OBJECT
131public: 131public:
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
229signals: 229signals:
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
239protected: 239protected:
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
247protected slots: 247protected 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
256private: 256private:
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
44namespace Opie { 44namespace Opie {
45namespace Ui { 45namespace 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 */
58class OTimePicker : public QWidget 58class OTimePicker : public QWidget
59{ 59{
60 Q_OBJECT 60 Q_OBJECT
61 61
62public: 62public:
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
65public slots: 65public 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
71public: 71public:
72 QTime time()const; 72 QTime time()const;
73 73
74private: 74private:
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
81private slots: 81private slots:
82 void slotHour(bool b); 82 void slotHour(bool b);
83 void slotMinute(bool b); 83 void slotMinute(bool b);
84 84
85signals: 85signals:
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
100class OTimePickerDialog: public OTimePickerDialogBase 100class OTimePickerDialog: public OTimePickerDialogBase
101{ 101{
102 Q_OBJECT 102 Q_OBJECT
103 103
104public: 104public:
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
110public slots: 110public 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
115private: 115private:
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
129typedef 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
@@ -1,399 +1,399 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#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
45class QHeader; 45class QHeader;
46class QIconSet; 46class QIconSet;
47class QIconViewItem; 47class QIconViewItem;
48class QListViewItem; 48class QListViewItem;
49class QPopupMenu; 49class QPopupMenu;
50class QString; 50class QString;
51 51
52#ifndef QT_NO_DRAGANDDROP 52#ifndef QT_NO_DRAGANDDROP
53class QIconDragItem; 53class QIconDragItem;
54#endif 54#endif
55 55
56namespace Opie { 56namespace Opie {
57namespace Ui { 57namespace Ui {
58class OListView; 58class OListView;
59 59
60class OVersatileView : public QWidgetStack 60class 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
163public: 163public:
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