summaryrefslogtreecommitdiffabout
path: root/microkde
Side-by-side diff
Diffstat (limited to 'microkde') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/KDGanttMinimizeSplitter.cpp194
-rw-r--r--microkde/KDGanttMinimizeSplitter.h35
-rwxr-xr-xmicrokde/fncolordialog.h16
-rw-r--r--microkde/kapplication.cpp33
-rw-r--r--microkde/kcolorbutton.cpp3
-rw-r--r--microkde/kconfig.cpp30
-rw-r--r--microkde/kconfig.h6
-rw-r--r--microkde/kdatepickernew.cpp2
-rw-r--r--microkde/kdatetbl.cpp99
-rw-r--r--microkde/kdatetbl.h20
-rw-r--r--microkde/kdebug.h4
-rw-r--r--microkde/kdecore/kcatalogue.cpp4
-rw-r--r--microkde/kdecore/kconfigbase.h4
-rw-r--r--microkde/kdecore/klibloader.cpp29
-rw-r--r--microkde/kdecore/klibloader.h10
-rw-r--r--microkde/kdecore/klocale.cpp23
-rw-r--r--microkde/kdecore/klocale.h4
-rw-r--r--microkde/kdecore/kmdcodec.cpp139
-rw-r--r--microkde/kdecore/kmdcodec.h38
-rw-r--r--microkde/kdecore/kprefs.cpp16
-rw-r--r--microkde/kdecore/kprefs.h10
-rw-r--r--microkde/kdecore/kshortcut.h8
-rw-r--r--microkde/kdecore/kstandarddirs.cpp24
-rw-r--r--microkde/kdecore/kstandarddirs.h10
-rw-r--r--microkde/kdeui/kaction.cpp75
-rw-r--r--microkde/kdeui/kaction.h26
-rw-r--r--microkde/kdeui/kactionclasses.cpp111
-rw-r--r--microkde/kdeui/kactionclasses.h51
-rw-r--r--microkde/kdeui/kactioncollection.cpp50
-rw-r--r--microkde/kdeui/kactioncollection.h4
-rw-r--r--microkde/kdeui/kbuttonbox.cpp18
-rw-r--r--microkde/kdeui/kbuttonbox.h4
-rw-r--r--microkde/kdeui/kguiitem.cpp14
-rw-r--r--microkde/kdeui/kguiitem.h12
-rw-r--r--microkde/kdeui/kjanuswidget.cpp140
-rw-r--r--microkde/kdeui/kjanuswidget.h56
-rw-r--r--microkde/kdeui/klistbox.cpp56
-rw-r--r--microkde/kdeui/klistbox.h25
-rw-r--r--microkde/kdeui/klistview.cpp337
-rw-r--r--microkde/kdeui/klistview.h121
-rw-r--r--microkde/kdeui/kmainwindow.cpp97
-rw-r--r--microkde/kdeui/kmainwindow.h19
-rw-r--r--microkde/kdeui/knuminput.cpp61
-rw-r--r--microkde/kdeui/knuminput.h15
-rw-r--r--microkde/kdeui/kpopupmenu.cpp5
-rw-r--r--microkde/kdeui/kpopupmenu.h6
-rw-r--r--microkde/kdeui/kseparator.cpp18
-rw-r--r--microkde/kdeui/kseparator.h8
-rw-r--r--microkde/kdeui/ksqueezedtextlabel.cpp3
-rw-r--r--microkde/kdeui/ksqueezedtextlabel.h2
-rw-r--r--microkde/kdeui/kstdaction.cpp2
-rw-r--r--microkde/kdeui/ktoolbar.cpp185
-rw-r--r--microkde/kdeui/ktoolbar.h68
-rw-r--r--microkde/kdeui/ktoolbarbutton.cpp106
-rw-r--r--microkde/kdeui/ktoolbarbutton.h17
-rw-r--r--microkde/kdeui/ktoolbarhandler.cpp26
-rw-r--r--microkde/kdeui/ktoolbarhandler.h10
-rw-r--r--microkde/kdeui/kxmlguiclient.cpp12
-rw-r--r--microkde/kdeui/kxmlguiclient.h6
-rw-r--r--microkde/kdialog.cpp10
-rw-r--r--microkde/kdialog.h6
-rw-r--r--microkde/kdialogbase.cpp20
-rw-r--r--microkde/kdialogbase.h16
-rw-r--r--microkde/keditlistbox.cpp33
-rw-r--r--microkde/keditlistbox.h16
-rw-r--r--microkde/kfiledialog.cpp14
-rw-r--r--microkde/kfontdialog.cpp4
-rw-r--r--microkde/kglobal.cpp5
-rw-r--r--microkde/kglobalsettings.cpp1
-rw-r--r--microkde/kiconloader.cpp12
-rw-r--r--microkde/kiconloader.h4
-rw-r--r--microkde/kio/kfile/kurlrequester.cpp10
-rw-r--r--microkde/kio/kfile/kurlrequester.h4
-rw-r--r--microkde/kio/kio/kdirwatch.cpp12
-rw-r--r--microkde/kio/kio/kdirwatch_p.h10
-rw-r--r--microkde/klineedit.h2
-rw-r--r--microkde/klineeditdlg.h4
-rw-r--r--microkde/kresources/configdialog.cpp17
-rw-r--r--microkde/kresources/configpage.cpp38
-rw-r--r--microkde/kresources/configpage.h10
-rw-r--r--microkde/kresources/factory.cpp6
-rw-r--r--microkde/kresources/factory.h4
-rw-r--r--microkde/kresources/kcmkresources.cpp7
-rw-r--r--microkde/kresources/manager.h8
-rw-r--r--microkde/kresources/managerimpl.cpp10
-rw-r--r--microkde/kresources/managerimpl.h8
-rw-r--r--microkde/kresources/resource.h4
-rw-r--r--microkde/kresources/selectdialog.cpp22
-rw-r--r--microkde/kresources/selectdialog.h10
-rw-r--r--microkde/ksystemtray.cpp3
-rw-r--r--microkde/ksystemtray.h2
-rw-r--r--microkde/ktempfile.cpp4
-rw-r--r--microkde/ktempfile.h4
-rw-r--r--microkde/ktextedit.cpp16
-rw-r--r--microkde/ktextedit.h6
-rw-r--r--microkde/kurl.cpp30
-rw-r--r--microkde/kurl.h14
-rw-r--r--microkde/kutils/kcmultidialog.cpp16
-rw-r--r--microkde/kutils/kcmultidialog.h8
-rw-r--r--microkde/microkde.pro4
-rw-r--r--microkde/microkdeE.pro2
-rw-r--r--microkde/ofileselector_p.cpp2
-rw-r--r--microkde/ofileselector_p.h2
-rw-r--r--microkde/qlayoutengine_p.h8
104 files changed, 1617 insertions, 1358 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp
index 72c4e60..4172cd0 100644
--- a/microkde/KDGanttMinimizeSplitter.cpp
+++ b/microkde/KDGanttMinimizeSplitter.cpp
@@ -17,249 +17,259 @@
** the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
** information about KDGantt Commercial License Agreements.
**
** Contact info@klaralvdalens-datakonsult.se if any conditions of this
** licensing are not clear to you.
**
** As a special exception, permission is given to link this program
** with any edition of Qt, and distribute the resulting executable,
** without including the source code for Qt in the source distribution.
**
**********************************************************************/
#include "KDGanttMinimizeSplitter.h"
#ifndef QT_NO_SPLITTER___
#include "qpainter.h"
#include "qdrawutil.h"
#include "qbitmap.h"
#if QT_VERSION >= 0x030000
-#include "qptrlist.h"
-#include "qmemarray.h"
+#include "q3ptrlist.h"
+#include "q3memarray.h"
#else
#include <qlist.h>
#include <qarray.h>
-#define QPtrList QList
-#define QMemArray QArray
+#define Q3PtrList QList
+#define Q3MemArray QArray
#endif
#include "qlayoutengine_p.h"
-#include "qobjectlist.h"
+#include "qobject.h"
#include "qstyle.h"
#include "qapplication.h" //sendPostedEvents
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qcursor.h>
-#include <qframe.h>
+#include <q3frame.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <QPixmap>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QChildEvent>
+#include <QEvent>
+#include <QPaintEvent>
#ifndef KDGANTT_MASTER_CVS
//#include "KDGanttMinimizeSplitter.moc"
#endif
#ifndef DOXYGEN_SKIP_INTERNAL
#if QT_VERSION >= 232
static int mouseOffset;
static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
-class KDRubberBand: public QFrame
+class KDRubberBand: public Q3Frame
{
public:
- KDRubberBand( QWidget *parent, const char * name, WFlags f ) :QFrame ( parent, name, f ) {;}
+ KDRubberBand( QWidget *parent, const char * name, Qt::WFlags f ) :Q3Frame ( parent, name, f ) {;}
protected:
virtual void mousePressEvent ( QMouseEvent * )
{
close();
};
};
KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o,
KDGanttMinimizeSplitter *parent, const char * name )
- : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false )
+ : _activeButton( 0 ), _collapsed( false )
{
-
+ setObjectName(name);
+ setParent(parent);
if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) {
mSizeHint = QSize(7,7);
mUseOffset = true;
} else {
mSizeHint = QSize(6,6);
mUseOffset = false;
}
s = parent;
setOrientation(o);
setMouseTracking( true );
mMouseDown = false;
//setMaximumHeight( 5 ); // test only
}
QSize KDGanttSplitterHandle::sizeHint() const
{
return mSizeHint;
}
void KDGanttSplitterHandle::setOrientation( Qt::Orientation o )
{
orient = o;
#ifndef QT_NO_CURSOR
- if ( o == KDGanttMinimizeSplitter::Horizontal )
- setCursor( splitHCursor );
+ if ( o == Qt::Horizontal )
+ setCursor( Qt::splitHCursor );
else
- setCursor( splitVCursor );
+ setCursor( Qt::splitVCursor );
#endif
}
void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e )
{
updateCursor( e->pos() );
- if ( !(e->state()&LeftButton) )
+ if ( !(e->state()&Qt::LeftButton) )
return;
if ( _activeButton != 0)
return;
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
if ( opaque() ) {
s->moveSplitter( pos, id() );
} else {
int min = pos; int max = pos;
s->getRange( id(), &min, &max );
s->setRubberband( QMAX( min, QMIN(max, pos )));
}
_collapsed = false;
}
void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e )
{
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
_activeButton = onButton( e->pos() );
mouseOffset = s->pick(e->pos());
mMouseDown = true;
repaint();
updateCursor( e->pos() );
}
}
void KDGanttSplitterHandle::updateCursor( const QPoint& p)
{
if ( onButton( p ) != 0 ) {
- setCursor( arrowCursor );
+ setCursor( Qt::arrowCursor );
}
else {
- if ( orient == KDGanttMinimizeSplitter::Horizontal )
- setCursor( splitHCursor );
+ if ( orient == Qt::Horizontal )
+ setCursor( Qt::splitHCursor );
else
- setCursor( splitVCursor );
+ setCursor( Qt::splitVCursor );
}
}
void KDGanttSplitterHandle::toggle()
{
int pos;
int min, max;
if ( !_collapsed ) {
s->expandPos( id(), &min, &max );
if ( s->minimizeDirection() == KDGanttMinimizeSplitter::Left
|| s->minimizeDirection() == KDGanttMinimizeSplitter::Up ) {
pos = min;
}
else {
pos = max;
}
_origPos = s->pick(mapToParent( QPoint( 0,0 ) ));
s->moveSplitter( pos, id() );
_collapsed = true;
}
else {
s->moveSplitter( _origPos, id() );
_collapsed = false;
}
repaint();
}
void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
{
mMouseDown = false;
if ( _activeButton != 0 ) {
if ( onButton( e->pos() ) == _activeButton )
{
toggle();
}
_activeButton = 0;
updateCursor( e->pos() );
}
else {
- if ( !opaque() && e->button() == LeftButton ) {
+ if ( !opaque() && e->button() == Qt::LeftButton ) {
QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
- mouseOffset;
s->setRubberband( -1 );
s->moveSplitter( pos, id() );
}
}
if ( s->rubberBand() ) {
//qDebug("hide rubberband ");
s->rubberBand()->close();
}
repaint();
}
int KDGanttSplitterHandle::onButton( const QPoint& p )
{
- QValueList<QPointArray> list = buttonRegions();
+ Q3ValueList<Q3PointArray> list = buttonRegions();
int index = 1;
int add = 12;
- for( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
QRect rect = (*it).boundingRect();
rect.setLeft( rect.left()- add );
rect.setRight( rect.right() + add);
rect.setTop( rect.top()- add );
rect.setBottom( rect.bottom() + add);
if ( rect.contains( p ) ) {
return index;
}
index++;
}
return 0;
}
-QValueList<QPointArray> KDGanttSplitterHandle::buttonRegions()
+Q3ValueList<Q3PointArray> KDGanttSplitterHandle::buttonRegions()
{
- QValueList<QPointArray> list;
+ Q3ValueList<Q3PointArray> list;
int sw = 8;
int yyy = 1;
int xxx = 1;
int voffset[] = { (int) -sw*3, (int) sw*3 };
for ( int i = 0; i < 2; i++ ) {
- QPointArray arr;
+ Q3PointArray arr;
if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left) {
int mid = height()/2 + voffset[i];
arr.setPoints( 3,
1-xxx, mid - sw + 4,
sw-3-xxx, mid,
1-xxx, mid + sw -4);
}
else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Left ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Right ) {
int mid = height()/2 + voffset[i];
arr.setPoints( 3,
sw-4, mid - sw + 4,
0, mid,
sw-4, mid + sw - 4);
}
else if ( !_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Up ||
_collapsed && s->minimizeDirection() == KDGanttMinimizeSplitter::Down) {
int mid = width()/2 + voffset[i];
arr.setPoints( 3,
mid - sw + 4, sw-4,
mid, 0,
mid + sw - 4, sw-4 );
}
@@ -290,53 +300,53 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
if ( mMouseDown && ! _activeButton)
buffer.fill( colorGroup().background().dark() );
else
#endif
buffer.fill( colorGroup().background() );
//buffer.fill( backgroundColor() );
// parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup());
int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size
// arrow color
QColor col;
if ( _activeButton )
col = colorGroup().background().dark( 250 );
else {
if ( mMouseDown )
col = Qt::white;
else
col = colorGroup().background().dark( 150 );
}
//QColor col = backgroundColor().dark( 130 );
p.setBrush( col );
p.setPen( col );
- QValueList<QPointArray> list = buttonRegions();
+ Q3ValueList<Q3PointArray> list = buttonRegions();
int index = 1;
if ( mUseOffset )
p.translate( 0, 1 );
- for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
+ for ( Q3ValueList<Q3PointArray>::Iterator it = list.begin(); it != list.end(); ++it ) {
if ( index == _activeButton ) {
/*
if ( ! _collapsed ) {
p.save();
// p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ),
// parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) );
p.translate( -1, 0 );
p.drawPolygon( *it, true );
p.restore(); } else
*/
p.drawPolygon( *it, true );
}
else {
/*
if ( ! _collapsed ) {
p.save();
p.translate( -1, 0 );
p.drawPolygon( *it, true );
p.restore();
} else
*/
p.drawPolygon( *it, true );
@@ -356,54 +366,54 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * )
s->minimizeDirection() == KDGanttMinimizeSplitter::Down ) {
int mid = width()/2;
p.drawLine( mid -sw, 1, mid +sw, 1 );
p.drawLine( mid -sw, 3, mid +sw, 3 );
}
bitBlt( this, 0, 0, &buffer );
}
#endif
class QSplitterLayoutStruct
{
public:
KDGanttMinimizeSplitter::ResizeMode mode;
QCOORD sizer;
bool isSplitter;
QWidget *wid;
};
class QSplitterData
{
public:
QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {}
- QPtrList<QSplitterLayoutStruct> list;
+ Q3PtrList<QSplitterLayoutStruct> list;
bool opaque;
bool firstShow;
};
-void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer );
#endif // DOXYGEN_SKIP_INTERNAL
/*!
\class KDGanttMinimizeSplitter KDGanttMinimizeSplitter.h
\brief The KDGanttMinimizeSplitter class implements a splitter
widget with minimize buttons.
This class (and its documentation) is largely a copy of Qt's
QSplitter; the copying was necessary because QSplitter is not
extensible at all. QSplitter and its documentation are licensed
according to the GPL and the Qt Professional License (if you hold
such a license) and are (C) Trolltech AS.
A splitter lets the user control the size of child widgets by
dragging the boundary between the children. Any number of widgets
may be controlled.
To show a QListBox, a QListView and a QTextEdit side by side:
\code
KDGanttMinimizeSplitter *split = new KDGanttMinimizeSplitter( parent );
QListBox *lb = new QListBox( split );
@@ -440,498 +450,505 @@ static QSize minSize( const QWidget* /*w*/ )
{
return QSize(0,0);
}
// This is the original version of minSize
static QSize minSizeHint( const QWidget* w )
{
QSize min = w->minimumSize();
QSize s;
if ( min.height() <= 0 || min.width() <= 0 )
s = w->minimumSizeHint();
if ( min.height() > 0 )
s.setHeight( min.height() );
if ( min.width() > 0 )
s.setWidth( min.width() );
return s.expandedTo(QSize(0,0));
}
/*!
Constructs a horizontal splitter with the \a parent and \a
name arguments being passed on to the QFrame constructor.
*/
KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
+ :Q3Frame(parent,name)
{
+ setAttribute(Qt::WA_PaintUnclipped);
mRubberBand = 0;
mFirstHandle = 0;
#if QT_VERSION >= 232
- orient = Horizontal;
+ orient = Qt::Horizontal;
init();
#endif
}
/*!
Constructs a splitter with orientation \a o with the \a parent
and \a name arguments being passed on to the QFrame constructor.
*/
-KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name )
- :QFrame(parent,name,WPaintUnclipped)
+KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Qt::Orientation o, QWidget *parent, const char *name )
+ :Q3Frame(parent,name)
{
-
+ setAttribute(Qt::WA_PaintUnclipped);
mRubberBand = 0;
mFirstHandle = 0;
#if QT_VERSION >= 232
orient = o;
init();
#endif
}
/*!
Destroys the splitter and any children.
*/
KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter()
{
#if QT_VERSION >= 232
data->list.setAutoDelete( TRUE );
delete data;
#endif
if ( mRubberBand )
delete mRubberBand;
}
#if QT_VERSION >= 232
void KDGanttMinimizeSplitter::init()
{
data = new QSplitterData;
- if ( orient == Horizontal )
+ if ( orient == Qt::Horizontal )
setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum) );
else
setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding) );
#ifndef DESKTOP_VERSION
setOpaqueResize( false );
#else
setOpaqueResize( true );
#endif
}
#endif
void KDGanttMinimizeSplitter::toggle()
{
if ( mFirstHandle )
mFirstHandle->toggle();
else
qDebug("KDGanttMinimizeSplitter::toggle::sorry, handle not available ");
}
/*!
\brief the orientation of the splitter
By default the orientation is horizontal (the widgets are side by side).
The possible orientations are Qt:Vertical and Qt::Horizontal (the default).
*/
-void KDGanttMinimizeSplitter::setOrientation( Orientation o )
+void KDGanttMinimizeSplitter::setOrientation( Qt::Orientation o )
{
#if QT_VERSION >= 232
if ( orient == o )
return;
orient = o;
- if ( orient == Horizontal )
+ if ( orient == Qt::Horizontal )
setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
else
setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->isSplitter )
((KDGanttSplitterHandle*)s->wid)->setOrientation( o );
s = data->list.next(); // ### next at end of loop, no iterator
}
recalc( isVisible() );
#endif
}
#if QT_VERSION >= 232
/*!
\reimp
*/
void KDGanttMinimizeSplitter::resizeEvent( QResizeEvent * )
{
doResize();
}
/*
Inserts the widget \a w at the end (or at the beginning if \a first
is TRUE) of the splitter's list of widgets.
It is the responsibility of the caller of this function to make sure
that \a w is not already in the splitter and to call recalcId if
needed. (If \a first is TRUE, then recalcId is very probably
needed.)
*/
QSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( QWidget *w, bool first )
{
QSplitterLayoutStruct *s;
KDGanttSplitterHandle *newHandle = 0;
if ( data->list.count() > 0 ) {
s = new QSplitterLayoutStruct;
s->mode = KeepSize;
QString tmp = "qt_splithandle_";
tmp += w->name();
newHandle = new KDGanttSplitterHandle( orientation(), this, tmp.latin1() );
- if ( ! mFirstHandle )
- mFirstHandle = newHandle;
+ if ( ! mFirstHandle )
+ mFirstHandle = newHandle;
s->wid = newHandle;
newHandle->setId(data->list.count());
s->isSplitter = TRUE;
s->sizer = pick( newHandle->sizeHint() );
if ( first )
data->list.insert( 0, s );
else
data->list.append( s );
}
s = new QSplitterLayoutStruct;
s->mode = Stretch;
s->wid = w;
- if ( !testWState( WState_Resized ) && w->sizeHint().isValid() )
+ if ( !testAttribute( Qt::WA_Resized ) && w->sizeHint().isValid() )
s->sizer = pick( w->sizeHint() );
else
s->sizer = pick( w->size() );
s->isSplitter = FALSE;
if ( first )
data->list.insert( 0, s );
else
data->list.append( s );
if ( newHandle && isVisible() )
newHandle->show(); //will trigger sending of post events
return s;
}
/*!
Tells the splitter that a child widget has been inserted or removed.
The event is passed in \a c.
*/
void KDGanttMinimizeSplitter::childEvent( QChildEvent *c )
{
- if ( c->type() == QEvent::ChildInserted ) {
+ if ( c->type() == QEvent::ChildAdded ) {
if ( !c->child()->isWidgetType() )
return;
- if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) )
+ QWidget *cw = (QWidget*)c->child();
+
+ if ( (cw->windowFlags())&Qt::Window )
+ return;
+
+ // avoid infinite recursion
+ if(cw->objectName().startsWith("qt_splithandle_"))
return;
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
- if ( s->wid == c->child() )
+ if ( s->wid == cw )
return;
s = data->list.next();
}
- addWidget( (QWidget*)c->child() );
+ addWidget( cw );
recalc( isVisible() );
} else if ( c->type() == QEvent::ChildRemoved ) {
QSplitterLayoutStruct *p = 0;
if ( data->list.count() > 1 )
p = data->list.at(1); //remove handle _after_ first widget.
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->wid == c->child() ) {
data->list.removeRef( s );
delete s;
if ( p && p->isSplitter ) {
data->list.removeRef( p );
delete p->wid; //will call childEvent
delete p;
}
recalcId();
doResize();
return;
}
p = s;
s = data->list.next();
}
}
}
/*!
Shows a rubber band at position \a p. If \a p is negative, the
rubber band is removed.
*/
void KDGanttMinimizeSplitter::setRubberband( int p )
{
#ifdef DESKTOP_VERSION
QPainter paint( this );
- paint.setPen( gray );
- paint.setBrush( gray );
- paint.setRasterOp( XorROP );
+ paint.setPen( Qt::gray );
+ paint.setBrush( Qt::gray );
+ paint.setCompositionMode( QPainter::CompositionMode_Xor );
QRect r = contentsRect();
const int rBord = 3; //Themable????
#if QT_VERSION >= 0x030000
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
#else
int sw = style().splitterWidth();
#endif
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
if ( opaqueOldPos >= 0 )
paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(),
2*rBord, r.height() );
if ( p >= 0 )
paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() );
} else {
if ( opaqueOldPos >= 0 )
paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord,
r.width(), 2*rBord );
if ( p >= 0 )
paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord );
}
opaqueOldPos = p;
#else
if ( !mRubberBand ) {
- mRubberBand = new KDRubberBand( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop);
+ mRubberBand = new KDRubberBand( 0, "rubber", Qt::WStyle_NoBorder | Qt::WStyle_Customize | Qt::WStyle_StaysOnTop);
mRubberBand->setFrameStyle( Box | Raised );
//mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) );
mRubberBand->setPalette( QPalette ( colorGroup().background().light(), colorGroup().background().dark() ));
}
QRect r = contentsRect();
static int rBord = 0; //Themable????
if ( !rBord ) {
if (QApplication::desktop()->width() <= 320 )
rBord = 3;
else
rBord = 4;
}
int sw = style().splitterWidth();
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
if ( p >= 0 ) {
QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y()));
mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() );
}
} else {
if ( p >= 0 ) {
QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord));
mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord);
}
}
opaqueOldPos = p;
if ( ! mRubberBand->isVisible() ) {
mRubberBand->show();
}
#endif
}
/*! \reimp */
bool KDGanttMinimizeSplitter::event( QEvent *e )
{
- if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) {
+ if ( e->type() == QEvent::LayoutRequest || ( e->type() == QEvent::Show && data->firstShow ) ) {
recalc( isVisible() );
if ( e->type() == QEvent::Show )
data->firstShow = FALSE;
}
return QWidget::event( e );
}
/*!
\obsolete
Draws the splitter handle in the rectangle described by \a x, \a y,
\a w, \a h using painter \a p.
\sa QStyle::drawPrimitive()
*/
void KDGanttMinimizeSplitter::drawSplitter( QPainter *p,
QCOORD x, QCOORD y, QCOORD w, QCOORD h )
{
#if 0
// LR
style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(),
(orientation() == Qt::Horizontal ?
- QStyle::Style_Horizontal : 0));
+ QStyle::State_Horizontal : 0));
#endif
}
/*!
Returns the id of the splitter to the right of or below the widget \a w,
or 0 if there is no such splitter
(i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end).
*/
int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const
{
QSplitterLayoutStruct *s = data->list.first();
bool seen_w = FALSE;
while ( s ) {
if ( s->isSplitter && seen_w )
return data->list.at();
if ( !s->isSplitter && s->wid == w )
seen_w = TRUE;
s = data->list.next();
}
return 0;
}
/*!
Moves the left/top edge of the splitter handle with id \a id as
close as possible to position \a p, which is the distance from the
left (or top) edge of the widget.
For Arabic and Hebrew the layout is reversed, and using this
function to set the position of the splitter might lead to
unexpected results, since in Arabic and Hebrew the position of
splitter one is to the left of the position of splitter zero.
\sa idAfter()
*/
void KDGanttMinimizeSplitter::moveSplitter( QCOORD p, int id )
{
p = adjustPos( p, id );
QSplitterLayoutStruct *s = data->list.at(id);
- int oldP = orient == Horizontal ? s->wid->x() : s->wid->y();
+ int oldP = orient == Qt::Horizontal ? s->wid->x() : s->wid->y();
bool upLeft;
- if ( false && orient == Horizontal ) {
+ if ( false && orient == Qt::Horizontal ) {
p += s->wid->width();
upLeft = p > oldP;
} else
upLeft = p < oldP;
moveAfter( p, id, upLeft );
moveBefore( p-1, id-1, upLeft );
storeSizes();
}
void KDGanttMinimizeSplitter::setG( QWidget *w, int p, int s, bool isSplitter )
{
- if ( orient == Horizontal ) {
- if ( false && orient == Horizontal && !isSplitter )
+ if ( orient == Qt::Horizontal ) {
+ if ( false && orient == Qt::Horizontal && !isSplitter )
p = contentsRect().width() - p - s;
w->setGeometry( p, contentsRect().y(), s, contentsRect().height() );
} else
w->setGeometry( contentsRect().x(), p, contentsRect().width(), s );
}
/*
Places the right/bottom edge of the widget at \a id at position \a pos.
\sa idAfter()
*/
void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft )
{
if( id < 0 )
return;
QSplitterLayoutStruct *s = data->list.at(id);
if ( !s )
return;
QWidget *w = s->wid;
if ( w->isHidden() ) {
moveBefore( pos, id-1, upLeft );
} else if ( s->isSplitter ) {
int pos1, pos2;
int dd = s->sizer;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
pos1 = pos;
pos2 = pos + dd;
} else {
pos2 = pos - dd;
pos1 = pos2 + 1;
}
if ( upLeft ) {
setG( w, pos1, dd, TRUE );
moveBefore( pos2, id-1, upLeft );
} else {
moveBefore( pos2, id-1, upLeft );
setG( w, pos1, dd, TRUE );
}
} else {
int dd, newLeft, nextPos;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
dd = w->geometry().right() - pos;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos+1;
nextPos = newLeft + dd;
} else {
dd = pos - pick( w->pos() ) + 1;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
}
setG( w, newLeft, dd, TRUE );
moveBefore( nextPos, id-1, upLeft );
}
}
/*
Places the left/top edge of the widget at \a id at position \a pos.
\sa idAfter()
*/
void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft )
{
QSplitterLayoutStruct *s = id < int(data->list.count()) ?
data->list.at(id) : 0;
if ( !s )
return;
QWidget *w = s->wid;
if ( w->isHidden() ) {
moveAfter( pos, id+1, upLeft );
} else if ( pick( w->pos() ) == pos ) {
//No need to do anything if it's already there.
return;
} else if ( s->isSplitter ) {
int dd = s->sizer;
int pos1, pos2;
- if( false && orient == Horizontal ) {
+ if( false && orient == Qt::Horizontal ) {
pos2 = pos - dd;
pos1 = pos2 + 1;
} else {
pos1 = pos;
pos2 = pos + dd;
}
if ( upLeft ) {
setG( w, pos1, dd, TRUE );
moveAfter( pos2, id+1, upLeft );
} else {
moveAfter( pos2, id+1, upLeft );
setG( w, pos1, dd, TRUE );
}
} else {
int left = pick( w->pos() );
int right, dd,/* newRight,*/ newLeft, nextPos;
- if ( false && orient == Horizontal ) {
+ if ( false && orient == Qt::Horizontal ) {
dd = pos - left + 1;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
newLeft = pos-dd+1;
nextPos = newLeft - 1;
} else {
right = pick( w->geometry().bottomRight() );
dd = right - pos + 1;
dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize())));
/*newRight = pos+dd-1;*/
newLeft = pos;
nextPos = newLeft + dd;
}
setG( w, newLeft, dd, TRUE );
/*if( right != newRight )*/
moveAfter( nextPos, id+1, upLeft );
}
}
void KDGanttMinimizeSplitter::expandPos( int id, int* min, int* max )
{
QSplitterLayoutStruct *s = data->list.at(id-1);
QWidget* w = s->wid;
*min = pick( w->mapToParent( QPoint(0,0) ) );
@@ -967,91 +984,91 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max )
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
//ignore
} else if ( s->isSplitter ) {
minB += s->sizer;
maxB += s->sizer;
} else {
minB += pick( minSize(s->wid) );
maxB += pick( s->wid->maximumSize() );
}
}
for ( i = id; i < n; i++ ) {
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
//ignore
} else if ( s->isSplitter ) {
minA += s->sizer;
maxA += s->sizer;
} else {
minA += pick( minSize(s->wid) );
maxA += pick( s->wid->maximumSize() );
}
}
QRect r = contentsRect();
- if ( orient == Horizontal && false ) {
+ if ( orient == Qt::Horizontal && false ) {
#if QT_VERSION >= 0x030000
- int splitterWidth = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int splitterWidth = style()->pixelMetric(QStyle::PM_SplitterWidth, 0,this);
#else
int splitterWidth = style().splitterWidth();
#endif
if ( min )
*min = pick(r.topRight()) - QMIN( maxB, pick(r.size())-minA ) - splitterWidth;
if ( max )
*max = pick(r.topRight()) - QMAX( minB, pick(r.size())-maxA ) - splitterWidth;
} else {
if ( min )
*min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA );
if ( max )
*max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA );
}
}
/*!
Returns the closest legal position to \a p of the splitter with id \a id.
\sa idAfter()
*/
int KDGanttMinimizeSplitter::adjustPos( int p, int id )
{
int min = 0;
int max = 0;
getRange( id, &min, &max );
p = QMAX( min, QMIN( p, max ) );
return p;
}
void KDGanttMinimizeSplitter::doResize()
{
QRect r = contentsRect();
int i;
int n = data->list.count();
- QMemArray<QLayoutStruct> a( n );
+ Q3MemArray<QLayoutStruct> a( n );
for ( i = 0; i< n; i++ ) {
a[i].init();
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->wid->isHidden() ) {
a[i].stretch = 0;
a[i].sizeHint = a[i].minimumSize = 0;
a[i].maximumSize = 0;
} else if ( s->isSplitter ) {
a[i].stretch = 0;
a[i].sizeHint = a[i].minimumSize = a[i].maximumSize = s->sizer;
a[i].empty = FALSE;
} else if ( s->mode == KeepSize ) {
a[i].stretch = 0;
a[i].minimumSize = pick( minSize(s->wid) );
a[i].sizeHint = s->sizer;
a[i].maximumSize = pick( s->wid->maximumSize() );
a[i].empty = FALSE;
} else if ( s->mode == FollowSizeHint ) {
a[i].stretch = 0;
a[i].minimumSize = a[i].sizeHint = pick( s->wid->sizeHint() );
a[i].maximumSize = pick( s->wid->maximumSize() );
a[i].empty = FALSE;
} else { //proportional
a[i].stretch = s->sizer;
@@ -1111,49 +1128,49 @@ void KDGanttMinimizeSplitter::recalc( bool update )
QSize minS = minSize(s->wid);
minl += pick( minS );
maxl += pick( s->wid->maximumSize() );
mint = QMAX( mint, trans( minS ));
int tm = trans( s->wid->maximumSize() );
if ( tm > 0 )
maxt = QMIN( maxt, tm );
}
}
}
if ( empty ) {
if ( parentWidget() != 0 && parentWidget()->inherits("KDGanttMinimizeSplitter") ) {
// nested splitters; be nice
maxl = maxt = 0;
} else {
// KDGanttMinimizeSplitter with no children yet
maxl = QWIDGETSIZE_MAX;
}
} else {
maxl = QMIN( maxl, QWIDGETSIZE_MAX );
}
if ( maxt < mint )
maxt = mint;
- if ( orient == Horizontal ) {
+ if ( orient == Qt::Horizontal ) {
setMaximumSize( maxl, maxt );
setMinimumSize( minl, mint );
} else {
setMaximumSize( maxt, maxl );
setMinimumSize( mint, minl );
}
if ( update )
doResize();
}
/*!
Sets resize mode of \a w to \a mode.
\sa ResizeMode
*/
void KDGanttMinimizeSplitter::setResizeMode( QWidget *w, ResizeMode mode )
{
processChildEvents();
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->wid == w ) {
s->mode = mode;
return;
@@ -1246,96 +1263,90 @@ void KDGanttMinimizeSplitter::moveToLast( QWidget *w )
if ( !found )
addWidget( w);
recalcId();
}
void KDGanttMinimizeSplitter::recalcId()
{
int n = data->list.count();
for ( int i = 0; i < n; i++ ) {
QSplitterLayoutStruct *s = data->list.at(i);
if ( s->isSplitter )
((KDGanttSplitterHandle*)s->wid)->setId(i);
}
}
/*!\reimp
*/
QSize KDGanttMinimizeSplitter::sizeHint() const
{
constPolish();
int l = 0;
int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
+ if ( !children().empty() ) {
+ const QObjectList c = children();
+ for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
+ QObject * o = *i;
if ( o->isWidgetType() &&
!((QWidget*)o)->isHidden() ) {
QSize s = ((QWidget*)o)->sizeHint();
if ( s.isValid() ) {
l += pick( s );
t = QMAX( t, trans( s ) );
}
}
}
}
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
+ return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
}
/*!
\reimp
*/
QSize KDGanttMinimizeSplitter::minimumSizeHint() const
{
constPolish();
int l = 0;
int t = 0;
- if ( children() ) {
- const QObjectList * c = children();
- QObjectListIt it( *c );
- QObject * o;
-
- while( (o=it.current()) != 0 ) {
- ++it;
+ if ( !children().empty() ) {
+ const QObjectList c = children();
+ for(QObjectList::const_iterator i=c.begin();i!=c.end();++i) {
+ QObject * o = *i;
if ( o->isWidgetType() &&
!((QWidget*)o)->isHidden() ) {
QSize s = minSizeHint((QWidget*)o);
if ( s.isValid() ) {
l += pick( s );
t = QMAX( t, trans( s ) );
}
}
}
}
- return orientation() == Horizontal ? QSize( l, t ) : QSize( t, l );
+ return orientation() == Qt::Horizontal ? QSize( l, t ) : QSize( t, l );
}
/*
Calculates stretch parameters from current sizes
*/
void KDGanttMinimizeSplitter::storeSizes()
{
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( !s->isSplitter )
s->sizer = pick( s->wid->size() );
s = data->list.next();
}
}
#if 0 // ### remove this code ASAP
/*!
Hides \a w if \a hide is TRUE and updates the splitter.
\warning Due to a limitation in the current implementation,
@@ -1381,159 +1392,160 @@ bool KDGanttMinimizeSplitter::isHidden( QWidget *w ) const
#endif
/*!
Returns a list of the size parameters of all the widgets in this
splitter.
Giving the values to another splitter's setSizes() function will
produce a splitter with the same layout as this one.
Note that if you want to iterate over the list, you should
iterate over a copy, e.g.
\code
QValueList<int> list = mySplitter.sizes();
QValueList<int>::Iterator it = list.begin();
while( it != list.end() ) {
myProcessing( *it );
++it;
}
\endcode
\sa setSizes()
*/
-QValueList<int> KDGanttMinimizeSplitter::sizes() const
+Q3ValueList<int> KDGanttMinimizeSplitter::sizes() const
{
+ /* TODO: hacker
if ( !testWState(WState_Polished) ) {
QWidget* that = (QWidget*) this;
that->polish();
- }
- QValueList<int> list;
+ } */
+ Q3ValueList<int> list;
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( !s->isSplitter )
list.append( s->sizer );
s = data->list.next();
}
return list;
}
/*!
Sets the size parameters to the values given in \a list.
If the splitter is horizontal, the values set the sizes from
left to right. If it is vertical, the sizes are applied from
top to bottom.
Extra values in \a list are ignored.
If \a list contains too few values, the result is undefined
but the program will still be well-behaved.
\sa sizes()
*/
-void KDGanttMinimizeSplitter::setSizes( QValueList<int> list )
+void KDGanttMinimizeSplitter::setSizes( Q3ValueList<int> list )
{
processChildEvents();
- QValueList<int>::Iterator it = list.begin();
+ Q3ValueList<int>::Iterator it = list.begin();
QSplitterLayoutStruct *s = data->list.first();
while ( s && it != list.end() ) {
if ( !s->isSplitter ) {
s->sizer = *it;
++it;
}
s = data->list.next();
}
doResize();
}
/*!
Gets all posted child events, ensuring that the internal state of
the splitter is consistent.
*/
void KDGanttMinimizeSplitter::processChildEvents()
{
- QApplication::sendPostedEvents( this, QEvent::ChildInserted );
+ QApplication::sendPostedEvents( this, QEvent::ChildAdded );
}
/*!
\reimp
*/
void KDGanttMinimizeSplitter::styleChange( QStyle& old )
{
#if QT_VERSION >= 0x030000
- int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this);
+ int sw = style()->pixelMetric(QStyle::PM_SplitterWidth, 0, this);
#else
int sw = style().splitterWidth();
#endif
QSplitterLayoutStruct *s = data->list.first();
while ( s ) {
if ( s->isSplitter )
s->sizer = sw;
s = data->list.next();
}
doResize();
- QFrame::styleChange( old );
+ Q3Frame::styleChange( old );
}
#endif
/*!
Specifies the direction of the minimize buttons.
If the orientation of the splitter is horizontal then with
KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used,
otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down
should be used.
*/
void KDGanttMinimizeSplitter::setMinimizeDirection( Direction direction )
{
_direction = direction;
}
/*!
Returns the direction of the minimize buttons.
*/
KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection() const
{
return _direction;
}
/*
This is a copy of qGeomCalc() in qlayoutengine.cpp which
unfortunately isn't exported.
*/
static inline int toFixed( int i ) { return i * 256; }
static inline int fRound( int i ) {
return ( i % 256 < 128 ) ? i / 256 : 1 + i / 256;
}
-void kdganttGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void kdganttGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer )
{
typedef int fixed;
int cHint = 0;
int cMin = 0;
int cMax = 0;
int sumStretch = 0;
int spacerCount = 0;
bool wannaGrow = FALSE; // anyone who really wants to grow?
// bool canShrink = FALSE; // anyone who could be persuaded to shrink?
int i;
for ( i = start; i < start + count; i++ ) {
chain[i].done = FALSE;
cHint += chain[i].sizeHint;
cMin += chain[i].minimumSize;
cMax += chain[i].maximumSize;
sumStretch += chain[i].stretch;
if ( !chain[i].empty )
spacerCount++;
wannaGrow = wannaGrow || chain[i].expansive;
}
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h
index 3042e0a..338d965 100644
--- a/microkde/KDGanttMinimizeSplitter.h
+++ b/microkde/KDGanttMinimizeSplitter.h
@@ -1,190 +1,197 @@
+//Added by qt3to4:
+#include <Q3PointArray>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QChildEvent>
+#include <QMouseEvent>
+#include <QEvent>
/* -*- Mode: C++ -*-
$Id$
*/
/****************************************************************************
** Copyright (C) 2001-2004 Klarälvdalens Datakonsult AB. All rights reserved.
**
** This file is part of the KDGantt library.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid commercial KDGantt licenses may use this file in
** accordance with the KDGantt Commercial License Agreement provided with
** the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.klaralvdalens-datakonsult.se/Public/products/ for
** information about KDGantt Commercial License Agreements.
**
** Contact info@klaralvdalens-datakonsult.se if any conditions of this
** licensing are not clear to you.
**
** As a special exception, permission is given to link this program
** with any edition of Qt, and distribute the resulting executable,
** without including the source code for Qt in the source distribution.
**
**********************************************************************/
#ifndef KDGANTTMINIMIZESPLITTER_H
#define KDGANTTMINIMIZESPLITTER_H
#ifndef QT_H
-#include "qframe.h"
-#include "qvaluelist.h"
+#include "q3frame.h"
+#include "q3valuelist.h"
#endif // QT_H
#ifndef QT_NO_SPLITTER___
class QSplitterData;
class QSplitterLayoutStruct;
class KDGanttSplitterHandle;
class KDRubberBand;
-class KDGanttMinimizeSplitter : public QFrame
+class KDGanttMinimizeSplitter : public Q3Frame
{
Q_OBJECT
// Q_ENUMS( Direction )
// Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
// Q_PROPERTY( Direction minimizeDirection READ minimizeDirection WRITE setMinimizeDirection )
public:
enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
enum Direction { Left, Right, Up, Down };
KDGanttMinimizeSplitter( QWidget* parent=0, const char* name=0 );
- KDGanttMinimizeSplitter( Orientation, QWidget* parent=0, const char* name=0 );
+ KDGanttMinimizeSplitter( Qt::Orientation, QWidget* parent=0, const char* name=0 );
~KDGanttMinimizeSplitter();
- virtual void setOrientation( Orientation );
- Orientation orientation() const { return orient; }
+ virtual void setOrientation( Qt::Orientation );
+ Qt::Orientation orientation() const { return orient; }
void setMinimizeDirection( Direction );
Direction minimizeDirection() const;
#if QT_VERSION >= 232
virtual void setResizeMode( QWidget *w, ResizeMode );
virtual void setOpaqueResize( bool = TRUE );
bool opaqueResize() const;
void moveToFirst( QWidget * );
void moveToLast( QWidget * );
void refresh() { recalc( TRUE ); }
QSize sizeHint() const;
QSize minimumSizeHint() const;
- QValueList<int> sizes() const;
- void setSizes( QValueList<int> );
+ Q3ValueList<int> sizes() const;
+ void setSizes( Q3ValueList<int> );
KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;}
void expandPos( int id, int* min, int* max );
KDRubberBand* rubberBand() { return mRubberBand ;}
public slots:
void toggle();
protected:
void childEvent( QChildEvent * );
bool event( QEvent * );
void resizeEvent( QResizeEvent * );
int idAfter( QWidget* ) const;
void moveSplitter( QCOORD pos, int id );
virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
QCOORD w, QCOORD h );
void styleChange( QStyle& );
int adjustPos( int , int );
virtual void setRubberband( int );
void getRange( int id, int*, int* );
private:
KDRubberBand* mRubberBand;
void init();
void recalc( bool update = FALSE );
void doResize();
void storeSizes();
void processChildEvents();
QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
void recalcId();
void moveBefore( int pos, int id, bool upLeft );
void moveAfter( int pos, int id, bool upLeft );
void setG( QWidget *w, int p, int s, bool isSplitter = FALSE );
QCOORD pick( const QPoint &p ) const
- { return orient == Horizontal ? p.x() : p.y(); }
+ { return orient == Qt::Horizontal ? p.x() : p.y(); }
QCOORD pick( const QSize &s ) const
- { return orient == Horizontal ? s.width() : s.height(); }
+ { return orient == Qt::Horizontal ? s.width() : s.height(); }
QCOORD trans( const QPoint &p ) const
- { return orient == Vertical ? p.x() : p.y(); }
+ { return orient == Qt::Vertical ? p.x() : p.y(); }
QCOORD trans( const QSize &s ) const
- { return orient == Vertical ? s.width() : s.height(); }
+ { return orient == Qt::Vertical ? s.width() : s.height(); }
KDGanttSplitterHandle* mFirstHandle;
QSplitterData *data;
#endif
private:
- Orientation orient;
+ Qt::Orientation orient;
Direction _direction;
#ifndef DOXYGEN_SKIP_INTERNAL
friend class KDGanttSplitterHandle;
#endif
private: // Disabled copy constructor and operator=
#if defined(Q_DISABLE_COPY)
KDGanttMinimizeSplitter( const KDGanttMinimizeSplitter & );
KDGanttMinimizeSplitter& operator=( const KDGanttMinimizeSplitter & );
#endif
};
#ifndef DOXYGEN_SKIP_INTERNAL
// This class was continued from a verbatim copy of the
// QSplitterHandle pertaining to the Qt Enterprise License and the
// GPL. It has only been renamed to KDGanttSplitterHandler in order to
// avoid a symbol clash on some platforms.
class KDGanttSplitterHandle : public QWidget
{
Q_OBJECT
#if QT_VERSION >= 232
public:
KDGanttSplitterHandle( Qt::Orientation o,
KDGanttMinimizeSplitter *parent, const char* name=0 );
void setOrientation( Qt::Orientation o );
Qt::Orientation orientation() const { return orient; }
bool opaque() const { return s->opaqueResize(); }
QSize sizeHint() const;
void toggle();
int id() const { return myId; } // data->list.at(id())->wid == this
void setId( int i ) { myId = i; }
protected:
- QValueList<QPointArray> buttonRegions();
+ Q3ValueList<Q3PointArray> buttonRegions();
void paintEvent( QPaintEvent * );
void mouseMoveEvent( QMouseEvent * );
void mousePressEvent( QMouseEvent * );
void mouseReleaseEvent( QMouseEvent * );
int onButton( const QPoint& p );
void updateCursor( const QPoint& p );
private:
bool mMouseDown;
QSize mSizeHint;
bool mUseOffset;
Qt::Orientation orient;
bool opaq;
int myId;
KDGanttMinimizeSplitter *s;
int _activeButton;
bool _collapsed;
int _origPos;
#endif
};
#endif
#endif // QT_NO_SPLITTER
diff --git a/microkde/fncolordialog.h b/microkde/fncolordialog.h
index 615d2ed..52356be 100755
--- a/microkde/fncolordialog.h
+++ b/microkde/fncolordialog.h
@@ -14,124 +14,124 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
2005/02/27 FreeNote 1.11.10pre
EPDF‚Ìo—ÍŒ`Ž®‚ðˆê•”•ÏX
EƒCƒ“ƒ|[ƒgŽž‚̃oƒOfix
*/
#ifndef FNPALETTEDIALOG_H
#define FNPALETTEDIALOG_H
#include <qwidget.h>
#include <qpixmap.h>
#include <qpainter.h>
#include <qcolor.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qslider.h>
#include <qspinbox.h>
//-----------------------------------------------------------------------------
// FNPaletteBase
//-----------------------------------------------------------------------------
-class Q_EXPORT FNPaletteBase : public QWidget
+class /* Q_EXPORT */ FNPaletteBase : public QWidget
{
Q_OBJECT
public:
- FNPaletteBase(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ FNPaletteBase(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
virtual ~FNPaletteBase();
void setBGColor(QColor c) {
bgcolor_ = c;
selection_ = c;
redraw();
};
QColor color() const {
return selection_;
};
protected:
virtual void paintEvent(QPaintEvent*);
virtual void resizeEvent(QResizeEvent* evt);
virtual void redraw(bool force=false);
virtual void drawImpl(QPainter& pa);
virtual void mouseReleaseEvent(QMouseEvent* evt);
virtual bool pickColor(int x, int y);
QColor selection_;
private:
QPixmap wbuf_;
QColor bgcolor_;
bool _isblock;
signals:
void clicked(FNPaletteBase* sender);
};
//-----------------------------------------------------------------------------
// FNColorPalette
//-----------------------------------------------------------------------------
-class Q_EXPORT FNColorPalette : public FNPaletteBase
+class /* Q_EXPORT */ FNColorPalette : public FNPaletteBase
{
Q_OBJECT
public:
- FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ FNColorPalette(QColor c, QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
virtual ~FNColorPalette();
};
//-----------------------------------------------------------------------------
// FNHSVPalette
//-----------------------------------------------------------------------------
-class Q_EXPORT FNHSVPalette : public FNPaletteBase
+class /*Q_EXPORT */ FNHSVPalette : public FNPaletteBase
{
Q_OBJECT
public:
- FNHSVPalette(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
+ FNHSVPalette(QWidget* parent = 0, const char* name = 0, Qt::WFlags fl = 0);
virtual ~FNHSVPalette();
public slots:
void hueChanged(int v);
protected:
virtual void drawImpl(QPainter& pa);
int _hue;
};
//-----------------------------------------------------------------------------
// FNColorDialog
//-----------------------------------------------------------------------------
-class Q_EXPORT FNColorDialog : public QDialog
+class /*Q_EXPORT */FNColorDialog : public QDialog
{
Q_OBJECT
public:
- FNColorDialog(QWidget* parent=0, const char* name=0, WFlags f=0);
+ FNColorDialog(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
virtual ~FNColorDialog();
void setColor(QColor c);
QColor color() const;
public slots:
virtual void basePaletteClicked(FNPaletteBase*);
virtual void hsvPaletteClicked(FNPaletteBase*);
void rgbChanged(int);
private:
FNHSVPalette* _palette;
FNColorPalette* _base[16];
QSlider* _hue;
FNColorPalette* _select;
QSpinBox* _r;
QSpinBox* _g;
QSpinBox* _b;
bool _isblock;
};
#endif //FNPALETTEDIALOG_H
diff --git a/microkde/kapplication.cpp b/microkde/kapplication.cpp
index d7c12bb..b058d54 100644
--- a/microkde/kapplication.cpp
+++ b/microkde/kapplication.cpp
@@ -1,37 +1,40 @@
#include <stdlib.h>
#include <stdio.h>
#include "kapplication.h"
#include "ktextedit.h"
#include <qapplication.h>
#include <qstring.h>
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qdialog.h>
#include <qlayout.h>
-#include <qtextbrowser.h>
+#include <q3textbrowser.h>
#include <qregexp.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
int KApplication::random()
{
return rand();
}
//US
QString KApplication::randomString(int length)
{
if (length <=0 ) return QString::null;
QString str;
while (length--)
{
int r=random() % 62;
r+=48;
if (r>57) r+=7;
if (r>90) r+=6;
str += char(r);
// so what if I work backwards?
}
return str;
}
int KApplication::execDialog( QDialog* d )
@@ -54,123 +57,123 @@ void KApplication::testCoords( int* x, int* y, int* wid, int * hei )
if ( *x < 0 ) *x = 0;
if ( *y < 20 ) *y = 20 ;
if ( *x + *wid > dWid ) {
*x = 0;
if ( *wid > dWid )
*wid = dWid;
}
if ( *y + *hei > dHei ) {
*y = 20;
if ( *hei > dHei )
*hei = dHei;
}
}
void KApplication::showFile(QString caption, QString fn)
{
QString text;
QString fileName;
#ifndef DESKTOP_VERSION
fileName = getenv("QPEDIR");
fileName += "/pics/" + fn ;
#else
fileName = qApp->applicationDirPath () + "/" + fn;
#endif
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return ;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
text = ts.read();
file.close();
KApplication::showText( caption, text );
}
bool KApplication::convert2latin1(QString fileName)
{
QString text;
QFile file( fileName );
- if (!file.open( IO_ReadOnly ) ) {
+ if (!file.open( QIODevice::ReadOnly ) ) {
return false;
}
- QTextStream ts( &file );
- ts.setEncoding( QTextStream::UnicodeUTF8 );
+ Q3TextStream ts( &file );
+ ts.setEncoding( Q3TextStream::UnicodeUTF8 );
text = ts.read();
file.close();
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return false;
}
- QTextStream tsIn( &file );
- tsIn.setEncoding( QTextStream::Latin1 );
+ Q3TextStream tsIn( &file );
+ tsIn.setEncoding( Q3TextStream::Latin1 );
tsIn << text.latin1();
file.close();
return true;
}
void KApplication::showText(QString caption, QString text)
{
QDialog dia( 0, "name", true ); ;
dia.setCaption( caption );
- QVBoxLayout* lay = new QVBoxLayout( &dia );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( &dia );
lay->setSpacing( 3 );
lay->setMargin( 3 );
KTextEdit tb ( &dia );
- tb.setWordWrap( QMultiLineEdit::WidgetWidth );
+ tb.setWordWrap( Q3MultiLineEdit::WidgetWidth );
lay->addWidget( &tb );
tb.setText( text );
#ifdef DESKTOP_VERSION
dia.resize( 640, 480);
#else
dia.showMaximized();
#endif
dia.exec();
}
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
#include <qdir.h>
#include <qradiobutton.h>
-#include <qbuttongroup.h>
+#include <q3buttongroup.h>
#include "kglobal.h"
#include "klocale.h"
class KBackupPrefs : public QDialog
{
public:
KBackupPrefs( QString message , QWidget *parent=0, const char *name=0 ) :
QDialog( parent, name, true )
{
setCaption( i18n("Backup Failed!") );
- QVBoxLayout* lay = new QVBoxLayout( this );
+ Q3VBoxLayout* lay = new Q3VBoxLayout( this );
lay->setSpacing( 3 );
lay->setMargin( 3 );
QLabel * lab = new QLabel( message, this );
lay->addWidget( lab );
- QButtonGroup* format = new QButtonGroup( 1, Horizontal, i18n("Choose action"), this );
+ Q3ButtonGroup* format = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Choose action"), this );
lay->addWidget( format );
format->setExclusive ( true ) ;
vcal = new QRadioButton(i18n("Try again now"), format );
tcal = new QRadioButton(i18n("Try again later"), format );
ical = new QRadioButton(i18n("Try again tomorrow"), format );
ocal = new QRadioButton(i18n("Disable backup"), format );
vcal->setChecked( true );
QPushButton * ok = new QPushButton( i18n("OK"), this );
lay->addWidget(ok );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
}
bool again() { return vcal->isChecked(); }
bool later() { return tcal->isChecked(); }
bool againTomorrow() { return ical->isChecked(); }
private:
QRadioButton* vcal, *ical, *ocal, *tcal;
};
int KApplication::createBackup( QString fn, QString dp, int numBup )
{
if ( numBup < 1) return 3;
int ret = 3;
//qDebug("KApplication::createBackup %s --- %s --- %d", fn.latin1(), dp.latin1(), numBup);
QDir bupDir ( dp );
diff --git a/microkde/kcolorbutton.cpp b/microkde/kcolorbutton.cpp
index 197bea2..16618fc 100644
--- a/microkde/kcolorbutton.cpp
+++ b/microkde/kcolorbutton.cpp
@@ -1,32 +1,35 @@
#include "kcolorbutton.h"
#include "kcolordialog.h"
#include "qapplication.h"
+#include <QDesktopWidget>
#include "qlayout.h"
#ifdef DESKTOP_VERSION
#include <qcolordialog.h>
+//Added by qt3to4:
+#include <QPixmap>
#endif
void KColorButton:: edit()
{
#ifdef DESKTOP_VERSION
QColor col = QColorDialog::getColor ( mColor );
if ( col.isValid () ) {
mColor = col;
setColor ( mColor );
emit changed ( mColor );
emit changedID ( mColor, id );
}
#else
KColorDialog* k = new KColorDialog( this );
k->setColor( mColor );
int res = k->exec();
if ( res ) {
mColor = k->getColor();
setColor ( mColor );
emit changed ( mColor );
emit changedID ( mColor, id );
}
delete k;
#endif
diff --git a/microkde/kconfig.cpp b/microkde/kconfig.cpp
index 940196e..12063ca 100644
--- a/microkde/kconfig.cpp
+++ b/microkde/kconfig.cpp
@@ -1,27 +1,29 @@
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "kdebug.h"
#include "kurl.h"
#include "kstandarddirs.h"
#include "kconfig.h"
QString KConfig::mGroup = "";
//QString KConfig::mGroup = "General";
KConfig::KConfig( const QString &fileName )
: mFileName( fileName ), mDirty( false )
{
mTempGroup = "";
load();
}
KConfig::~KConfig()
{
sync();
}
@@ -32,53 +34,53 @@ void KConfig::setTempGroup( const QString &group )
if ( mTempGroup.right( 1 ) != "/" ) mTempGroup += "/";
}
QString KConfig::tempGroup() const {
return mTempGroup;
}
void KConfig::setGroup( const QString &group )
{
mGroup = group;
if ( mGroup.right( 1 ) != "/" ) mGroup += "/";
}
//US
QString KConfig::group() const {
return mGroup;
}
//US added method
-QValueList<int> KConfig::readIntListEntry( const QString & key)
+Q3ValueList<int> KConfig::readIntListEntry( const QString & key)
{
// qDebug("KConfig::readIntListEntry key=%s:", key.latin1());
- QValueList<int> result;
+ Q3ValueList<int> result;
QMap<QString,QString>::ConstIterator mit = mStringMap.find( mGroup + key );
if ( mit == mStringMap.end() ) {
return result;
}
QStringList valuesAsStrings = QStringList::split(":", *mit );
bool ok = false;
bool ok2 = true;
int val;
for ( QStringList::Iterator sit = valuesAsStrings.begin(); sit != valuesAsStrings.end(); ++sit ) {
val = (*sit).toInt(&ok);
result << val;
if (ok == false) {
//qDebug("KConfig::readIntListEntry str=%s , int=%n:", (*sit).latin1(), &val);
ok2 = false;
}
}
if (ok2 == false)
{
@@ -90,49 +92,49 @@ QValueList<int> KConfig::readIntListEntry( const QString & key)
int KConfig::readNumEntry( const QString & key, int def )
{
QString res = readEntry(key, QString::number(def ) );
bool ok = false;
int result = res.toInt(&ok);
if ( ok )
return result;
return def;
}
QString KConfig::readEntry( const QString &key, const QString &def )
{
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return def;
}
return QString::fromUtf8((*it).latin1());
}
QSize KConfig::readSizeEntry( const QString &key, QSize* def )
{
- QValueList<int> intlist = readIntListEntry(key);
+ Q3ValueList<int> intlist = readIntListEntry(key);
if (intlist.count() < 2)
{
if (def)
return *def;
else
return QSize();
}
QSize ret;
ret.setWidth(intlist[0]);
ret.setHeight(intlist[1]);
return ret;
}
QStringList KConfig::readListEntry( const QString &key )
{
QMap<QString,QString>::ConstIterator it = mStringMap.find( mGroup + key );
if ( it == mStringMap.end() ) {
return QStringList();
}
QStringList temp = QStringList::split(":@:", QString::fromUtf8((*it).latin1()));
@@ -173,186 +175,186 @@ QFont KConfig::readFontEntry( const QString & e, QFont *def )
QStringList font = readListEntry( e );
if ( font.isEmpty() )
return *def;
QFont f;
f.setFamily( font[0]);
f.setBold ( font[1] == "bold");
f.setPointSize ( font[2].toInt());
f.setItalic( font[3] == "italic" );
return f;
}
QDateTime KConfig::readDateTimeEntry( const QString &key, const QDateTime *def )
{
QMap<QString,QDateTime>::ConstIterator it = mDateTimeMap.find( mGroup + key );
if ( it == mDateTimeMap.end() ) {
if ( def ) return *def;
else return QDateTime();
}
return *it;
}
//US added method
-void KConfig::writeEntry( const QString &key, const QValueList<int> &value)
+void KConfig::writeEntry( const QString &key, const Q3ValueList<int> &value)
{
QStringList valuesAsStrings;
- QValueList<int>::ConstIterator it;
+ Q3ValueList<int>::ConstIterator it;
for( it = value.begin(); it != value.end(); ++it )
{
valuesAsStrings << QString::number(*it);
}
mStringMap.insert( mGroup + key, valuesAsStrings.join(":") );
mDirty = true;
}
void KConfig::writeEntry( const QString & key , int num )
{
writeEntry( key, QString::number ( num ) );
}
void KConfig::writeEntry( const QString &key, const QString &value )
{
mStringMap.insert( mGroup + key, value.utf8() );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, const QStringList &value )
{
mStringMap.insert( mGroup + key, value.join(":@:").utf8() );
mDirty = true;
}
void KConfig::writeEntry( const QString &key, bool value)
{
mBoolMap.insert( mGroup + key, value );
mDirty = true;
}
void KConfig::writeEntry( const QString & e, const QColor & c )
{
QStringList l;
l.append( QString::number ( c.red() ) );
l.append( QString::number ( c.green() ) );
l.append( QString::number ( c.blue() ) );
writeEntry( e.utf8(), l );
}
void KConfig::writeEntry( const QString & e, const QSize & s )
{
- QValueList<int> intlist;
+ Q3ValueList<int> intlist;
intlist << s.width() << s.height();
writeEntry( e, intlist );
}
void KConfig::writeEntry( const QString & e , const QFont & f )
{
QStringList font;
font.append( f.family());
font.append( (!f.bold ()?"nonbold":"bold") );
font.append( QString::number ( f.pointSize () ) );
font.append( !f.italic ()?"nonitalic":"italic" );
writeEntry( e, font );
}
void KConfig::writeEntry( const QString &key, const QDateTime &dt )
{
mDateTimeMap.insert( mGroup + key, dt );
}
void KConfig::load()
{
QFile f( mFileName );
- if ( !f.open( IO_ReadOnly ) ) {
+ if ( !f.open( QIODevice::ReadOnly ) ) {
//qDebug("KConfig: could not open file %s ",mFileName.latin1() );
return;
}
mBoolMap.clear();
mStringMap.clear();
- QTextStream t( &f );
- t.setEncoding( QTextStream::Latin1 );
+ Q3TextStream t( &f );
+ t.setEncoding( Q3TextStream::Latin1 );
QString line = t.readLine();
while ( !line.isNull() ) {
- QStringList tokens = QStringList::split( ",", line );
+ QStringList tokens = line.split(',');
if ( tokens[0] == "bool" ) {
bool value = false;
if ( tokens[2] == "1" ) value = true;
mBoolMap.insert( tokens[1], value );
} else if ( tokens[0] == "QString" ) {
QString value = tokens[2];
mStringMap.insert( tokens[1], value );
} else if ( tokens[0] == "QDateTime" ) {
#if 0
int year = tokens[2].toInt();
QDateTime dt( QDate( year,
tokens[3].toInt(),
tokens[4].toInt() ),
QTime( tokens[5].toInt(), tokens[6].toInt(),
tokens[7].toInt() ) );
mDateTimeMap.insert( tokens[1], dt );
#endif
}
line = t.readLine();
}
}
void KConfig::sync()
{
if ( !mDirty ) return;
//qDebug("KConfig::sync() %s ",mFileName.latin1() );
//kdDebug() << "KConfig::sync(): " << mFileName << endl;
//US I took the following code from a newer version of KDE
// Create the containing dir if needed
KURL path;
path.setPath(mFileName);
QString dir=path.directory();
KStandardDirs::makeDir(dir);
QFile f( mFileName );
- if ( !f.open( IO_WriteOnly ) ) {
+ if ( !f.open( QIODevice::WriteOnly ) ) {
qDebug("KConfig::sync() Can't open file %s ",mFileName.latin1() );
return;
}
- QTextStream t( &f );
- t.setEncoding( QTextStream::Latin1 );
+ Q3TextStream t( &f );
+ t.setEncoding( Q3TextStream::Latin1 );
QMap<QString,bool>::ConstIterator itBool;
for( itBool = mBoolMap.begin(); itBool != mBoolMap.end(); ++itBool ) {
t << "bool," << itBool.key() << "," << ( *itBool ? "1" : "0" ) << endl;
}
QMap<QString,QString>::ConstIterator itString;
for( itString = mStringMap.begin(); itString != mStringMap.end(); ++itString ) {
t << "QString," << itString.key() << "," << (*itString ) << endl;
}
QMap<QString,QDateTime>::ConstIterator itDateTime;
for( itDateTime = mDateTimeMap.begin(); itDateTime != mDateTimeMap.end(); ++itDateTime ) {
QDateTime dt = *itDateTime;
t << "QDateTime," << itDateTime.key() << ","
<< dt.date().year() << ","
<< dt.date().month() << ","
<< dt.date().day() << ","
<< dt.time().hour() << ","
<< dt.time().minute() << ","
<< dt.time().second() << endl;
}
f.close();
diff --git a/microkde/kconfig.h b/microkde/kconfig.h
index 1a1038f..7b91e44 100644
--- a/microkde/kconfig.h
+++ b/microkde/kconfig.h
@@ -1,30 +1,30 @@
#ifndef MINIKDE_KCONFIG_H
#define MINIKDE_KCONFIG_H
#include <qstring.h>
#include <qstringlist.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qcolor.h>
#include <qfont.h>
#include <qmap.h>
#include <qdatetime.h>
class KConfig
{
public:
KConfig( const QString & );
~KConfig();
void setTempGroup( const QString &group );
QString tempGroup() const;
void setGroup( const QString & );
//US
/**
* Returns the name of the group in which we are
* searching for keys and from which we are retrieving entries.
*
* @return The current group.
*/
QString group() const;
@@ -36,61 +36,61 @@ class KConfig
* If the group is not empty and bDeep is false, nothing gets
* deleted and false is returned.
* If this group is the current group and it is deleted, the
* current group is undefined and should be set with setGroup()
* before the next operation on the configuration object.
*
* @param group The name of the group
* returns true if we deleted at least one entry.
*/
bool deleteGroup( const QString& group);
//US I took the following hasGroup method from a newer version from KDE.
/**
* Returns true if the specified group is known about.
*
* @param group The group to search for.
* @return Whether the group exists.
*/
bool hasGroup(const QString &group) const;
QString getFileName();
//US added method readIntListEntry
- QValueList<int> readIntListEntry( const QString &);
+ Q3ValueList<int> readIntListEntry( const QString &);
int readNumEntry( const QString &, int def=0 );
QString readEntry( const QString &, const QString &def=QString::null );
QStringList readListEntry( const QString & );
bool readBoolEntry( const QString &, bool def=false );
QColor readColorEntry( const QString &, QColor * );
QFont readFontEntry( const QString &, QFont * );
QDateTime readDateTimeEntry( const QString &, const QDateTime *pDefault = 0 );
QSize readSizeEntry(const QString &, QSize* );
bool hasKey( const QString &);
- void writeEntry( const QString &, const QValueList<int>& );
+ void writeEntry( const QString &, const Q3ValueList<int>& );
void writeEntry( const QString &, int );
void writeEntry( const QString &key , unsigned int value) { writeEntry( key, int( value ) ); }
void writeEntry( const char *key , unsigned int value) { writeEntry( QString( key ), value ); }
void writeEntry( const char *key, int value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QString & );
void writeEntry( const char *key, const QString &value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QStringList & );
void writeEntry( const QString &, bool );
void writeEntry( const char *key, bool value ) { writeEntry( QString( key ), value ); }
void writeEntry( const QString &, const QColor & );
void writeEntry( const QString &, const QFont & );
void writeEntry( const QString &, const QDateTime & );
void writeEntry( const QString &, const QSize & );
void deleteEntry( const QString &);
void load();
void sync();
private:
static QString mGroup;
QString mTempGroup;
QString mFileName;
diff --git a/microkde/kdatepickernew.cpp b/microkde/kdatepickernew.cpp
index f60a422..8f8001e 100644
--- a/microkde/kdatepickernew.cpp
+++ b/microkde/kdatepickernew.cpp
@@ -292,49 +292,49 @@ KDatePicker::weekSelected(int week)
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
QDate date = table->getDate();
int year = calendar->year(date);
calendar->setYMD(date, year, 1, 1);
date = calendar->addDays(date, -7);
while (calendar->weekNumber(date) != 1)
date = calendar->addDays(date, 1);
// date is now first day in week 1 some day in week 1
date = calendar->addDays(date, (week - calendar->weekNumber(date)) * 7);
setDate(date);
}
void
KDatePicker::selectMonthClicked()
{
// every year can have different month names (in some calendar systems)
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
QDate date = table->getDate();
int i, month, months = calendar->monthsInYear(date);
- QPopupMenu popup(selectMonth);
+ Q3PopupMenu popup(selectMonth);
for (i = 1; i <= months; i++)
popup.insertItem(calendar->monthName(i, calendar->year(date)), i);
popup.setActiveItem(calendar->month(date) - 1);
if ( (month = popup.exec(selectMonth->mapToGlobal(QPoint(0, 0)), calendar->month(date) - 1)) == -1 ) return; // canceled
int day = calendar->day(date);
// ----- construct a valid date in this month:
//date.setYMD(date.year(), month, 1);
//date.setYMD(date.year(), month, QMIN(day, date.daysInMonth()));
calendar->setYMD(date, calendar->year(date), month,
QMIN(day, calendar->daysInMonth(date)));
// ----- set this month
setDate(date);
}
void
KDatePicker::selectYearClicked()
{
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
int year;
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index 353f78d..10dc449 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -23,200 +23,207 @@
// Copyright (C) 1997 Tim D. Gilman
// (C) 1998-2001 Mirko Boehm
// Written using Qt (http://www.troll.no) for the
// KDE project (http://www.kde.org)
//
// This is a support class for the KDatePicker class. It just
// draws the calender table without titles, but could theoretically
// be used as a standalone.
//
// When a date is selected by the user, it emits a signal:
// dateSelected(QDate)
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kapplication.h>
#include <klocale.h>
#include <kdebug.h>
#include <knotifyclient.h>
#include "kdatetbl.h"
#include <qdatetime.h>
#include <qstring.h>
#include <qpen.h>
#include <qpainter.h>
#include <qdialog.h>
+#include <QDesktopWidget>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <Q3Frame>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
#include <assert.h>
#include <qapplication.h>
KDateValidator::KDateValidator(QWidget* parent, const char* name)
: QValidator(parent, name)
{
}
QValidator::State
KDateValidator::validate(QString& text, int&) const
{
QDate temp;
// ----- everything is tested in date():
return date(text, temp);
}
QValidator::State
KDateValidator::date(const QString& text, QDate& d) const
{
QDate tmp = KGlobal::locale()->readDate(text);
if (!tmp.isNull())
{
d = tmp;
return Acceptable;
} else
- return Valid;
+ return QValidator::Intermediate;
}
void
KDateValidator::fixup( QString& ) const
{
}
-KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, WFlags f)
- : QGridView(parent, name, f)
+KDateTable::KDateTable(QWidget *parent, QDate date_, const char* name, Qt::WFlags f)
+ : Q3GridView(parent, name, f)
{
setFont( KGlobalSettings::generalFont() );
if(!date_.isValid())
{
date_=QDate::currentDate();
}
- setFocusPolicy( QWidget::StrongFocus );
+ setFocusPolicy( Qt::StrongFocus );
setNumRows(7); // 6 weeks max + headline
setNumCols(7); // 7 days a week
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
viewport()->setBackgroundColor(QColor(220,245,255));
#if 0
- viewport()->setEraseColor(lightGray);
+ viewport()->setEraseColor(Qt::lightGray);
#endif
mMarkCurrent = false;
setDate(date_); // this initializes firstday, numdays, numDaysPrevMonth
}
void
KDateTable::paintCell(QPainter *painter, int row, int col)
{
QRect rect;
QString text;
QPen pen;
int w=cellWidth();
int h=cellHeight();
int pos;
- QBrush brushBlue(blue);
+ QBrush brushBlue(Qt::blue);
QBrush brushLightblue(QColor(220,245,255));
QFont _font=font();
// -----
if(row==0)
{ // we are drawing the headline
_font.setBold(true);
painter->setFont(_font);
bool normalday = true;
QString daystr;
if (KGlobal::locale()->weekStartsMonday())
{
daystr = KGlobal::locale()->weekDayName(col+1, true);
if (col == 5 || col == 6)
normalday = false;
} else {
daystr = KGlobal::locale()->weekDayName(col==0? 7 : col, true);
if (col == 0 || col == 6)
normalday = false;
}
if (!normalday)
{
painter->setPen(QColor(220,245,255));
painter->setBrush(brushLightblue);
painter->drawRect(0, 0, w, h);
- painter->setPen(blue);
+ painter->setPen(Qt::blue);
} else {
- painter->setPen(blue);
+ painter->setPen(Qt::blue);
painter->setBrush(brushBlue);
painter->drawRect(0, 0, w, h);
- painter->setPen(white);
+ painter->setPen(Qt::white);
}
- painter->drawText(0, 0, w, h-1, AlignCenter,
+ painter->drawText(0, 0, w, h-1, Qt::AlignCenter,
daystr, -1, &rect);
- painter->setPen(black);
- painter->moveTo(0, h-1);
- painter->lineTo(w-1, h-1);
+ painter->setPen(Qt::black);
+ painter->drawLine(0, h-1, w-1, h-1);
// ----- draw the weekday:
} else {
painter->setFont(_font);
pos=7*(row-1)+col;
if (KGlobal::locale()->weekStartsMonday())
pos++;
if(pos<firstday || (firstday+numdays<=pos))
{ // we are either
// ° painting a day of the previous month or
// ° painting a day of the following month
if(pos<firstday)
{ // previous month
text.setNum(numDaysPrevMonth+pos-firstday+1);
} else { // following month
text.setNum(pos-firstday-numdays+1);
}
- painter->setPen(gray);
+ painter->setPen(Qt::gray);
} else { // paint a day of the current month
text.setNum(pos-firstday+1);
- painter->setPen(black);
+ painter->setPen(Qt::black);
}
pen=painter->pen();
if(firstday+date.day()-1==pos)
{
if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
- painter->setPen(green);
+ painter->setPen(Qt::green);
else
- painter->setPen(red);
+ painter->setPen(Qt::red);
if(hasFocus())
{
- painter->setBrush(darkRed);
- pen=white;
+ painter->setBrush(Qt::darkRed);
+ pen=QColor(Qt::white);
} else {
- painter->setBrush(darkGray);
- pen=white;
+ painter->setBrush(Qt::darkGray);
+ pen=QColor(Qt::white);
}
} else {
if(mMarkCurrent && firstday+QDate::currentDate().day()-1==pos)
{
- painter->setPen(green);
- painter->setBrush(darkGreen);
- pen=white;
+ painter->setPen(Qt::green);
+ painter->setBrush(Qt::darkGreen);
+ pen=QColor(Qt::white);
} else {
painter->setBrush(QColor(220,245,255));
painter->setPen(QColor(220,245,255));
}
}
painter->drawRect(0, 0, w, h);
painter->setPen(pen);
- painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect);
+ painter->drawText(0, 0, w, h, Qt::AlignCenter, text, -1, &rect);
}
/*
if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width());
if(rect.height()>maxCell.height()) {
maxCell.setHeight(rect.height());
}
*/
}
void
KDateTable::keyPressEvent( QKeyEvent *e )
{
/*
// not working properly
if ( e->key() == Qt::Key_Prior ) {
if ( date.month() == 1 ) {
KNotifyClient::beep();
return;
}
int day = date.day();
if ( day > 27 )
while ( !QDate::isValid( date.year(), date.month()-1, day ) )
day--;
setDate(QDate(date.year(), date.month()-1, day));
@@ -253,49 +260,49 @@ KDateTable::keyPressEvent( QKeyEvent *e )
if ( e->key() == Qt::Key_Left ) {
--add;
irgnore = false;
}
if ( e->key() == Qt::Key_Right ) {
++add;
irgnore = false;
}
}
if ( irgnore ) {
e->ignore();
return;
}
pos += add;
setDate(date.addDays( add ));
updateCell(temp/7+1, temp%7); // Update the previously selected cell
updateCell(pos/7+1, pos%7); // Update the selected cell
}
void
KDateTable::viewportResizeEvent(QResizeEvent * e)
{
- QGridView::viewportResizeEvent(e);
+ Q3GridView::viewportResizeEvent(e);
setCellWidth(viewport()->width()/7);
setCellHeight(viewport()->height()/7);
}
void
KDateTable::setFontSize(int size)
{
int count;
QRect rect;
// ----- store rectangles:
fontsize=size;
QFont _font = font();
_font.setPointSize(fontsize);
setFont( _font );
_font.setBold( true );
QFontMetrics metrics(_font);
// ----- find largest day name:
maxCell.setWidth(0);
maxCell.setHeight(0);
for(count=0; count<7; ++count)
{
rect=metrics.boundingRect(KGlobal::locale()->weekDayName(count+1, true));
@@ -388,180 +395,180 @@ KDateTable::setDate(const QDate& date_)
if(date.month()==1)
{ // set to december of previous year
temp.setYMD(date.year()-1, 12, 1);
} else { // set to previous month
temp.setYMD(date.year(), date.month()-1, 1);
}
numDaysPrevMonth=temp.daysInMonth();
if(changed)
{
repaintContents(false);
}
emit(dateChanged(date));
return true;
}
const QDate&
KDateTable::getDate() const
{
return date;
}
void KDateTable::focusInEvent( QFocusEvent *e )
{
repaintContents(false);
- QGridView::focusInEvent( e );
+ Q3GridView::focusInEvent( e );
}
void KDateTable::focusOutEvent( QFocusEvent *e )
{
repaintContents(false);
- QGridView::focusOutEvent( e );
+ Q3GridView::focusOutEvent( e );
}
QSize
KDateTable::sizeHint() const
{
if(maxCell.height()>0 && maxCell.width()>0)
{
return QSize((maxCell.width()+2)*numCols()+2*frameWidth(),
(maxCell.height()+4)*numRows()+2*frameWidth());
} else {
return QSize(-1, -1);
}
}
KDateInternalMonthPicker::KDateInternalMonthPicker
(QWidget* parent, const char* name)
- : QGridView(parent, name),
+ : Q3GridView(parent, name),
result(0) // invalid
{
QRect rect;
QFont font;
// -----
activeCol = -1;
activeRow = -1;
font=KGlobalSettings::generalFont();
int fontsize = 10;
int add = 2;
if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
add += 8;
if ( QApplication::desktop()->width() > 640 )
add += 6;
font.setPointSize(fontsize+add);
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(Q3Frame::NoFrame);
setNumRows(4);
setNumCols(3);
// enable to find drawing failures:
// setTableFlags(Tbl_clipCellPainting);
#if 0
- viewport()->setEraseColor(lightGray); // for consistency with the datepicker
+ viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker
#endif
// ----- find the preferred size
// (this is slow, possibly, but unfortunatly it is needed here):
QFontMetrics metrics(font);
for(int i=1; i <= 12; ++i)
{
rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false));
if(max.width()<rect.width()) max.setWidth(rect.width());
if(max.height()<rect.height()) max.setHeight(rect.height());
}
}
QSize
KDateInternalMonthPicker::sizeHint() const
{
return QSize((max.width()+6)*numCols()+2*frameWidth(),
(max.height()+6)*numRows()+2*frameWidth());
}
int
KDateInternalMonthPicker::getResult() const
{
return result;
}
void
KDateInternalMonthPicker::setupPainter(QPainter *p)
{
- p->setPen(black);
+ p->setPen(Qt::black);
}
void
KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*)
{
setCellWidth(width()/3);
setCellHeight(height()/4);
}
void
KDateInternalMonthPicker::paintCell(QPainter* painter, int row, int col)
{
int index;
QString text;
// ----- find the number of the cell:
index=3*row+col+1;
text=KGlobal::locale()->monthName(index, false);
- painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
+ painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text);
if ( activeCol == col && activeRow == row )
painter->drawRect( 0, 0, cellWidth(), cellHeight() );
}
void
KDateInternalMonthPicker::contentsMousePressEvent(QMouseEvent *e)
{
- if(!isEnabled() || e->button() != LeftButton)
+ if(!isEnabled() || e->button() != Qt::LeftButton)
{
KNotifyClient::beep();
return;
}
// -----
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
if(row<0 || col<0)
{ // the user clicked on the frame of the table
activeCol = -1;
activeRow = -1;
} else {
activeCol = col;
activeRow = row;
updateCell( row, col /*, false */ );
}
}
void
KDateInternalMonthPicker::contentsMouseMoveEvent(QMouseEvent *e)
{
- if (e->state() & LeftButton)
+ if (e->state() & Qt::LeftButton)
{
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
int tmpRow = -1, tmpCol = -1;
if(row<0 || col<0)
{ // the user clicked on the frame of the table
if ( activeCol > -1 )
{
tmpRow = activeRow;
tmpCol = activeCol;
}
activeCol = -1;
activeRow = -1;
} else {
bool differentCell = (activeRow != row || activeCol != col);
if ( activeCol > -1 && differentCell)
{
tmpRow = activeRow;
tmpCol = activeCol;
}
@@ -593,107 +600,107 @@ KDateInternalMonthPicker::contentsMouseReleaseEvent(QMouseEvent *e)
col=columnAt(mouseCoord.x());
if(row<0 || col<0)
{ // the user clicked on the frame of the table
emit(closeMe(0));
}
pos=3*row+col+1;
result=pos;
emit(closeMe(1));
}
KDateInternalYearSelector::KDateInternalYearSelector
(int fontsize, QWidget* parent, const char* name)
: QLineEdit(parent, name),
val(new QIntValidator(this)),
result(0)
{
QFont font;
// -----
font=KGlobalSettings::generalFont();
font.setPointSize(fontsize);
setFont(font);
#if 0
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(Q3Frame::NoFrame);
#endif
// we have to respect the limits of QDate here, I fear:
val->setRange(0, 8000);
setValidator(val);
connect(this, SIGNAL(returnPressed()), SLOT(yearEnteredSlot()));
}
void
KDateInternalYearSelector::yearEnteredSlot()
{
bool ok;
int year;
QDate date;
// ----- check if this is a valid year:
year=text().toInt(&ok);
if(!ok)
{
KNotifyClient::beep();
return;
}
date.setYMD(year, 1, 1);
if(!date.isValid())
{
KNotifyClient::beep();
return;
}
result=year;
emit(closeMe(1));
}
int
KDateInternalYearSelector::getYear()
{
return result;
}
void
KDateInternalYearSelector::setYear(int year)
{
QString temp;
// -----
temp.setNum(year);
setText(temp);
}
KPopupFrame::KPopupFrame(QWidget* parent, const char* name)
- : QFrame(parent, name, WType_Popup),
+ : Q3Frame(parent, name, Qt::WType_Popup),
result(0), // rejected
main(0)
{
- setFrameStyle(QFrame::Box|QFrame::Raised);
+ setFrameStyle(Q3Frame::Box|Q3Frame::Raised);
setMidLineWidth(2);
}
void
KPopupFrame::keyPressEvent(QKeyEvent* e)
{
- if(e->key()==Key_Escape)
+ if(e->key()==Qt::Key_Escape)
{
result=0; // rejected
qApp->exit_loop();
}
}
void
KPopupFrame::close(int r)
{
result=r;
qApp->exit_loop();
}
void
KPopupFrame::setMainWidget(QWidget* m)
{
main=m;
if(main!=0)
{
resize(main->width()+2*frameWidth(), main->height()+2*frameWidth());
}
}
void
@@ -735,164 +742,164 @@ KPopupFrame::exec(QPoint pos)
popup(pos);
repaint();
qApp->enter_loop();
hide();
return result;
}
int
KPopupFrame::exec(int x, int y)
{
return exec(QPoint(x, y));
}
void KPopupFrame::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KDateTable::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//#include "kdatetbl.moc"
KDateInternalWeekPicker::KDateInternalWeekPicker
(QWidget* parent, const char* name)
- : QGridView(parent, name),
+ : Q3GridView(parent, name),
result(0) // invalid
{
QRect rect;
QFont font;
// -----
activeCol = -1;
activeRow = -1;
font=KGlobalSettings::generalFont();
int fontsize = 10;
int add = 2;
if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
add += 6;
font.setPointSize(fontsize+add);
setFont(font);
setHScrollBarMode(AlwaysOff);
setVScrollBarMode(AlwaysOff);
- setFrameStyle(QFrame::NoFrame);
+ setFrameStyle(Q3Frame::NoFrame);
if ( QApplication::desktop()->height() > 240 ) {
setNumRows(13);
setNumCols(4);
} else {
setNumRows(4);
setNumCols(13);
}
// enable to find drawing failures:
// setTableFlags(Tbl_clipCellPainting);
#if 0
- viewport()->setEraseColor(lightGray); // for consistency with the datepicker
+ viewport()->setEraseColor(Qt::lightGray); // for consistency with the datepicker
#endif
// ----- find the preferred size
// (this is slow, possibly, but unfortunatly it is needed here):
QFontMetrics metrics(font);
for(int i=1; i <= 52; ++i)
{
rect=metrics.boundingRect(QString::number( i ));
if(max.width()<rect.width()) max.setWidth(rect.width());
if(max.height()<rect.height()) max.setHeight(rect.height());
}
if ( QApplication::desktop()->width() > 640 ) {
max.setWidth(max.width()+6);
max.setHeight(max.height()+8);
}
}
QSize
KDateInternalWeekPicker::sizeHint() const
{
return QSize((max.width()+6)*numCols()+2*frameWidth(),
(max.height()+6)*numRows()+2*frameWidth());
}
int
KDateInternalWeekPicker::getResult() const
{
return result;
}
void
KDateInternalWeekPicker::setupPainter(QPainter *p)
{
- p->setPen(black);
+ p->setPen(Qt::black);
}
void
KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*)
{
setCellWidth(width()/ numCols());
setCellHeight(height()/ numRows());
}
void
KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col)
{
int index;
QString text;
// ----- find the number of the cell:
index=numCols()*row+col+1;
text=QString::number( index );
- painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
+ painter->drawText(0, 0, cellWidth(), cellHeight(), Qt::AlignCenter, text);
if ( activeCol == col && activeRow == row )
painter->drawRect( 0, 0, cellWidth(), cellHeight() );
}
void
KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e)
{
- if(!isEnabled() || e->button() != LeftButton)
+ if(!isEnabled() || e->button() != Qt::LeftButton)
{
KNotifyClient::beep();
return;
}
// -----
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
if(row<0 || col<0)
{ // the user clicked on the frame of the table
activeCol = -1;
activeRow = -1;
} else {
activeCol = col;
activeRow = row;
updateCell( row, col /*, false */ );
}
}
void
KDateInternalWeekPicker::contentsMouseMoveEvent(QMouseEvent *e)
{
- if (e->state() & LeftButton)
+ if (e->state() & Qt::LeftButton)
{
int row, col;
QPoint mouseCoord;
// -----
mouseCoord = e->pos();
row=rowAt(mouseCoord.y());
col=columnAt(mouseCoord.x());
int tmpRow = -1, tmpCol = -1;
if(row<0 || col<0)
{ // the user clicked on the frame of the table
if ( activeCol > -1 )
{
tmpRow = activeRow;
tmpCol = activeCol;
}
activeCol = -1;
activeRow = -1;
} else {
bool differentCell = (activeRow != row || activeCol != col);
if ( activeCol > -1 && differentCell)
{
tmpRow = activeRow;
tmpCol = activeCol;
}
diff --git a/microkde/kdatetbl.h b/microkde/kdatetbl.h
index 87808df..2d3d2cf 100644
--- a/microkde/kdatetbl.h
+++ b/microkde/kdatetbl.h
@@ -1,58 +1,64 @@
/* -*- C++ -*-
This file is part of the KDE libraries
Copyright (C) 1997 Tim D. Gilman (tdgilman@best.org)
(C) 1998-2001 Mirko Boehm (mirko@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KDATETBL_H
#define KDATETBL_H
#include <qvalidator.h>
-#include <qgridview.h>
+#include <q3gridview.h>
#include <qlineedit.h>
#include <qdatetime.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <Q3Frame>
+#include <QKeyEvent>
+#include <QFocusEvent>
/**
* A table containing month names. It is used to pick a month directly.
* @internal
* @version $Id$
* @author Tim Gilman, Mirko Boehm
*/
-class KDateInternalMonthPicker : public QGridView
+class KDateInternalMonthPicker : public Q3GridView
{
Q_OBJECT
protected:
/**
* Store the month that has been clicked [1..12].
*/
int result;
/**
* the cell under mouse cursor when LBM is pressed
*/
short int activeCol;
short int activeRow;
/**
* Contains the largest rectangle needed by the month names.
*/
QRect max;
signals:
/**
* This is send from the mouse click event handler.
*/
void closeMe(int);
public:
/**
* The constructor.
@@ -106,49 +112,49 @@ class KDateInternalYearSelector : public QLineEdit
protected:
QIntValidator *val;
int result;
public slots:
void yearEnteredSlot();
signals:
void closeMe(int);
public:
KDateInternalYearSelector(int fontsize,
QWidget* parent=0,
const char* name=0);
int getYear();
void setYear(int year);
private:
class KDateInternalYearPrivate;
KDateInternalYearPrivate *d;
};
/**
* Frame with popup menu behaviour.
* @author Tim Gilman, Mirko Boehm
* @version $Id$
*/
-class KPopupFrame : public QFrame
+class KPopupFrame : public Q3Frame
{
Q_OBJECT
protected:
/**
* The result. It is returned from exec() when the popup window closes.
*/
int result;
/**
* Catch key press events.
*/
void keyPressEvent(QKeyEvent* e);
/**
* The only subwidget that uses the whole dialog window.
*/
QWidget *main;
public slots:
/**
* Close the popup window. This is called from the main widget, usually.
* @p r is the result returned from exec().
*/
void close(int r);
public:
/**
* The contructor. Creates a dialog without buttons.
@@ -161,91 +167,91 @@ public:
* set the main widgets correct size before setting it as the main
* widget.
*/
void setMainWidget(QWidget* m);
/**
* The resize event. Simply resizes the main widget to the whole
* widgets client size.
*/
void resizeEvent(QResizeEvent*);
/**
* Open the popup window at position pos.
*/
void popup(const QPoint &pos);
/**
* Execute the popup window.
*/
int exec(QPoint p);
/**
* Dito.
*/
int exec(int x, int y);
private:
- virtual bool close(bool alsoDelete) { return QFrame::close(alsoDelete); }
+ virtual bool close(bool alsoDelete) { return Q3Frame::close(alsoDelete); }
protected:
virtual void virtual_hook( int id, void* data );
private:
class KPopupFramePrivate;
KPopupFramePrivate *d;
};
/**
* Validates user-entered dates.
*/
class KDateValidator : public QValidator
{
public:
KDateValidator(QWidget* parent=0, const char* name=0);
virtual State validate(QString&, int&) const;
virtual void fixup ( QString & input ) const;
State date(const QString&, QDate&) const;
};
/**
* Date selection table.
* This is a support class for the KDatePicker class. It just
* draws the calender table without titles, but could theoretically
* be used as a standalone.
*
* When a date is selected by the user, it emits a signal:
* dateSelected(QDate)
*
* @internal
* @version $Id$
* @author Tim Gilman, Mirko Boehm
*/
-class KDateTable : public QGridView
+class KDateTable : public Q3GridView
{
Q_OBJECT
public:
/**
* The constructor.
*/
KDateTable(QWidget *parent=0,
QDate date=QDate::currentDate(),
- const char* name=0, WFlags f=0);
+ const char* name=0, Qt::WFlags f=0);
/**
* Returns a recommended size for the widget.
* To save some time, the size of the largest used cell content is
* calculated in each paintCell() call, since all calculations have
* to be done there anyway. The size is stored in maxCell. The
* sizeHint() simply returns a multiple of maxCell.
*/
virtual QSize sizeHint() const;
/**
* Set the font size of the date table.
*/
void setFontSize(int size);
/**
* Select and display this date.
*/
bool setDate(const QDate&);
const QDate& getDate() const;
protected:
bool mMarkCurrent;
/**
* Paint a cell.
*/
@@ -286,49 +292,49 @@ protected:
*/
bool unused_hasSelection;
/**
* Save the size of the largest used cell content.
*/
QRect maxCell;
signals:
/**
* The selected date changed.
*/
void dateChanged(QDate);
/**
* A date has been selected by clicking on the table.
*/
void tableClicked();
protected:
virtual void virtual_hook( int id, void* data );
private:
class KDateTablePrivate;
KDateTablePrivate *d;
};
#endif // KDATETBL_H
-class KDateInternalWeekPicker : public QGridView
+class KDateInternalWeekPicker : public Q3GridView
{
Q_OBJECT
protected:
/**
* Store the month that has been clicked [1..12].
*/
int result;
/**
* the cell under mouse cursor when LBM is pressed
*/
short int activeCol;
short int activeRow;
/**
* Contains the largest rectangle needed by the month names.
*/
QRect max;
signals:
/**
* This is send from the mouse click event handler.
*/
void closeMe(int);
public:
/**
* The constructor.
diff --git a/microkde/kdebug.h b/microkde/kdebug.h
index bb9cfe3..534943c 100644
--- a/microkde/kdebug.h
+++ b/microkde/kdebug.h
@@ -1,30 +1,32 @@
#ifndef MINIKDE_KDEBUG_H
#define MINIKDE_KDEBUG_H
#include <stdio.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <Q3CString>
class kdbgstream;
typedef kdbgstream & (*KDBGFUNC)(kdbgstream &); // manipulator function
class kdbgstream {
public:
kdbgstream(unsigned int _area, unsigned int _level, bool _print = true) :
area(_area), level(_level), print( _print ) { print = false; }
/* kdbgstream(const char * initialString, unsigned int _area, unsigned int _level, bool _print = false) :
output(QString::fromLatin1(initialString)), area(_area), level(_level), print(_print) { print = false; }*/
~kdbgstream()
{
// if (!output.isEmpty()) {
// fprintf(stderr,"ASSERT: debug output not ended with \\n\n");
//*this << "\n";
//}
}
kdbgstream &operator<<(bool) {
return *this;
}
kdbgstream &operator<<(short) {
@@ -43,49 +45,49 @@ class kdbgstream {
return *this;
}
kdbgstream &operator<<(int) {
return *this;
}
kdbgstream &operator<<(unsigned int) {
return *this;
}
kdbgstream &operator<<(long) {
return *this;
}
kdbgstream &operator<<(unsigned long) {
return *this;
}
kdbgstream &operator<<(const QString&) {
return *this;
}
kdbgstream &operator<<(const char*) {
return *this;
}
- kdbgstream &operator<<(const QCString&) {
+ kdbgstream &operator<<(const Q3CString&) {
return *this;
}
kdbgstream& operator<<(KDBGFUNC f) {
return (*f)(*this);
}
kdbgstream& operator<<(double) {
if (!print) return *this;
return *this;
}
void flush() {
return;
}
private:
QString output;
unsigned int area, level;
bool print;
};
inline kdbgstream &endl( kdbgstream &s) { s << "\n"; return s; }
inline kdbgstream kdDebug(int area = 0) { return kdbgstream(area, 0); }
inline kdbgstream kdWarning(int area = 0) { return kdbgstream(area, 0); }
inline kdbgstream kdError(int area = 0) { return kdbgstream(area, 0); }
diff --git a/microkde/kdecore/kcatalogue.cpp b/microkde/kdecore/kcatalogue.cpp
index 97ac326..1600b08 100644
--- a/microkde/kdecore/kcatalogue.cpp
+++ b/microkde/kdecore/kcatalogue.cpp
@@ -1,46 +1,48 @@
/* This file is part of the KDE libraries
Copyright (c) 2001 Hans Petter Bieker <bieker@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kdebug.h>
#include "kcatalogue.h"
char *k_nl_find_msg(struct kde_loaded_l10nfile *domain_file,
const char *msgid);
void k_nl_unload_domain (struct loaded_domain *domain);
#ifndef KDE_USE_FINAL // with --enable-final, we're getting this from libintl.cpp
struct kde_loaded_l10nfile
{
const char *filename;
int decided;
const void *data;
kde_loaded_l10nfile() : filename(0), decided(0), data(0) {}
};
#endif
class KCataloguePrivate
{
public:
@@ -67,49 +69,49 @@ KCatalogue & KCatalogue::operator=(const KCatalogue & rhs)
setFileName( rhs.fileName() );
return *this;
}
KCatalogue::~KCatalogue()
{
doUnload();
delete d;
}
QString KCatalogue::name() const
{
return d->name;
}
void KCatalogue::setFileName( const QString & fileName )
{
// nothing to do if the file name is already the same
if ( this->fileName() == fileName ) return;
doUnload();
- QCString newFileName = QFile::encodeName( fileName );
+ Q3CString newFileName = QFile::encodeName( fileName );
if ( !fileName.isEmpty() )
{
// set file name
char *filename = new char[ newFileName.length() + 1 ];
::qstrcpy( filename, newFileName );
d->domain.filename = filename;
}
}
QString KCatalogue::fileName() const
{
return QFile::decodeName( d->domain.filename );
}
const char * KCatalogue::translate(const char * msgid) const
{
qDebug("KCatalogue::translate has to be fixed %s",msgid );
//US return ::k_nl_find_msg( &d->domain, msgid );
return msgid;
}
void KCatalogue::doUnload()
diff --git a/microkde/kdecore/kconfigbase.h b/microkde/kdecore/kconfigbase.h
index 7e56d11..1ef6a04 100644
--- a/microkde/kdecore/kconfigbase.h
+++ b/microkde/kdecore/kconfigbase.h
@@ -5,48 +5,50 @@
Copyright (c) 2001 Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#ifndef _KCONFIGBASE_H
#define _KCONFIGBASE_H
#include "kconfig.h"
+//Added by qt3to4:
+#include <Q3CString>
/**
* Helper class to facilitate working with @ref KConfig / @ref KSimpleConfig
* groups.
*
* Careful programmers always set the group of a
* @ref KConfig @ref KSimpleConfig object to the group they want to read from
* and set it back to the old one of afterwards. This is usually
* written as:
* <pre>
*
* QString oldgroup config->group();
* config->setGroup( "TheGroupThatIWant" );
* ...
* config->writeEntry( "Blah", "Blubb" );
*
* config->setGroup( oldgroup );
* </pre>
*
* In order to facilitate this task, you can use
* KConfigGroupSaver. Simply construct such an object ON THE STACK
* when you want to switch to a new group. Then, when the object goes
* out of scope, the group will automatically be restored. If you
* want to use several different groups within a function or method,
@@ -61,42 +63,42 @@
*/
//US I converted the class in a way that it can be used with KConfig objects of microkde
class KConfigGroupSaver
{
public:
/**
* Constructor. You pass a pointer to the KConfigBase-derived
* object you want to work with and a string indicating the _new_
* group.
*
* @param config The KConfigBase-derived object this
* KConfigGroupSaver works on.
* @param group The new group that the config object should switch to.
*/
KConfigGroupSaver( KConfig* config, QString group )
/* KDE 4 : make the second parameter const QString & */
: _config(config), _oldgroup(config->group())
{ _config->setGroup( group ); }
KConfigGroupSaver( KConfig* config, const char *group )
: _config(config), _oldgroup(config->group())
{ _config->setGroup( group ); }
- KConfigGroupSaver( KConfig* config, const QCString &group )
+ KConfigGroupSaver( KConfig* config, const Q3CString &group )
: _config(config), _oldgroup(config->group())
{ _config->setGroup( group ); }
~KConfigGroupSaver() { _config->setGroup( _oldgroup ); }
KConfig* config() { return _config; };
private:
KConfig* _config;
QString _oldgroup;
KConfigGroupSaver(const KConfigGroupSaver&);
KConfigGroupSaver& operator=(const KConfigGroupSaver&);
};
#endif
diff --git a/microkde/kdecore/klibloader.cpp b/microkde/kdecore/klibloader.cpp
index 6d0475a..0b54eb6 100644
--- a/microkde/kdecore/klibloader.cpp
+++ b/microkde/kdecore/klibloader.cpp
@@ -1,72 +1,75 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@kde.org>
Copyright (C) 2000 Michael Matz <matz@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#include <qclipboard.h>
#include <qfile.h>
#include <qtimer.h>
-#include <qobjectdict.h>
-#include <qwidgetlist.h>
+#include <q3objectdict.h>
#include <qwidget.h>
+#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PtrList>
#include "kapplication.h"
#include "klibloader.h"
#include "kstandarddirs.h"
#include "kdebug.h"
#include "klocale.h"
/*US
#ifndef NDEBUG
#include "ltdl.h"
#endif
*/
//US do everything through qlibrary
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#include <qtopia/qlibrary.h>
#else
#include <qlibrary.h>
#endif
-template class QAsciiDict<KLibrary>;
+template class Q3AsciiDict<KLibrary>;
#include <stdlib.h> //getenv
/*US
#if HAVE_DLFCN_H
# include <dlfcn.h>
#endif
#ifdef RTLD_GLOBAL
# define LT_GLOBAL RTLD_GLOBAL
#else
# ifdef DL_GLOBAL
# define LT_GLOBAL DL_GLOBAL
# endif
#endif
#ifndef LT_GLOBAL
# define LT_GLOBAL 0
#endif
*/
/*US
extern "C" {
extern int lt_dlopen_flag;
}
@@ -99,81 +102,81 @@ QObject* KLibFactory::createObject( QObject*, const char*, const char*, const QS
// -----------------------------------------------
//US KLibrary::KLibrary( const QString& libname, const QString& filename, void * handle )
KLibrary::KLibrary( const QString& libname, const QString& filename, QLibrary* handle )
{
/* Make sure, we have a KLibLoader */
(void) KLibLoader::self();
m_libname = libname;
m_filename = filename;
m_handle = handle;
m_factory = 0;
m_timer = 0;
}
KLibrary::~KLibrary()
{
// kdDebug(150) << "Deleting KLibrary " << this << " " << m_libname << endl;
if ( m_timer && m_timer->isActive() )
m_timer->stop();
// If any object is remaining, delete
if ( m_objs.count() > 0 )
{
- QPtrListIterator<QObject> it( m_objs );
+ Q3PtrListIterator<QObject> it( m_objs );
for ( ; it.current() ; ++it )
{
kdDebug(150) << "Factory still has object " << it.current() << " " << it.current()->name () << " Library = " << m_libname << endl;
disconnect( it.current(), SIGNAL( destroyed() ),
this, SLOT( slotObjectDestroyed() ) );
}
m_objs.setAutoDelete(true);
m_objs.clear();
}
if ( m_factory ) {
// kdDebug(150) << " ... deleting the factory " << m_factory << endl;
delete m_factory;
}
}
QString KLibrary::name() const
{
return m_libname;
}
QString KLibrary::fileName() const
{
return m_filename;
}
KLibFactory* KLibrary::factory()
{
if ( m_factory )
return m_factory;
- QCString symname;
+ Q3CString symname;
symname.sprintf("init_%s", name().latin1() );
void* sym = symbol( symname );
if ( !sym )
{
qDebug("KLibrary: The library %s does not offer an %s function", name().latin1(), symname.data());
#ifndef NDEBUG
//US qDebug("KLibrary: errorcode: %s", lt_dlerror());
#endif
kdWarning(150) << "KLibrary: The library " << name().latin1() << " does not offer an init_" << name().latin1() << " function" << endl;
return 0;
}
typedef KLibFactory* (*t_func)();
t_func func = (t_func)sym;
m_factory = func();
if( !m_factory )
{
kdWarning(150) << "KLibrary: The library " << name() << " does not offer a KDE compatible factory" << endl;
return 0;
}
connect( m_factory, SIGNAL( objectCreated( QObject * ) ),
@@ -284,108 +287,108 @@ public:
KLibWrapPrivate::KLibWrapPrivate(KLibrary *l, QLibrary* h)
: lib(l), ref_count(1), handle(h), name(l->name()), filename(l->fileName())
{
unload_mode = UNKNOWN;
/*US
if (lt_dlsym(handle, "__kde_do_not_unload") != 0) {
// kdDebug(150) << "Will not unload " << name << endl;
unload_mode = DONT_UNLOAD;
} else if (lt_dlsym(handle, "__kde_do_unload") != 0) {
unload_mode = UNLOAD;
}
*/
//US use instead:
if (h->resolve("__kde_do_not_unload") != 0) {
// kdDebug(150) << "Will not unload " << name << endl;
unload_mode = DONT_UNLOAD;
} else if (h->resolve("__kde_do_unload") != 0) {
unload_mode = UNLOAD;
}
}
class KLibLoaderPrivate
{
public:
- QPtrList<KLibWrapPrivate> loaded_stack;
- QPtrList<KLibWrapPrivate> pending_close;
+ Q3PtrList<KLibWrapPrivate> loaded_stack;
+ Q3PtrList<KLibWrapPrivate> pending_close;
enum {UNKNOWN, UNLOAD, DONT_UNLOAD} unload_mode;
QString errorMessage;
};
KLibLoader* KLibLoader::s_self = 0;
KLibLoader* KLibLoader::self()
{
if ( !s_self )
s_self = new KLibLoader;
return s_self;
}
void KLibLoader::cleanUp()
{
if ( !s_self )
return;
delete s_self;
s_self = 0;
}
KLibLoader::KLibLoader( QObject* parent, const char* name )
: QObject( parent, name )
{
s_self = this;
d = new KLibLoaderPrivate;
//US lt_dlinit();
d->unload_mode = KLibLoaderPrivate::UNKNOWN;
if (getenv("KDE_NOUNLOAD") != 0)
d->unload_mode = KLibLoaderPrivate::DONT_UNLOAD;
else if (getenv("KDE_DOUNLOAD") != 0)
d->unload_mode = KLibLoaderPrivate::UNLOAD;
d->loaded_stack.setAutoDelete( true );
}
KLibLoader::~KLibLoader()
{
// kdDebug(150) << "Deleting KLibLoader " << this << " " << name() << endl;
- QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
+ Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs );
for (; it.current(); ++it )
{
kdDebug(150) << "The KLibLoader contains the library " << it.current()->name
<< " (" << it.current()->lib << ")" << endl;
d->pending_close.append(it.current());
}
close_pending(0);
delete d;
}
//static
QString KLibLoader::findLibrary( const char * name/*US , const KInstance * instance*/ )
{
- QCString libname( name );
+ Q3CString libname( name );
// only append ".la" if there is no extension
// this allows to load non-libtool libraries as well
// (mhk, 20000228)
int pos = libname.findRev('/');
if (pos < 0)
pos = 0;
/*US
if (libname.find('.', pos) < 0) {
libname += ".la";
}
*/
//US in the microedition we work only with shared libraries.
if (libname.find('.', pos) < 0) {
#ifdef _WIN32_
libname += ".dll";
#else
libname += ".so";
#endif
}
// only look up the file if it is not an absolute filename
// (mhk, 20000228)
@@ -400,97 +403,97 @@ QString KLibLoader::findLibrary( const char * name/*US , const KInstance * insta
#ifndef _WIN32_
libname.insert(pos, "lib");
#endif
//US libfile = instance->dirs()->findResource( "module", libname );
//qDebug("libname = %s ",libname.data() );
libfile = KGlobal::dirs()->findResource( "module", libname );
//qDebug("libfile = %s ",libfile.latin1() );
if ( libfile.isEmpty() )
{
//US libfile = instance->dirs()->findResource( "lib", libname );
libfile = KGlobal::dirs()->findResource( "lib", libname );
//qDebug("libfile2 = %s ",libfile.latin1() );
#ifndef NDEBUG
if ( !libfile.isEmpty() && libname.left(3) == "lib" ) // don't warn for kdeinit modules
kdDebug(150) << "library " << libname << " not found under 'module' but under 'lib'" << endl;
#endif
}
if ( libfile.isEmpty() )
{
#ifndef NDEBUG
kdDebug(150) << "library=" << libname << ": No file names " << libname.data() << " found in paths." << endl;
- self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(libname);
+ self()->d->errorMessage = i18n("Library files for \"%1\" not found in paths").arg(QString(libname));
qDebug("KLibLoader::library could not find library: %s", libname.data());
#endif
}
else
self()->d->errorMessage = QString::null;
}
//qDebug("return libfile = %s ",libfile.latin1() );
return libfile;
}
KLibrary* KLibLoader::globalLibrary( const char *name )
{
KLibrary *tmp;
/*US
int olt_dlopen_flag = lt_dlopen_flag;
lt_dlopen_flag |= LT_GLOBAL;
kdDebug(150) << "Loading the next library global with flag "
<< lt_dlopen_flag
<< "." << endl;
*/
tmp = library(name);
/*US
lt_dlopen_flag = olt_dlopen_flag;
*/
return tmp;
}
KLibrary* KLibLoader::library( const char *name )
{
if (!name)
return 0;
KLibWrapPrivate* wrap = m_libs[name];
if (wrap) {
/* Nothing to do to load the library. */
wrap->ref_count++;
return wrap->lib;
}
/* Test if this library was loaded at some time, but got
unloaded meanwhile, whithout being dlclose()'ed. */
- QPtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
+ Q3PtrListIterator<KLibWrapPrivate> it(d->loaded_stack);
for (; it.current(); ++it) {
if (it.current()->name == name)
wrap = it.current();
}
if (wrap) {
d->pending_close.removeRef(wrap);
if (!wrap->lib) {
/* This lib only was in loaded_stack, but not in m_libs. */
wrap->lib = new KLibrary( name, wrap->filename, wrap->handle );
}
wrap->ref_count++;
} else {
QString libfile = findLibrary( name );
if ( libfile.isEmpty() )
return 0;
#ifdef DESKTOP_VERSION
QLibrary *qlib = new QLibrary( libfile.latin1() );
#else
QLibrary *qlib = new QLibrary( libfile.latin1(), QLibrary::Immediately );
#endif
//US lt_dlhandle handle = lt_dlopen( libfile.latin1() );
//US if ( !handle )
@@ -529,68 +532,68 @@ void KLibLoader::unloadLibrary( const char *libname )
return;
// kdDebug(150) << "closing library " << libname << endl;
m_libs.remove( libname );
disconnect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
close_pending( wrap );
}
KLibFactory* KLibLoader::factory( const char* name )
{
KLibrary* lib = library( name );
if ( !lib )
return 0;
return lib->factory();
}
void KLibLoader::slotLibraryDestroyed()
{
const KLibrary *lib = static_cast<const KLibrary *>( sender() );
- QAsciiDictIterator<KLibWrapPrivate> it( m_libs );
+ Q3AsciiDictIterator<KLibWrapPrivate> it( m_libs );
for (; it.current(); ++it )
if ( it.current()->lib == lib )
{
KLibWrapPrivate *wrap = it.current();
wrap->lib = 0; /* the KLibrary object is already away */
m_libs.remove( it.currentKey() );
close_pending( wrap );
return;
}
}
void KLibLoader::close_pending(KLibWrapPrivate *wrap)
{
if (wrap && !d->pending_close.containsRef( wrap ))
d->pending_close.append( wrap );
/* First delete all KLibrary objects in pending_close, but _don't_ unload
the DSO behind it. */
- QPtrListIterator<KLibWrapPrivate> it(d->pending_close);
+ Q3PtrListIterator<KLibWrapPrivate> it(d->pending_close);
for (; it.current(); ++it) {
wrap = it.current();
if (wrap->lib) {
disconnect( wrap->lib, SIGNAL( destroyed() ),
this, SLOT( slotLibraryDestroyed() ) );
delete wrap->lib;
wrap->lib = 0;
}
}
if (d->unload_mode == KLibLoaderPrivate::DONT_UNLOAD) return;
bool deleted_one = false;
while ((wrap = d->loaded_stack.first())) {
/* Let's first see, if we want to try to unload this lib.
If the env. var KDE_DOUNLOAD is set, we try to unload every lib.
If not, we look at the lib itself, and unload it only, if it exports
the symbol __kde_do_unload. */
if (d->unload_mode != KLibLoaderPrivate::UNLOAD
&& wrap->unload_mode != KLibWrapPrivate::UNLOAD)
break;
/* Now ensure, that the libs are only unloaded in the reverse direction
they were loaded. */
diff --git a/microkde/kdecore/klibloader.h b/microkde/kdecore/klibloader.h
index ed57109..53d146e 100644
--- a/microkde/kdecore/klibloader.h
+++ b/microkde/kdecore/klibloader.h
@@ -1,79 +1,79 @@
/* This file is part of the KDE libraries
Copyright (C) 1999 Torben Weis <weis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KLIBLOADER_H
#define KLIBLOADER_H
#include <qobject.h>
#include <qstring.h>
#include <qstringlist.h>
-#include <qasciidict.h>
-#include <qptrlist.h>
+#include <q3asciidict.h>
+#include <q3ptrlist.h>
#include <kglobal.h>
#include <stdlib.h> // For backwards compatibility
class KInstance;
class QTimer;
class KLibrary;
class KLibFactory;
class KLibFactoryPrivate;
class KLibLoaderPrivate;
class KLibraryPrivate;
class QLibrary;
#define K_EXPORT_COMPONENT_FACTORY( libname, factory ) \
extern "C" { void *init_##libname() { return new factory; } }
/**
* @short Represents a dynamically loaded library.
*
* KLibrary allows you to look up symbols of the shared library.
* Use @ref KLibLoader to create a new instance of KLibrary.
*
* @see KLibLoader
* @author Torben Weis <weis@kde.org>
*/
class KLibrary : public QObject
{
friend class KLibLoader;
- friend class QAsciiDict<KLibrary>;
+ friend class Q3AsciiDict<KLibrary>;
Q_OBJECT
public:
/**
* @internal
* Don't create KLibrary objects on your own. Instead use @ref KLibLoader.
*/
//US KLibrary( const QString& libname, const QString& filename, void * handle );
KLibrary( const QString& libname, const QString& filename, QLibrary* handle );
/**
* Returns the name of the library.
* @return The name of the library like "libkspread".
*/
QString name() const;
/**
* Returns the file name of the library.
* @return The filename of the library, for example "/opt/kde2&/lib/libkspread.la"
*/
QString fileName() const;
/**
* Returns the factory of the library.
@@ -106,49 +106,49 @@ public:
/**
* Unloads the library.
* This typically results in the deletion of this object. You should
* not reference its pointer after calling this function.
*/
void unload() const;
private slots:
void slotObjectCreated( QObject *obj );
void slotObjectDestroyed();
void slotTimeout();
private:
/**
* @internal
* Don't destruct KLibrary objects yourself. Instead use @ref unload() instead.
*/
~KLibrary();
QString m_libname;
QString m_filename;
KLibFactory* m_factory;
//US void * m_handle;
QLibrary* m_handle;
- QPtrList<QObject> m_objs;
+ Q3PtrList<QObject> m_objs;
QTimer *m_timer;
KLibraryPrivate *d;
};
class KLibWrapPrivate;
/**
* The KLibLoader allows you to load libraries dynamically at runtime.
* Dependent libraries are loaded automatically.
*
* KLibLoader follows the singleton pattern. You can not create multiple
* instances. Use @ref self() to get a pointer to the loader.
*
* @see KLibrary
* @author Torben Weis <weis@kde.org>
*/
class KLibLoader : public QObject
{
friend class KLibrary;
Q_OBJECT
public:
/**
* You should NEVER destruct an instance of KLibLoader
@@ -266,49 +266,49 @@ public:
* being called in all cases, whether the library is unloaded
* while the application is running or when exiting.
*/
static void cleanUp();
/**
* Helper method which looks for a library in the standard paths
* ("module" and "lib" resources).
* Made public for code that doesn't use KLibLoader itself, but still
* wants to open modules.
* @param name of the library. If it is not a path, the function searches in
* the "module" and "lib" resources. If there is no extension,
* ".la" will be appended.
* @param instance a KInstance used to get the standard paths
*/
static QString findLibrary( const char * name/*US , const KInstance * instance = KGlobal::instance()*/ );
protected:
KLibLoader( QObject* parent = 0, const char* name = 0 );
private slots:
void slotLibraryDestroyed();
private:
void close_pending( KLibWrapPrivate * );
- QAsciiDict<KLibWrapPrivate> m_libs;
+ Q3AsciiDict<KLibWrapPrivate> m_libs;
static KLibLoader* s_self;
protected:
virtual void virtual_hook( int id, void* data );
private:
KLibLoaderPrivate *d;
};
/**
* If you develop a library that is to be loaded dynamically at runtime, then
* you should return a pointer to your factory. The K_EXPORT_COMPONENT_FACTORY
* macro is provided for this purpose:
* <pre>
* K_EXPORT_COMPONENT_FACTORY( libkspread, KSpreadFactory )
* </pre>
*
* The first macro argument is the name of your library, the second specifies the name
* of your factory.
*
* In the constructor of your factory you should create an instance of @ref KInstance
* like this:
* <pre>
* s_global = new KInstance( "kspread" );
diff --git a/microkde/kdecore/klocale.cpp b/microkde/kdecore/klocale.cpp
index 1d8ae9f..dd310fa 100644
--- a/microkde/kdecore/klocale.cpp
+++ b/microkde/kdecore/klocale.cpp
@@ -1,100 +1,101 @@
#include <qregexp.h>
#include <qapplication.h>
+#include <QDesktopWidget>
#include "kdebug.h"
#include "kcalendarsystemgregorian.h"
#include "klocale.h"
#include <qstringlist.h>
//#define COLLECT_TRANSLATION
-QDict<QString> *mLocaleDict = 0;
-void setLocaleDict( QDict<QString> * dict )
+Q3Dict<QString> *mLocaleDict = 0;
+void setLocaleDict( Q3Dict<QString> * dict )
{
mLocaleDict = dict;
}
#ifdef COLLECT_TRANSLATION
QStringList missingTrans;
QStringList existingTrans1;
QStringList existingTrans2;
void addMissing(const char *text)
{
QString mis ( text );
if ( !missingTrans.contains( mis ) )
missingTrans.append(mis);
}
void addExist(const char *text,QString trans )
{
//return;
QString mis ( text );
if ( !existingTrans1.contains( mis ) ) {
existingTrans1.append(mis);
existingTrans2.append(trans);
}
}
#include <qfile.h>
-#include <qtextstream.h>
+#include <q3textstream.h>
#include <qtextcodec.h>
#endif
void dumpMissing()
{
#ifdef COLLECT_TRANSLATION
QString fileName = "/tmp/usernewtrans.txt";
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return ;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
int i;
for ( i = 0; i< missingTrans.count(); ++i ) {
QString text = missingTrans[i].replace( QRegExp("\n"),"\\n" );
ts << "{ \""<<text<< "\",\""<< text <<"\" },\n";
}
file.close();
{
QString fileName = "/tmp/usertrans.txt";
QFile file( fileName );
- if (!file.open( IO_WriteOnly ) ) {
+ if (!file.open( QIODevice::WriteOnly ) ) {
return ;
}
- QTextStream ts( &file );
+ Q3TextStream ts( &file );
ts.setCodec( QTextCodec::codecForName("utf8") );
int i;
for ( i = 0; i< existingTrans1.count(); ++i ) {
QString text = existingTrans1[i].replace( QRegExp("\n"),"\\n" );
QString text2 = existingTrans2[i].replace( QRegExp("\n"),"\\n" );
ts << "{ \""<<text<< "\",\""<< text2 <<"\" },\n";
}
file.close();
}
#endif
}
QString i18n(const char *text)
{
if ( ! mLocaleDict ) {
#ifdef COLLECT_TRANSLATION
addMissing( text );
#endif
return QString( text );
}
else {
QString* ret = mLocaleDict->find(QString(text)) ;
@@ -446,49 +447,49 @@ QString KLocale::formatDate(const QDate &pDate, bool shortFormat, IntDateFormat
break;
default:
buffer[index++] = rst.at( format_index );
break;
}
escape = false;
}
}
QString ret( buffer, index );
delete [] buffer;
return ret;
}
QString KLocale::formatDateTime(const QDateTime &pDateTime,
bool shortFormat,
bool includeSeconds,
IntDateFormat intIntDateFormat) const
{
QString format("%1 %2");
if ( intIntDateFormat == Default )
format = "%1 %2";
else if ( intIntDateFormat == Format1 )
format = "%1 %2";
- else if ( intIntDateFormat == ISODate )
+ else if ( intIntDateFormat == Qt::ISODate )
format = "%1T%2";
QString res = format.arg(formatDate( pDateTime.date(), shortFormat, intIntDateFormat ))
.arg(formatTime( pDateTime.time(), includeSeconds , intIntDateFormat ));
//qDebug("KLocale::formatDateTime transformed %s, into %s", pDateTime.toString().latin1(), res.latin1() );
return res;
}
QString KLocale::formatDateTime(const QDateTime &pDateTime, IntDateFormat intIntDateFormat) const
{
return formatDateTime(pDateTime, true, true, intIntDateFormat);
}
QDate KLocale::readDate(const QString &intstr, bool* ok) const
{
QDate date;
date = readDate(intstr, true, ok);
if (date.isValid()) return date;
return readDate(intstr, false, ok);
}
QDate KLocale::readDate(const QString &intstr, bool shortFormat, bool* ok) const
@@ -506,49 +507,49 @@ QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool* ok) con
int year = QDate::currentDate().year();
uint strpos = 0;
uint fmtpos = 0;
while (fmt.length() > fmtpos || str.length() > strpos)
{
if ( !(fmt.length() > fmtpos && str.length() > strpos) )
goto error;
QChar c = fmt.at(fmtpos++);
if (c != '%') {
if (c.isSpace())
strpos++;
else if (c != str.at(strpos++))
goto error;
continue;
}
// remove space at the begining
if (str.length() > strpos && str.at(strpos).isSpace())
strpos++;
c = fmt.at(fmtpos++);
- switch (c)
+ switch (c.unicode())
{
case 'a':
case 'A':
// this will just be ignored
{ // Cristian Tache: porting to Win: Block added because of "j" redefinition
for (int j = 1; j < 8; j++) {
QString s = weekDayName(j, c == 'a').lower();
int len = s.length();
if (str.mid(strpos, len) == s)
strpos += len;
}
break;
}
case 'b':
case 'B':
{ // Cristian Tache: porting to Win: Block added because of "j" redefinition
for (int j = 1; j < 13; j++) {
QString s = monthName(j, c == 'b').lower();
int len = s.length();
if (str.mid(strpos, len) == s) {
month = j;
strpos += len;
}
}
@@ -617,49 +618,49 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
bool pm = false;
uint strpos = 0;
uint Formatpos = 0;
while (Format.length() > Formatpos || str.length() > strpos)
{
if ( !(Format.length() > Formatpos && str.length() > strpos) ) goto error;
QChar c = Format.at(Formatpos++);
if (c != '%')
{
if (c.isSpace())
strpos++;
else if (c != str.at(strpos++))
goto error;
continue;
}
// remove space at the begining
if (str.length() > strpos && str.at(strpos).isSpace())
strpos++;
c = Format.at(Formatpos++);
- switch (c)
+ switch (c.unicode())
{
case 'p':
{
QString s;
s = i18n("pm").lower();
int len = s.length();
if (str.mid(strpos, len) == s)
{
pm = true;
strpos += len;
}
else
{
s = i18n("am").lower();
len = s.length();
if (str.mid(strpos, len) == s) {
pm = false;
strpos += len;
}
else
goto error;
}
}
break;
@@ -713,49 +714,49 @@ QTime KLocale::readTime(const QString &intstr, bool seconds, bool *ok) const
// The presence of the bool* (since KDE-3.0) removes the need for an invalid QTime.
}
QDateTime KLocale::readDateTime(const QString &intstr,
IntDateFormat intIntDateFormat,
bool* ok) const
{
bool ok1, ok2;
// AT the moment we can not read any other format then ISODate
if ( intIntDateFormat != ISODate )
{
qDebug("KLocale::readDateTime, only ISODate is supported.");
return QDateTime();
}
int pos = intstr.find("T");
QString date = intstr.left(pos);
QString time = intstr.mid(pos+1);
QString dformat = dateFormat(intIntDateFormat);
QString tformat = timeFormat(intIntDateFormat);
QDate m_date = readDate(date, dformat, &ok1);
- QTime m_time = readTime(time, tformat, &ok2);
+ QTime m_time = readTime(time, !tformat.isEmpty(), &ok2);
QDateTime m_dt;
if (ok)
{
if ((ok1 == false) || (ok2 == false))
*ok = false;
else
*ok = true;
}
//only set values if both operations returned true.
if ((ok1 == true) && (ok2 == true))
{
m_dt.setDate(m_date);
m_dt.setTime(m_time);
}
//qDebug("KLocale::readDateTime() transformed %s into %s (%s), %s (%s) : err1=%i, err2=%i", intstr.latin1(), date.latin1(), dformat.latin1(), time.latin1(), tformat.latin1(), ok1, ok2);
return m_dt;
}
QDate KLocale::readDate(const QString &intstr,
IntDateFormat intIntDateFormat,
diff --git a/microkde/kdecore/klocale.h b/microkde/kdecore/klocale.h
index 58e0b39..840fc9d 100644
--- a/microkde/kdecore/klocale.h
+++ b/microkde/kdecore/klocale.h
@@ -1,38 +1,38 @@
#ifndef MINIKDE_KLOCALE_H
#define MINIKDE_KLOCALE_H
#include <qstring.h>
#include <qstringlist.h>
#include <qdatetime.h>
-#include <qdict.h>
+#include <q3dict.h>
#ifndef I18N_NOOP
#define I18N_NOOP(x) (x)
#endif
class KCalendarSystem;
-void setLocaleDict( QDict<QString> * dict );
+void setLocaleDict( Q3Dict<QString> * dict );
QString i18n(const char *text);
QString i18n(const char *hint, const char *text);
QString i18n(const char *text1, const char *textn, int num);
// Qt3's uic generates i18n( "msg", "comment" ) calls which conflict
// with our i18n method. we use uic -tr tr2i18n to redirect
// to the right i18n() function
inline QString tr2i18n(const char* message, const char* =0) {
return i18n( message);
}
class KLocale
{
public:
KLocale();
QString formatNumber(double num, int precision = -1) const;
QString formatNumber(const QString &numStr) const;
double readNumber(const QString &numStr, bool * ok = 0) const;
QString decimalSymbol() const;
QString thousandsSeparator() const;
QString positiveSign() const;
QString negativeSign() const;
diff --git a/microkde/kdecore/kmdcodec.cpp b/microkde/kdecore/kmdcodec.cpp
index bc03569..db11e52 100644
--- a/microkde/kdecore/kmdcodec.cpp
+++ b/microkde/kdecore/kmdcodec.cpp
@@ -18,48 +18,50 @@
RFC 1321 "MD5 Message-Digest Algorithm" Copyright (C) 1991-1992.
RSA Data Security, Inc. Created 1991. All rights reserved.
The KMD5 class is based on a C++ implementation of
"RSA Data Security, Inc. MD5 Message-Digest Algorithm" by
Mordechai T. Abzug, Copyright (c) 1995. This implementation
passes the test-suite as defined in RFC 1321.
The encoding and decoding utilities in KCodecs with the exception of
quoted-printable are based on the java implementation in HTTPClient
package by Ronald Tschal� Copyright (C) 1996-1999.
The quoted-printable codec as described in RFC 2045, section 6.7. is by
Rik Hemsley (C) 2001.
*/
//US #include <config.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <kdebug.h>
#include "kmdcodec.h"
+//Added by qt3to4:
+#include <Q3CString>
#define KMD5_S11 7
#define KMD5_S12 12
#define KMD5_S13 17
#define KMD5_S14 22
#define KMD5_S21 5
#define KMD5_S22 9
#define KMD5_S23 14
#define KMD5_S24 20
#define KMD5_S31 4
#define KMD5_S32 11
#define KMD5_S33 16
#define KMD5_S34 23
#define KMD5_S41 6
#define KMD5_S42 10
#define KMD5_S43 15
#define KMD5_S44 21
const char KCodecs::Base64EncMap[64] =
{
0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66,
@@ -126,56 +128,56 @@ const char KCodecs::hexChars[16] =
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};
const unsigned int KCodecs::maxQPLineLength = 70;
/******************************** KCodecs ********************************/
// strchr(3) for broken systems.
static int rikFindChar(register const char * _s, const char c)
{
register const char * s = _s;
while (true)
{
if ((0 == *s) || (c == *s)) break; ++s;
if ((0 == *s) || (c == *s)) break; ++s;
if ((0 == *s) || (c == *s)) break; ++s;
if ((0 == *s) || (c == *s)) break; ++s;
}
return s - _s;
}
-QCString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF)
+Q3CString KCodecs::quotedPrintableEncode(const QByteArray& in, bool useCRLF)
{
QByteArray out;
quotedPrintableEncode (in, out, useCRLF);
- return QCString (out.data(), out.size()+1);
+ return Q3CString (out.data(), out.size()+1);
}
-QCString KCodecs::quotedPrintableEncode(const QCString& str, bool useCRLF)
+Q3CString KCodecs::quotedPrintableEncode(const Q3CString& str, bool useCRLF)
{
if (str.isEmpty())
return "";
QByteArray in (str.length());
memcpy (in.data(), str.data(), str.length());
return quotedPrintableEncode(in, useCRLF);
}
void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool useCRLF)
{
out.resize (0);
if (in.isEmpty())
return;
char *cursor;
const char *data;
unsigned int lineLength;
unsigned int pos;
const unsigned int length = in.size();
const unsigned int end = length - 1;
@@ -259,56 +261,56 @@ void KCodecs::quotedPrintableEncode(const QByteArray& in, QByteArray& out, bool
lineLength += 3;
}
// If we're approaching the maximum line length, do a soft line break.
if ((lineLength > maxQPLineLength) && (i < end))
{
if (useCRLF) {
*cursor++ = '=';
*cursor++ = '\r';
*cursor++ = '\n';
} else {
*cursor++ = '=';
*cursor++ = '\n';
}
lineLength = 0;
}
}
out.truncate(cursor - out.data());
}
-QCString KCodecs::quotedPrintableDecode(const QByteArray & in)
+Q3CString KCodecs::quotedPrintableDecode(const QByteArray & in)
{
QByteArray out;
quotedPrintableDecode (in, out);
- return QCString (out.data(), out.size()+1);
+ return Q3CString (out.data(), out.size()+1);
}
-QCString KCodecs::quotedPrintableDecode(const QCString & str)
+Q3CString KCodecs::quotedPrintableDecode(const Q3CString & str)
{
if (str.isEmpty())
return "";
QByteArray in (str.length());
memcpy (in.data(), str.data(), str.length());
return quotedPrintableDecode (in);
}
void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out)
{
// clear out the output buffer
out.resize (0);
if (in.isEmpty())
return;
char *cursor;
const char *data;
const unsigned int length = in.size();
data = in.data();
out.resize (length);
cursor = out.data();
@@ -334,348 +336,345 @@ void KCodecs::quotedPrintableDecode(const QByteArray& in, QByteArray& out)
else
{
// =XX encoded byte.
int hexChar0 = rikFindChar(hexChars, c1);
int hexChar1 = rikFindChar(hexChars, c2);
if (hexChar0 < 16 && hexChar1 < 16)
{
*cursor++ = char((hexChar0 * 16) | hexChar1);
i += 2;
}
}
}
}
else
{
*cursor++ = c;
}
}
out.truncate(cursor - out.data());
}
-QCString KCodecs::base64Encode( const QCString& str, bool insertLFs )
+Q3CString KCodecs::base64Encode( const Q3CString& str, bool insertLFs )
{
if ( str.isEmpty() )
return "";
QByteArray in (str.length());
memcpy( in.data(), str.data(), str.length() );
return base64Encode( in, insertLFs );
}
-QCString KCodecs::base64Encode( const QByteArray& in, bool insertLFs )
+Q3CString KCodecs::base64Encode( const QByteArray& in, bool insertLFs )
{
QByteArray out;
base64Encode( in, out, insertLFs );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::base64Encode( const QByteArray& in, QByteArray& out,
bool insertLFs )
{
// clear out the output buffer
out.resize (0);
if ( in.isEmpty() )
return;
unsigned int sidx = 0;
unsigned int didx = 0;
const char* data = in.data();
const unsigned int len = in.size();
unsigned int out_len = ((len+2)/3)*4;
// Deal with the 76 characters or less per
// line limit specified in RFC 2045 on a
// pre request basis.
insertLFs = (insertLFs && out_len > 76);
if ( insertLFs )
out_len += ((out_len-1)/76);
int count = 0;
out.resize( out_len );
// 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
if ( len > 1 )
{
while (sidx < len-2)
{
if ( insertLFs )
{
if ( count && (count%76) == 0 )
- out.at(didx++) = '\n';
+ out[didx++] = '\n';
count += 4;
}
- out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = Base64EncMap[(data[sidx+2] >> 6) & 003 |
+ out[didx++] = Base64EncMap[(data[sidx+2] >> 6) & 003 |
(data[sidx+1] << 2) & 077];
- out.at(didx++) = Base64EncMap[data[sidx+2] & 077];
+ out[didx++] = Base64EncMap[data[sidx+2] & 077];
sidx += 3;
}
}
if (sidx < len)
{
if ( insertLFs && (count > 0) && (count%76) == 0 )
- out.at(didx++) = '\n';
+ out[didx++] = '\n';
- out.at(didx++) = Base64EncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = Base64EncMap[(data[sidx] >> 2) & 077];
if (sidx < len-1)
{
- out.at(didx++) = Base64EncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = Base64EncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = Base64EncMap[(data[sidx+1] << 2) & 077];
+ out[didx++] = Base64EncMap[(data[sidx+1] << 2) & 077];
}
else
{
- out.at(didx++) = Base64EncMap[(data[sidx] << 4) & 077];
+ out[didx++] = Base64EncMap[(data[sidx] << 4) & 077];
}
}
// Add padding
while (didx < out.size())
- {
- out.at(didx) = '=';
- didx++;
- }
+ out[didx++] = '=';
}
-QCString KCodecs::base64Decode( const QCString& str )
+Q3CString KCodecs::base64Decode( const Q3CString& str )
{
if ( str.isEmpty() )
return "";
QByteArray in( str.length() );
memcpy( in.data(), str.data(), str.length() );
return base64Decode( in );
}
-QCString KCodecs::base64Decode( const QByteArray& in )
+Q3CString KCodecs::base64Decode( const QByteArray& in )
{
QByteArray out;
base64Decode( in, out );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::base64Decode( const QByteArray& in, QByteArray& out )
{
out.resize(0);
if ( in.isEmpty() )
return;
unsigned int count = 0;
unsigned int len = in.size(), tail = len;
const char* data = in.data();
// Deal with possible *nix "BEGIN" marker!!
while ( count < len && (data[count] == '\n' || data[count] == '\r' ||
data[count] == '\t' || data[count] == ' ') )
count++;
if ( QString(data+count).left(5).lower() == "begin" )
{
count += 5;
while ( count < len && data[count] != '\n' && data[count] != '\r' )
count++;
while ( count < len && (data[count] == '\n' || data[count] == '\r') )
count ++;
data += count;
tail = (len -= count);
}
// Find the tail end of the actual encoded data even if
// there is/are trailing CR and/or LF.
while ( data[tail-1] == '=' || data[tail-1] == '\n' ||
data[tail-1] == '\r' )
if ( data[--tail] != '=' ) len = tail;
unsigned int outIdx = 0;
out.resize( (count=len) );
for (unsigned int idx = 0; idx < count; idx++)
{
// Adhere to RFC 2045 and ignore characters
// that are not part of the encoding table.
unsigned char ch = data[idx];
if ((ch > 47 && ch < 58) || (ch > 64 && ch < 91) ||
(ch > 96 && ch < 123) || ch == '+' || ch == '/' || ch == '=')
{
- out.at(outIdx++) = Base64DecMap[ch];
+ out[outIdx++] = Base64DecMap[ch];
}
else
{
len--;
tail--;
}
}
// kdDebug() << "Tail size = " << tail << ", Length size = " << len << endl;
// 4-byte to 3-byte conversion
len = (tail>(len/4)) ? tail-(len/4) : 0;
unsigned int sidx = 0, didx = 0;
if ( len > 1 )
{
while (didx < len-2)
{
- out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003));
- out.at(didx+1) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017));
- out.at(didx+2) = (((out.at(sidx+2) << 6) & 255) | (out.at(sidx+3) & 077));
+ out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
+ out[didx+1] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
+ out[didx+2] = (((out[sidx+2] << 6) & 255) | (out[sidx+3] & 077));
sidx += 4;
didx += 3;
}
}
if (didx < len)
- out.at(didx) = (((out.at(sidx) << 2) & 255) | ((out.at(sidx+1) >> 4) & 003));
+ out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx+1] >> 4) & 003));
if (++didx < len )
- out.at(didx) = (((out.at(sidx+1) << 4) & 255) | ((out.at(sidx+2) >> 2) & 017));
+ out[didx] = (((out[sidx+1] << 4) & 255) | ((out[sidx+2] >> 2) & 017));
// Resize the output buffer
if ( len == 0 || len < out.size() )
out.resize(len);
}
-QCString KCodecs::uuencode( const QCString& str )
+Q3CString KCodecs::uuencode( const Q3CString& str )
{
if ( str.isEmpty() )
return "";
QByteArray in;
in.resize( str.length() );
memcpy( in.data(), str.data(), str.length() );
return uuencode( in );
}
-QCString KCodecs::uuencode( const QByteArray& in )
+Q3CString KCodecs::uuencode( const QByteArray& in )
{
QByteArray out;
uuencode( in, out );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::uuencode( const QByteArray& in, QByteArray& out )
{
out.resize( 0 );
if( in.isEmpty() )
return;
unsigned int sidx = 0;
unsigned int didx = 0;
unsigned int line_len = 45;
const char nl[] = "\n";
const char* data = in.data();
const unsigned int nl_len = strlen(nl);
const unsigned int len = in.size();
out.resize( (len+2)/3*4 + ((len+line_len-1)/line_len)*(nl_len+1) );
// split into lines, adding line-length and line terminator
while (sidx+line_len < len)
{
// line length
- out.at(didx++) = UUEncMap[line_len];
+ out[didx++] = UUEncMap[line_len];
// 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
for (unsigned int end = sidx+line_len; sidx < end; sidx += 3)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 |
+ out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 |
(data[sidx+1] << 2) & 077];
- out.at(didx++) = UUEncMap[data[sidx+2] & 077];
+ out[didx++] = UUEncMap[data[sidx+2] & 077];
}
// line terminator
//for (unsigned int idx=0; idx < nl_len; idx++)
- //out.at(didx++) = nl[idx];
+ //out[didx++] = nl[idx];
memcpy(out.data()+didx, nl, nl_len);
didx += nl_len;
}
// line length
- out.at(didx++) = UUEncMap[len-sidx];
+ out[didx++] = UUEncMap[len-sidx];
// 3-byte to 4-byte conversion + 0-63 to ascii printable conversion
while (sidx+2 < len)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+2] >> 6) & 003 |
+ out[didx++] = UUEncMap[(data[sidx+2] >> 6) & 003 |
(data[sidx+1] << 2) & 077];
- out.at(didx++) = UUEncMap[data[sidx+2] & 077];
+ out[didx++] = UUEncMap[data[sidx+2] & 077];
sidx += 3;
}
if (sidx < len-1)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] >> 4) & 017 |
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx+1] >> 4) & 017 |
(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[(data[sidx+1] << 2) & 077];
- out.at(didx++) = UUEncMap[0];
+ out[didx++] = UUEncMap[(data[sidx+1] << 2) & 077];
+ out[didx++] = UUEncMap[0];
}
else if (sidx < len)
{
- out.at(didx++) = UUEncMap[(data[sidx] >> 2) & 077];
- out.at(didx++) = UUEncMap[(data[sidx] << 4) & 077];
- out.at(didx++) = UUEncMap[0];
- out.at(didx++) = UUEncMap[0];
+ out[didx++] = UUEncMap[(data[sidx] >> 2) & 077];
+ out[didx++] = UUEncMap[(data[sidx] << 4) & 077];
+ out[didx++] = UUEncMap[0];
+ out[didx++] = UUEncMap[0];
}
// line terminator
memcpy(out.data()+didx, nl, nl_len);
didx += nl_len;
// sanity check
if ( didx != out.size() )
out.resize( 0 );
}
-QCString KCodecs::uudecode( const QCString& str )
+Q3CString KCodecs::uudecode( const Q3CString& str )
{
if ( str.isEmpty() )
return "";
QByteArray in;
in.resize( str.length() );
memcpy( in.data(), str.data(), str.length() );
return uudecode( in );
}
-QCString KCodecs::uudecode( const QByteArray& in )
+Q3CString KCodecs::uudecode( const QByteArray& in )
{
QByteArray out;
uudecode( in, out );
- return QCString( out.data(), out.size()+1 );
+ return Q3CString( out.data(), out.size()+1 );
}
void KCodecs::uudecode( const QByteArray& in, QByteArray& out )
{
out.resize( 0 );
if( in.isEmpty() )
return;
unsigned int sidx = 0;
unsigned int didx = 0;
unsigned int len = in.size();
unsigned int line_len, end;
const char* data = in.data();
// Deal with *nix "BEGIN"/"END" separators!!
unsigned int count = 0;
while ( count < len && (data[count] == '\n' || data[count] == '\r' ||
data[count] == '\t' || data[count] == ' ') )
count ++;
bool hasLF = false;
if ( QString( data+count).left(5).lower() == "begin" )
{
count += 5;
@@ -684,116 +683,116 @@ void KCodecs::uudecode( const QByteArray& in, QByteArray& out )
while ( count < len && (data[count] == '\n' || data[count] == '\r') )
count ++;
data += count;
len -= count;
hasLF = true;
}
out.resize( len/4*3 );
while ( sidx < len )
{
// get line length (in number of encoded octets)
line_len = UUDecMap[ (unsigned char) data[sidx++]];
// ascii printable to 0-63 and 4-byte to 3-byte conversion
end = didx+line_len;
char A, B, C, D;
if (end > 2) {
while (didx < end-2)
{
A = UUDecMap[(unsigned char) data[sidx]];
B = UUDecMap[(unsigned char) data[sidx+1]];
C = UUDecMap[(unsigned char) data[sidx+2]];
D = UUDecMap[(unsigned char) data[sidx+3]];
- out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) );
- out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) );
- out.at(didx++) = ( ((C << 6) & 255) | (D & 077) );
+ out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) );
+ out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) );
+ out[didx++] = ( ((C << 6) & 255) | (D & 077) );
sidx += 4;
}
}
if (didx < end)
{
A = UUDecMap[(unsigned char) data[sidx]];
B = UUDecMap[(unsigned char) data[sidx+1]];
- out.at(didx++) = ( ((A << 2) & 255) | ((B >> 4) & 003) );
+ out[didx++] = ( ((A << 2) & 255) | ((B >> 4) & 003) );
}
if (didx < end)
{
B = UUDecMap[(unsigned char) data[sidx+1]];
C = UUDecMap[(unsigned char) data[sidx+2]];
- out.at(didx++) = ( ((B << 4) & 255) | ((C >> 2) & 017) );
+ out[didx++] = ( ((B << 4) & 255) | ((C >> 2) & 017) );
}
// skip padding
while (sidx < len && data[sidx] != '\n' && data[sidx] != '\r')
sidx++;
// skip end of line
while (sidx < len && (data[sidx] == '\n' || data[sidx] == '\r'))
sidx++;
// skip the "END" separator when present.
if ( hasLF && QString( data+sidx).left(3).lower() == "end" )
break;
}
if ( didx < out.size() )
out.resize( didx );
}
/******************************** KMD5 ********************************/
KMD5::KMD5()
{
init();
}
KMD5::KMD5(const char *in, int len)
{
init();
update(in, len);
}
KMD5::KMD5(const QByteArray& in)
{
init();
update( in );
}
-KMD5::KMD5(const QCString& in)
+KMD5::KMD5(const Q3CString& in)
{
init();
update( in );
}
void KMD5::update(const QByteArray& in)
{
update(in.data(), int(in.size()));
}
-void KMD5::update(const QCString& in)
+void KMD5::update(const Q3CString& in)
{
update(in.data(), int(in.length()));
}
void KMD5::update(const unsigned char* in, int len)
{
if (len < 0)
len = qstrlen(reinterpret_cast<const char*>(in));
if (!len)
return;
if (m_finalized) {
kdWarning() << "KMD5::update called after state was finalized!" << endl;
return;
}
Q_UINT32 in_index;
Q_UINT32 buffer_index;
Q_UINT32 buffer_space;
Q_UINT32 in_length = static_cast<Q_UINT32>( len );
buffer_index = static_cast<Q_UINT32>((m_count[0] >> 3) & 0x3F);
@@ -852,132 +851,132 @@ void KMD5::finalize ()
index = static_cast<Q_UINT32>((m_count[0] >> 3) & 0x3f);
padLen = (index < 56) ? (56 - index) : (120 - index);
update (reinterpret_cast<const char*>(PADDING), padLen);
// Append length (before padding)
update (reinterpret_cast<const char*>(bits), 8);
// Store state in digest
encode (m_digest, m_state, 16);
//memcpy( m_digest, m_state, 16 );
// Fill sensitive information with zero's
memset ( (void *)m_buffer, 0, sizeof(*m_buffer));
m_finalized = true;
}
bool KMD5::verify( const KMD5::Digest& digest)
{
finalize();
return (0 == memcmp(rawDigest(), digest, sizeof(KMD5::Digest)));
}
-bool KMD5::verify( const QCString& hexdigest)
+bool KMD5::verify( const Q3CString& hexdigest)
{
finalize();
return (0 == strcmp(hexDigest().data(), hexdigest));
}
const KMD5::Digest& KMD5::rawDigest()
{
finalize();
return m_digest;
}
void KMD5::rawDigest( KMD5::Digest& bin )
{
finalize();
memcpy( bin, m_digest, 16 );
}
-QCString KMD5::hexDigest()
+Q3CString KMD5::hexDigest()
{
- QCString s(33);
+ Q3CString s(33);
finalize();
sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5],
m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11],
m_digest[12], m_digest[13], m_digest[14], m_digest[15]);
return s;
}
-void KMD5::hexDigest(QCString& s)
+void KMD5::hexDigest(Q3CString& s)
{
finalize();
s.resize(33);
sprintf(s.data(), "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
m_digest[0], m_digest[1], m_digest[2], m_digest[3], m_digest[4], m_digest[5],
m_digest[6], m_digest[7], m_digest[8], m_digest[9], m_digest[10], m_digest[11],
m_digest[12], m_digest[13], m_digest[14], m_digest[15]);
}
-QCString KMD5::base64Digest()
+Q3CString KMD5::base64Digest()
{
QByteArray ba(16);
finalize();
memcpy(ba.data(), m_digest, 16);
return KCodecs::base64Encode(ba);
}
void KMD5::init()
{
d = 0;
reset();
}
void KMD5::reset()
{
m_finalized = false;
m_count[0] = 0;
m_count[1] = 0;
m_state[0] = 0x67452301;
m_state[1] = 0xefcdab89;
m_state[2] = 0x98badcfe;
m_state[3] = 0x10325476;
memset ( m_buffer, 0, sizeof(*m_buffer));
memset ( m_digest, 0, sizeof(*m_digest));
}
void KMD5::transform( const unsigned char block[64] )
{
Q_UINT32 a = m_state[0], b = m_state[1], c = m_state[2], d = m_state[3], x[16];
decode (x, block, 64);
//memcpy( x, block, 64 );
//US Q_ASSERT(!m_finalized); // not just a user error, since the method is private
- ASSERT(!m_finalized); // not just a user error, since the method is private
+ Q_ASSERT(!m_finalized); // not just a user error, since the method is private
/* Round 1 */
FF (a, b, c, d, x[ 0], KMD5_S11, 0xd76aa478); /* 1 */
FF (d, a, b, c, x[ 1], KMD5_S12, 0xe8c7b756); /* 2 */
FF (c, d, a, b, x[ 2], KMD5_S13, 0x242070db); /* 3 */
FF (b, c, d, a, x[ 3], KMD5_S14, 0xc1bdceee); /* 4 */
FF (a, b, c, d, x[ 4], KMD5_S11, 0xf57c0faf); /* 5 */
FF (d, a, b, c, x[ 5], KMD5_S12, 0x4787c62a); /* 6 */
FF (c, d, a, b, x[ 6], KMD5_S13, 0xa8304613); /* 7 */
FF (b, c, d, a, x[ 7], KMD5_S14, 0xfd469501); /* 8 */
FF (a, b, c, d, x[ 8], KMD5_S11, 0x698098d8); /* 9 */
FF (d, a, b, c, x[ 9], KMD5_S12, 0x8b44f7af); /* 10 */
FF (c, d, a, b, x[10], KMD5_S13, 0xffff5bb1); /* 11 */
FF (b, c, d, a, x[11], KMD5_S14, 0x895cd7be); /* 12 */
FF (a, b, c, d, x[12], KMD5_S11, 0x6b901122); /* 13 */
FF (d, a, b, c, x[13], KMD5_S12, 0xfd987193); /* 14 */
FF (c, d, a, b, x[14], KMD5_S13, 0xa679438e); /* 15 */
FF (b, c, d, a, x[15], KMD5_S14, 0x49b40821); /* 16 */
/* Round 2 */
GG (a, b, c, d, x[ 1], KMD5_S21, 0xf61e2562); /* 17 */
GG (d, a, b, c, x[ 6], KMD5_S22, 0xc040b340); /* 18 */
GG (c, d, a, b, x[11], KMD5_S23, 0x265e5a51); /* 19 */
GG (b, c, d, a, x[ 0], KMD5_S24, 0xe9b6c7aa); /* 20 */
diff --git a/microkde/kdecore/kmdcodec.h b/microkde/kdecore/kmdcodec.h
index 2c4d611..616b683 100644
--- a/microkde/kdecore/kmdcodec.h
+++ b/microkde/kdecore/kmdcodec.h
@@ -18,329 +18,331 @@
RFC 1321 "MD5 Message-Digest Algorithm" Copyright (C) 1991-1992.
RSA Data Security, Inc. Created 1991. All rights reserved.
The KMD5 class is based on a C++ implementation of
"RSA Data Security, Inc. MD5 Message-Digest Algorithm" by
Mordechai T. Abzug, Copyright (c) 1995. This implementation
passes the test-suite as defined in RFC 1321.
The encoding and decoding utilities in KCodecs with the exception of
quoted-printable are based on the java implementation in HTTPClient
package by Ronald Tschalär Copyright (C) 1996-1999.
The quoted-printable codec as described in RFC 2045, section 6.7. is by
Rik Hemsley (C) 2001.
*/
#ifndef _KMDBASE_H
#define _KMDBASE_H
#define KBase64 KCodecs
#include <qglobal.h>
#include <qstring.h>
#include <qiodevice.h>
+//Added by qt3to4:
+#include <Q3CString>
/**
* A wrapper class for the most commonly used encoding and
* decoding algorithms. Currently there is support for encoding
* and decoding input using base64, uu and the quoted-printable
* specifications.
*
* @sect Usage:
*
* <PRE>
* QCString input = "Aladdin:open sesame";
* QCString result = KCodecs::base64Encode(input);
* cout << "Result: " << result.data() << endl;
*
* Output should be
* Result: QWxhZGRpbjpvcGVuIHNlc2FtZQ==
* </PRE>
*
* The above example makes use of the convenience functions
* (ones that accept/return null-terminated strings) to encode/decode
* a string. If what you need is to encode or decode binary data, then
* it is highly recommended that you use the functions that take an input
* and output QByteArray as arguments. These functions are specifically
* tailored for encoding and decoding binary data.
*
* @short A collection of commonly used encoding and decoding algorithms.
* @author Dawit Alemayehu <adawit@kde.org>
* @author Rik Hemsley <rik@kde.org>
*/
class KCodecs
{
public:
/**
* Encodes the given data using the quoted-printable algorithm.
*
* @param in data to be encoded.
* @param useCRLF if true the input data is expected to have
* CRLF line breaks and the output will have CRLF line
* breaks, too.
* @return quoted-printable encoded data.
*/
- static QCString quotedPrintableEncode(const QByteArray & in,
+ static Q3CString quotedPrintableEncode(const QByteArray & in,
bool useCRLF = true);
/**
* @overload
*
* Same as above except it accepts a null terminated
* string instead an array.
*
* @param str data to be encoded.
* @param useCRLF if true the input data is expected to have
* CRLF line breaks and the output will have CRLF line
* breaks, too.
* @return quoted-printable encoded data.
*/
- static QCString quotedPrintableEncode(const QCString & str,
+ static Q3CString quotedPrintableEncode(const Q3CString & str,
bool useCRLF = true);
/**
* Encodes the given data using the quoted-printable algorithm.
*
* Use this function if you want the result of the encoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for encoding binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in data to be encoded.
* @param out decoded data.
* @param useCRLF if true the input data is expected to have
* CRLF line breaks and the output will have CRLF line
* breaks, too.
* @return quoted-printable encoded data.
*/
static void quotedPrintableEncode(const QByteArray & in, QByteArray& out,
bool useCRLF);
/**
* Decodes a quoted-printable encoded string.
*
* Accepts data with CRLF or standard unix line breaks.
*
* @param in the data to be decoded.
* @return decoded data.
*/
- static QCString quotedPrintableDecode(const QByteArray & in);
+ static Q3CString quotedPrintableDecode(const QByteArray & in);
/**
* @overload
*
* Same as above except it accepts a null terminated
* string instead an array.
*
* @param str the data to be decoded.
* @return decoded data.
*/
- static QCString quotedPrintableDecode(const QCString & str);
+ static Q3CString quotedPrintableDecode(const Q3CString & str);
/**
* Decodes a quoted-printable encoded data.
*
* Accepts data with CRLF or standard unix line breaks.
* Use this function if you want the result of the decoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for decoding an encoded
* binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in data to be encoded.
* @param out decoded data.
*
* @return quoted-printable encoded data.
*/
static void quotedPrintableDecode(const QByteArray & in, QByteArray& out);
/**
* Encodes the given data using the uuencode algorithm.
*
* The output is split into lines starting with the number of
* encoded octets in the line and ending with a newline. No
* line is longer than 45 octets (60 characters), excluding the
* line terminator.
*
* @param in the data to be uuencoded
* @return a uuencoded data.
*/
- static QCString uuencode( const QByteArray& in );
+ static Q3CString uuencode( const QByteArray& in );
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the string to be uuencoded.
* @return the encoded string.
*/
- static QCString uuencode( const QCString& str );
+ static Q3CString uuencode( const Q3CString& str );
/**
* Encodes the given data using the uuencode algorithm.
*
* Use this function if you want the result of the encoding
* to be placed in another array and cut down the number of
* copy operation that have to be performed in the process.
* This is the preffered method for encoding binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the data to be uuencoded.
* @param out the container for the uudecoded data.
*/
static void uuencode( const QByteArray& in, QByteArray& out );
/**
* Decodes the given data using the uuencode algorithm.
*
* Any 'begin' and 'end' lines like those generated by
* the utilities in unix and unix-like OS will be
* automatically ignored.
*
* @param in the data uuencoded data to be decoded.
* @return a decoded string.
*/
- static QCString uudecode( const QByteArray& in );
+ static Q3CString uudecode( const QByteArray& in );
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the string to be decoded.
* @return a uudecoded string.
*/
- static QCString uudecode( const QCString& str );
+ static Q3CString uudecode( const Q3CString& str );
/**
* Decodes the given data using the uudecode algorithm.
*
* Use this function if you want the result of the decoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is the preferred method for decoding binary data.
*
* Any 'begin' and 'end' lines like those generated by
* the utilities in unix and unix-like OS will be
* automatically ignored.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the uuencoded-data to be decoded.
* @param out the container for the uudecoded data.
*/
static void uudecode( const QByteArray& in, QByteArray& out );
/**
* Encodes the given data using the base64 algorithm.
*
* The boolean argument determines if the encoded data is
* going to be restricted to 76 characters or less per line
* as specified by RFC 2045. If @p insertLFs is true, then
* there will be 76 characters or less per line.
*
* @param in the data to be encoded.
* @param insertLFs limit the number of characters per line.
*
* @return a base64 encoded string.
*/
- static QCString base64Encode( const QByteArray& in, bool insertLFs = false);
+ static Q3CString base64Encode( const QByteArray& in, bool insertLFs = false);
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the string to be encoded.
* @param insertLFs limit the number of characters per line.
* @return the decoded string.
*/
- static QCString base64Encode( const QCString& str, bool insertLFs = false );
+ static Q3CString base64Encode( const Q3CString& str, bool insertLFs = false );
/**
* Encodes the given data using the base64 algorithm.
*
* Use this function if you want the result of the encoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for encoding binary data.
*
* The boolean argument determines if the encoded data is going
* to be restricted to 76 characters or less per line as specified
* by RFC 2045. If @p insertLFs is true, then there will be 76
* characters or less per line.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the data to be encoded using base64.
* @param out the container for the encoded data.
* @param insertLFs limit the number of characters per line.
*/
static void base64Encode( const QByteArray& in, QByteArray& out,
bool insertLFs = false );
/**
* Decodes the given data that was encoded using the
* base64 algorithm.
*
* @param in the base64-encoded data to be decoded.
* @return the decoded data.
*/
- static QCString base64Decode( const QByteArray& in );
+ static Q3CString base64Decode( const QByteArray& in );
/**
* @overload
*
* Same as the above functions except it accepts
* a null terminated string instead an array.
*
* @param str the base64-encoded string.
* @return the decoded string.
*/
- static QCString base64Decode( const QCString& str );
+ static Q3CString base64Decode( const Q3CString& str );
/**
* Decodes the given data that was encoded with the base64
* algorithm.
*
* Use this function if you want the result of the decoding
* to be placed in another array which cuts down the number
* of copy operation that have to be performed in the process.
* This is also the preferred method for decoding an encoded
* binary data.
*
* NOTE: the output array is first reset and then resized
* appropriately before use, hence, all data stored in the
* output array will be lost.
*
* @param in the encoded data to be decoded.
* @param out the container for the decoded data.
*/
static void base64Decode( const QByteArray& in, QByteArray& out );
private:
KCodecs();
@@ -410,142 +412,142 @@ public:
KMD5();
/**
* Constructor that updates the digest for the given string.
*
* @param in C string or binary data
* @param len if negative, calculates the length by using
* strlen on the first parameter, otherwise
* it trusts the given length (does not stop on NUL byte).
*/
KMD5(const char* in, int len = -1);
/**
* @overload
*
* Same as above except it accepts a QByteArray as its argument.
*/
KMD5(const QByteArray& a );
/**
* @overload
*
* Same as above except it accepts a QByteArray as its argument.
*/
- KMD5(const QCString& a );
+ KMD5(const Q3CString& a );
/**
* Updates the message to be digested. Be sure to add all data
* before you read the digest. After reading the digest, you
* can <b>not</b> add more data!
*
* @param in message to be added to digest
* @param len the length of the given message.
*/
void update(const char* in, int len = -1) { update(reinterpret_cast<const unsigned char*>(in), len); }
/**
* @overload
*/
void update(const unsigned char* in, int len = -1);
/**
* @overload
*
* @param in message to be added to the digest (QByteArray).
*/
void update(const QByteArray& in );
/**
* @overload
*
* @param in message to be added to the digest (QByteArray).
*/
- void update(const QCString& in );
+ void update(const Q3CString& in );
/**
* @overload
*
* reads the data from an I/O device, i.e. from a file (QFile).
*
* NOTE that the file must be open for reading.
*
* @param file a pointer to FILE as returned by calls like f{d,re}open
*
* @returns false if an error occured during reading.
*/
bool update(QIODevice& file);
/**
* Calling this function will reset the calculated message digest.
* Use this method to perform another message digest calculation
* without recreating the KMD5 object.
*/
void reset();
/**
* @return the raw representation of the digest
*/
const Digest& rawDigest ();
/**
* Fills the given array with the binary representation of the
* message digest.
*
* Use this method if you do not want to worry about making
* copy of the digest once you obtain it.
*
* @param bin an array of 16 characters ( char[16] )
*/
void rawDigest( KMD5::Digest& bin );
/**
* Returns the value of the calculated message digest in
* a hexadecimal representation.
*/
- QCString hexDigest ();
+ Q3CString hexDigest ();
/**
* @overload
*/
- void hexDigest(QCString&);
+ void hexDigest(Q3CString&);
/**
* Returns the value of the calculated message digest in
* a base64-encoded representation.
*/
- QCString base64Digest ();
+ Q3CString base64Digest ();
/**
* returns true if the calculated digest for the given
* message matches the given one.
*/
bool verify( const KMD5::Digest& digest);
/**
* @overload
*/
- bool verify(const QCString&);
+ bool verify(const Q3CString&);
protected:
/**
* Performs the real update work. Note
* that length is implied to be 64.
*/
void transform( const unsigned char buffer[64] );
/**
* finalizes the digest
*/
void finalize();
private:
KMD5(const KMD5& u);
KMD5& operator=(const KMD5& md);
void init();
void encode( unsigned char* output, Q_UINT32 *in, Q_UINT32 len );
void decode( Q_UINT32 *output, const unsigned char* in, Q_UINT32 len );
Q_UINT32 rotate_left( Q_UINT32 x, Q_UINT32 n );
Q_UINT32 F( Q_UINT32 x, Q_UINT32 y, Q_UINT32 z );
Q_UINT32 G( Q_UINT32 x, Q_UINT32 y, Q_UINT32 z );
diff --git a/microkde/kdecore/kprefs.cpp b/microkde/kdecore/kprefs.cpp
index 0220a34..d4010fa 100644
--- a/microkde/kdecore/kprefs.cpp
+++ b/microkde/kdecore/kprefs.cpp
@@ -1,47 +1,49 @@
/*
This file is part of KOrganizer.
Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#include <qcolor.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include <kconfig.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <kdebug.h>
#include "kprefs.h"
class KPrefsItemBool : public KPrefsItem {
public:
KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true);
virtual ~KPrefsItemBool() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
bool *mReference;
bool mDefault;
};
class KPrefsItemInt : public KPrefsItem {
public:
@@ -119,59 +121,59 @@ class KPrefsItemString : public KPrefsItem {
QString *mReference;
QString mDefault;
bool mPassword;
};
class KPrefsItemStringList : public KPrefsItem {
public:
KPrefsItemStringList(const QString &group,const QString &name,QStringList *,
const QStringList &defaultValue=QStringList());
virtual ~KPrefsItemStringList() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
QStringList *mReference;
QStringList mDefault;
};
class KPrefsItemIntList : public KPrefsItem {
public:
- KPrefsItemIntList(const QString &group,const QString &name,QValueList<int> *,
- const QValueList<int> &defaultValue=QValueList<int>());
+ KPrefsItemIntList(const QString &group,const QString &name,Q3ValueList<int> *,
+ const Q3ValueList<int> &defaultValue=Q3ValueList<int>());
virtual ~KPrefsItemIntList() {}
void setDefault();
void readConfig(KConfig *);
void writeConfig(KConfig *);
private:
- QValueList<int> *mReference;
- QValueList<int> mDefault;
+ Q3ValueList<int> *mReference;
+ Q3ValueList<int> mDefault;
};
KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name,
bool *reference,bool defaultValue) :
KPrefsItem(group,name)
{
mReference = reference;
mDefault = defaultValue;
}
void KPrefsItemBool::setDefault()
{
*mReference = mDefault;
}
void KPrefsItemBool::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemBool::readConfig(KConfig *config)
@@ -343,49 +345,49 @@ KPrefsItemStringList::KPrefsItemStringList(const QString &group,const QString &n
{
mReference = reference;
mDefault = defaultValue;
}
void KPrefsItemStringList::setDefault()
{
*mReference = mDefault;
}
void KPrefsItemStringList::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemStringList::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readListEntry(mName);
}
KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name,
- QValueList<int> *reference,const QValueList<int> &defaultValue) :
+ Q3ValueList<int> *reference,const Q3ValueList<int> &defaultValue) :
KPrefsItem(group,name)
{
mReference = reference;
mDefault = defaultValue;
}
void KPrefsItemIntList::setDefault()
{
*mReference = mDefault;
}
void KPrefsItemIntList::writeConfig(KConfig *config)
{
config->setGroup(mGroup);
config->writeEntry(mName,*mReference);
}
void KPrefsItemIntList::readConfig(KConfig *config)
{
config->setGroup(mGroup);
*mReference = config->readIntListEntry(mName);
}
@@ -484,29 +486,29 @@ void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaul
addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue));
}
void KPrefs::addItemSize(const QString &key,QSize *reference,const QSize &defaultValue)
{
addItem(new KPrefsItemSize(*mCurrentGroup,key,reference,defaultValue));
}
void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue)
{
addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,false));
}
void KPrefs::addItemPassword(const QString &key,QString *reference,const QString &defaultValue)
{
addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue,true));
}
void KPrefs::addItemStringList(const QString &key,QStringList *reference,
const QStringList &defaultValue)
{
addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue));
}
-void KPrefs::addItemIntList(const QString &key,QValueList<int> *reference,
- const QValueList<int> &defaultValue)
+void KPrefs::addItemIntList(const QString &key,Q3ValueList<int> *reference,
+ const Q3ValueList<int> &defaultValue)
{
addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue));
}
diff --git a/microkde/kdecore/kprefs.h b/microkde/kdecore/kprefs.h
index 95d2724..d9d1572 100644
--- a/microkde/kdecore/kprefs.h
+++ b/microkde/kdecore/kprefs.h
@@ -1,52 +1,54 @@
/*
This file is part of KOrganizer.
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _KPREFS_H
#define _KPREFS_H
// $Id$
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qcolor.h>
#include <qfont.h>
#include <qsize.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3ValueList>
class KConfig;
/**
@short Class for storing a preferences setting
@author Cornelius Schumacher
@see KPref
This class represents one preferences setting as used by @ref KPrefs.
Subclasses of KPrefsItem implement storage functions for a certain type of
setting. Normally you don't have to use this class directly. Use the special
addItem() functions of KPrefs instead. If you subclass this class you will
have to register instances with the function KPrefs::addItem().
*/
class KPrefsItem {
public:
/**
Constructor.
@param group Config file group.
@param name Config file key.
*/
KPrefsItem(const QString &group,const QString &name) :
mGroup(group),mName(name) {}
@@ -262,55 +264,55 @@ class KPrefs {
const QString &defaultValue="");
/**
Register an item of type QStringList.
@param key Key used in config file.
@param reference Pointer to the variable, which is set by readConfig()
and setDefaults() calls and read by writeConfig() calls.
@param defaultValue Default value, which is used by setDefaults() and
when the config file does not yet contain the key of
this item.
*/
void addItemStringList(const QString &key,QStringList *reference,
const QStringList &defaultValue=QStringList());
/**
Register an item of type QValueList<int>.
@param key Key used in config file.
@param reference Pointer to the variable, which is set by readConfig()
and setDefaults() calls and read by writeConfig() calls.
@param defaultValue Default value, which is used by setDefaults() and
when the config file does not yet contain the key of
this item.
*/
- void addItemIntList(const QString &key,QValueList<int> *reference,
- const QValueList<int> &defaultValue=QValueList<int>());
+ void addItemIntList(const QString &key,Q3ValueList<int> *reference,
+ const Q3ValueList<int> &defaultValue=Q3ValueList<int>());
protected:
/**
Implemented by subclasses that use special defaults.
*/
virtual void usrSetDefaults() {};
/**
Implemented by subclasses that read special config values.
*/
virtual void usrReadConfig() {};
/**
Implemented by subclasses that write special config values.
*/
virtual void usrWriteConfig() {};
/**
Return the @ref KConfig object used for reading and writing the settings.
*/
KConfig *config() const;
private:
static QString *mCurrentGroup;
KConfig *mConfig; // pointer to KConfig object
- QPtrList<KPrefsItem> mItems;
+ Q3PtrList<KPrefsItem> mItems;
};
#endif
diff --git a/microkde/kdecore/kshortcut.h b/microkde/kdecore/kshortcut.h
index 4813734..244d590 100644
--- a/microkde/kdecore/kshortcut.h
+++ b/microkde/kdecore/kshortcut.h
@@ -542,94 +542,94 @@ class KKey
class KShortcut
{
public:
/**
* The maximum number of key sequences that can be contained in
* a KShortcut.
*/
enum { MAX_SEQUENCES = 2 };
/**
* Creates a new null shortcut.
* @see null()
* @see isNull()
* @see clear()
*/
KShortcut() {}
/**
* Creates a new shortcut with the given Qt key code
* as the only key sequence.
* @param keyQt the qt keycode
* @see Qt::Key
*/
- KShortcut( int keyQt ) {}
+ KShortcut( int /*keyQt */) {}
/**
* Creates a new shortcut that contains only the given qt key
* sequence.
* @param keySeq the qt key sequence to add
*/
//US KShortcut( const QKeySequence& keySeq ) {}
/**
* Creates a new shortcut that contains only the given key
* in its only sequence.
* @param key the key to add
*/
//US KShortcut( const KKey& key );
/**
* Creates a new shortcut that contains only the given key
* sequence.
* @param keySeq the key sequence to add
*/
//US KShortcut( const KKeySequence& keySeq );
/**
* Copies the given shortcut.
* @param shortcut the shortcut to add
*/
//US KShortcut( const KShortcut& shortcut );
/**
* Creates a new key sequence that contains the given key sequence.
* The description consists of semicolon-separated keys as
* used in @ref KKeySequence::KKeySequence(const QString&).
* @param shortcut the description of the key
* @see KKeySequence::KKeySequence(const QString&)
*/
- KShortcut( const char* shortcut ) {}
+ KShortcut( const char* /*shortcut */) {}
/**
* Creates a new key sequence that contains the given key sequence.
* The description consists of semicolon-separated keys as
* used in @ref KKeySequence::KKeySequence(const QString&).
* @param shortcut the description of the key
* @see KKeySequence::KKeySequence(const QString&)
*/
- KShortcut( const QString& shortcut ) {}
+ KShortcut( const QString& /*shortcut */) {}
~KShortcut() {}
/**
* Clears the shortcut. The shortcut is null after calling this
* function.
* @see isNull()
*/
//US void clear();
/**
* Initializes the shortcut with the given Qt key code
* as the only key sequence.
* @param keyQt the qt keycode
* @see Qt::Key
*/
//US bool init( int keyQt );
/**
* Initializes the shortcut with the given qt key sequence.
* @param keySeq the qt key sequence to add
*/
//US bool init( const QKeySequence& keySeq );
/**
@@ -795,49 +795,49 @@ class KShortcut
* @return true if successful, false otherwise
* @see MAX_SEQUENCES
* @since 3.2
*/
//US bool append( const KShortcut& cut );
/**
* Converts this shortcut to a key sequence. The first key sequence
* will be taken.
*/
//US operator QKeySequence () const;
/**
* Returns a description of the shortcut as semicolon-separated
* ket sequences, as returned by @ref KKeySequence::toString().
* @return the string represenation of this shortcut
* @see KKey::toString()
* @see KKeySequence::toString()
*/
//US QString toString() const;
/**
* @internal
*/
- QString toStringInternal( const KShortcut* pcutDefault = 0 ) const
+ QString toStringInternal( const KShortcut* /*pcutDefault*/ = 0 ) const
{
return "EMPTY IMPL.";
}
/**
* Returns a null shortcut.
* @return the null shortcut
* @see isNull()
* @see clear()
*/
//US static KShortcut& null();
//US protected:
//US uint m_nSeqs;
//US KKeySequence m_rgseq[MAX_SEQUENCES];
//US private:
//US class KShortcutPrivate* d;
//US friend class KKeyNative;
//US#ifndef KDE_NO_COMPAT
//US public:
//US operator int () const { return keyCodeQt(); }
//US#endif
diff --git a/microkde/kdecore/kstandarddirs.cpp b/microkde/kdecore/kstandarddirs.cpp
index d5bfefd..f10934b 100644
--- a/microkde/kdecore/kstandarddirs.cpp
+++ b/microkde/kdecore/kstandarddirs.cpp
@@ -16,97 +16,99 @@
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
* Author: Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
* Version: $Id$
* Generated: Thu Mar 5 16:05:28 EST 1998
*/
//US #include "config.h"
#include <stdlib.h>
#include <assert.h>
//US#include <errno.h>
//US #ifdef HAVE_SYS_STAT_H
//US #include <sys/stat.h>
//US #endif
//US#include <sys/types.h>
//US#include <dirent.h>
//US#include <pwd.h>
#include <qregexp.h>
-#include <qasciidict.h>
-#include <qdict.h>
+#include <q3asciidict.h>
+#include <q3dict.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qstring.h>
#include <qmessagebox.h>
#include <qapplication.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3CString>
#include "kstandarddirs.h"
#include "kconfig.h"
#include "kdebug.h"
//US #include "kinstance.h"
#include "kshell.h"
//US#include <sys/param.h>
//US#include <unistd.h>
//US
QString KStandardDirs::mAppDir = QString::null;
-template class QDict<QStringList>;
+template class Q3Dict<QStringList>;
#if 0
-#include <qtextedit.h>
+#include <q3textedit.h>
void ddd( QString op )
{
- static QTextEdit * dot = 0;
+ static Q3TextEdit * dot = 0;
if ( ! dot )
- dot = new QTextEdit();
+ dot = new Q3TextEdit();
dot->show();
dot->append( op );
}
#endif
class KStandardDirs::KStandardDirsPrivate
{
public:
KStandardDirsPrivate()
: restrictionsActive(false),
dataRestrictionActive(false)
{ }
bool restrictionsActive;
bool dataRestrictionActive;
- QAsciiDict<bool> restrictions;
+ Q3AsciiDict<bool> restrictions;
QStringList xdgdata_prefixes;
QStringList xdgconf_prefixes;
};
static const char* const types[] = {"html", "icon", "apps", "sound",
"data", "locale", "services", "mime",
"servicetypes", "config", "exe", "tmp",
"wallpaper", "lib", "pixmap", "templates",
"module", "qtplugins",
"xdgdata-apps", "xdgdata-dirs", "xdgconf-menu", 0 };
static int tokenize( QStringList& token, const QString& str,
const QString& delim );
KStandardDirs::KStandardDirs( ) : addedCustoms(false)
{
d = new KStandardDirsPrivate;
dircache.setAutoDelete(true);
relatives.setAutoDelete(true);
absolutes.setAutoDelete(true);
savelocations.setAutoDelete(true);
addKDEDefaults();
}
@@ -424,86 +426,86 @@ static void lookupDirectory(const QString& path, const QString &relPart,
QString _dot(".");
QString _dotdot("..");
//US while( ( ep = readdir( dp ) ) != 0L )
QStringList direntries = dp.entryList();
QStringList::Iterator it = direntries.begin();
while ( it != list.end() ) // for each file...
{
//US QString fn( QFile::decodeName(ep->d_name));
QString fn = (*it); // dp.entryList already decodes
it++;
if ( fn.isNull() )
break;
if (fn == _dot || fn == _dotdot || fn.at(fn.length() - 1).latin1() == '~' )
continue;
/*US
if (!recursive && !regexp.exactMatch(fn))
continue; // No match
*/
//US this should do the same:
- int pos = regexp.match(fn);
+ int pos = regexp.exactMatch(fn);
if (!recursive && !pos == 0)
continue; // No match
QString pathfn = path + fn;
/*US
if ( stat( QFile::encodeName(pathfn), &buff ) != 0 ) {
kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl;
continue; // Couldn't stat (e.g. no read permissions)
}
if ( recursive )
{
if ( S_ISDIR( buff.st_mode )) {
lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq);
}
*/
//US replacement:
QFileInfo pathfnInfo(QFile::encodeName(pathfn));
if ( pathfnInfo.isReadable() == false )
{
//US kdDebug() << "Error stat'ing " << pathfn << " : " << perror << endl;
continue; // Couldn't stat (e.g. no read permissions)
}
if ( recursive )
{
if ( pathfnInfo.isDir()) {
lookupDirectory(pathfn + '/', relPart + fn + '/', regexp, list, relList, recursive, uniq);
}
/*US
if (!regexp.exactMatch(fn))
continue; // No match
*/
//US this should do the same:
- pos = regexp.match(fn);
+ pos = regexp.exactMatch(fn);
if (!pos == 0)
continue; // No match
}
//US if ( S_ISREG( buff.st_mode))
if ( pathfnInfo.isFile())
{
if (!uniq || !relList.contains(relPart + fn))
{
list.append( pathfn );
relList.append( relPart + fn );
}
}
}
//US closedir( dp );
}
else
{
// We look for a single file.
QString fn = pattern;
QString pathfn = path + fn;
//US struct stat buff;
QFileInfo pathfnInfo(QFile::encodeName(pathfn));
@@ -1087,49 +1089,49 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
{
QString dir = QDir::convertSeparators( dir2 );
#if 0
//LR
// we want an absolute path
if (dir.at(0) != '/')
return false;
QString target = dir;
uint len = target.length();
// append trailing slash if missing
if (dir.at(len - 1) != '/')
target += '/';
QString base("");
uint i = 1;
while( i < len )
{
//US struct stat st;
int pos = target.find('/', i);
base += target.mid(i - 1, pos - i + 1);
- QCString baseEncoded = QFile::encodeName(base);
+ Q3CString baseEncoded = QFile::encodeName(base);
// bail out if we encountered a problem
//US if (stat(baseEncoded, &st) != 0)
QFileInfo baseEncodedInfo(baseEncoded);
if (!baseEncodedInfo.exists())
{
// Directory does not exist....
// Or maybe a dangling symlink ?
//US if (lstat(baseEncoded, &st) == 0)
if (baseEncodedInfo.isSymLink()) {
//US (void)unlink(baseEncoded); // try removing
QFile(baseEncoded).remove();
}
//US if ( mkdir(baseEncoded, (mode_t) mode) != 0)
QDir dirObj;
if ( dirObj.mkdir(baseEncoded) != true )
{
//US perror("trying to create local folder");
return false; // Couldn't create it :-(
}
}
i = pos + 1;
}
return true;
@@ -1187,49 +1189,49 @@ bool KStandardDirs::makeDir(const QString& dir2, int mode)
}
*/
if (dirObj.exists(base) == false)
{
//qDebug("KStandardDirs::makeDir try to create : %s" , base.latin1());
if (dirObj.mkdir(base) != true)
{
qDebug("KStandardDirs::makeDir could not create: %s" , base.latin1());
return false;
}
}
i = pos + 1;
}
return true;
}
QString readEnvPath(const char *env)
{
//#ifdef _WIN32_
// return "";
//#else
- QCString c_path;
+ Q3CString c_path;
if ( getenv(env) != NULL )
c_path = QString ( getenv(env) );
if (c_path.isEmpty())
return QString::null;
return QFile::decodeName(c_path);
//#endif
}
void KStandardDirs::addKDEDefaults()
{
//qDebug("ERROR: KStandardDirs::addKDEDefaults() called ");
//return;
QStringList kdedirList;
// begin KDEDIRS
QString kdedirs = readEnvPath("MICROKDEDIRS");
if (!kdedirs.isEmpty())
{
tokenize(kdedirList, kdedirs, ":");
}
else
{
diff --git a/microkde/kdecore/kstandarddirs.h b/microkde/kdecore/kstandarddirs.h
index 901384e..f0e28fc 100644
--- a/microkde/kdecore/kstandarddirs.h
+++ b/microkde/kdecore/kstandarddirs.h
@@ -3,49 +3,49 @@
Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
Stephan Kulow <coolo@kde.org>
Waldo Bastian <bastian@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef SSK_KSTDDIRS_H
#define SSK_KSTDDIRS_H
#include <qstring.h>
-#include <qdict.h>
+#include <q3dict.h>
#include <qstringlist.h>
#include <kglobal.h>
class KConfig;
class KStandardDirsPrivate;
/**
* @short Site-independent access to standard KDE directories.
* @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
* @version $Id$
*
* This is one of the most central classes in kdelibs as
* it provides a basic service: It knows where the files
* reside on the user's hard disk. And it's meant to be the
* only one that knows -- to make the real location as
* transparent as possible to both the user and the applications.
*
* To this end it insulates the application from all information
* and applications always refer to a file with a resource type
* (e.g. icon) and a filename (e.g. khexdit.xpm). In an ideal world
* the application would make no assumption where this file is and
* leave it up to @ref KStandardDirs::findResource("apps", "Home.desktop")
* to apply this knowledge to return /opt/kde/share/applnk/Home.desktop
@@ -553,53 +553,53 @@ public:
* Faster than creating a QFileInfo first.
* @param fullPath the path to check
* @return true if the directory exists
*/
static bool exists(const QString &fullPath);
/**
* Expands all symbolic links and resolves references to
* '/./', '/../' and extra '/' characters in @p dirname
* and returns the canonicalized absolute pathname.
* The resulting path will have no symbolic link, '/./'
* or '/../' components.
* @since 3.1
*/
static QString realPath(const QString &dirname);
static void setAppDir( const QString & );
static QString appDir();
private:
QStringList prefixes;
// Directory dictionaries
- QDict<QStringList> absolutes;
- QDict<QStringList> relatives;
+ Q3Dict<QStringList> absolutes;
+ Q3Dict<QStringList> relatives;
- mutable QDict<QStringList> dircache;
- mutable QDict<QString> savelocations;
+ mutable Q3Dict<QStringList> dircache;
+ mutable Q3Dict<QString> savelocations;
// Disallow assignment and copy-construction
KStandardDirs( const KStandardDirs& );
KStandardDirs& operator= ( const KStandardDirs& );
bool addedCustoms;
class KStandardDirsPrivate;
KStandardDirsPrivate *d;
//US
static QString mAppDir;
void checkConfig() const;
void applyDataRestrictions(const QString &) const;
//US void createSpecialResource(const char*);
};
/**
* \addtogroup locates Locate Functions
* @{
* On The Usage Of 'locate' and 'locateLocal'
*
* Typical KDE applications use resource files in one out of
* three ways:
diff --git a/microkde/kdeui/kaction.cpp b/microkde/kdeui/kaction.cpp
index d38a6d5..c2df381 100644
--- a/microkde/kdeui/kaction.cpp
+++ b/microkde/kdeui/kaction.cpp
@@ -7,203 +7,206 @@
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2002 Joseph Wenninger <jowenn@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kaction.h"
#include <assert.h>
#include <qtooltip.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3ValueList>
//US#include <qwhatsthis.h>
//US#include <kaccel.h>
//US#include <kaccelbase.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kguiitem.h>
//US#include <kmainwindow.h>
//US#include <kmenubar.h>
//US#include <kpopupmenu.h>
#include <ktoolbar.h>
#include <ktoolbarbutton.h>
//US added this includefiles
#include <qmenubar.h>
-#include <qtoolbar.h>
-#include <qpopupmenu.h>
-#include <qiconset.h>
+#include <q3toolbar.h>
+#include <q3popupmenu.h>
+#include <qicon.h>
/**
* How it works.
* KActionCollection is an organizing container for KActions.
* KActionCollection keeps track of the information necessary to handle
* configuration and shortcuts.
*
* Focus Widget pointer:
* This is the widget which is the focus for action shortcuts.
* It is set either by passing a QWidget* to the KActionCollection constructor
* or by calling setWidget() if the widget wasn't known when the object was
* initially constructed (as in KXMLGUIClient and KParts::PartBase)
*
* Shortcuts:
* An action's shortcut will not not be connected unless a focus widget has
* been specified in KActionCollection.
*
* XML Filename:
* This is used to save user-modified settings back to the *ui.rc file.
* It is set by KXMLGUIFactory.
*/
int KAction::getToolButtonID()
{
static int toolbutton_no = -2;
return toolbutton_no--;
}
//---------------------------------------------------------------------
// KAction::KActionPrivate
//---------------------------------------------------------------------
class KAction::KActionPrivate : public KGuiItem
{
public:
KActionPrivate() : KGuiItem()
{
m_kaccel = 0;
m_configurable = true;
}
KAccel *m_kaccel;
- QValueList<KAccel*> m_kaccelList;
+ Q3ValueList<KAccel*> m_kaccelList;
QString m_groupText;
QString m_group;
KShortcut m_cut;
KShortcut m_cutDefault;
bool m_configurable;
struct Container
{
Container() { m_container = 0; m_representative = 0; m_id = 0; }
Container( const Container& s ) { m_container = s.m_container;
m_id = s.m_id; m_representative = s.m_representative; }
QWidget* m_container;
int m_id;
QWidget* m_representative;
};
- QValueList<Container> m_containers;
+ Q3ValueList<Container> m_containers;
};
//---------------------------------------------------------------------
// KAction
//---------------------------------------------------------------------
KAction::KAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
}
KAction::KAction( const QString& text, const QString& sIconName, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
d->setIconName( sIconName );
}
-KAction::KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+KAction::KAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
d->setIconSet( pix );
}
KAction::KAction( const KGuiItem& item, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name )
{
initPrivate( item.text(), cut, receiver, slot );
if( item.hasIconSet() )
setIcon( item.iconName() );
setToolTip( item.toolTip() );
setWhatsThis( item.whatsThis() );
}
// KDE 4: remove
KAction::KAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, 0, 0 );
}
KAction::KAction( const QString& text, const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
}
-KAction::KAction( const QString& text, const QIconSet& pix,
+KAction::KAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, 0, 0 );
setIconSet( pix );
}
KAction::KAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, 0, 0 );
d->setIconName( pix );
}
-KAction::KAction( const QString& text, const QIconSet& pix,
+KAction::KAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
setIconSet( pix );
}
KAction::KAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name )
: QObject( parent, name )
{
initPrivate( text, cut, receiver, slot );
d->setIconName(pix);
}
KAction::KAction( QObject* parent, const char* name )
: QObject( parent, name )
{
initPrivate( QString::null, KShortcut(), 0, 0 );
@@ -485,61 +488,61 @@ void KAction::removeKAccel( KAccel* kaccel )
//kdDebug(129) << "KAction::removeKAccel( " << i << " ): this = " << this << endl;
for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
if( d->m_kaccelList[i] == kaccel ) {
kaccel->remove( name() );
d->m_kaccelList.remove( d->m_kaccelList.at( i ) );
disconnect( kaccel, SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
break;
}
}
*/
}
// KDE 4: remove
void KAction::setAccel( int keyQt )
{
setShortcut( KShortcut(keyQt) );
}
// KDE 4: remove end
void KAction::updateShortcut( int i )
{
int id = itemId( i );
QWidget* w = container( i );
- if ( w->inherits( "QPopupMenu" ) ) {
- QPopupMenu* menu = static_cast<QPopupMenu*>(w);
+ if ( w->inherits( "Q3PopupMenu" ) ) {
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>(w);
updateShortcut( menu, id );
}
else if ( w->inherits( "QMenuBar" ) )
//US static_cast<QMenuBar*>(w)->setAccel( d->m_cut.keyCodeQt(), id );
//US (QMenuBar*)(w)->setAccel( d->m_cut.keyCodeQt(), id );
; //qDebug("KAction::updateShortcut( int i ) ...1 has top be fixed");
}
-void KAction::updateShortcut( QPopupMenu* menu, int id )
+void KAction::updateShortcut( Q3PopupMenu* menu, int id )
{
/*US
//kdDebug(129) << "KAction::updateShortcut(): this = " << this << " d->m_kaccelList.count() = " << d->m_kaccelList.count() << endl;
// If the action has a KAccel object,
// show the string representation of its shortcut.
if ( d->m_kaccel || d->m_kaccelList.count() ) {
QString s = menu->text( id );
int i = s.find( '\t' );
if ( i >= 0 )
s.replace( i+1, s.length()-i, d->m_cut.seq(0).toString() );
else
s += "\t" + d->m_cut.seq(0).toString();
menu->changeItem( id, s );
}
// Otherwise insert the shortcut itself into the popup menu.
else {
// This is a fall-hack in case the KAction is missing a proper parent collection.
// It should be removed eventually. --ellis
menu->setAccel( d->m_cut.keyCodeQt(), id );
kdWarning(129) << "KAction::updateShortcut(): name = \"" << name() << "\", cut = " << d->m_cut.toStringInternal() << "; No KAccel, probably missing a parent collection." << endl;
}
*/
@@ -600,76 +603,76 @@ bool KAction::isEnabled() const
}
bool KAction::isShortcutConfigurable() const
{
return d->m_configurable;
}
void KAction::setToolTip( const QString& tt )
{
//qDebug("KAction::setToolTip ...1 has top be fixed");
d->setToolTip( tt );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateToolTip( i );
}
void KAction::updateToolTip( int i )
{
//qDebug("KAction::updateToolTip ...1 has top be fixed");
QWidget *w = container( i );
if ( w->inherits( "KToolBar" ) )
QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
- else if ( w->inherits( "QToolBar" ) )
+ else if ( w->inherits( "Q3ToolBar" ) )
QToolTip::add( static_cast<KToolBar*>(w)->getWidget( itemId( i ) ), d->toolTip() );
}
QString KAction::toolTip() const
{
return d->toolTip();
}
int KAction::plug( QWidget *w, int index )
{
//kdDebug(129) << "KAction::plug( " << w << ", " << index << " )" << endl;
if (w == 0) {
kdWarning(129) << "KAction::plug called with 0 argument\n";
return -1;
}
// Check if action is permitted
//US if (kapp && !kapp->authorizeKAction(name()))
//US return -1;
plugShortcut();
- if ( w->inherits("QPopupMenu") )
+ if ( w->inherits("Q3PopupMenu") )
{
- QPopupMenu* menu = static_cast<QPopupMenu*>( w );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( w );
int id;
// Don't insert shortcut into menu if it's already in a KAccel object.
//qDebug("KAction::plug warning: real shortcuts not available yet. ");
//US int keyQt = (d->m_kaccelList.count() || d->m_kaccel) ? 0 : d->m_cut.keyCodeQt();
int keyQt = 0;
if ( d->hasIcon() )
{
/*US
KInstance *instance;
if ( m_parentCollection )
instance = m_parentCollection->instance();
else
instance = KGlobal::instance();
*/
id = menu->insertItem( d->iconSet( KIcon::Small, 0/*US , instance */), d->text(), this,//dsweet
SLOT( slotActivated() ), keyQt,
-1, index );
}
else
id = menu->insertItem( d->text(), this,
SLOT( slotActivated() ), //dsweet
keyQt, -1, index );
@@ -700,79 +703,79 @@ int KAction::plug( QWidget *w, int index )
int id_ = getToolButtonID();
/*US
KInstance *instance;
if ( m_parentCollection )
instance = m_parentCollection->instance();
else
instance = KGlobal::instance();
*/
if ( icon().isEmpty() && !iconSet().pixmap().isNull() ) // old code using QIconSet directly
{
bar->insertButton( iconSet().pixmap(), id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ),
d->isEnabled(), d->plainText(), index );
}
else
{
QString icon = d->iconName();
if ( icon.isEmpty() )
icon = "unknown";
bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ),
d->isEnabled(), d->plainText(), index/*US, instance*/ );
}
- bar->getButton( id_ )->setName( QCString("toolbutton_")+name() );
+ bar->getButton( id_ )->setName( Q3CString("toolbutton_")+name() );
//US if ( !d->whatsThis().isEmpty() )
//US QWhatsThis::add( bar->getButton(id_), whatsThisWithIcon() );
if ( !d->toolTip().isEmpty() )
QToolTip::add( bar->getButton(id_), d->toolTip() );
addContainer( bar, id_ );
connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
if ( m_parentCollection )
m_parentCollection->connectHighlight( bar, this );
return containerCount() - 1;
}
return -1;
}
void KAction::unplug( QWidget *w )
{
int i = findContainer( w );
if ( i == -1 )
return;
int id = itemId( i );
- if ( w->inherits( "QPopupMenu" ) )
+ if ( w->inherits( "Q3PopupMenu" ) )
{
- QPopupMenu *menu = static_cast<QPopupMenu *>( w );
+ Q3PopupMenu *menu = static_cast<Q3PopupMenu *>( w );
menu->removeItem( id );
}
else if ( w->inherits( "KToolBar" ) )
{
KToolBar *bar = static_cast<KToolBar *>( w );
bar->removeItemDelayed( id );
}
else if ( w->inherits( "QMenuBar" ) )
{
QMenuBar *bar = static_cast<QMenuBar *>( w );
bar->removeItem( id );
}
removeContainer( i );
if ( m_parentCollection )
m_parentCollection->disconnectHighlight( w, this );
}
void KAction::plugAccel(KAccel *kacc, bool configurable)
{
// qDebug("KAction::plugAccel ...1 has top be fixed");
/*US
@@ -841,254 +844,254 @@ void KAction::setEnabled(bool enable)
if ( enable == d->isEnabled() )
return;
// KDE 4: remove
//US if (d->m_kaccel)
//US d->m_kaccel->setEnabled(name(), enable);
// KDE 4: remove end
//US for ( uint i = 0; i < d->m_kaccelList.count(); i++ )
//US d->m_kaccelList[i]->setEnabled( name(), enable );
d->setEnabled( enable );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateEnabled( i );
emit enabled( d->isEnabled() );
}
void KAction::updateEnabled( int i )
{
QWidget *w = container( i );
- if ( w->inherits("QPopupMenu") )
- static_cast<QPopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
+ if ( w->inherits("Q3PopupMenu") )
+ static_cast<Q3PopupMenu*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
else if ( w->inherits("QMenuBar") )
static_cast<QMenuBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
else if ( w->inherits( "KToolBar" ) )
{
static_cast<KToolBar*>(w)->setItemEnabled( itemId( i ), d->isEnabled() );
}
}
void KAction::setShortcutConfigurable( bool b )
{
d->m_configurable = b;
}
void KAction::setText( const QString& text )
{
/*US
// KDE 4: remove
if (d->m_kaccel) {
KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name());
if (pAction)
pAction->setLabel( text );
}
// KDE 4: remove end
for( uint i = 0; i < d->m_kaccelList.count(); i++ ) {
KAccelAction* pAction = d->m_kaccelList[i]->actions().actionPtr(name());
if (pAction)
pAction->setLabel( text );
}
*/
d->setText( text );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateText( i );
}
void KAction::updateText( int i )
{
QWidget *w = container( i );
- if ( w->inherits( "QPopupMenu" ) ) {
+ if ( w->inherits( "Q3PopupMenu" ) ) {
int id = itemId( i );
- static_cast<QPopupMenu*>(w)->changeItem( id, d->text() );
- updateShortcut( static_cast<QPopupMenu*>(w), id );
+ static_cast<Q3PopupMenu*>(w)->changeItem( id, d->text() );
+ updateShortcut( static_cast<Q3PopupMenu*>(w), id );
}
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->changeItem( itemId( i ), d->text() );
else if ( w->inherits( "KToolBar" ) )
{
//qDebug("KAction::updateText ...3 has top be fixed");
QWidget *button = static_cast<KToolBar *>(w)->getWidget( itemId( i ) );
if ( button->inherits( "KToolBarButton" ) )
static_cast<KToolBarButton *>(button)->setText( d->plainText() );
}
}
QString KAction::text() const
{
return d->text();
}
QString KAction::plainText() const
{
return d->plainText( );
}
void KAction::setIcon( const QString &icon )
{
d->setIconName( icon );
// now handle any toolbars
int len = containerCount();
for ( int i = 0; i < len; ++i )
updateIcon( i );
}
void KAction::updateIcon( int id )
{
QWidget* w = container( id );
- if ( w->inherits( "QPopupMenu" ) ) {
+ if ( w->inherits( "Q3PopupMenu" ) ) {
int itemId_ = itemId( id );
- static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() );
- updateShortcut( static_cast<QPopupMenu*>(w), itemId_ );
+ static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet( KIcon::Small ), d->text() );
+ updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ );
}
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet( KIcon::Small ), d->text() );
else if ( w->inherits( "KToolBar" ) )
static_cast<KToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
- else if ( w->inherits( "QToolBar" ) )
+ else if ( w->inherits( "Q3ToolBar" ) )
{
qDebug("KAction::updateIcon has top be fixed");
//US static_cast<QToolBar *>(w)->setButtonIcon( itemId( id ), d->iconName() );
}
}
QString KAction::icon() const
{
return d->iconName( );
}
-void KAction::setIconSet( const QIconSet &iconset )
+void KAction::setIconSet( const QIcon &iconset )
{
d->setIconSet( iconset );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateIconSet( i );
}
void KAction::updateIconSet( int id )
{
QWidget *w = container( id );
- if ( w->inherits( "QPopupMenu" ) )
+ if ( w->inherits( "Q3PopupMenu" ) )
{
int itemId_ = itemId( id );
- static_cast<QPopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() );
- updateShortcut( static_cast<QPopupMenu*>(w), itemId_ );
+ static_cast<Q3PopupMenu*>(w)->changeItem( itemId_, d->iconSet(), d->text() );
+ updateShortcut( static_cast<Q3PopupMenu*>(w), itemId_ );
}
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->changeItem( itemId( id ), d->iconSet(), d->text() );
else if ( w->inherits( "KToolBar" ) )
{
if ( icon().isEmpty() && d->hasIconSet() ) // only if there is no named icon ( scales better )
static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet() );
else
static_cast<KToolBar *>(w)->setButtonIconSet( itemId( id ), d->iconSet( KIcon::Small ) );
}
}
-QIconSet KAction::iconSet( KIcon::Group group, int size ) const
+QIcon KAction::iconSet( KIcon::Group group, int size ) const
{
return d->iconSet( group, size );
}
bool KAction::hasIcon() const
{
return d->hasIcon();
}
void KAction::setWhatsThis( const QString& text )
{
d->setWhatsThis( text );
int len = containerCount();
for( int i = 0; i < len; ++i )
updateWhatsThis( i );
}
void KAction::updateWhatsThis( int i )
{
qDebug("KAction::updateWhatsThis ...1 has top be fixed");
- QPopupMenu* pm = popupMenu( i );
+ Q3PopupMenu* pm = popupMenu( i );
if ( pm )
{
pm->setWhatsThis( itemId( i ), d->whatsThis() );
return;
}
KToolBar *tb = toolBar( i );
if ( tb )
{
QWidget *w = tb->getButton( itemId( i ) );
//US QWhatsThis::remove( w );
//US QWhatsThis::add( w, d->whatsThis() );
return;
}
}
QString KAction::whatsThis() const
{
return d->whatsThis();
}
QString KAction::whatsThisWithIcon() const
{
QString text = whatsThis();
if (!d->iconName().isEmpty())
return QString::fromLatin1("<img source=\"small|%1\"> %2").arg(d->iconName() ).arg(text);
return text;
}
QWidget* KAction::container( int index ) const
{
assert( index < containerCount() );
return d->m_containers[ index ].m_container;
}
KToolBar* KAction::toolBar( int index ) const
{
//US return dynamic_cast<KToolBar *>( d->m_containers[ index ].m_container );
return (KToolBar *)( d->m_containers[ index ].m_container );
}
-QPopupMenu* KAction::popupMenu( int index ) const
+Q3PopupMenu* KAction::popupMenu( int index ) const
{
//US return dynamic_cast<QPopupMenu *>( d->m_containers[ index ].m_container );
- return (QPopupMenu *)( d->m_containers[ index ].m_container );
+ return (Q3PopupMenu *)( d->m_containers[ index ].m_container );
}
QWidget* KAction::representative( int index ) const
{
return d->m_containers[ index ].m_representative;
}
int KAction::itemId( int index ) const
{
return d->m_containers[ index ].m_id;
}
int KAction::containerCount() const
{
return d->m_containers.count();
}
uint KAction::kaccelCount() const
{
return d->m_kaccelList.count();
}
void KAction::addContainer( QWidget* c, int id )
{
@@ -1134,64 +1137,64 @@ void KAction::slotDestroyed()
for( uint i = 0; i < d->m_kaccelList.count(); i++ )
{
if ( o == d->m_kaccelList[i] )
{
disconnect( d->m_kaccelList[i], SIGNAL(destroyed()), this, SLOT(slotDestroyed()) );
d->m_kaccelList.remove( d->m_kaccelList.at( i ) );
return;
}
}
*/
int i;
do
{
i = findContainer( static_cast<const QWidget*>( o ) );
if ( i != -1 )
removeContainer( i );
} while ( i != -1 );
}
int KAction::findContainer( const QWidget* widget ) const
{
int pos = 0;
- QValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin();
+ Q3ValueList<KActionPrivate::Container>::ConstIterator it = d->m_containers.begin();
while( it != d->m_containers.end() )
{
if ( (*it).m_representative == widget || (*it).m_container == widget )
return pos;
++it;
++pos;
}
return -1;
}
void KAction::removeContainer( int index )
{
int i = 0;
- QValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin();
+ Q3ValueList<KActionPrivate::Container>::Iterator it = d->m_containers.begin();
while( it != d->m_containers.end() )
{
if ( i == index )
{
d->m_containers.remove( it );
return;
}
++it;
++i;
}
}
// FIXME: Remove this (ellis)
void KAction::slotKeycodeChanged()
{
qDebug("KAction::slotKeycodeChanged() ...44 has top be fixed");
/*US
kdDebug(129) << "KAction::slotKeycodeChanged()" << endl; // -- ellis
KAccelAction* pAction = d->m_kaccel->actions().actionPtr(name());
if( pAction )
setShortcut(pAction->shortcut());
*/
}
diff --git a/microkde/kdeui/kaction.h b/microkde/kdeui/kaction.h
index 13e2e1e..5c690ec 100644
--- a/microkde/kdeui/kaction.h
+++ b/microkde/kdeui/kaction.h
@@ -8,63 +8,65 @@
(C) 2002 Ellis Whitehead <ellis@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef __kaction_h__
#define __kaction_h__
//US #include <qkeysequence.h>
#include <qobject.h>
-#include <qvaluelist.h>
-#include <qguardedptr.h>
+#include <q3valuelist.h>
+#include <qpointer.h>
+//Added by qt3to4:
+#include <Q3PopupMenu>
#include <kguiitem.h>
#include <kshortcut.h>
#include <kstdaction.h>
//US#include <kicontheme.h>
//US added the following files
#include <kiconloader.h>
class QMenuBar;
-class QPopupMenu;
+class Q3PopupMenu;
//USclass QComboBox;
//USclass QPoint;
-class QIconSet;
+class QIcon;
class QString;
class KToolBar;
class KAccel;
//USclass KAccelActions;
//USclass KConfig;
//USclass KConfigBase;
//USclass KURL;
//USclass KInstance;
//USclass KToolBar;
class KActionCollection;
//USclass KPopupMenu;
class KMainWindow;
/**
* The KAction class (and derived and super classes) provides a way to
* easily encapsulate a "real" user-selected action or event in your
* program.
*
* For instance, a user may want to @p paste the contents of
* the clipboard or @p scroll @p down a document or @p quit the
* application. These are all @p actions -- events that the
* user causes to happen. The KAction class allows the developer to
* deal with these actions in an easy and intuitive manner.
@@ -238,108 +240,108 @@ public:
*/
KAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* Constructs an action with text, icon, potential keyboard
* shortcut, and a SLOT to call when this action is invoked by
* the user.
*
* If you do not want or have a keyboard shortcut, set the
* @p cut param to 0.
*
* This is the other common KAction used. Use it when you
* @p do have a corresponding icon.
*
* @param text The text that will be displayed.
* @param pix The icon to display.
* @param cut The corresponding keyboard shortcut.
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* Constructs an action with text, icon, potential keyboard
* shortcut, and a SLOT to call when this action is invoked by
* the user. The icon is loaded on demand later based on where it
* is plugged in.
*
* If you do not want or have a keyboard shortcut, set the
* @p cut param to 0.
*
* This is the other common KAction used. Use it when you
* @p do have a corresponding icon.
*
* @param text The text that will be displayed.
* @param pix The icon to display.
* @param cut The corresponding keyboard shortcut (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* The same as the above constructor, but with a KGuiItem providing
* the text and icon.
*
* @param item The KGuiItem with the label and (optional) icon.
*/
KAction( const KGuiItem& item, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
/**
* @obsolete
*/
KAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @obsolete
*/
KAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @obsolete
*/
- KAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @obsolete
*/
KAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @obsolete
*/
- KAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @obsolete
*/
KAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
/**
* @obsolete
*/
KAction( QObject* parent = 0, const char* name = 0 );
/**
* Standard destructor
*/
virtual ~KAction();
/**
* "Plug" or insert this action into a given widget.
*
* This will
* typically be a menu or a toolbar. From this point on, you will
* never need to directly manipulate the item in the menu or
* toolbar. You do all enabling/disabling/manipulation directly
@@ -440,52 +442,52 @@ public:
*/
virtual bool isEnabled() const;
/**
* Returns true if this action's shortcut is configurable.
*/
virtual bool isShortcutConfigurable() const;
virtual QString group() const;
/**
* Get the What's this text for the action.
*/
virtual QString whatsThis() const;
/**
* Get the tooltip text for the action.
*/
virtual QString toolTip() const;
/**
* Get the QIconSet from which the icons used to display this action will
* be chosen.
*/
- virtual QIconSet iconSet( KIcon::Group group, int size=0 ) const;
+ virtual QIcon iconSet( KIcon::Group group, int size=0 ) const;
#ifndef KDE_NO_COMPAT
- QIconSet iconSet() const
+ QIcon iconSet() const
{
return iconSet( KIcon::Small );
}
#endif
virtual QString icon() const;
KActionCollection *parentCollection() const;
/**
* @internal
* Generate a toolbar button id. Made public for reimplementations.
*/
static int getToolButtonID();
void unplugAll();
public slots:
/**
* Sets the text associated with this action. The text is used for menu
* and toolbar labels etc.
*/
virtual void setText(const QString &text);
@@ -497,86 +499,86 @@ public slots:
virtual void setGroup( const QString& );
/**
* Sets the What's this text for the action. This text will be displayed when
* a widget that has been created by plugging this action into a container
* is clicked on in What's this mode.
*
* The What's this text can include QML markup as well as raw text.
*/
virtual void setWhatsThis( const QString& text );
/**
* Sets the tooltip text for the action.
* This will be used as a tooltip for a toolbar button, as a
* statusbar help-text for a menu item, and it also appears
* in the toolbar editor, to describe the action.
*/
virtual void setToolTip( const QString& );
/**
* Sets the QIconSet from which the icons used to display this action will
* be chosen.
*/
- virtual void setIconSet( const QIconSet &iconSet );
+ virtual void setIconSet( const QIcon &iconSet );
virtual void setIcon( const QString& icon );
/**
* Enables or disables this action. All uses of this action (eg. in menus
* or toolbars) will be updated to reflect the state of the action.
*/
virtual void setEnabled(bool enable);
/**
* Indicate whether the user may configure the action's shortcut.
*/
virtual void setShortcutConfigurable( bool );
/**
* Emulate user's interaction programmatically, by activating the action.
* The implementation simply emits activated().
*/
virtual void activate();
protected slots:
virtual void slotDestroyed();
virtual void slotKeycodeChanged();
virtual void slotActivated();
protected:
KToolBar* toolBar( int index ) const;
- QPopupMenu* popupMenu( int index ) const;
+ Q3PopupMenu* popupMenu( int index ) const;
void removeContainer( int index );
int findContainer( const QWidget* widget ) const;
void plugMainWindowAccel( QWidget *w );
void addContainer( QWidget* parent, int id );
void addContainer( QWidget* parent, QWidget* representative );
virtual void updateShortcut( int i );
- virtual void updateShortcut( QPopupMenu* menu, int id );
+ virtual void updateShortcut( Q3PopupMenu* menu, int id );
virtual void updateGroup( int id );
virtual void updateText(int i );
virtual void updateEnabled(int i);
virtual void updateIconSet(int i);
virtual void updateIcon( int i);
virtual void updateToolTip( int id );
virtual void updateWhatsThis( int i );
KActionCollection *m_parentCollection;
QString whatsThisWithIcon() const;
signals:
void activated();
void enabled( bool );
private:
void initPrivate( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot );
KAccel* kaccelCurrent();
bool initShortcut( const KShortcut& );
void plugShortcut();
bool updateKAccelShortcut( KAccel* kaccel );
void insertKAccel( KAccel* );
/** @internal To be used exclusively by KActionCollection::removeWidget(). */
diff --git a/microkde/kdeui/kactionclasses.cpp b/microkde/kdeui/kactionclasses.cpp
index 82e6c8b..c611865 100644
--- a/microkde/kdeui/kactionclasses.cpp
+++ b/microkde/kdeui/kactionclasses.cpp
@@ -7,318 +7,319 @@
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2002 Joseph Wenninger <jowenn@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kactionclasses.h"
#include <assert.h>
#include <qfontdatabase.h>
-#include <qobjectlist.h>
+#include <qobject.h>
//US#include <qwhatsthis.h>
#include <qtimer.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//US#include <kaccel.h>
//US#include <kapplication.h>
#include <kconfig.h>
#include <kdebug.h>
//US#include <kfontcombo.h>
//US#include <kmainwindow.h>
//US#include <kmenubar.h>
//US#include <kpopupmenu.h>
#include <kcombobox.h>
#include <ktoolbar.h>
#include <ktoolbarbutton.h>
#include <kurl.h>
//US added the following includefiles
#include <kconfigbase.h>
#include <qwidget.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qmenubar.h>
-#include <qmainwindow.h>
-#include <qtoolbar.h>
+#include <q3mainwindow.h>
+#include <q3toolbar.h>
#include <qcombobox.h>
-#include <qmainwindow.h>
-
+#include <q3mainwindow.h>
+#include <qcoreapplication.h>
static QFontDatabase *fontDataBase = 0;
static void cleanupFontDatabase()
{
delete fontDataBase;
fontDataBase = 0;
}
static void get_fonts( QStringList &lst )
{
if ( !fontDataBase ) {
fontDataBase = new QFontDatabase();
qAddPostRoutine( cleanupFontDatabase );
}
lst.clear();
QStringList families = fontDataBase->families();
for ( QStringList::Iterator it = families.begin(); it != families.end(); ++it )
{
QString family = *it;
if ( family. contains('-') ) // remove foundry
family = family.right( family.length() - family.find('-' ) - 1);
if ( !lst.contains( family ) )
lst.append( family );
}
lst.sort();
}
-static QValueList<int> get_standard_font_sizes()
+static Q3ValueList<int> get_standard_font_sizes()
{
if ( !fontDataBase ) {
fontDataBase = new QFontDatabase();
qAddPostRoutine( cleanupFontDatabase );
}
return fontDataBase->standardSizes();
}
class KToggleAction::KToggleActionPrivate
{
public:
KToggleActionPrivate()
{
m_checked = false;
}
bool m_checked;
QString m_exclusiveGroup;
};
KToggleAction::KToggleAction( const QString& text, const KShortcut& cut,
QObject* parent,
const char* name )
: KAction( text, cut, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KAction( text, cut, receiver, slot, parent, name )
{
d = new KToggleActionPrivate;
}
-KToggleAction::KToggleAction( const QString& text, const QIconSet& pix,
+KToggleAction::KToggleAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KToggleActionPrivate;
}
-KToggleAction::KToggleAction( const QString& text, const QIconSet& pix,
+KToggleAction::KToggleAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::KToggleAction( QObject* parent, const char* name )
: KAction( parent, name )
{
d = new KToggleActionPrivate;
}
KToggleAction::~KToggleAction()
{
delete d;
}
int KToggleAction::plug( QWidget* widget, int index )
{
- if ( !widget->inherits("QPopupMenu") && !widget->inherits("KToolBar") )
+ if ( !widget->inherits("Q3PopupMenu") && !widget->inherits("KToolBar") )
{
kdWarning() << "Can not plug KToggleAction in " << widget->className() << endl;
return -1;
}
/*US
if (kapp && !kapp->authorizeKAction(name()))
return -1;
*/
int _index = KAction::plug( widget, index );
if ( _index == -1 )
return _index;
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
int id = itemId( _index );
- static_cast<QPopupMenu*>(widget)->setItemChecked( id, d->m_checked );
+ static_cast<Q3PopupMenu*>(widget)->setItemChecked( id, d->m_checked );
} else if ( widget->inherits( "KToolBar" ) ) {
KToolBar *bar = static_cast<KToolBar *>( widget );
bar->setToggle( itemId( _index ), true );
bar->setButton( itemId( _index ), isChecked() );
}
return _index;
}
void KToggleAction::setChecked( bool c )
{
if ( c == d->m_checked )
return;
//kdDebug(129) << "KToggleAction::setChecked(" << c << ") " << this << " " << name() << endl;
d->m_checked = c;
int len = containerCount();
for( int i = 0; i < len; ++i )
updateChecked( i );
if ( c && parent() && !exclusiveGroup().isEmpty() ) {
- const QObjectList *list = parent()->children();
- if ( list ) {
- QObjectListIt it( *list );
- for( ; it.current(); ++it ) {
- if ( it.current()->inherits( "KToggleAction" ) && it.current() != this &&
- static_cast<KToggleAction*>(it.current())->exclusiveGroup() == exclusiveGroup() ) {
- KToggleAction *a = static_cast<KToggleAction*>(it.current());
+ const QObjectList list = parent()->children();
+ if ( !list.empty() ) {
+ for(QObjectList::const_iterator it=list.begin();it!=list.end();++it) {
+ if ( (*it)->inherits( "KToggleAction" ) && (*it) != this &&
+ static_cast<KToggleAction*>((*it))->exclusiveGroup() == exclusiveGroup() ) {
+ KToggleAction *a = static_cast<KToggleAction*>(*it);
if( a->isChecked() ) {
a->setChecked( false );
emit a->toggled( false );
}
}
}
}
}
}
void KToggleAction::updateChecked( int id )
{
QWidget *w = container( id );
- if ( w->inherits( "QPopupMenu" ) )
- static_cast<QPopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked );
+ if ( w->inherits( "Q3PopupMenu" ) )
+ static_cast<Q3PopupMenu*>(w)->setItemChecked( itemId( id ), d->m_checked );
else if ( w->inherits( "QMenuBar" ) )
static_cast<QMenuBar*>(w)->setItemChecked( itemId( id ), d->m_checked );
else if ( w->inherits( "KToolBar" ) )
{
QWidget* r = static_cast<KToolBar*>( w )->getButton( itemId( id ) );
if ( r && r->inherits( "KToolBarButton" ) )
static_cast<KToolBar*>( w )->setButton( itemId( id ), d->m_checked );
}
}
void KToggleAction::slotActivated()
{
setChecked( !isChecked() );
emit activated();
emit toggled( isChecked() );
}
bool KToggleAction::isChecked() const
{
return d->m_checked;
}
void KToggleAction::setExclusiveGroup( const QString& name )
{
d->m_exclusiveGroup = name;
}
QString KToggleAction::exclusiveGroup() const
{
return d->m_exclusiveGroup;
}
KRadioAction::KRadioAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: KToggleAction( text, cut, parent, name )
{
}
KRadioAction::KRadioAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KToggleAction( text, cut, receiver, slot, parent, name )
{
}
-KRadioAction::KRadioAction( const QString& text, const QIconSet& pix,
+KRadioAction::KRadioAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, parent, name )
{
}
KRadioAction::KRadioAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, parent, name )
{
}
-KRadioAction::KRadioAction( const QString& text, const QIconSet& pix,
+KRadioAction::KRadioAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, receiver, slot, parent, name )
{
}
KRadioAction::KRadioAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KToggleAction( text, pix, cut, receiver, slot, parent, name )
{
}
KRadioAction::KRadioAction( QObject* parent, const char* name )
: KToggleAction( parent, name )
{
}
void KRadioAction::slotActivated()
{
if ( isChecked() )
{
@@ -328,185 +329,185 @@ void KRadioAction::slotActivated()
return;
qDebug("KRadioAction::slotActivated has to be fixed");
const_cast<KToolBarButton *>( static_cast<const KToolBarButton *>( senderObj ) )->on( true );
return;
}
KToggleAction::slotActivated();
}
class KSelectAction::KSelectActionPrivate
{
public:
KSelectActionPrivate()
{
m_edit = false;
m_menuAccelsEnabled = true;
m_menu = 0;
m_current = -1;
m_comboWidth = -1;
}
bool m_edit;
bool m_menuAccelsEnabled;
- QPopupMenu *m_menu;
+ Q3PopupMenu *m_menu;
int m_current;
int m_comboWidth;
QStringList m_list;
QString makeMenuText( const QString &_text )
{
if ( m_menuAccelsEnabled )
return _text;
QString text = _text;
uint i = 0;
while ( i < text.length() ) {
if ( text.at( i ) == '&' ) {
text.insert( i, '&' );
i += 2;
}
else
++i;
}
return text;
}
};
KSelectAction::KSelectAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, cut, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KAction( text, cut, receiver, slot, parent, name )
{
d = new KSelectActionPrivate;
}
-KSelectAction::KSelectAction( const QString& text, const QIconSet& pix,
+KSelectAction::KSelectAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KAction( text, pix, cut, parent, name )
{
d = new KSelectActionPrivate;
}
-KSelectAction::KSelectAction( const QString& text, const QIconSet& pix,
+KSelectAction::KSelectAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::KSelectAction( QObject* parent, const char* name )
: KAction( parent, name )
{
d = new KSelectActionPrivate;
}
KSelectAction::~KSelectAction()
{
assert(d);
delete d->m_menu;
delete d; d = 0;
}
void KSelectAction::setCurrentItem( int id )
{
if ( id >= (int)d->m_list.count() ) {
- ASSERT(id < (int)d->m_list.count());
+ Q_ASSERT(id < (int)d->m_list.count());
return;
}
if ( d->m_menu )
{
if ( d->m_current >= 0 )
d->m_menu->setItemChecked( d->m_current, false );
if ( id >= 0 )
{
//US qDebug("KSelectAction::setCurrentItem %i", id);
d->m_menu->setItemChecked( id, true );
}
}
d->m_current = id;
int len = containerCount();
for( int i = 0; i < len; ++i )
updateCurrentItem( i );
// emit KAction::activated();
// emit activated( currentItem() );
// emit activated( currentText() );
}
void KSelectAction::setComboWidth( int width )
{
if ( width < 0 )
return;
d->m_comboWidth=width;
int len = containerCount();
for( int i = 0; i < len; ++i )
updateComboWidth( i );
}
-QPopupMenu* KSelectAction::popupMenu() const
+Q3PopupMenu* KSelectAction::popupMenu() const
{
kdDebug(129) << "KSelectAction::popupMenu()" << endl; // remove -- ellis
if ( !d->m_menu )
{
//US d->m_menu = new KPopupMenu(0L, "KSelectAction::popupMenu()");
- d->m_menu = new QPopupMenu(0L, "QSelectAction::popupMenu()");
+ d->m_menu = new Q3PopupMenu(0L, "QSelectAction::popupMenu()");
setupMenu();
if ( d->m_current >= 0 )
d->m_menu->setItemChecked( d->m_current, true );
}
return d->m_menu;
}
void KSelectAction::setupMenu() const
{
if ( !d->m_menu )
return;
d->m_menu->clear();
QStringList::ConstIterator it = d->m_list.begin();
for( uint id = 0; it != d->m_list.end(); ++it, ++id ) {
QString text = *it;
if ( !text.isEmpty() )
d->m_menu->insertItem( d->makeMenuText( text ), this, SLOT( slotActivated( int ) ), 0, id );
else
d->m_menu->insertSeparator();
}
}
@@ -622,88 +623,88 @@ void KSelectAction::updateItems( int id )
QWidget* r = static_cast<KToolBar*>( w )->getWidget( itemId( id ) );
if ( r->inherits( "QComboBox" ) ) {
QComboBox *cb = static_cast<QComboBox*>( r );
cb->clear();
QStringList lst = comboItems();
QStringList::ConstIterator it = lst.begin();
for( ; it != lst.end(); ++it )
cb->insertItem( *it );
// Ok, this currently doesn't work due to a bug in QComboBox
// (the sizehint is cached for ever and never recalculated)
// Bug reported (against Qt 2.3.1).
cb->setMinimumWidth( cb->sizeHint().width() );
}
}
}
int KSelectAction::plug( QWidget *widget, int index )
{
//US if (kapp && !kapp->authorizeKAction(name()))
//US return -1;
kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
// Create the PopupMenu and store it in m_menu
(void)popupMenu();
- QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget );
int id;
if ( hasIconSet() )
id = menu->insertItem( iconSet(), text(), d->m_menu, -1, index );
else
id = menu->insertItem( text(), d->m_menu, -1, index );
if ( !isEnabled() )
menu->setItemEnabled( id, false );
QString wth = whatsThis();
if ( !wth.isEmpty() )
menu->setWhatsThis( id, wth );
addContainer( menu, id );
connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
else if ( widget->inherits("KToolBar") )
{
KToolBar* bar = static_cast<KToolBar*>( widget );
int id_ = KAction::getToolButtonID();
bar->insertCombo( comboItems(), id_, isEditable(),
SIGNAL( activated( const QString & ) ), this,
SLOT( slotActivated( const QString & ) ), isEnabled(),
toolTip(), -1, index );
KComboBox *cb = bar->getCombo( id_ );
if ( cb )
{
cb->setMaximumHeight( 34 );
- if (!isEditable()) cb->setFocusPolicy(QWidget::NoFocus);
+ if (!isEditable()) cb->setFocusPolicy(Qt::NoFocus);
cb->setMinimumWidth( cb->sizeHint().width() );
if ( d->m_comboWidth > 0 )
{
cb->setMinimumWidth( d->m_comboWidth );
cb->setMaximumWidth( d->m_comboWidth );
}
cb->setInsertionPolicy( QComboBox::NoInsertion );
//US QWhatsThis::add( cb, whatsThis() );
}
addContainer( bar, id_ );
connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
updateCurrentItem( containerCount() - 1 );
return containerCount() - 1;
}
kdWarning() << "Can not plug KAction in " << widget->className() << endl;
return -1;
}
QStringList KSelectAction::comboItems() const
@@ -831,65 +832,65 @@ public:
KListActionPrivate()
{
m_current = 0;
}
int m_current;
};
KListAction::KListAction( const QString& text, const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, cut, parent, name )
{
d = new KListActionPrivate;
}
KListAction::KListAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, cut, parent, name )
{
d = new KListActionPrivate;
if ( receiver )
connect( this, SIGNAL( activated( int ) ), receiver, slot );
}
-KListAction::KListAction( const QString& text, const QIconSet& pix,
+KListAction::KListAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
}
KListAction::KListAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
}
-KListAction::KListAction( const QString& text, const QIconSet& pix,
+KListAction::KListAction( const QString& text, const QIcon& pix,
const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
if ( receiver )
connect( this, SIGNAL( activated( int ) ), receiver, slot );
}
KListAction::KListAction( const QString& text, const QString& pix,
const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KListActionPrivate;
if ( receiver )
connect( this, SIGNAL( activated( int ) ), receiver, slot );
}
KListAction::KListAction( QObject* parent, const char* name )
: KSelectAction( parent, name )
{
@@ -944,75 +945,75 @@ KRecentFilesAction::KRecentFilesAction( const QString& text,
d->m_maxItems = maxItems;
init();
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
const KShortcut& cut,
const QObject* receiver,
const char* slot,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
if ( receiver )
connect( this, SIGNAL(urlSelected(const KURL&)),
receiver, slot );
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
- const QIconSet& pix,
+ const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, pix, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, pix, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
- const QIconSet& pix,
+ const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot,
QObject* parent, const char* name,
uint maxItems )
: KListAction( text, pix, cut, parent, name)
{
d = new KRecentFilesActionPrivate;
d->m_maxItems = maxItems;
init();
if ( receiver )
connect( this, SIGNAL(urlSelected(const KURL&)),
receiver, slot );
}
KRecentFilesAction::KRecentFilesAction( const QString& text,
const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot,
QObject* parent, const char* name,
uint maxItems )
@@ -1180,71 +1181,71 @@ public:
};
KFontAction::KFontAction( const QString& text,
const KShortcut& cut, QObject* parent,
const char* name )
: KSelectAction( text, cut, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
KFontAction::KFontAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, cut, receiver, slot, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
-KFontAction::KFontAction( const QString& text, const QIconSet& pix,
+KFontAction::KFontAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
KFontAction::KFontAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
-KFontAction::KFontAction( const QString& text, const QIconSet& pix,
+KFontAction::KFontAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
KFontAction::KFontAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
d = new KFontActionPrivate;
get_fonts( d->m_fonts );
KSelectAction::setItems( d->m_fonts );
setEditable( true );
}
@@ -1340,282 +1341,282 @@ class KFontSizeAction::KFontSizeActionPrivate
{
public:
KFontSizeActionPrivate()
{
}
};
KFontSizeAction::KFontSizeAction( const QString& text,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, cut, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( const QString& text,
const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name )
: KSelectAction( text, cut, receiver, slot, parent, name )
{
init();
}
-KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix,
+KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix,
const KShortcut& cut,
QObject* parent, const char* name )
: KSelectAction( text, pix, cut, parent, name )
{
init();
}
-KFontSizeAction::KFontSizeAction( const QString& text, const QIconSet& pix,
+KFontSizeAction::KFontSizeAction( const QString& text, const QIcon& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( const QString& text, const QString& pix,
const KShortcut& cut,
const QObject* receiver,
const char* slot, QObject* parent,
const char* name )
: KSelectAction( text, pix, cut, receiver, slot, parent, name )
{
init();
}
KFontSizeAction::KFontSizeAction( QObject* parent, const char* name )
: KSelectAction( parent, name )
{
init();
}
KFontSizeAction::~KFontSizeAction()
{
delete d;
d = 0;
}
void KFontSizeAction::init()
{
d = new KFontSizeActionPrivate;
setEditable( true );
- QValueList<int> sizes = get_standard_font_sizes();
+ Q3ValueList<int> sizes = get_standard_font_sizes();
QStringList lst;
- for ( QValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it )
+ for ( Q3ValueList<int>::Iterator it = sizes.begin(); it != sizes.end(); ++it )
lst.append( QString::number( *it ) );
setItems( lst );
}
void KFontSizeAction::setFontSize( int size )
{
if ( size == fontSize() ) {
setCurrentItem( items().findIndex( QString::number( size ) ) );
return;
}
if ( size < 1 ) {
kdWarning() << "KFontSizeAction: Size " << size << " is out of range" << endl;
return;
}
int index = items().findIndex( QString::number( size ) );
if ( index == -1 ) {
// Insert at the correct position in the list (to keep sorting)
- QValueList<int> lst;
+ Q3ValueList<int> lst;
// Convert to list of ints
QStringList itemsList = items();
for (QStringList::Iterator it = itemsList.begin() ; it != itemsList.end() ; ++it)
lst.append( (*it).toInt() );
// New size
lst.append( size );
// Sort the list
qDebug("KFontSizeAction::setFontSize heapsort not found.");
//US has to be fixed
//US qHeapSort( lst );
// Convert back to string list
QStringList strLst;
- for (QValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it)
+ for (Q3ValueList<int>::Iterator it = lst.begin() ; it != lst.end() ; ++it)
strLst.append( QString::number(*it) );
KSelectAction::setItems( strLst );
// Find new current item
index = lst.findIndex( size );
setCurrentItem( index );
}
else
setCurrentItem( index );
//emit KAction::activated();
//emit activated( index );
//emit activated( QString::number( size ) );
//emit fontSizeChanged( size );
}
int KFontSizeAction::fontSize() const
{
return currentText().toInt();
}
void KFontSizeAction::slotActivated( int index )
{
KSelectAction::slotActivated( index );
emit fontSizeChanged( items()[ index ].toInt() );
}
void KFontSizeAction::slotActivated( const QString& size )
{
setFontSize( size.toInt() ); // insert sorted first
KSelectAction::slotActivated( size );
emit fontSizeChanged( size.toInt() );
}
class KActionMenu::KActionMenuPrivate
{
public:
KActionMenuPrivate()
{
//US m_popup = new KPopupMenu(0L,"KActionMenu::KActionMenuPrivate");
- m_popup = new QPopupMenu(0L,"KActionMenu::KActionMenuPrivate");
+ m_popup = new Q3PopupMenu(0L,"KActionMenu::KActionMenuPrivate");
m_delayed = true;
m_stickyMenu = true;
}
~KActionMenuPrivate()
{
delete m_popup; m_popup = 0;
}
//US KPopupMenu *m_popup;
- QPopupMenu *m_popup;
+ Q3PopupMenu *m_popup;
bool m_delayed;
bool m_stickyMenu;
};
KActionMenu::KActionMenu( QObject* parent, const char* name )
: KAction( parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
KActionMenu::KActionMenu( const QString& text, QObject* parent,
const char* name )
: KAction( text, 0, parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
-KActionMenu::KActionMenu( const QString& text, const QIconSet& icon,
+KActionMenu::KActionMenu( const QString& text, const QIcon& icon,
QObject* parent, const char* name )
: KAction( text, icon, 0, parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
KActionMenu::KActionMenu( const QString& text, const QString& icon,
QObject* parent, const char* name )
: KAction( text, icon, 0, parent, name )
{
d = new KActionMenuPrivate;
setShortcutConfigurable( false );
}
KActionMenu::~KActionMenu()
{
unplugAll();
kdDebug(129) << "KActionMenu::~KActionMenu()" << endl; // ellis
delete d; d = 0;
}
void KActionMenu::popup( const QPoint& global )
{
popupMenu()->popup( global );
}
//US KPopupMenu* KActionMenu::popupMenu() const
-QPopupMenu* KActionMenu::popupMenu() const
+Q3PopupMenu* KActionMenu::popupMenu() const
{
return d->m_popup;
}
void KActionMenu::insert( KAction* cmd, int index )
{
if ( cmd )
cmd->plug( d->m_popup, index );
}
void KActionMenu::remove( KAction* cmd )
{
if ( cmd )
cmd->unplug( d->m_popup );
}
bool KActionMenu::delayed() const {
return d->m_delayed;
}
void KActionMenu::setDelayed(bool _delayed) {
d->m_delayed = _delayed;
}
bool KActionMenu::stickyMenu() const {
return d->m_stickyMenu;
}
void KActionMenu::setStickyMenu(bool sticky) {
d->m_stickyMenu = sticky;
}
int KActionMenu::plug( QWidget* widget, int index )
{
/*US
if (kapp && !kapp->authorizeKAction(name()))
return -1;
*/
kdDebug(129) << "KAction::plug( " << widget << ", " << index << " )" << endl; // remove -- ellis
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
- QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget );
int id;
if ( hasIconSet() )
id = menu->insertItem( iconSet(), text(), d->m_popup, -1, index );
else
id = menu->insertItem( text(), d->m_popup, -1, index );
if ( !isEnabled() )
menu->setItemEnabled( id, false );
addContainer( menu, id );
connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
if ( m_parentCollection )
m_parentCollection->connectHighlight( menu, this );
return containerCount() - 1;
}
else if ( widget->inherits( "KToolBar" ) )
{
KToolBar *bar = static_cast<KToolBar *>( widget );
int id_ = KAction::getToolButtonID();
if ( icon().isEmpty() && !iconSet().isNull() )
@@ -1760,54 +1761,54 @@ int KToolBarPopupAction::plug( QWidget *widget, int index )
SLOT( slotActivated() ), isEnabled(), plainText(),
index/*US, instance*/ );
addContainer( bar, id_ );
connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
if (delayed()) {
bar->setDelayedPopup( id_, popupMenu(), stickyMenu() );
} else {
bar->getButton(id_)->setPopup(popupMenu(), stickyMenu());
}
/*US
if ( !whatsThis().isEmpty() )
QWhatsThis::add( bar->getButton( id_ ), whatsThisWithIcon() );
*/
return containerCount() - 1;
}
return KAction::plug( widget, index );
}
//US KPopupMenu *KToolBarPopupAction::popupMenu() const
-QPopupMenu *KToolBarPopupAction::popupMenu() const
+Q3PopupMenu *KToolBarPopupAction::popupMenu() const
{
if ( !m_popup ) {
KToolBarPopupAction *that = const_cast<KToolBarPopupAction*>(this);
//US that->m_popup = new KPopupMenu;
- that->m_popup = new QPopupMenu;
+ that->m_popup = new Q3PopupMenu;
}
return m_popup;
}
////////
KToggleToolBarAction::KToggleToolBarAction( const char* toolBarName,
const QString& text, KActionCollection* parent, const char* name )
: KToggleAction( text, KShortcut(), parent, name )
, m_toolBarName( toolBarName )
, m_toolBar( 0L )
{
}
KToggleToolBarAction::KToggleToolBarAction( KToolBar *toolBar, const QString &text,
KActionCollection *parent, const char *name )
: KToggleAction( text, KShortcut(), parent, name )
, m_toolBarName( 0 )
, m_toolBar( toolBar )
{
}
KToggleToolBarAction::~KToggleToolBarAction()
{
@@ -1932,72 +1933,72 @@ int KWidgetAction::plug( QWidget* w, int index )
connect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) );
connect( toolBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
void KWidgetAction::unplug( QWidget *w )
{
if( !m_widget || !isPlugged() )
return;
KToolBar* toolBar = (KToolBar*)m_widget->parent();
if ( toolBar == w )
{
disconnect( toolBar, SIGNAL( toolbarDestroyed() ), this, SLOT( slotToolbarDestroyed() ) );
m_widget->reparent( 0L, QPoint(), false ); // false = showit
}
KAction::unplug( w );
}
void KWidgetAction::slotToolbarDestroyed()
{
//Q_ASSERT( m_widget ); // When exiting the app the widget could be destroyed before the toolbar.
- ASSERT( isPlugged() );
+ Q_ASSERT( isPlugged() );
if( !m_widget || !isPlugged() )
return;
// Don't let a toolbar being destroyed, delete my widget.
m_widget->reparent( 0L, QPoint(), false /*showIt*/ );
}
////////
KActionSeparator::KActionSeparator( QObject *parent, const char *name )
: KAction( parent, name )
{
}
KActionSeparator::~KActionSeparator()
{
}
int KActionSeparator::plug( QWidget *widget, int index )
{
- if ( widget->inherits("QPopupMenu") )
+ if ( widget->inherits("Q3PopupMenu") )
{
- QPopupMenu* menu = static_cast<QPopupMenu*>( widget );
+ Q3PopupMenu* menu = static_cast<Q3PopupMenu*>( widget );
int id = menu->insertSeparator( index );
addContainer( menu, id );
connect( menu, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
else if ( widget->inherits( "QMenuBar" ) )
{
QMenuBar *menuBar = static_cast<QMenuBar *>( widget );
int id = menuBar->insertSeparator( index );
addContainer( menuBar, id );
connect( menuBar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );
return containerCount() - 1;
}
else if ( widget->inherits( "KToolBar" ) )
{
KToolBar *toolBar = static_cast<KToolBar *>( widget );
diff --git a/microkde/kdeui/kactionclasses.h b/microkde/kdeui/kactionclasses.h
index f6e7a0f..a9b9104 100644
--- a/microkde/kdeui/kactionclasses.h
+++ b/microkde/kdeui/kactionclasses.h
@@ -13,69 +13,72 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef __kactionclasses_h__
#define __kactionclasses_h__
#include <kaction.h>
//US#include <qkeysequence.h>
//US#include <qobject.h>
//US#include <qvaluelist.h>
//US#include <qguardedptr.h>
//US#include <kguiitem.h>
#include <kshortcut.h>
+//Added by qt3to4:
+#include <Q3CString>
+#include <Q3PopupMenu>
//US#include <kstdaction.h>
//US#include <kicontheme.h>
class QMenuBar;
-class QPopupMenu;
+class Q3PopupMenu;
//USclass QComboBox;
//USclass QPoint;
//USclass QIconSet;
//USclass QString;
//USclass KToolBar;
//USclass KAccel;
//USclass KAccelActions;
class KConfig;
//USclass KConfigBase;
class KURL;
//USclass KInstance;
//US class KToolBar needs to be replaced
-class KToolBar;
+#include "ktoolbar.h"
class KActionCollection;
//US class KPopupMenu needs to be replaced
//US class KPopupMenu;
//USclass KMainWindow;
/**
* Checkbox like action.
*
* This action provides two states: checked or not.
*
* @short Checkbox like action.
*/
class KToggleAction : public KAction
{
Q_OBJECT
Q_PROPERTY( bool checked READ isChecked WRITE setChecked )
Q_PROPERTY( QString exclusiveGroup READ exclusiveGroup WRITE setExclusiveGroup )
public:
/**
* Constructs a toggle action with text and potential keyboard
* accelerator but nothing else. Use this only if you really
* know what you are doing.
@@ -84,71 +87,71 @@ public:
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KToggleAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KToggleAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToggleAction( QObject* parent = 0, const char* name = 0 );
/**
* Destructor
*/
@@ -225,71 +228,71 @@ public:
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KRadioAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KRadioAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KRadioAction( QObject* parent = 0, const char* name = 0 );
protected:
virtual void slotActivated();
@@ -331,71 +334,71 @@ public:
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KSelectAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KSelectAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KSelectAction( QObject* parent = 0, const char* name = 0 );
/**
* Destructor
*/
@@ -417,49 +420,49 @@ public:
/**
* When this action is plugged into a toolbar, it creates a combobox.
* @return true if the combo editable.
*/
virtual bool isEditable() const;
/**
* @return the items that can be selected with this action.
* Use setItems to set them.
*/
virtual QStringList items() const;
virtual void changeItem( int index, const QString& text );
virtual QString currentText() const;
virtual int currentItem() const;
/**
* When this action is plugged into a toolbar, it creates a combobox.
* This returns the maximum width set by setComboWidth
*/
virtual int comboWidth() const;
- QPopupMenu* popupMenu() const;
+ Q3PopupMenu* popupMenu() const;
/**
* Deprecated. See @ref setMenuAccelsEnabled .
* @since 3.1
*/
void setRemoveAmpersandsInCombo( bool b );
/// @since 3.1
bool removeAmpersandsInCombo() const;
/**
* Sets whether any occurence of the ampersand character ( &amp; ) in items
* should be interpreted as keyboard accelerator for items displayed in a
* menu or not.
* @since 3.1
*/
void setMenuAccelsEnabled( bool b );
/// @since 3.1
bool menuAccelsEnabled() const;
public slots:
/**
* Sets the currently checked item.
*
* @param index Index of the item (remember the first item is zero).
@@ -546,71 +549,71 @@ public:
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KListAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
- KListAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KListAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KListAction( QObject* parent = 0, const char* name = 0 );
/**
* Destructor
@@ -664,76 +667,76 @@ public:
/**
* @param text The text that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke when a URL is selected.
* Its signature is of the form slotURLSelected( const KURL & ).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
- KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The icons that go with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke when a URL is selected.
* Its signature is of the form slotURLSelected( const KURL & ).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
- KRecentFilesAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KRecentFilesAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param text The text that will be displayed.
* @param pix The dynamically loaded icon that goes with this action.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's parent.
* @param slot The SLOT to invoke when a URL is selected.
* Its signature is of the form slotURLSelected( const KURL & ).
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
*/
KRecentFilesAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0,
uint maxItems = 10 );
/**
* @param parent This action's parent.
* @param name An internal name for this action.
* @param maxItems The maximum number of files to display
@@ -813,92 +816,92 @@ protected slots:
/**
*
*/
void itemSelected( const QString& string );
protected:
virtual void virtual_hook( int id, void* data );
private:
void init();
class KRecentFilesActionPrivate;
KRecentFilesActionPrivate *d;
};
class KFontAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY( QString font READ font WRITE setFont )
public:
KFontAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
const char* name = 0 );
KFontAction( const QString& text, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
- KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
KFontAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
- KFontAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KFontAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
KFontAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot, QObject* parent,
const char* name = 0 );
KFontAction( QObject* parent = 0, const char* name = 0 );
~KFontAction();
QString font() const {
return currentText();
}
int plug( QWidget*, int index = -1 );
public slots:
void setFont( const QString &family );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KFontActionPrivate;
KFontActionPrivate *d;
};
class KFontSizeAction : public KSelectAction
{
Q_OBJECT
Q_PROPERTY( int fontSize READ fontSize WRITE setFontSize )
public:
KFontSizeAction( const QString& text, const KShortcut& cut = KShortcut(), QObject* parent = 0,
const char* name = 0 );
KFontSizeAction( const QString& text, const KShortcut& cut, const QObject* receiver,
const char* slot, QObject* parent, const char* name = 0 );
- KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut = KShortcut(),
+ KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut = KShortcut(),
QObject* parent = 0, const char* name = 0 );
- KFontSizeAction( const QString& text, const QIconSet& pix, const KShortcut& cut,
+ KFontSizeAction( const QString& text, const QIcon& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
KFontSizeAction( const QString& text, const QString& pix, const KShortcut& cut,
const QObject* receiver, const char* slot,
QObject* parent, const char* name = 0 );
KFontSizeAction( QObject* parent = 0, const char* name = 0 );
virtual ~KFontSizeAction();
virtual int fontSize() const;
public slots:
virtual void setFontSize( int size );
protected slots:
virtual void slotActivated( int );
virtual void slotActivated( const QString& );
virtual void slotActivated() { KAction::slotActivated(); }
signals:
void fontSizeChanged( int );
private:
void init();
@@ -910,60 +913,60 @@ private:
class KFontSizeActionPrivate;
KFontSizeActionPrivate *d;
};
/**
* A KActionMenu is an action that holds a sub-menu of other actions.
* insert() and remove() allow to insert and remove actions into this action-menu.
* Plugged in a popupmenu, it will create a submenu.
* Plugged in a toolbar, it will create a button with a popup menu.
*
* This is the action used by the XMLGUI since it holds other actions.
* If you want a submenu for selecting one tool among many (without icons), see KSelectAction.
* See also setDelayed about the main action.
*/
class KActionMenu : public KAction
{
Q_OBJECT
Q_PROPERTY( bool delayed READ delayed WRITE setDelayed )
Q_PROPERTY( bool stickyMenu READ stickyMenu WRITE setStickyMenu )
public:
KActionMenu( const QString& text, QObject* parent = 0,
const char* name = 0 );
- KActionMenu( const QString& text, const QIconSet& icon,
+ KActionMenu( const QString& text, const QIcon& icon,
QObject* parent = 0, const char* name = 0 );
KActionMenu( const QString& text, const QString& icon,
QObject* parent = 0, const char* name = 0 );
KActionMenu( QObject* parent = 0, const char* name = 0 );
virtual ~KActionMenu();
virtual void insert( KAction*, int index = -1 );
virtual void remove( KAction* );
//US KPopupMenu* popupMenu() const;
- QPopupMenu* popupMenu() const;
+ Q3PopupMenu* popupMenu() const;
void popup( const QPoint& global );
/**
* Returns true if this action creates a delayed popup menu
* when plugged in a KToolbar.
*/
bool delayed() const;
/**
* If set to true, this action will create a delayed popup menu
* when plugged in a KToolbar. Otherwise it creates a normal popup.
* Default: delayed
*
* Remember that if the "main" action (the toolbar button itself)
* cannot be clicked, then you should call setDelayed(false).
*
* On the opposite, if the main action can be clicked, it can only happen
* in a toolbar: in a menu, the parent of a submenu can't be activated.
* To get a "normal" menu item when plugged a menu (and no submenu)
* use KToolBarPopupAction.
*/
void setDelayed(bool _delayed);
/**
* Returns true if this action creates a sticky popup menu.
@@ -1046,177 +1049,177 @@ public:
* @p cut param to 0.
*
* @param item The text and icon that will be displayed.
* @param cut The corresponding keyboard accelerator (shortcut).
* @param receiver The SLOT's owner.
* @param slot The SLOT to invoke to execute this action.
* @param parent This action's parent.
* @param name An internal name for this action.
*/
KToolBarPopupAction( const KGuiItem& item, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
virtual ~KToolBarPopupAction();
virtual int plug( QWidget *widget, int index = -1 );
/**
* The popup menu that is shown when clicking (some time) on the toolbar
* button. You may want to plug items into it on creation, or connect to
* aboutToShow for a more dynamic menu.
*/
//US KPopupMenu *popupMenu() const;
- QPopupMenu *popupMenu() const;
+ Q3PopupMenu *popupMenu() const;
/**
* Returns true if this action creates a delayed popup menu
* when plugged in a KToolbar.
*/
bool delayed() const;
/**
* If set to true, this action will create a delayed popup menu
* when plugged in a KToolbar. Otherwise it creates a normal popup.
* Default: delayed.
*/
void setDelayed(bool delayed);
/**
* Returns true if this action creates a sticky popup menu.
* See @ref setStickyMenu.
*/
bool stickyMenu() const;
/**
* If set to true, this action will create a sticky popup menu
* when plugged in a KToolbar.
* "Sticky", means it's visible until a selection is made or the mouse is
* clicked elsewhere. This feature allows you to make a selection without
* having to press and hold down the mouse while making a selection.
* Only available if delayed() is true.
* Default: sticky.
*/
void setStickyMenu(bool sticky);
private:
//US KPopupMenu *m_popup;
- QPopupMenu *m_popup;
+ Q3PopupMenu *m_popup;
bool m_delayed:1;
bool m_stickyMenu:1;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KToolBarPopupActionPrivate;
KToolBarPopupActionPrivate *d;
};
/**
* An action that takes care of everything associated with
* showing or hiding a toolbar by a menu action. It will
* show or hide the toolbar with the given name when
* activated, and check or uncheck itself if the toolbar
* is manually shown or hidden.
*
* If you need to perfom some additional action when the
* toolbar is shown or hidden, connect to the toggled(bool)
* signal. It will be emitted after the toolbar's
* visibility has changed, whenever it changes.
* @since 3.1
*/
class KToggleToolBarAction : public KToggleAction
{
Q_OBJECT
public:
/**
* Create a KToggleToolbarAction that manages the toolbar
* named toolBarName. This can be either the name of a
* toolbar in an xml ui file, or a toolbar programmatically
* created with that name.
*/
KToggleToolBarAction( const char* toolBarName, const QString& text,
KActionCollection* parent, const char* name );
KToggleToolBarAction( KToolBar *toolBar, const QString &text,
KActionCollection *parent, const char *name );
virtual ~KToggleToolBarAction();
virtual int plug( QWidget*, int index = -1 );
KToolBar *toolBar() {
return m_toolBar;
}
public slots:
virtual void setChecked( bool );
private:
- QCString m_toolBarName;
- QGuardedPtr<KToolBar> m_toolBar;
+ Q3CString m_toolBarName;
+ QPointer<KToolBar> m_toolBar;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KToggleToolBarActionPrivate;
KToggleToolBarActionPrivate *d;
};
/**
* An action that automatically embeds a widget into a
* toolbar.
*/
class KWidgetAction : public KAction
{
Q_OBJECT
public:
/**
* Create an action that will embed widget into a toolbar
* when plugged. This action may only be plugged into
* a toolbar.
*/
KWidgetAction( QWidget* widget, const QString& text,
const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name );
virtual ~KWidgetAction();
/**
* Returns the widget associated with this action.
*/
QWidget* widget() { return m_widget; }
void setAutoSized( bool );
/**
* Plug the action. The widget passed to the constructor
* will be reparented to w, which must inherit KToolBar.
*/
virtual int plug( QWidget* w, int index = -1 );
/**
* Unplug the action. Ensures that the action is not
* destroyed. It will be hidden and reparented to 0L instead.
*/
virtual void unplug( QWidget *w );
protected slots:
void slotToolbarDestroyed();
private:
- QGuardedPtr<QWidget> m_widget;
+ QPointer<QWidget> m_widget;
bool m_autoSized;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KWidgetActionPrivate;
KWidgetActionPrivate *d;
};
class KActionSeparator : public KAction
{
Q_OBJECT
public:
KActionSeparator( QObject* parent = 0, const char* name = 0 );
virtual ~KActionSeparator();
virtual int plug( QWidget*, int index = -1 );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KActionSeparatorPrivate;
KActionSeparatorPrivate *d;
};
diff --git a/microkde/kdeui/kactioncollection.cpp b/microkde/kdeui/kactioncollection.cpp
index 69e5d02..4d66c7f 100644
--- a/microkde/kdeui/kactioncollection.cpp
+++ b/microkde/kdeui/kactioncollection.cpp
@@ -5,96 +5,98 @@
(C) 2000 Kurt Granroth <granroth@kde.org>
(C) 2000 Michael Koch <koch@kde.org>
(C) 2001 Holger Freyther <freyther@kde.org>
(C) 2002 Ellis Whitehead <ellis@kde.org>
(C) 2002 Joseph Wenninger <jowenn@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kactioncollection.h"
//US#include "kactionshortcutlist.h"
-#include <qptrdict.h>
+#include <q3ptrdict.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//US#include <qvariant.h>
//US#include <kaccel.h>
//US#include <kaccelbase.h>
//US#include <kapplication.h>
#include <kdebug.h>
//US#include <kxmlguifactory.h>
//US I included the following files
-#include <qasciidict.h>
-#include <qptrlist.h>
+#include <q3asciidict.h>
+#include <q3ptrlist.h>
#include "kaction.h"
#include <kglobal.h>
#include <qobject.h>
#include <qwidget.h>
class KActionCollection::KActionCollectionPrivate
{
public:
KActionCollectionPrivate()
{
//US m_instance = 0;
//m_bOneKAccelOnly = false;
//m_iWidgetCurrent = 0;
m_bAutoConnectShortcuts = true;
m_widget = 0;
m_kaccel = m_builderKAccel = 0;
m_dctHighlightContainers.setAutoDelete( true );
m_highlight = false;
m_currentHighlightAction = 0;
m_statusCleared = true;
}
//US KInstance *m_instance;
//US QString m_sXMLFile;
bool m_bAutoConnectShortcuts;
//bool m_bOneKAccelOnly;
//int m_iWidgetCurrent;
//QValueList<QWidget*> m_widgetList;
//QValueList<KAccel*> m_kaccelList;
- QValueList<KActionCollection*> m_docList;
+ Q3ValueList<KActionCollection*> m_docList;
QWidget *m_widget;
KAccel *m_kaccel;
KAccel *m_builderKAccel;
- QAsciiDict<KAction> m_actionDict;
- QPtrDict< QPtrList<KAction> > m_dctHighlightContainers;
+ Q3AsciiDict<KAction> m_actionDict;
+ Q3PtrDict< Q3PtrList<KAction> > m_dctHighlightContainers;
bool m_highlight;
KAction *m_currentHighlightAction;
bool m_statusCleared;
};
KActionCollection::KActionCollection( QWidget *parent, const char *name /*US,
KInstance *instance */)
: QObject( (QObject*)parent, name )
{
kdDebug(129) << "KActionCollection::KActionCollection( " << parent << ", " << name << " ): this = " << this << endl; // ellis
d = new KActionCollectionPrivate;
if( parent )
setWidget( parent );
//d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
//US setInstance( instance );
}
KActionCollection::KActionCollection( QWidget *watch, QObject* parent, const char *name /*US,
KInstance *instance */)
: QObject( parent, name )
{
kdDebug(129) << "KActionCollection::KActionCollection( " << watch << ", " << parent << ", " << name << " ): this = " << this << endl; //ellis
d = new KActionCollectionPrivate;
@@ -112,49 +114,49 @@ KActionCollection::KActionCollection( QObject *parent, const char *name /*US,
kdWarning(129) << "KActionCollection::KActionCollection( QObject *parent, const char *name, KInstance *instance )" << endl; //ellis
//US kdBacktrace not available
//US kdDebug(129) << kdBacktrace() << endl;
d = new KActionCollectionPrivate;
//US QWidget* w = dynamic_cast<QWidget*>( parent );
QWidget* w = (QWidget*)( parent );
if( w )
setWidget( w );
//d->m_bOneKAccelOnly = (d->m_kaccelList.count() > 0);
//US setInstance( instance );
}
KActionCollection::KActionCollection( const KActionCollection &copy )
: QObject()
{
kdWarning(129) << "KActionCollection::KActionCollection( const KActionCollection & ): function is severely deprecated." << endl;
d = new KActionCollectionPrivate;
*this = copy;
}
// KDE 4: remove end
KActionCollection::~KActionCollection()
{
kdDebug(129) << "KActionCollection::~KActionCollection(): this = " << this << endl;
- for ( QAsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) {
+ for ( Q3AsciiDictIterator<KAction> it( d->m_actionDict ); it.current(); ++it ) {
KAction* pAction = it.current();
if ( pAction->m_parentCollection == this )
pAction->m_parentCollection = 0L;
}
//US delete d->m_kaccel;
//US delete d->m_builderKAccel;
delete d; d = 0;
}
void KActionCollection::setWidget( QWidget* w )
{
//if ( d->m_actionDict.count() > 0 ) {
// kdError(129) << "KActionCollection::setWidget(): must be called before any actions are added to collection!" << endl;
// kdDebug(129) << kdBacktrace() << endl;
//}
//else
if ( !d->m_widget ) {
d->m_widget = w;
//qDebug("KActionCollection::setWidget: warning: KAccel is never used in microkde");
//US d->m_kaccel = new KAccel( w, this, "KActionCollection-KAccel" );
}
else if ( d->m_widget != w )
;
@@ -344,142 +346,142 @@ void KActionCollection::_remove( KAction* action )
{
delete _take( action );
}
KAction* KActionCollection::_take( KAction* action )
{
char unnamed_name[100];
const char *name = action->name();
if( qstrcmp( name, "unnamed" ) == 0 )
{
sprintf(unnamed_name, "unnamed-%p", (void *) action);
name = unnamed_name;
}
KAction *a = d->m_actionDict.take( name );
if ( !a || a != action )
return 0;
emit removed( action );
return a;
}
void KActionCollection::_clear()
{
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
while ( it.current() )
_remove( it.current() );
}
void KActionCollection::insert( KAction* action ) { _insert( action ); }
void KActionCollection::remove( KAction* action ) { _remove( action ); }
KAction* KActionCollection::take( KAction* action ) { return _take( action ); }
void KActionCollection::clear() { _clear(); }
KAccel* KActionCollection::accel() { return kaccel(); }
const KAccel* KActionCollection::accel() const { return kaccel(); }
KAccel* KActionCollection::builderKAccel() const { return d->m_builderKAccel; }
KAction* KActionCollection::action( const char* name, const char* classname ) const
{
KAction* pAction = 0;
if ( !classname && name )
pAction = d->m_actionDict[ name ];
else {
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
{
if ( ( !name || strcmp( it.current()->name(), name ) == 0 ) &&
( !classname || strcmp( it.current()->className(), classname ) == 0 ) ) {
pAction = it.current();
break;
}
}
}
if( !pAction ) {
for( uint i = 0; i < d->m_docList.count() && !pAction; i++ )
pAction = d->m_docList[i]->action( name, classname );
}
return pAction;
}
KAction* KActionCollection::action( int index ) const
{
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
it += index;
return it.current();
// return d->m_actions.at( index );
}
/*US
bool KActionCollection::readShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig )
{
return KActionShortcutList(this).readSettings( sConfigGroup, pConfig );
}
bool KActionCollection::writeShortcutSettings( const QString& sConfigGroup, KConfigBase* pConfig ) const
{
return KActionShortcutList((KActionCollection*)this).writeSettings( sConfigGroup, pConfig );
}
*/
uint KActionCollection::count() const
{
return d->m_actionDict.count();
}
QStringList KActionCollection::groups() const
{
QStringList lst;
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
if ( !it.current()->group().isEmpty() && !lst.contains( it.current()->group() ) )
lst.append( it.current()->group() );
return lst;
}
KActionPtrList KActionCollection::actions( const QString& group ) const
{
KActionPtrList lst;
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
if ( it.current()->group() == group )
lst.append( it.current() );
else if ( it.current()->group().isEmpty() && group.isEmpty() )
lst.append( it.current() );
return lst;
}
KActionPtrList KActionCollection::actions() const
{
KActionPtrList lst;
- QAsciiDictIterator<KAction> it( d->m_actionDict );
+ Q3AsciiDictIterator<KAction> it( d->m_actionDict );
for( ; it.current(); ++it )
lst.append( it.current() );
return lst;
}
/*US we have no instance object. Use KGlobal instead
void KActionCollection::setInstance( KInstance *instance )
{
if ( instance )
d->m_instance = instance;
qDebug("KActionCollection::setInstance has to be fixed");
else
d->m_instance = KGlobal::instance();
}
KInstance *KActionCollection::instance() const
{
return d->m_instance;
}
*/
/*US we have no XML facility in microkde
void KActionCollection::setXMLFile( const QString& sXMLFile )
@@ -487,83 +489,83 @@ void KActionCollection::setXMLFile( const QString& sXMLFile )
d->m_sXMLFile = sXMLFile;
}
const QString& KActionCollection::xmlFile() const
{
return d->m_sXMLFile;
}
*/
void KActionCollection::setHighlightingEnabled( bool enable )
{
d->m_highlight = enable;
}
bool KActionCollection::highlightingEnabled() const
{
return d->m_highlight;
}
void KActionCollection::connectHighlight( QWidget *container, KAction *action )
{
if ( !d->m_highlight )
return;
- QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
+ Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
if ( !actionList )
{
- actionList = new QPtrList<KAction>;
+ actionList = new Q3PtrList<KAction>;
- if ( container->inherits( "QPopupMenu" ) )
+ if ( container->inherits( "Q3PopupMenu" ) )
{
connect( container, SIGNAL( highlighted( int ) ),
this, SLOT( slotMenuItemHighlighted( int ) ) );
connect( container, SIGNAL( aboutToHide() ),
this, SLOT( slotMenuAboutToHide() ) );
}
//US else if ( container->inherits( "KToolBar" ) )
- else if ( container->inherits( "QToolBar" ) )
+ else if ( container->inherits( "Q3ToolBar" ) )
{
connect( container, SIGNAL( highlighted( int, bool ) ),
this, SLOT( slotToolBarButtonHighlighted( int, bool ) ) );
}
connect( container, SIGNAL( destroyed() ),
this, SLOT( slotDestroyed() ) );
d->m_dctHighlightContainers.insert( container, actionList );
}
actionList->append( action );
}
void KActionCollection::disconnectHighlight( QWidget *container, KAction *action )
{
if ( !d->m_highlight )
return;
- QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
+ Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ container ];
if ( !actionList )
return;
actionList->removeRef( action );
if ( actionList->count() == 0 )
d->m_dctHighlightContainers.remove( container );
}
void KActionCollection::slotMenuItemHighlighted( int id )
{
if ( !d->m_highlight )
return;
if ( d->m_currentHighlightAction )
emit actionHighlighted( d->m_currentHighlightAction, false );
QWidget *container = static_cast<QWidget *>( const_cast<QObject *>( sender() ) );
d->m_currentHighlightAction = findAction( container, id );
if ( !d->m_currentHighlightAction )
{
@@ -604,94 +606,94 @@ void KActionCollection::slotToolBarButtonHighlighted( int id, bool highlight )
d->m_currentHighlightAction = 0;
// use tooltip groups for toolbar status text stuff instead (Simon)
// emit clearStatusText();
return;
}
emit actionHighlighted( action, highlight );
if ( highlight )
d->m_currentHighlightAction = action;
else
{
d->m_currentHighlightAction = 0;
// emit clearStatusText();
}
}
void KActionCollection::slotDestroyed()
{
d->m_dctHighlightContainers.remove( reinterpret_cast<void *>( const_cast<QObject *>(sender()) ) );
}
KAction *KActionCollection::findAction( QWidget *container, int id )
{
- QPtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ];
+ Q3PtrList<KAction> *actionList = d->m_dctHighlightContainers[ reinterpret_cast<void *>( container ) ];
if ( !actionList )
return 0;
- QPtrListIterator<KAction> it( *actionList );
+ Q3PtrListIterator<KAction> it( *actionList );
for (; it.current(); ++it )
if ( it.current()->isPlugged( container, id ) )
return it.current();
return 0;
}
// KDE 4: remove
KActionCollection KActionCollection::operator+(const KActionCollection &c ) const
{
kdWarning(129) << "KActionCollection::operator+(): function is severely deprecated." << endl;
KActionCollection ret( *this );
- QValueList<KAction *> actions = c.actions();
- QValueList<KAction *>::ConstIterator it = actions.begin();
- QValueList<KAction *>::ConstIterator end = actions.end();
+ Q3ValueList<KAction *> actions = c.actions();
+ Q3ValueList<KAction *>::ConstIterator it = actions.begin();
+ Q3ValueList<KAction *>::ConstIterator end = actions.end();
for (; it != end; ++it )
ret.insert( *it );
return ret;
}
KActionCollection &KActionCollection::operator=( const KActionCollection &copy )
{
kdWarning(129) << "KActionCollection::operator=(): function is severely deprecated." << endl;
//d->m_bOneKAccelOnly = copy.d->m_bOneKAccelOnly;
//d->m_iWidgetCurrent = copy.d->m_iWidgetCurrent;
//d->m_widgetList = copy.d->m_widgetList;
//d->m_kaccelList = copy.d->m_kaccelList;
d->m_widget = copy.d->m_widget;
d->m_kaccel = copy.d->m_kaccel;
d->m_actionDict = copy.d->m_actionDict;
//US setInstance( copy.instance() );
return *this;
}
KActionCollection &KActionCollection::operator+=( const KActionCollection &c )
{
kdWarning(129) << "KActionCollection::operator+=(): function is severely deprecated." << endl;
- QAsciiDictIterator<KAction> it(c.d->m_actionDict);
+ Q3AsciiDictIterator<KAction> it(c.d->m_actionDict);
for ( ; it.current(); ++it )
insert( it.current() );
return *this;
}
// KDE 4: remove end
//---------------------------------------------------------------------
// KActionShortcutList
//---------------------------------------------------------------------
/*US
KActionShortcutList::KActionShortcutList( KActionCollection* pColl )
: m_actions( *pColl )
{ }
KActionShortcutList::~KActionShortcutList()
{ }
uint KActionShortcutList::count() const
{ return m_actions.count(); }
QString KActionShortcutList::name( uint i ) const
{ return m_actions.action(i)->name(); }
QString KActionShortcutList::label( uint i ) const
{ return m_actions.action(i)->text(); }
QString KActionShortcutList::whatsThis( uint i ) const
{ return m_actions.action(i)->whatsThis(); }
diff --git a/microkde/kdeui/kactioncollection.h b/microkde/kdeui/kactioncollection.h
index b9466d0..50cb02a 100644
--- a/microkde/kdeui/kactioncollection.h
+++ b/microkde/kdeui/kactioncollection.h
@@ -9,79 +9,81 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//$Id$
#ifndef __kactioncollection_h__
#define __kactioncollection_h__
#include <kaction.h>
//US #include <qkeysequence.h>
#include <qobject.h>
+//Added by qt3to4:
+#include <Q3ValueList>
//US#include <qvaluelist.h>
//US#include <qguardedptr.h>
//US #include <kguiitem.h>
//US#include <kshortcut.h>
//US#include <kstdaction.h>
//US#include <kicontheme.h>
//USclass QMenuBar;
//USclass QPopupMenu;
//USclass QComboBox;
//USclass QPoint;
//USclass QIconSet;
//USclass QString;
//USclass KToolBar;
//USclass KAccel;
//USclass KAccelActions;
//USclass KConfig;
//USclass KConfigBase;
//USclass KURL;
//USclass KInstance;
//USclass KToolBar;
//USclass KActionCollection;
//USclass KPopupMenu;
//USclass KMainWindow;
//US added inclidefiles
class QWidget;
-typedef QValueList<KAction *> KActionPtrList;
+typedef Q3ValueList<KAction *> KActionPtrList;
/**
* A managed set of KAction objects.
*/
class KActionCollection : public QObject
{
friend class KAction;
friend class KXMLGUIClient;
Q_OBJECT
public:
KActionCollection( QWidget *parent, const char *name = 0/*US , KInstance *instance = 0 */);
/**
* Use this constructor if you want the collection's actions to restrict
* their accelerator keys to @p watch rather than the @p parent. If
* you don't require shortcuts, you can pass a null to the @p watch parameter.
*/
KActionCollection( QWidget *watch, QObject* parent, const char *name = 0/*US, KInstance *instance = 0 */);
KActionCollection( const KActionCollection &copy );
virtual ~KActionCollection();
/**
* This sets the widget to which the keyboard shortcuts should be attached.
* You only need to call this if a null pointer was passed in the constructor.
diff --git a/microkde/kdeui/kbuttonbox.cpp b/microkde/kdeui/kbuttonbox.cpp
index 83d622a..3ea6703 100644
--- a/microkde/kdeui/kbuttonbox.cpp
+++ b/microkde/kdeui/kbuttonbox.cpp
@@ -28,73 +28,75 @@
* 03/08/2000 Mario Weilguni <mweilguni@kde.org>
* Removed all those long outdated Motif stuff
* Improved and clarified some if conditions (easier to understand)
*
* 11/13/98 Reginald Stadlbauer <reggie@kde.org>
* Now in Qt 1.4x motif default buttons have no extra width/height anymore.
* So the KButtonBox doesn't add this width/height to default buttons anymore
* which makes the buttons look better.
*
* 01/17/98 Mario Weilguni <mweilguni@sime.com>
* Fixed a bug in sizeHint()
* Improved the handling of Motif default buttons
*
* 01/09/98 Mario Weilguni <mweilguni@sime.com>
* The last button was to far right away from the right/bottom border.
* Fixed this. Removed old code. Buttons get now a minimum width.
* Programmer may now override minimum width and height of a button.
*
*/
//US #include "kbuttonbox.moc"
#include <kbuttonbox.h>
#include <qpushbutton.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QResizeEvent>
#include <assert.h>
#define minButtonWidth 50
class KButtonBox::Item {
public:
QPushButton *button;
bool noexpand;
unsigned short stretch;
unsigned short actual_size;
};
-template class QPtrList<KButtonBox::Item>;
+template class Q3PtrList<KButtonBox::Item>;
class KButtonBoxPrivate {
public:
unsigned short border;
unsigned short autoborder;
unsigned short orientation;
bool activated;
- QPtrList<KButtonBox::Item> buttons;
+ Q3PtrList<KButtonBox::Item> buttons;
};
-KButtonBox::KButtonBox(QWidget *parent, Orientation _orientation,
+KButtonBox::KButtonBox(QWidget *parent, Qt::Orientation _orientation,
int border, int autoborder)
: QWidget(parent)
{
data = new KButtonBoxPrivate;
assert(data != 0);
data->orientation = _orientation;
data->border = border;
data->autoborder = autoborder < 0 ? border : autoborder;
data->buttons.setAutoDelete(TRUE);
}
KButtonBox::~KButtonBox() {
delete data;
}
QPushButton *KButtonBox::addButton(const QString& text, bool noexpand) {
Item *item = new Item;
item->button = new QPushButton(text, this);
item->noexpand = noexpand;
data->buttons.append(item);
item->button->adjustSize();
@@ -128,49 +130,49 @@ void KButtonBox::addStretch(int scale) {
}
}
void KButtonBox::layout() {
// resize all buttons
QSize bs = bestButtonSize();
for(unsigned int i = 0; i < data->buttons.count(); i++) {
Item *item = data->buttons.at(i);
QPushButton *b = item->button;
if(b != 0) {
if(item->noexpand)
b->setFixedSize(buttonSizeHint(b));
else
b->setFixedSize(bs);
}
}
setMinimumSize(sizeHint());
}
void KButtonBox::placeButtons() {
unsigned int i;
- if(data->orientation == Horizontal) {
+ if(data->orientation == Qt::Horizontal) {
// calculate free size and stretches
int fs = width() - 2 * data->border;
int stretch = 0;
for(i = 0; i < data->buttons.count(); i++) {
Item *item = data->buttons.at(i);
if(item->button != 0) {
fs -= item->button->width();
// Last button?
if(i != data->buttons.count() - 1)
fs -= data->autoborder;
} else
stretch +=item->stretch;
}
// distribute buttons
int x_pos = data->border;
for(i = 0; i < data->buttons.count(); i++) {
Item *item = data->buttons.at(i);
if(item->button != 0) {
QPushButton *b = item->button;
b->move(x_pos, (height() - b->height()) / 2);
x_pos += b->width() + data->autoborder;
@@ -230,68 +232,68 @@ QSize KButtonBox::bestButtonSize() const {
return s;
}
QSize KButtonBox::sizeHint() const {
unsigned int i, dw;
if(data->buttons.count() == 0)
return QSize(0, 0);
else {
dw = 2 * data->border;
QSize bs = bestButtonSize();
for(i = 0; i < data->buttons.count(); i++) {
KButtonBox *that = (KButtonBox*)this;
Item *item = that->data->buttons.at(i);
QPushButton *b = item->button;
if(b != 0) {
QSize s;
if(item->noexpand)
s = that->buttonSizeHint(b);
else
s = bs;
- if(data->orientation == Horizontal)
+ if(data->orientation == Qt::Horizontal)
dw += s.width();
else
dw += s.height();
if( i != data->buttons.count() - 1 )
dw += data->autoborder;
}
}
- if(data->orientation == Horizontal)
+ if(data->orientation == Qt::Horizontal)
return QSize(dw, bs.height() + 2 * data->border);
else
return QSize(bs.width() + 2 * data->border, dw);
}
}
QSizePolicy KButtonBox::sizePolicy() const
{
- return data->orientation == Horizontal?
+ return data->orientation == Qt::Horizontal?
QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) :
QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum );
}
/*
* Returns the best size for a button. If a button is less than
* minButtonWidth pixels wide, return minButtonWidth pixels
* as minimum width
*/
QSize KButtonBox::buttonSizeHint(QPushButton *b) const {
QSize s = b->sizeHint();
QSize ms = b->minimumSize();
if(s.width() < minButtonWidth)
s.setWidth(minButtonWidth);
// allows the programmer to override the settings
if(ms.width() > s.width())
s.setWidth(ms.width());
if(ms.height() > s.height())
s.setHeight(ms.height());
return s;
}
diff --git a/microkde/kdeui/kbuttonbox.h b/microkde/kdeui/kbuttonbox.h
index 1104366..2e0f41d 100644
--- a/microkde/kdeui/kbuttonbox.h
+++ b/microkde/kdeui/kbuttonbox.h
@@ -1,75 +1,77 @@
/* This file is part of the KDE libraries
Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __KBUTTONBOX__H__
#define __KBUTTONBOX__H__
#include <qwidget.h>
+//Added by qt3to4:
+#include <QResizeEvent>
class QPushButton;
class KButtonBoxPrivate;
/**
* Container widget for buttons.
*
* This class uses Qt layout control to place the buttons; can handle
* both vertical and horizontal button placement. The default border
* is now @p 0 (making it easier to deal with layouts). The space
* between buttons is now more Motif compliant.
*
* @author Mario Weilguni <mweilguni@sime.com>
* @version $Id$
**/
class KButtonBox : public QWidget
{
Q_OBJECT
public:
/**
* Create an empty container for buttons.
*
* If @p _orientation is @p Vertical, the buttons inserted with
* @ref addButton() are laid out from top to bottom, otherwise they
* are laid out from left to right.
*/
- KButtonBox(QWidget *parent, Orientation _orientation = Horizontal,
+ KButtonBox(QWidget *parent, Qt::Orientation _orientation = Qt::Horizontal,
int border = 0, int _autoborder = 6);
/**
* Free private data field
*/
~KButtonBox();
/**
* @return The minimum size needed to fit all buttons.
*
* This size is
* calculated by the width/height of all buttons plus border/autoborder.
*/
virtual QSize sizeHint() const;
/**
* @reimplemented
*/
virtual QSizePolicy sizePolicy() const;
/**
* @reimplemented
*/
virtual void resizeEvent(QResizeEvent *);
/**
diff --git a/microkde/kdeui/kguiitem.cpp b/microkde/kdeui/kguiitem.cpp
index 828c5e6..c91ffb7 100644
--- a/microkde/kdeui/kguiitem.cpp
+++ b/microkde/kdeui/kguiitem.cpp
@@ -1,205 +1,205 @@
/* This file is part of the KDE libraries
Copyright (C) 2001 Holger Freyther (freyher@yahoo.com)
based on ideas from Martijn and Simon
many thanks to Simon
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qregexp.h>
#include <qstring.h>
-#include <qiconset.h>
+#include <qicon.h>
#include <qpixmap.h>
#include <assert.h>
//US #include <kiconloader.h>
#include <kdebug.h>
#include "kguiitem.h"
class KGuiItem::KGuiItemPrivate
{
public:
KGuiItemPrivate()
{
m_enabled = true;
m_hasIcon = false;
}
KGuiItemPrivate( const KGuiItemPrivate &rhs )
{
(*this ) = rhs;
}
KGuiItemPrivate &operator=( const KGuiItemPrivate &rhs )
{
m_text = rhs.m_text;
m_iconSet = rhs.m_iconSet;
m_iconName = rhs.m_iconName;
m_toolTip = rhs.m_toolTip;
m_whatsThis = rhs.m_whatsThis;
m_statusText = rhs.m_statusText;
m_enabled = rhs.m_enabled;
m_hasIcon = rhs.m_hasIcon;
return *this;
}
QString m_text;
QString m_toolTip;
QString m_whatsThis;
QString m_statusText;
QString m_iconName;
- QIconSet m_iconSet;
+ QIcon m_iconSet;
bool m_hasIcon : 1;
bool m_enabled : 1;
};
KGuiItem::KGuiItem() {
d = new KGuiItemPrivate;
}
KGuiItem::KGuiItem( const QString &text, const QString &iconName,
const QString &toolTip, const QString &whatsThis )
{
d = new KGuiItemPrivate;
d->m_text = text;
d->m_toolTip = toolTip;
d->m_whatsThis = whatsThis;
setIconName( iconName );
}
-KGuiItem::KGuiItem( const QString &text, const QIconSet &iconSet,
+KGuiItem::KGuiItem( const QString &text, const QIcon &iconSet,
const QString &toolTip, const QString &whatsThis )
{
d = new KGuiItemPrivate;
d->m_text = text;
d->m_toolTip = toolTip;
d->m_whatsThis = whatsThis;
setIconSet( iconSet );
}
KGuiItem::KGuiItem( const KGuiItem &rhs )
: d( 0 )
{
(*this) = rhs;
}
KGuiItem &KGuiItem::operator=( const KGuiItem &rhs ) {
if ( d == rhs.d )
return *this;
assert( rhs.d );
delete d;
d = new KGuiItemPrivate( *rhs.d );
return *this;
}
KGuiItem::~KGuiItem() {
delete d;
}
QString KGuiItem::text() const {
return d->m_text;
}
QString KGuiItem::plainText() const {
QString stripped( d->m_text );
stripped.replace( QRegExp( "&(?!&)" ), QString::null );
return stripped;
}
-QIconSet KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const
+QIcon KGuiItem::iconSet( KIcon::Group group, int size /*US, KInstance* instance */ ) const
{
if( d->m_hasIcon )
{
if( !d->m_iconName.isEmpty())
{
// some caching here would(?) come handy
//US return instance->iconLoader()->loadIconSet( d->m_iconName, group, size );
return KGlobal::iconLoader()->loadIconSet( d->m_iconName);
// here is a little problem that with delayed icon loading
// we can't check if the icon really exists ... so what ...
// if( set.isNull() )
// {
// d->m_hasIcon = false;
// return QIconSet();
// }
// return set;
}
else
{
return d->m_iconSet;
}
}
else
- return QIconSet();
+ return QIcon();
}
QString KGuiItem::iconName() const
{
return d->m_iconName;
}
QString KGuiItem::toolTip() const {
return d->m_toolTip;
}
QString KGuiItem::whatsThis() const {
return d->m_whatsThis;
}
bool KGuiItem::isEnabled() const
{
return d->m_enabled;
}
bool KGuiItem::hasIcon() const
{
return d->m_hasIcon;
}
void KGuiItem::setText( const QString &text ) {
d->m_text=text;
}
-void KGuiItem::setIconSet( const QIconSet &iconset )
+void KGuiItem::setIconSet( const QIcon &iconset )
{
d->m_iconSet = iconset;
d->m_iconName = QString::null;
d->m_hasIcon = !iconset.isNull();
}
void KGuiItem::setIconName( const QString &iconName )
{
d->m_iconName = iconName;
- d->m_iconSet = QIconSet();
+ d->m_iconSet = QIcon();
d->m_hasIcon = !iconName.isEmpty();
}
void KGuiItem::setToolTip( const QString &toolTip) {
d->m_toolTip = toolTip;
}
void KGuiItem::setWhatsThis( const QString &whatsThis ) {
d->m_whatsThis = whatsThis;
}
void KGuiItem::setEnabled( bool enabled ){
d->m_enabled = enabled;
}
/* vim: et sw=4
*/
diff --git a/microkde/kdeui/kguiitem.h b/microkde/kdeui/kguiitem.h
index 0079bb4..6f92137 100644
--- a/microkde/kdeui/kguiitem.h
+++ b/microkde/kdeui/kguiitem.h
@@ -2,86 +2,86 @@
Copyright (C) 2001 Holger Freyther (freyher@yahoo.com)
based on ideas from Martijn and Simon
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Many thanks to Simon tronical Hausmann
*/
#ifndef __kguiitem_h__
#define __kguiitem_h__
#include <qstring.h>
-#include <qiconset.h>
+#include <qicon.h>
#include <qpixmap.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
//US#include <kicontheme.h>
#include <kglobal.h>
//US added the following files
#include <kiconloader.h>
class KGuiItem
{
public:
KGuiItem();
KGuiItem( const QString &text,
const QString &iconName = QString::null,
const QString &toolTip = QString::null,
const QString &whatsThis = QString::null );
- KGuiItem( const QString &text, const QIconSet &iconSet,
+ KGuiItem( const QString &text, const QIcon &iconSet,
const QString &toolTip = QString::null,
const QString &whatsThis = QString::null );
KGuiItem( const KGuiItem &rhs );
KGuiItem &operator=( const KGuiItem &rhs );
~KGuiItem();
QString text() const;
QString plainText() const;
- QIconSet iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const;
+ QIcon iconSet( KIcon::Group, int size = 0/*US , KInstance* instance = KGlobal::instance()*/) const;
#ifndef KDE_NO_COMPAT
- QIconSet iconSet() const { return iconSet( KIcon::Small); }
+ QIcon iconSet() const { return iconSet( KIcon::Small); }
#endif
QString iconName() const;
QString toolTip() const;
QString whatsThis() const;
bool isEnabled() const;
bool hasIcon() const;
#ifndef KDE_NO_COMPAT
bool hasIconSet() const { return hasIcon(); }
#endif
void setText( const QString &text );
- void setIconSet( const QIconSet &iconset );
+ void setIconSet( const QIcon &iconset );
void setIconName( const QString &iconName );
void setToolTip( const QString &tooltip );
void setWhatsThis( const QString &whatsThis );
void setEnabled( bool enable );
private:
class KGuiItemPrivate;
KGuiItemPrivate *d;
};
/* vim: et sw=4
*/
#endif
diff --git a/microkde/kdeui/kjanuswidget.cpp b/microkde/kdeui/kjanuswidget.cpp
index 462c44f..3d9173d 100644
--- a/microkde/kdeui/kjanuswidget.cpp
+++ b/microkde/kdeui/kjanuswidget.cpp
@@ -1,486 +1,494 @@
/* This file is part of the KDE Libraries
* Copyright (C) 1999-2000 Espen Sand (espensa@online.no)
* Copyright (C) 2003 Ravikiran Rajagopal (ravi@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <qpixmap.h>
#include <qbitmap.h>
#include <qlayout.h>
#include <qlabel.h>
-#include <qwidgetstack.h>
+#include <q3widgetstack.h>
#include <qtabwidget.h>
-#include <qlistview.h>
-#include <qhbox.h>
-#include <qvbox.h>
-#include <qgrid.h>
+#include <q3listview.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
+#include <q3grid.h>
#include <qpainter.h>
-#include <qobjectlist.h>
+#include <qobject.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3HBoxLayout>
+#include <Q3GridLayout>
+#include <Q3PtrList>
+#include <Q3Frame>
+#include <QEvent>
+#include <Q3VBoxLayout>
+#include <QShowEvent>
/*US
#include <qbitmap.h>
#include <qgrid.h>
#include <qhbox.h>
#include <qheader.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qobjectlist.h>
#include <qpixmap.h>
#include <qsplitter.h>
#include <qtabwidget.h>
#include <qvbox.h>
#include <qwidgetstack.h>
#include <qpainter.h>
#include <qstyle.h>
#include <kapplication.h>
#include <klocale.h>
#include <kglobal.h>
#include <kglobalsettings.h>
#include <kseparator.h>
#include <kdebug.h>
#include "kjanuswidget.h"
#include <klistview.h>
*/
#include <kseparator.h>
#include <kdialog.h> // Access to some static members
#include <kdebug.h>
#include <klistview.h>
#include "kjanuswidget.h"
-class KJanusWidget::IconListItem : public QListBoxItem
+class KJanusWidget::IconListItem : public Q3ListBoxItem
{
public:
- IconListItem( QListBox *listbox, const QPixmap &pixmap,
+ IconListItem( Q3ListBox *listbox, const QPixmap &pixmap,
const QString &text );
- virtual int height( const QListBox *lb ) const;
- virtual int width( const QListBox *lb ) const;
+ virtual int height( const Q3ListBox *lb ) const;
+ virtual int width( const Q3ListBox *lb ) const;
int expandMinimumWidth( int width );
protected:
const QPixmap &defaultPixmap();
void paint( QPainter *painter );
private:
QPixmap mPixmap;
int mMinimumWidth;
};
class KJanusWidget::KJanusWidgetPrivate
{
public:
KJanusWidgetPrivate() : mNextPageIndex(0) { }
int mNextPageIndex; // The next page index.
// Dictionary for multipage modes.
QMap<int,QWidget*> mIntToPage;
// Reverse dictionary. Used because showPage() may be performance critical.
QMap<QWidget*,int> mPageToInt;
// Dictionary of title string associated with page.
QMap<int, QString> mIntToTitle;
};
-template class QPtrList<QListViewItem>;
+template class Q3PtrList<Q3ListViewItem>;
KJanusWidget::KJanusWidget( QWidget *parent, const char *name, int face )
: QWidget( parent, name ),
mValid(false), mPageList(0),
mTitleList(0), mFace(face), mTitleLabel(0), mActivePageWidget(0),
mShowIconsInTreeList(false), d(0)
{
- QVBoxLayout *topLayout = new QVBoxLayout( this );
+ Q3VBoxLayout *topLayout = new Q3VBoxLayout( this );
if( mFace == TreeList || mFace == IconList )
{
d = new KJanusWidgetPrivate;
- QFrame *page = 0;
+ Q3Frame *page = 0;
if( mFace == TreeList )
{
//US
qDebug("KJanusWidget::KJanusWidget TreeList not implemented yet");
/*US
QSplitter *splitter = new QSplitter( this );
topLayout->addWidget( splitter, 10 );
mTreeListResizeMode = QSplitter::KeepSize;
mTreeList = new KListView( splitter );
mTreeList->addColumn( QString::null );
mTreeList->header()->hide();
mTreeList->setRootIsDecorated(true);
mTreeList->setSorting( -1 );
connect( mTreeList, SIGNAL(selectionChanged()), SLOT(slotShowPage()) );
connect( mTreeList, SIGNAL(clicked(QListViewItem *)), SLOT(slotItemClicked(QListViewItem *)));
//
// Page area. Title at top with a separator below and a pagestack using
// all available space at bottom.
//
QFrame *p = new QFrame( splitter );
QHBoxLayout *hbox = new QHBoxLayout( p, 0, 0 );
hbox->addSpacing( KDialog::marginHint() );
page = new QFrame( p );
hbox->addWidget( page, 10 );
*/
}
else
{
- QHBoxLayout *hbox = new QHBoxLayout( topLayout );
+ Q3HBoxLayout *hbox = new Q3HBoxLayout( topLayout );
mIconList = new IconListBox( this );
QFont listFont( mIconList->font() );
listFont.setBold( true );
mIconList->setFont( listFont );
mIconList->verticalScrollBar()->installEventFilter( this );
hbox->addWidget( mIconList );
connect( mIconList, SIGNAL(selectionChanged()), SLOT(slotShowPage()));
hbox->addSpacing( KDialog::marginHint() );
- page = new QFrame( this );
+ page = new Q3Frame( this );
hbox->addWidget( page, 10 );
}
//
// Rest of page area. Title at top with a separator below and a
// pagestack using all available space at bottom.
//
- QVBoxLayout *vbox = new QVBoxLayout( page, 0, KDialog::spacingHint() );
+ Q3VBoxLayout *vbox = new Q3VBoxLayout( page, 0, KDialog::spacingHint() );
mTitleLabel = new QLabel( QString::fromLatin1("Empty page"), page, "KJanusWidgetTitleLabel" );
vbox->addWidget( mTitleLabel );
QFont titleFont( mTitleLabel->font() );
titleFont.setBold( true );
mTitleLabel->setFont( titleFont );
mTitleSep = new KSeparator( page );
- mTitleSep->setFrameStyle( QFrame::HLine|QFrame::Plain );
+ mTitleSep->setFrameStyle( Q3Frame::HLine|Q3Frame::Plain );
vbox->addWidget( mTitleSep );
- mPageStack = new QWidgetStack( page );
+ mPageStack = new Q3WidgetStack( page );
connect(mPageStack, SIGNAL(aboutToShow(QWidget *)),
SIGNAL(aboutToShowPage(QWidget *)));
vbox->addWidget( mPageStack, 10 );
}
else if( mFace == Tabbed )
{
d = new KJanusWidgetPrivate;
mTabControl = new QTabWidget( this );
mTabControl->setMargin (KDialog::marginHint());
topLayout->addWidget( mTabControl, 10 );
}
else if( mFace == Swallow )
{
mSwallowPage = new QWidget( this );
topLayout->addWidget( mSwallowPage, 10 );
}
else
{
mFace = Plain;
- mPlainPage = new QFrame( this );
+ mPlainPage = new Q3Frame( this );
topLayout->addWidget( mPlainPage, 10 );
}
/*US
if ( kapp )
connect(kapp,SIGNAL(kdisplayFontChanged()),SLOT(slotFontChanged()));
*/
mValid = true;
setSwallowedWidget(0); // Set default size if 'mFace' is Swallow.
}
KJanusWidget::~KJanusWidget()
{
/*US the destroyed signal caused a segmentation fault while closing the dialog and destructing
all pages. Why not just remove all pages in the destructor??
*/
// LR we have all subwidgets with parent-child relation
// LR we do not need to delete here anything by the private class
/*
if( mFace == Tabbed )
{
QMap<QWidget*,int>::Iterator it;
for (it = d->mPageToInt.begin(); it != d->mPageToInt.end(); ++it) {
QObject*page = (QObject*)it.key();
pageGone(page);
}
}
else
qDebug("KJanusWidget::~KJanusWidget so far ");
*/
//US end
delete d;
}
bool KJanusWidget::isValid() const
{
return( mValid );
}
-QFrame *KJanusWidget::plainPage()
+Q3Frame *KJanusWidget::plainPage()
{
return( mPlainPage );
}
int KJanusWidget::face() const
{
return( mFace );
}
QWidget *KJanusWidget::FindParent()
{
if( mFace == Tabbed ) {
return mTabControl;
}
else {
return this;
}
}
-QFrame *KJanusWidget::addPage( const QStringList &items, const QString &header,
+Q3Frame *KJanusWidget::addPage( const QStringList &items, const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
- QFrame *page = new QFrame( FindParent(), "page" );
+ Q3Frame *page = new Q3Frame( FindParent(), "page" );
addPageWidget( page, items, header, pixmap );
return page;
}
void KJanusWidget::pageGone( QObject *obj )
{
// QObject* obj = (QObject*)sender();
removePage( static_cast<QWidget*>( obj ) );
}
-void KJanusWidget::slotReopen( QListViewItem * item )
+void KJanusWidget::slotReopen( Q3ListViewItem * item )
{
if( item )
item->setOpen( true );
}
-QFrame *KJanusWidget::addPage( const QString &itemName, const QString &header,
+Q3Frame *KJanusWidget::addPage( const QString &itemName, const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addPage(items, header, pixmap);
}
-QVBox *KJanusWidget::addVBoxPage( const QStringList &items,
+Q3VBox *KJanusWidget::addVBoxPage( const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
qDebug("addPage: Invalid object ");
return( 0 );
}
- QVBox *page = new QVBox(FindParent() , "vbox_page" );
+ Q3VBox *page = new Q3VBox(FindParent() , "vbox_page" );
page->setSpacing( KDialog::spacingHintSmall() );
addPageWidget( page, items, header, pixmap );
return page;
}
-QVBox *KJanusWidget::addVBoxPage( const QString &itemName,
+Q3VBox *KJanusWidget::addVBoxPage( const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addVBoxPage(items, header, pixmap);
}
-QHBox *KJanusWidget::addHBoxPage( const QStringList &items,
+Q3HBox *KJanusWidget::addHBoxPage( const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false ) {
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
- QHBox *page = new QHBox(FindParent(), "hbox_page");
+ Q3HBox *page = new Q3HBox(FindParent(), "hbox_page");
page->setSpacing( KDialog::spacingHint() );
addPageWidget( page, items, header, pixmap );
return page;
}
-QHBox *KJanusWidget::addHBoxPage( const QString &itemName,
+Q3HBox *KJanusWidget::addHBoxPage( const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addHBoxPage(items, header, pixmap);
}
-QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir,
+Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir,
const QStringList &items,
const QString &header,
const QPixmap &pixmap )
{
if( mValid == false )
{
kdDebug() << "addPage: Invalid object" << endl;
return( 0 );
}
- QGrid *page = new QGrid( n, dir, FindParent(), "page" );
+ Q3Grid *page = new Q3Grid( n, dir, FindParent(), "page" );
page->setSpacing( KDialog::spacingHint() );
addPageWidget( page, items, header, pixmap );
return page;
}
-QGrid *KJanusWidget::addGridPage( int n, QGrid::Direction dir,
+Q3Grid *KJanusWidget::addGridPage( int n, Qt::Orientation dir,
const QString &itemName,
const QString &header,
const QPixmap &pixmap )
{
QStringList items;
items << itemName;
return addGridPage(n, dir, items, header, pixmap);
}
-void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page)
+void KJanusWidget::InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page)
{
bool isTop = true;
- QListViewItem *curTop = 0, *child, *last, *newChild;
+ Q3ListViewItem *curTop = 0, *child, *last, *newChild;
unsigned int index = 1;
QStringList curPath;
for ( QStringList::ConstIterator it = items.begin(); it != items.end(); ++it, index++ ) {
QString name = (*it);
bool isPath = ( index != items.count() );
// Find the first child.
if (isTop) {
child = mTreeList->firstChild();
}
else {
child = curTop->firstChild();
}
// Now search for a child with the current Name, and if it we doesn't
// find it, then remember the location of the last child.
for (last = 0; child && child->text(0) != name ; last = child, child = child->nextSibling());
if (last == 0 && child == 0) {
// This node didn't have any children at all, lets just insert the
// new child.
if (isTop)
- newChild = new QListViewItem(mTreeList, name);
+ newChild = new Q3ListViewItem(mTreeList, name);
else
- newChild = new QListViewItem(curTop, name);
+ newChild = new Q3ListViewItem(curTop, name);
}
else if (child != 0) {
// we found the given name in this child.
if (!isPath) {
kdDebug() << "The element inserted was already in the TreeList box!" << endl;
return;
}
else {
// Ok we found the folder
newChild = child;
}
}
else {
// the node had some children, but we didn't find the given name
if (isTop)
- newChild = new QListViewItem(mTreeList, last, name);
+ newChild = new Q3ListViewItem(mTreeList, last, name);
else
- newChild = new QListViewItem(curTop, last, name);
+ newChild = new Q3ListViewItem(curTop, last, name);
}
// Now make the element expandable if it is a path component, and make
// ready for next loop
if (isPath) {
newChild->setExpandable(true);
curTop = newChild;
isTop = false;
curPath << name;
QString key = curPath.join("_/_");
if (mFolderIconMap.contains(key)) {
QPixmap p = mFolderIconMap[key];
newChild->setPixmap(0,p);
}
}
else {
if (mShowIconsInTreeList) {
newChild->setPixmap(0, pixmap);
}
mTreeListToPageStack.insert(newChild, page);
}
}
}
-void KJanusWidget::addPageWidget( QFrame *page, const QStringList &items,
+void KJanusWidget::addPageWidget( Q3Frame *page, const QStringList &items,
const QString &header,const QPixmap &pixmap )
{
/*US the following signal causes a segmentation fault while closing the dialog.
Why not just remove all pages in the destructor??
*/
//US connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*)));
// we have the SIGNAL(destroyed(QObject*) only in Qt3
#ifdef DESKTOP_VERSION
// connect(page, SIGNAL(destroyed(QObject*)), this, SLOT(pageGone(QObject*)));
#endif
if( mFace == Tabbed )
{
mTabControl->addTab (page, items.last());
d->mIntToPage[d->mNextPageIndex] = static_cast<QWidget*>(page);
d->mPageToInt[static_cast<QWidget*>(page)] = d->mNextPageIndex;
d->mNextPageIndex++;
}
else if( mFace == TreeList || mFace == IconList )
{
d->mIntToPage[d->mNextPageIndex] = static_cast<QWidget*>(page);
d->mPageToInt[static_cast<QWidget*>(page)] = d->mNextPageIndex;
mPageStack->addWidget( page, 0 );
if (items.count() == 0) {
@@ -529,191 +537,191 @@ void KJanusWidget::addPageWidget( QFrame *page, const QStringList &items,
}
void KJanusWidget::setFolderIcon(const QStringList &path, const QPixmap &pixmap)
{
QString key = path.join("_/_");
mFolderIconMap.insert(key,pixmap);
}
bool KJanusWidget::setSwallowedWidget( QWidget *widget )
{
if( mFace != Swallow || mValid == false )
{
return( false );
}
//
// Remove current layout and make a new.
//
if( mSwallowPage->layout() != 0 )
{
delete mSwallowPage->layout();
}
- QGridLayout *gbox = new QGridLayout( mSwallowPage, 1, 1, 0 );
+ Q3GridLayout *gbox = new Q3GridLayout( mSwallowPage, 1, 1, 0 );
//
// Hide old children
//
- QObjectList *l = (QObjectList*)mSwallowPage->children(); // silence please
- for( uint i=0; i < l->count(); i++ )
+ QObjectList l = mSwallowPage->children(); // silence please
+ for( uint i=0; i < l.count(); i++ )
{
- QObject *o = l->at(i);
+ QObject *o = l.at(i);
if( o->isWidgetType() )
{
((QWidget*)o)->hide();
}
}
//
// Add new child or make default size
//
if( widget == 0 )
{
gbox->addRowSpacing(0,100);
gbox->addColSpacing(0,100);
mSwallowPage->setMinimumSize(100,100);
}
else
{
if( widget->parent() != mSwallowPage )
{
widget->reparent( mSwallowPage, 0, QPoint(0,0) );
}
gbox->addWidget(widget, 0, 0 );
gbox->activate();
mSwallowPage->setMinimumSize( widget->minimumSize() );
}
return( true );
}
bool KJanusWidget::slotShowPage()
{
if( mValid == false )
{
return( false );
}
if( mFace == TreeList )
{
- QListViewItem *node = mTreeList->selectedItem();
+ Q3ListViewItem *node = mTreeList->selectedItem();
if( node == 0 ) { return( false ); }
QWidget *stackItem = mTreeListToPageStack[node];
// Make sure to call through the virtual function showPage(int)
return showPage(d->mPageToInt[stackItem]);
}
else if( mFace == IconList )
{
- QListBoxItem *node = mIconList->item( mIconList->currentItem() );
+ Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() );
if( node == 0 ) { return( false ); }
QWidget *stackItem = mIconListToPageStack[node];
// Make sure to call through the virtual function showPage(int)
return showPage(d->mPageToInt[stackItem]);
}
return( false );
}
bool KJanusWidget::showPage( int index )
{
if( d == 0 || mValid == false )
{
return( false );
}
else
{
return showPage(d->mIntToPage[index]);
}
}
bool KJanusWidget::showPage( QWidget *w )
{
if( w == 0 || mValid == false )
{
return( false );
}
if( mFace == TreeList || mFace == IconList )
{
mPageStack->raiseWidget( w );
mActivePageWidget = w;
int index = d->mPageToInt[w];
mTitleLabel->setText( d->mIntToTitle[index] );
if( mFace == TreeList )
{
- QMap<QListViewItem *, QWidget *>::Iterator it;
+ QMap<Q3ListViewItem *, QWidget *>::Iterator it;
for (it = mTreeListToPageStack.begin(); it != mTreeListToPageStack.end(); ++it){
- QListViewItem *key = it.key();
+ Q3ListViewItem *key = it.key();
QWidget *val = it.data();
if (val == w) {
mTreeList->setSelected(key, true );
break;
}
}
}
else
{
- QMap<QListBoxItem *, QWidget *>::Iterator it;
+ QMap<Q3ListBoxItem *, QWidget *>::Iterator it;
for (it = mIconListToPageStack.begin(); it != mIconListToPageStack.end(); ++it){
- QListBoxItem *key = it.key();
+ Q3ListBoxItem *key = it.key();
QWidget *val = it.data();
if (val == w) {
mIconList->setSelected( key, true );
break;
}
}
}
}
else if( mFace == Tabbed )
{
mTabControl->showPage(w);
mActivePageWidget = w;
}
else
{
return( false );
}
return( true );
}
int KJanusWidget::activePageIndex() const
{
if( mFace == TreeList) {
- QListViewItem *node = mTreeList->selectedItem();
+ Q3ListViewItem *node = mTreeList->selectedItem();
if( node == 0 ) { return -1; }
QWidget *stackItem = mTreeListToPageStack[node];
return d->mPageToInt[stackItem];
}
else if (mFace == IconList) {
- QListBoxItem *node = mIconList->item( mIconList->currentItem() );
+ Q3ListBoxItem *node = mIconList->item( mIconList->currentItem() );
if( node == 0 ) { return( false ); }
QWidget *stackItem = mIconListToPageStack[node];
return d->mPageToInt[stackItem];
}
else if( mFace == Tabbed ) {
QWidget *widget = mTabControl->currentPage();
return( widget == 0 ? -1 : d->mPageToInt[widget] );
}
else {
return( -1 );
}
}
int KJanusWidget::pageIndex( QWidget *widget ) const
{
if( widget == 0 )
{
return( -1 );
}
else if( mFace == TreeList || mFace == IconList )
{
return( d->mPageToInt[widget] );
}
@@ -740,49 +748,49 @@ int KJanusWidget::pageIndex( QWidget *widget ) const
}
/*US not yet implemented
void KJanusWidget::slotFontChanged()
{
if( mTitleLabel != 0 )
{
mTitleLabel->setFont( KGlobalSettings::generalFont() );
QFont titleFont( mTitleLabel->font() );
titleFont.setBold( true );
mTitleLabel->setFont( titleFont );
}
if( mFace == IconList )
{
QFont listFont( mIconList->font() );
listFont.setBold( true );
mIconList->setFont( listFont );
mIconList->invalidateHeight();
mIconList->invalidateWidth();
}
}
*/
// makes the treelist behave like the list of kcontrol
-void KJanusWidget::slotItemClicked(QListViewItem *it)
+void KJanusWidget::slotItemClicked(Q3ListViewItem *it)
{
if(it && (it->childCount()>0))
it->setOpen(!it->isOpen());
}
void KJanusWidget::setFocus()
{
if( mValid == false ) { return; }
if( mFace == TreeList )
{
mTreeList->setFocus();
}
if( mFace == IconList )
{
mIconList->setFocus();
}
else if( mFace == Tabbed )
{
mTabControl->setFocus();
}
else if( mFace == Swallow )
{
mSwallowPage->setFocus();
}
@@ -874,53 +882,53 @@ void KJanusWidget::setIconListAllVisible( bool state )
{
if( mFace == IconList )
{
mIconList->setShowAll( state );
}
}
void KJanusWidget::setShowIconsInTreeList( bool state )
{
mShowIconsInTreeList = state;
}
void KJanusWidget::setRootIsDecorated( bool state )
{
if( mFace == TreeList ) {
mTreeList->setRootIsDecorated(state);
}
}
void KJanusWidget::unfoldTreeList( bool persist )
{
if( mFace == TreeList )
{
if( persist )
- connect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) );
+ connect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) );
else
- disconnect( mTreeList, SIGNAL( collapsed( QListViewItem * ) ), this, SLOT( slotReopen( QListViewItem * ) ) );
+ disconnect( mTreeList, SIGNAL( collapsed( Q3ListViewItem * ) ), this, SLOT( slotReopen( Q3ListViewItem * ) ) );
- for( QListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
+ for( Q3ListViewItem * item = mTreeList->firstChild(); item; item = item->itemBelow() )
item->setOpen( true );
}
}
void KJanusWidget::showEvent( QShowEvent * )
{
if( mFace == TreeList )
{
/*US
QSplitter *splitter = (QSplitter*)(mTreeList->parentWidget());
splitter->setResizeMode( mTreeList, mTreeListResizeMode );
*/
}
}
//
// 2000-13-02 Espen Sand
// It should be obvious that this eventfilter must only be
// be installed on the vertical scrollbar of the mIconList.
//
bool KJanusWidget::eventFilter( QObject *o, QEvent *e )
{
if( e->type() == QEvent::Show )
@@ -932,120 +940,120 @@ bool KJanusWidget::eventFilter( QObject *o, QEvent *e )
int sw = mIconList->verticalScrollBar()->sizeHint().width();
mIconList->setFixedWidth( lw+sw+mIconList->frameWidth()*2 );
}
}
else if( e->type() == QEvent::Hide )
{
IconListItem *item = (IconListItem*)mIconList->item(0);
if( item != 0 )
{
int lw = item->width( mIconList );
mIconList->setFixedWidth( lw+mIconList->frameWidth()*2 );
}
}
return QWidget::eventFilter( o, e );
}
//
// Code for the icon list box
//
KJanusWidget::IconListBox::IconListBox( QWidget *parent, const char *name,
- WFlags f )
+ Qt::WFlags f )
:KListBox( parent, name, f ), mShowAll(false), mHeightValid(false),
mWidthValid(false)
{
}
void KJanusWidget::IconListBox::updateMinimumHeight()
{
if( mShowAll == true && mHeightValid == false )
{
int h = frameWidth()*2;
- for( QListBoxItem *i = item(0); i != 0; i = i->next() )
+ for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() )
{
h += i->height( this );
}
setMinimumHeight( h );
mHeightValid = true;
}
}
void KJanusWidget::IconListBox::updateWidth()
{
if( mWidthValid == false )
{
int maxWidth = 10;
- for( QListBoxItem *i = item(0); i != 0; i = i->next() )
+ for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() )
{
int w = ((IconListItem *)i)->width(this);
maxWidth = QMAX( w, maxWidth );
}
- for( QListBoxItem *i = item(0); i != 0; i = i->next() )
+ for( Q3ListBoxItem *i = item(0); i != 0; i = i->next() )
{
((IconListItem *)i)->expandMinimumWidth( maxWidth );
}
if( verticalScrollBar()->isVisible() )
{
maxWidth += verticalScrollBar()->sizeHint().width();
}
setFixedWidth( maxWidth + frameWidth()*2 );
mWidthValid = true;
}
}
void KJanusWidget::IconListBox::invalidateHeight()
{
mHeightValid = false;
}
void KJanusWidget::IconListBox::invalidateWidth()
{
mWidthValid = false;
}
void KJanusWidget::IconListBox::setShowAll( bool showAll )
{
mShowAll = showAll;
mHeightValid = false;
}
-KJanusWidget::IconListItem::IconListItem( QListBox *listbox, const QPixmap &pixmap,
+KJanusWidget::IconListItem::IconListItem( Q3ListBox *listbox, const QPixmap &pixmap,
const QString &text )
- : QListBoxItem( listbox )
+ : Q3ListBoxItem( listbox )
{
mPixmap = pixmap;
if( mPixmap.isNull() == true )
{
mPixmap = defaultPixmap();
}
setText( text );
mMinimumWidth = 0;
}
int KJanusWidget::IconListItem::expandMinimumWidth( int width )
{
mMinimumWidth = QMAX( mMinimumWidth, width );
return( mMinimumWidth );
}
const QPixmap &KJanusWidget::IconListItem::defaultPixmap()
{
static QPixmap *pix=0;
if( pix == 0 )
{
pix = new QPixmap( 32, 32 );
@@ -1062,103 +1070,103 @@ const QPixmap &KJanusWidget::IconListItem::defaultPixmap()
p.drawRect ( 0, 0, pix->width(), pix->height() );
p.end();
pix->setMask( mask );
}
return( *pix );
}
void KJanusWidget::IconListItem::paint( QPainter *painter )
{
QFontMetrics fm = painter->fontMetrics();
//int wt = fm.boundingRect(text()).width();
int wp = mPixmap.width();
int ht = fm.lineSpacing();
int hp = mPixmap.height();
painter->drawPixmap( (mMinimumWidth-wp)/2, 5, mPixmap );
if( text().isEmpty() == false )
{
painter->drawText( 0, hp+7, mMinimumWidth, ht, Qt::AlignCenter, text() );
}
}
-int KJanusWidget::IconListItem::height( const QListBox *lb ) const
+int KJanusWidget::IconListItem::height( const Q3ListBox *lb ) const
{
if( text().isEmpty() == true )
{
return( mPixmap.height() );
}
else
{
return( mPixmap.height() + lb->fontMetrics().lineSpacing()+10 );
}
}
-int KJanusWidget::IconListItem::width( const QListBox *lb ) const
+int KJanusWidget::IconListItem::width( const Q3ListBox *lb ) const
{
int wt = lb->fontMetrics().boundingRect(text()).width()+10;
int wp = mPixmap.width() + 10;
int w = QMAX( wt, wp );
return( QMAX( w, mMinimumWidth ) );
}
void KJanusWidget::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
// TODO: In TreeList, if the last child of a node is removed, and there is no corrsponding widget for that node, allow the caller to
// delete the node.
void KJanusWidget::removePage( QWidget *page )
{
//US qDebug("KJanusWidget::removePage 1 %lu , %lu, %lu", d, page, &(d->mPageToInt));
if (!d || !(d->mPageToInt.contains(page)))
{
return;
}
int index = d->mPageToInt[page];
if ( mFace == TreeList )
{
- QMap<QListViewItem*, QWidget *>::Iterator i;
+ QMap<Q3ListViewItem*, QWidget *>::Iterator i;
for( i = mTreeListToPageStack.begin(); i != mTreeListToPageStack.end(); ++i )
if (i.data()==page)
{
delete i.key();
mPageStack->removeWidget(page);
mTreeListToPageStack.remove(i);
d->mIntToTitle.remove(index);
d->mPageToInt.remove(page);
d->mIntToPage.remove(index);
break;
}
}
else if ( mFace == IconList )
{
- QMap<QListBoxItem*, QWidget *>::Iterator i;
+ QMap<Q3ListBoxItem*, QWidget *>::Iterator i;
for( i = mIconListToPageStack.begin(); i != mIconListToPageStack.end(); ++i )
if (i.data()==page)
{
delete i.key();
mPageStack->removeWidget(page);
mIconListToPageStack.remove(i);
d->mIntToTitle.remove(index);
d->mPageToInt.remove(page);
d->mIntToPage.remove(index);
break;
}
}
else // Tabbed
{
mTabControl->removePage(page);
d->mPageToInt.remove(page);
d->mIntToPage.remove(index);
}
}
QString KJanusWidget::pageTitle(int index) const
{
if (!d || !d->mIntToTitle.contains(index))
return QString::null;
diff --git a/microkde/kdeui/kjanuswidget.h b/microkde/kdeui/kjanuswidget.h
index 6d3f23d..72465ea 100644
--- a/microkde/kdeui/kjanuswidget.h
+++ b/microkde/kdeui/kjanuswidget.h
@@ -1,70 +1,76 @@
/* This file is part of the KDE Libraries
* Copyright (C) 1999-2000 Espen Sand (espen@kde.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _KJANUS_WIDGET_H_
#define _KJANUS_WIDGET_H_
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qwidget.h>
#include <qmap.h>
-#include <qgrid.h>
+#include <q3grid.h>
+//Added by qt3to4:
+#include <QShowEvent>
+#include <Q3Frame>
+#include <QPixmap>
+#include <QLabel>
+#include <QEvent>
#include <klistbox.h>
/*US
#include <qptrlist.h>
#include <qpixmap.h>
#include <qsplitter.h>
#include <qstringlist.h>
#include <qmap.h>
*/
class KSeparator;
class KListView;
-class QWidgetStack;
+class Q3WidgetStack;
class QLabel;
class QTabWidget;
-class QListViewItem;
-class QVBox;
-class QHBox;
+class Q3ListViewItem;
+class Q3VBox;
+class Q3HBox;
/**
* Provides a number of ready to use layouts (faces). It is used
* as an internal widget in @ref KDialogBase, but can also used as a
* widget of its own.
*
* It provides TreeList, IconList, Tabbed, Plain and Swallow layouts.
*
* The TreeList face provides a list in the left area and pages in the
* right. The area are separated by a movable splitter. The style is somewhat
* similar to the layout in the Control Center. A page is raised by
* selecting the corresponding tree list item.
*
* The IconList face provides an icon list in the left area and pages in the
* right. For each entry the Icon is on top with the text below. The style
* is somewhat similar to the layout of the Eudora configuation dialog box.
* A page is raised by selecting the corresponding icon list item. The
* preferred icon size is 32x32 pixels.
*
* The Tabbed face is a common tabbed widget. The procedure for creating a
* page is similar for creating a TreeList. This has the advantage that if
* your widget contain too many pages it is trivial to convert it into a
* TreeList. Just change the face in the KJanusWidget constructor to
* KJanusWidget::TreeList and you have a tree list layout instead.
@@ -81,49 +87,49 @@ class QHBox;
*
* For all modes it is important that you specify the @ref QWidget::minimumSize()
* on the page, plain widget or the swallowed widget. If you use a QLayout
* on the page, plain widget or the swallowed widget this will be taken care
* of automatically. The size is used when the KJanusWidget determines its
* own minimum size. You get the minimum size by using the
* @ref #minimumSizeHint() or @ref #sizeHint() methods.
*
* Pages that have been added in TreeList, IconList or Tabbed mode can be
* removed by simply deleting the page. However, it would be preferable to use
* the QObject::deleteLater() function on the page as the main event loop
* may have optimized UI update events of the page by scheduling them for later.
*
* @short Easy to use widget with many layouts
* @author Espen Sand (espen@kde.org)
*/
class KJanusWidget : public QWidget
{
Q_OBJECT
private:
class IconListBox : public KListBox
{
public:
- IconListBox( QWidget *parent=0, const char *name=0, WFlags f=0 );
+ IconListBox( QWidget *parent=0, const char *name=0, Qt::WFlags f=0 );
void updateMinimumHeight();
void updateWidth();
void invalidateHeight();
void invalidateWidth();
void setShowAll( bool showAll );
private:
bool mShowAll;
bool mHeightValid;
bool mWidthValid;
};
public:
enum Face
{
TreeList = 0,
Tabbed,
Plain,
Swallow,
IconList
};
public:
@@ -172,211 +178,211 @@ class KJanusWidget : public QWidget
*/
virtual int face() const;
/**
* Returns the minimum size that must be made available for the widget
* so that UIs can be displayed properly
*
* @return The minimum size.
*/
virtual QSize minimumSizeHint() const;
/**
* Returns the recommended size for the widget in order to be displayed
* properly.
*
* @return The recommended size.
*/
virtual QSize sizeHint() const;
/**
* Returns the empty widget that is available in Plain mode.
*
* @return The widget or 0 if the face in not Plain.
*/
- virtual QFrame *plainPage();
+ virtual Q3Frame *plainPage();
/**
* Add a new page when the class is used in TreeList, IconList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. In most cases you must create a layout
* manager and associate it with this widget as well.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed.
*/
- virtual QFrame *addPage(const QString &item,const QString &header=QString::null,
+ virtual Q3Frame *addPage(const QString &item,const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
- virtual QFrame *addPage(const QStringList &items, const QString &header=QString::null,
+ virtual Q3Frame *addPage(const QStringList &items, const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* Add a new page when the class is used in TreeList, IconList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. The returned widget is a @ref QVBox
* so it contains a QVBoxLayout layout that lines up the child widgets
* are vertically.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed. */
- virtual QVBox *addVBoxPage( const QString &item,
+ virtual Q3VBox *addVBoxPage( const QString &item,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addVBoxPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
- virtual QVBox *addVBoxPage( const QStringList &items,
+ virtual Q3VBox *addVBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* Add a new page when the class is used in TreeList, IconList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. The returned widget is a @ref QHBox
* so it contains a QHBoxLayout layout that lines up the child widgets
* are horizontally.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed.
*/
- virtual QHBox *addHBoxPage( const QString &itemName,
+ virtual Q3HBox *addHBoxPage( const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addHBoxPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
- virtual QHBox *addHBoxPage( const QStringList &items,
+ virtual Q3HBox *addHBoxPage( const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* Add a new page when the class is used in either TreeList or Tabbed
* mode. The returned widget is empty and you must add your widgets
* as children to this widget. The returned widget is a @ref QGrid
* so it contains a QGridLayout layout that places up the child widgets
* in a grid.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
*
* @param n Specifies the number of columns if 'dir' is QGrid::Horizontal
* or the number of rows if 'dir' is QGrid::Vertical.
* @param dir Can be QGrid::Horizontal or QGrid::Vertical.
* @param item String used in the list or Tab item.
* @param header A longer string used in TreeList and IconList mode to
* describe the contents of a page. If empty, the item string
* will be used instead.
* @param pixmap Used in IconList mode or in TreeList mode. You should
* prefer a pixmap with size 32x32 pixels.
*
* @return The empty page or 0 if the face is not TreeList, IconList or
* Tabbed.
*/
//US changed Orientation into Direction for compatibility
- virtual QGrid *addGridPage( int n, QGrid::Direction dir,
+ virtual Q3Grid *addGridPage( int n, Qt::Orientation dir,
const QString &itemName,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* This is like addGridPage just above, with the difference that the first
* element is a list of strings. These strings are used to form a path
* of folders down to the given page. The initial elements are names
* for the folders, while the last element is the name of the page.
* Note: This does yet only work for the TreeList face. Later this may
* be added for the IconList face too. In other faces than the
* TreeList, all the strings except the last one is ignored.
*
* Deleting the returned frame will cause the listitem or tab to be
* removed (you can re-add a page with the same name later.
**/
//US changed Orientation into Direction for compatibility
- virtual QGrid *addGridPage( int n, QGrid::Direction dir,
+ virtual Q3Grid *addGridPage( int n, Qt::Orientation dir,
const QStringList &items,
const QString &header=QString::null,
const QPixmap &pixmap=QPixmap() );
/**
* @short Removes a page created with @ref addPage, @ref addVBoxPage,
* @ref addHBoxPage or @ref addGridPage. If the page has already
* been deleted or has already been removed, nothing happens. The widget
* itself is not deleted.
*
* @param page The widget returned by @ref addPage , @ref addVBoxPage ,
* @ref addHBoxPage or @ref addGridPage .
*/
void removePage( QWidget *page );
/**
* Returns the index of a page created with @ref addPage ,
* @ref addVBoxPage , @ref addHBoxPage or @ref addGridPage .
* You can can compare this index with the value returned from
* @ref activePageIndex if you need to do some page specific actions
* in your code.
*
* The returned index will never change so you can safely use this
@@ -496,70 +502,70 @@ class KJanusWidget : public QWidget
* Give the keyboard input focus to the widget.
*/
virtual void setFocus();
protected:
/**
* Reimplemented to handle the splitter width when the the face
* is TreeList
*/
virtual void showEvent( QShowEvent * );
/**
* This function is used internally when in IconList mode. If you
* reimplement this class a make your own event filter, make sure to
* call this function from your filter.
*
* @param o Object that has received an event.
* @param e The event.
*/
virtual bool eventFilter( QObject *o, QEvent *e );
private slots:
bool slotShowPage();
//US not yet implemented void slotFontChanged();
- void slotItemClicked(QListViewItem *it);
+ void slotItemClicked(Q3ListViewItem *it);
void pageGone( QObject *obj); // signal from the added page's "destroyed" signal
- void slotReopen(QListViewItem *item);
+ void slotReopen(Q3ListViewItem *item);
protected:
bool showPage( QWidget *w );
- void addPageWidget( QFrame *page, const QStringList &items,
+ void addPageWidget( Q3Frame *page, const QStringList &items,
const QString &header, const QPixmap &pixmap );
- void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, QFrame *page);
+ void InsertTreeListItem(const QStringList &items, const QPixmap &pixmap, Q3Frame *page);
QWidget *FindParent();
private:
bool mValid;
// Obsolete members. Remove in KDE 4.
- QPtrList<QWidget> *mPageList;
+ Q3PtrList<QWidget> *mPageList;
QStringList *mTitleList;
int mFace;
KListView *mTreeList;
IconListBox *mIconList;
- QWidgetStack *mPageStack;
+ Q3WidgetStack *mPageStack;
QLabel *mTitleLabel;
QTabWidget *mTabControl;
- QFrame *mPlainPage;
+ Q3Frame *mPlainPage;
QWidget *mSwallowPage;
QWidget *mActivePageWidget;
KSeparator *mTitleSep;
//US QSplitter::ResizeMode mTreeListResizeMode;
bool mShowIconsInTreeList;
- QMap<QListViewItem *, QWidget *> mTreeListToPageStack;
- QMap<QListBoxItem *, QWidget *> mIconListToPageStack;
+ QMap<Q3ListViewItem *, QWidget *> mTreeListToPageStack;
+ QMap<Q3ListBoxItem *, QWidget *> mIconListToPageStack;
QMap<QString, QPixmap> mFolderIconMap;
QMap<QString, QStringList> mChildrenNames;
QMap<QString, QWidget *> mChildPages;
public:
class IconListItem;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KJanusWidgetPrivate;
KJanusWidgetPrivate *d;
};
#endif
diff --git a/microkde/kdeui/klistbox.cpp b/microkde/kdeui/klistbox.cpp
index c65b892..71020b3 100644
--- a/microkde/kdeui/klistbox.cpp
+++ b/microkde/kdeui/klistbox.cpp
@@ -1,87 +1,93 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qtimer.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QFocusEvent>
#include <kglobalsettings.h>
//US#include <kcursor.h>
#include <kapplication.h>
//US#include <kipc.h>
#include <kdebug.h>
#include "klistbox.h"
#ifdef Q_WS_X11
+#include <QX11Info>
#include <X11/Xlib.h>
#endif
#ifdef _WIN32_
#define Q_WS_QWS
#endif
-KListBox::KListBox( QWidget *parent, const char *name, WFlags f )
- : QListBox( parent, name, f )
+KListBox::KListBox( QWidget *parent, const char *name, Qt::WFlags f )
+ : Q3ListBox( parent, name, f )
{
connect( this, SIGNAL( onViewport() ),
this, SLOT( slotOnViewport() ) );
- connect( this, SIGNAL( onItem( QListBoxItem * ) ),
- this, SLOT( slotOnItem( QListBoxItem * ) ) );
+ connect( this, SIGNAL( onItem( Q3ListBoxItem * ) ),
+ this, SLOT( slotOnItem( Q3ListBoxItem * ) ) );
- connect( this, SIGNAL( mouseButtonClicked( int, QListBoxItem *,
+ connect( this, SIGNAL( mouseButtonClicked( int, Q3ListBoxItem *,
const QPoint & ) ),
- this, SLOT( slotMouseButtonClicked( int, QListBoxItem *,
+ this, SLOT( slotMouseButtonClicked( int, Q3ListBoxItem *,
const QPoint & ) ) );
/*US
slotSettingsChanged(KApplication::SETTINGS_MOUSE);
if (kapp)
{
connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) );
kapp->addKipcEventMask( KIPC::SettingsChanged );
}
*/
m_pCurrentItem = 0L;
//US set single to true
m_bUseSingle = true;
m_pAutoSelect = new QTimer( this );
connect( m_pAutoSelect, SIGNAL( timeout() ),
this, SLOT( slotAutoSelect() ) );
}
-void KListBox::slotOnItem( QListBoxItem *item )
+void KListBox::slotOnItem( Q3ListBoxItem *item )
{
/*US
if ( item && m_bChangeCursorOverItem && m_bUseSingle )
viewport()->setCursor( KCursor().handCursor() );
*/
if ( item && (m_autoSelectDelay > -1) && m_bUseSingle ) {
m_pAutoSelect->start( m_autoSelectDelay, true );
m_pCurrentItem = item;
}
}
void KListBox::slotOnViewport()
{
/*US
if ( m_bChangeCursorOverItem )
viewport()->unsetCursor();
*/
m_pAutoSelect->stop();
m_pCurrentItem = 0L;
}
/*US
void KListBox::slotSettingsChanged(int category)
@@ -118,197 +124,197 @@ void KListBox::slotSettingsChanged(int category)
m_bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
m_autoSelectDelay = KGlobalSettings::autoSelectDelay();
if( !m_bUseSingle || !m_bChangeCursorOverItem )
viewport()->unsetCursor();
}
*/
void KListBox::slotAutoSelect()
{
// check that the item still exists
if( index( m_pCurrentItem ) == -1 )
return;
//Give this widget the keyboard focus.
if( !hasFocus() )
setFocus();
#ifdef Q_WS_X11 //FIXME
Window root;
Window child;
int root_x, root_y, win_x, win_y;
uint keybstate;
- XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
+ XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
&root_x, &root_y, &win_x, &win_y, &keybstate );
#endif
- QListBoxItem* previousItem = item( currentItem() );
+ Q3ListBoxItem* previousItem = item( currentItem() );
setCurrentItem( m_pCurrentItem );
if( m_pCurrentItem ) {
#ifndef Q_WS_QWS //FIXME
//Shift pressed?
if( (keybstate & ShiftMask) ) {
#endif
bool block = signalsBlocked();
blockSignals( true );
#ifndef Q_WS_QWS //FIXME
//No Ctrl? Then clear before!
if( !(keybstate & ControlMask) )
clearSelection();
#endif
//US in my QT version it is called isSelected() So what is right?
//US bool select = !m_pCurrentItem->isSelected();
bool select = !m_pCurrentItem->selected();
bool update = viewport()->isUpdatesEnabled();
viewport()->setUpdatesEnabled( false );
bool down = index( previousItem ) < index( m_pCurrentItem );
- QListBoxItem* it = down ? previousItem : m_pCurrentItem;
+ Q3ListBoxItem* it = down ? previousItem : m_pCurrentItem;
for (;it ; it = it->next() ) {
if ( down && it == m_pCurrentItem ) {
setSelected( m_pCurrentItem, select );
break;
}
if ( !down && it == previousItem ) {
setSelected( previousItem, select );
break;
}
setSelected( it, select );
}
blockSignals( block );
viewport()->setUpdatesEnabled( update );
triggerUpdate( false );
emit selectionChanged();
- if( selectionMode() == QListBox::Single )
+ if( selectionMode() == Q3ListBox::Single )
emit selectionChanged( m_pCurrentItem );
}
#ifndef Q_WS_QWS //FIXME
else if( (keybstate & ControlMask) )
setSelected( m_pCurrentItem, !m_pCurrentItem->isSelected() );
#endif
else {
bool block = signalsBlocked();
blockSignals( true );
//US in my QT version it is called isSelected() So what is right?
//US if( !m_pCurrentItem->isSelected() )
if( !m_pCurrentItem->selected() )
clearSelection();
blockSignals( block );
setSelected( m_pCurrentItem, true );
}
#ifndef Q_WS_QWS //FIXME
}
else
kdDebug() << "Thats not supposed to happen!!!!" << endl;
#endif
}
-void KListBox::emitExecute( QListBoxItem *item, const QPoint &pos )
+void KListBox::emitExecute( Q3ListBoxItem *item, const QPoint &pos )
{
#ifdef Q_WS_X11 //FIXME
Window root;
Window child;
int root_x, root_y, win_x, win_y;
uint keybstate;
- XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child,
+ XQueryPointer( x11Info().display(), x11Info().appRootWindow(), &root, &child,
&root_x, &root_y, &win_x, &win_y, &keybstate );
#endif
m_pAutoSelect->stop();
#ifndef Q_WS_QWS //FIXME
//Dont emit executed if in SC mode and Shift or Ctrl are pressed
if( !( m_bUseSingle && ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) {
#endif
emit executed( item );
emit executed( item, pos );
#ifndef Q_WS_QWS //FIXME
}
#endif
}
//
// 2000-16-01 Espen Sand
// This widget is used in dialogs. It should ignore
// F1 (and combinations) and Escape since these are used
// to start help or close the dialog. This functionality
// should be done in QListView but it is not (at least now)
//
void KListBox::keyPressEvent(QKeyEvent *e)
{
- if( e->key() == Key_Escape )
+ if( e->key() == Qt::Key_Escape )
{
e->ignore();
}
- else if( e->key() == Key_F1 )
+ else if( e->key() == Qt::Key_F1 )
{
e->ignore();
}
else
{
- QListBox::keyPressEvent(e);
+ Q3ListBox::keyPressEvent(e);
}
}
void KListBox::focusOutEvent( QFocusEvent *fe )
{
m_pAutoSelect->stop();
- QListBox::focusOutEvent( fe );
+ Q3ListBox::focusOutEvent( fe );
}
void KListBox::leaveEvent( QEvent *e )
{
m_pAutoSelect->stop();
- QListBox::leaveEvent( e );
+ Q3ListBox::leaveEvent( e );
}
void KListBox::contentsMousePressEvent( QMouseEvent *e )
{
- if( (selectionMode() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) ) {
+ if( (selectionMode() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) ) {
bool block = signalsBlocked();
blockSignals( true );
clearSelection();
blockSignals( block );
}
- QListBox::contentsMousePressEvent( e );
+ Q3ListBox::contentsMousePressEvent( e );
}
void KListBox::contentsMouseDoubleClickEvent ( QMouseEvent * e )
{
- QListBox::contentsMouseDoubleClickEvent( e );
+ Q3ListBox::contentsMouseDoubleClickEvent( e );
- QListBoxItem* item = itemAt( e->pos() );
+ Q3ListBoxItem* item = itemAt( e->pos() );
if( item ) {
emit doubleClicked( item, e->globalPos() );
- if( (e->button() == LeftButton) && !m_bUseSingle )
+ if( (e->button() == Qt::LeftButton) && !m_bUseSingle )
emitExecute( item, e->globalPos() );
}
}
-void KListBox::slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos )
+void KListBox::slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos )
{
- if( (btn == LeftButton) && item )
+ if( (btn == Qt::LeftButton) && item )
emitExecute( item, pos );
}
void KListBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "klistbox.moc"
diff --git a/microkde/kdeui/klistbox.h b/microkde/kdeui/klistbox.h
index 8023780..5ec514b 100644
--- a/microkde/kdeui/klistbox.h
+++ b/microkde/kdeui/klistbox.h
@@ -1,141 +1,146 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KLISTBOX_H
#define KLISTBOX_H
-#include <qlistbox.h>
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QFocusEvent>
+#include <QKeyEvent>
+#include <QEvent>
/**
* Extends the functionality of @ref QListBox to honor the system
* wide settings for Single Click/Double Click mode, Auto Selection and
* Change Cursor over Link.
*
* There is a new signal @ref executed(). It gets connected to either
* @ref QListBox::clicked() or @ref QListBox::doubleClicked()
* depending on the KDE wide Single Click/Double Click settings. It is
* strongly recomended that you use this signal instead of the above
* mentioned. This way you don't need to care about the current
* settings. If you want to get informed when the user selects
* something connect to the @ref QListBox::selectionChanged() signal.
*
* @short A variant of @ref QListBox that honors KDE's system-wide settings.
**/
-class KListBox : public QListBox
+class KListBox : public Q3ListBox
{
Q_OBJECT
public:
- KListBox( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
+ KListBox( QWidget *parent = 0, const char *name = 0, Qt::WFlags f = 0 );
signals:
/**
* Emitted whenever the user executes an listbox item.
*
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listbox item.
*
* Note that you may not delete any @ref QListBoxItem objects in slots
* connected to this signal.
*/
- void executed( QListBoxItem *item );
+ void executed( Q3ListBoxItem *item );
/**
* Emitted whenever the user executes an listbox item.
*
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listbox item.
* @param pos is the position where the user has clicked
*
* Note that you may not delete any @ref QListBoxItem objects in slots
* connected to this signal.
*/
- void executed( QListBoxItem *item, const QPoint &pos );
+ void executed( Q3ListBoxItem *item, const QPoint &pos );
/**
* This signal gets emitted whenever the user double clicks into the
* listbox.
*
* @param item The pointer to the clicked listbox item.
* @param pos The position where the user has clicked.
*
* Note that you may not delete any @ref QListBoxItem objects in slots
* connected to this signal.
*
* This signal is more or less here for the sake of completeness.
* You should normally not need to use this. In most cases it's better
* to use @ref executed() instead.
*/
- void doubleClicked( QListBoxItem *item, const QPoint &pos );
+ void doubleClicked( Q3ListBoxItem *item, const QPoint &pos );
protected slots:
- void slotOnItem( QListBoxItem *item );
+ void slotOnItem( Q3ListBoxItem *item );
void slotOnViewport();
//US void slotSettingsChanged(int);
/**
* Auto selection happend.
*/
void slotAutoSelect();
protected:
- void emitExecute( QListBoxItem *item, const QPoint &pos );
+ void emitExecute( Q3ListBoxItem *item, const QPoint &pos );
/**
* @reimplemented
*/
virtual void keyPressEvent(QKeyEvent *e);
/**
* @reimplemented
*/
virtual void focusOutEvent( QFocusEvent *fe );
/**
* @reimplemented
*/
virtual void leaveEvent( QEvent *e );
/**
* @reimplemented
*/
virtual void contentsMousePressEvent( QMouseEvent *e );
/**
* @reimplemented
*/
virtual void contentsMouseDoubleClickEvent ( QMouseEvent *e );
bool m_bUseSingle;
//US bool m_bChangeCursorOverItem;
- QListBoxItem* m_pCurrentItem;
+ Q3ListBoxItem* m_pCurrentItem;
QTimer* m_pAutoSelect;
int m_autoSelectDelay;
private slots:
- void slotMouseButtonClicked( int btn, QListBoxItem *item, const QPoint &pos );
+ void slotMouseButtonClicked( int btn, Q3ListBoxItem *item, const QPoint &pos );
protected:
virtual void virtual_hook( int id, void* data );
private:
class KListBoxPrivate;
KListBoxPrivate *d;
};
#endif
diff --git a/microkde/kdeui/klistview.cpp b/microkde/kdeui/klistview.cpp
index 60f3084..0e98160 100644
--- a/microkde/kdeui/klistview.cpp
+++ b/microkde/kdeui/klistview.cpp
@@ -1,94 +1,109 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
Copyright (C) 2000 Charles Samuels <charles@kde.org>
Copyright (C) 2000 Peter Putzer
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qdragobject.h>
+#include <q3dragobject.h>
#include <qtimer.h>
-#include <qheader.h>
+#include <q3header.h>
#include <qcursor.h>
#include <qtooltip.h>
#include <qstyle.h>
#include <qpainter.h>
+//Added by qt3to4:
+#include <QDragLeaveEvent>
+#include <QKeyEvent>
+#include <Q3ValueList>
+#include <Q3PtrList>
+#include <QPixmap>
+#include <QDragEnterEvent>
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QEvent>
+#include <QPaintEvent>
#include <kglobalsettings.h>
#include <kconfig.h>
#include <kconfigbase.h>
//US #include <kcursor.h>
#include <kapplication.h>
//US #include <kipc.h>
#include <kdebug.h>
#ifdef _WIN32_
#define Q_WS_QWS
#endif
#ifndef _WIN32_
#define private public
-#include <qlistview.h>
+#include <q3listview.h>
#undef private
#endif
#include "klistview.h"
//US #include "klistviewlineedit.h"
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
+#include <Q3Action>
// /*US
-class KListView::Tooltip : public QToolTip
+class KListView::Tooltip /* TODO:hacker:TODO: : public QToolTip */
{
public:
Tooltip (KListView* parent, QToolTipGroup* group = 0L);
virtual ~Tooltip () {}
protected:
// */
/**
* Reimplemented from QToolTip for internal reasons.
*/
// /*US
virtual void maybeTip (const QPoint&);
private:
KListView* mParent;
};
KListView::Tooltip::Tooltip (KListView* parent, QToolTipGroup* group)
- : QToolTip (parent, group),
+ : /* XXX:hacker:XXX: QToolTip (parent, group), */
mParent (parent)
{
}
void KListView::Tooltip::maybeTip (const QPoint&)
{
// FIXME
}
// */
class KListView::KListViewPrivate
{
public:
KListViewPrivate (KListView* listview)
: pCurrentItem (0L),
autoSelectDelay(1),
//US dragDelay (KGlobalSettings::dndEventDelay()),
dragDelay (10),
//US editor (new KListViewLineEdit (listview)),
cursorInExecuteArea(false),
bUseSingle(false),
bChangeCursorOverItem(false),
itemsMovable (true),
@@ -102,97 +117,97 @@ public:
dropHighlighter (false),
createChildren (true),
pressedOnSelected (false),
wasShiftEvent (false),
fullWidth (false),
sortAscending(true),
tabRename(true),
sortColumn(0),
selectionDirection(0),
tooltipColumn (0),
selectionMode (Single),
contextMenuKey ( Qt::Key_Menu ),//KGlobalSettings::contextMenuKey()),
showContextMenusOnPress (true),//showContextMenusOnPress (KGlobalSettings::showContextMenusOnPress()),
mDropVisualizerWidth (4)
{
renameable += 0;
//US connect(editor, SIGNAL(done(QListViewItem*,int)), listview, SLOT(doneEditing(QListViewItem*,int)));
}
~KListViewPrivate ()
{
//US delete editor;
}
- QListViewItem* pCurrentItem;
+ Q3ListViewItem* pCurrentItem;
QTimer autoSelect;
int autoSelectDelay;
QTimer dragExpand;
- QListViewItem* dragOverItem;
+ Q3ListViewItem* dragOverItem;
QPoint dragOverPoint;
QPoint startDragPos;
int dragDelay;
//US KListViewLineEdit *editor;
- QValueList<int> renameable;
+ Q3ValueList<int> renameable;
bool cursorInExecuteArea:1;
bool bUseSingle:1;
bool bChangeCursorOverItem:1;
bool itemsMovable:1;
bool selectedBySimpleMove : 1;
bool selectedUsingMouse:1;
bool itemsRenameable:1;
bool validDrag:1;
bool dragEnabled:1;
bool autoOpen:1;
bool dropVisualizer:1;
bool dropHighlighter:1;
bool createChildren:1;
bool pressedOnSelected:1;
bool wasShiftEvent:1;
bool fullWidth:1;
bool sortAscending:1;
bool tabRename:1;
int sortColumn;
//+1 means downwards (y increases, -1 means upwards, 0 means not selected), aleXXX
int selectionDirection;
int tooltipColumn;
SelectionModeExt selectionMode;
int contextMenuKey;
bool showContextMenusOnPress;
QRect mOldDropVisualizer;
int mDropVisualizerWidth;
QRect mOldDropHighlighter;
- QListViewItem *afterItemDrop;
- QListViewItem *parentItemDrop;
+ Q3ListViewItem *afterItemDrop;
+ Q3ListViewItem *parentItemDrop;
QColor alternateBackground;
};
/*US
KListViewLineEdit::KListViewLineEdit(KListView *parent)
: KLineEdit(parent->viewport()), item(0), col(0), p(parent)
{
setFrame( false );
hide();
connect( parent, SIGNAL( selectionChanged() ), SLOT( slotSelectionChanged() ));
}
KListViewLineEdit::~KListViewLineEdit()
{
}
void KListViewLineEdit::load(QListViewItem *i, int c)
{
item=i;
col=c;
QRect rect(p->itemRect(i));
setText(item->text(c));
@@ -205,83 +220,83 @@ void KListViewLineEdit::load(QListViewItem *i, int c)
fieldX += p->columnWidth( p->header()->mapToSection( index ));
if ( col == 0 ) {
int d = i->depth() + (p->rootIsDecorated() ? 1 : 0);
d *= p->treeStepSize();
fieldX += d;
fieldW -= d;
}
if ( i->pixmap( col ) ) {// add width of pixmap
int d = i->pixmap( col )->width();
fieldX += d;
fieldW -= d;
}
setGeometry(fieldX, rect.y() - 1, fieldW, rect.height() + 2);
show();
setFocus();
}
*/
/* Helper functions to for
* tabOrderedRename functionality.
*/
-static int nextCol (KListView *pl, QListViewItem *pi, int start, int dir)
+static int nextCol (KListView *pl, Q3ListViewItem *pi, int start, int dir)
{
if (pi)
{
// Find the next renameable column in the current row
for (; ((dir == +1) ? (start < pl->columns()) : (start >= 0)); start += dir)
if (pl->isRenameable(start))
return start;
}
return -1;
}
-static QListViewItem *prevItem (QListViewItem *pi)
+static Q3ListViewItem *prevItem (Q3ListViewItem *pi)
{
- QListViewItem *pa = pi->itemAbove();
+ Q3ListViewItem *pa = pi->itemAbove();
/* Does what the QListViewItem::previousSibling()
* of my dreams would do.
*/
if (pa && pa->parent() == pi->parent())
return pa;
return NULL;
}
-static QListViewItem *lastQChild (QListViewItem *pi)
+static Q3ListViewItem *lastQChild (Q3ListViewItem *pi)
{
if (pi)
{
/* Since there's no QListViewItem::lastChild().
* This finds the last sibling for the given
* item.
*/
- for (QListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling())
+ for (Q3ListViewItem *pt = pi->nextSibling(); pt; pt = pt->nextSibling())
pi = pt;
}
return pi;
}
/*US
void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool forward)
{
const int ncols = p->columns();
const int dir = forward ? +1 : -1;
const int restart = forward ? 0 : (ncols - 1);
QListViewItem *top = (pitem && pitem->parent())
? pitem->parent()->firstChild()
: p->firstChild();
QListViewItem *pi = pitem;
terminate(); // Save current changes
do
{
*/
/* Check the rest of the current row for an editable column,
* if that fails, check the entire next/previous row. The
* last case goes back to the first item in the current branch
@@ -307,52 +322,52 @@ void KListViewLineEdit::selectNextCell (QListViewItem *pitem, int column, bool f
if (!item)
continue;
break;
}
}
}
while (pi && !item);
}
*/
/*US
#ifdef KeyPress
#undef KeyPress
#endif
bool KListViewLineEdit::event (QEvent *pe)
{
if (pe->type() == QEvent::KeyPress)
{
QKeyEvent *k = (QKeyEvent *) pe;
if ((k->key() == Qt::Key_Backtab || k->key() == Qt::Key_Tab) &&
p->tabOrderedRenaming() && p->itemsRenameable() &&
- !(k->state() & ControlButton || k->state() & AltButton))
+ !(k->state() & Qt::ControlButton || k->state() & AltButton))
{
selectNextCell(item, col,
- (k->key() == Key_Tab && !(k->state() & ShiftButton)));
+ (k->key() == Key_Tab && !(k->state() & Qt::ShiftButton)));
return true;
}
}
return KLineEdit::event(pe);
}
void KListViewLineEdit::keyPressEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter )
terminate(true);
else if(e->key() == Qt::Key_Escape)
terminate(false);
else if (e->key() == Qt::Key_Down || e->key() == Qt::Key_Up)
{
terminate(true);
KLineEdit::keyPressEvent(e);
}
else
KLineEdit::keyPressEvent(e);
}
void KListViewLineEdit::terminate()
{
@@ -385,182 +400,182 @@ void KListViewLineEdit::focusOutEvent(QFocusEvent *ev)
void KListViewLineEdit::paintEvent( QPaintEvent *e )
{
KLineEdit::paintEvent( e );
if ( !frame() ) {
QPainter p( this );
p.setClipRegion( e->region() );
p.drawRect( rect() );
}
}
// selection changed -> terminate. As our "item" can be already deleted,
// we can't call terminate(false), because that would emit done() with
// a dangling pointer to "item".
void KListViewLineEdit::slotSelectionChanged()
{
item = 0;
col = 0;
hide();
}
*/
KListView::KListView( QWidget *parent, const char *name ,bool emulateRightMouse )
- : QListView( parent, name ),
+ : Q3ListView( parent, name ),
d (new KListViewPrivate (this))
{
#ifndef DESKTOP_VERSION
if ( emulateRightMouse )
QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
#endif
//US setDragAutoScroll(true);
connect( this, SIGNAL( onViewport() ),
this, SLOT( slotOnViewport() ) );
- connect( this, SIGNAL( onItem( QListViewItem * ) ),
- this, SLOT( slotOnItem( QListViewItem * ) ) );
+ connect( this, SIGNAL( onItem( Q3ListViewItem * ) ),
+ this, SLOT( slotOnItem( Q3ListViewItem * ) ) );
connect (this, SIGNAL(contentsMoving(int,int)),
this, SLOT(cleanDropVisualizer()));
connect (this, SIGNAL(contentsMoving(int,int)),
this, SLOT(cleanItemHighlighter()));
/*US
slotSettingsChanged(KApplication::SETTINGS_MOUSE);
if (kapp)
{
connect( kapp, SIGNAL( settingsChanged(int) ), SLOT( slotSettingsChanged(int) ) );
kapp->addKipcEventMask( KIPC::SettingsChanged );
}
*/
slotSettingsChanged(1); //US do this to initialize the connections
connect(&d->autoSelect, SIGNAL( timeout() ),
this, SLOT( slotAutoSelect() ) );
connect(&d->dragExpand, SIGNAL( timeout() ),
this, SLOT( slotDragExpand() ) );
// context menu handling
if (d->showContextMenusOnPress)
{
- connect (this, SIGNAL (rightButtonPressed (QListViewItem*, const QPoint&, int)),
- this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
+ connect (this, SIGNAL (rightButtonPressed (Q3ListViewItem*, const QPoint&, int)),
+ this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int)));
}
else
{
- connect (this, SIGNAL (rightButtonClicked (QListViewItem*, const QPoint&, int)),
- this, SLOT (emitContextMenu (QListViewItem*, const QPoint&, int)));
+ connect (this, SIGNAL (rightButtonClicked (Q3ListViewItem*, const QPoint&, int)),
+ this, SLOT (emitContextMenu (Q3ListViewItem*, const QPoint&, int)));
}
- connect (this, SIGNAL (menuShortCutPressed (KListView*, QListViewItem*)),
- this, SLOT (emitContextMenu (KListView*, QListViewItem*)));
+ connect (this, SIGNAL (menuShortCutPressed (KListView*, Q3ListViewItem*)),
+ this, SLOT (emitContextMenu (KListView*, Q3ListViewItem*)));
//qDebug("KListView::KListView make alternate color configurable");
d->alternateBackground = KGlobalSettings::alternateBackgroundColor();
}
KListView::~KListView()
{
delete d;
}
bool KListView::isExecuteArea( const QPoint& point )
{
if ( itemAt( point ) )
return isExecuteArea( point.x() );
return false;
}
QSize KListView::sizeHint() const
{
//qDebug("KListView::QSize sizeHint() ");
#ifdef DESKTOP_VERSION
- return QListView::sizeHint();
+ return Q3ListView::sizeHint();
#else
return QSize ( 40, 40 );
#endif
}
bool KListView::isExecuteArea( int x )
{
if( allColumnsShowFocus() )
return true;
else {
int offset = 0;
int width = columnWidth( 0 );
int pos = header()->mapToIndex( 0 );
for ( int index = 0; index < pos; index++ )
offset += columnWidth( header()->mapToSection( index ) );
x += contentsX(); // in case of a horizontal scrollbar
return ( x > offset && x < ( offset + width ) );
}
}
-void KListView::slotOnItem( QListViewItem *item )
+void KListView::slotOnItem( Q3ListViewItem *item )
{
QPoint vp = viewport()->mapFromGlobal( QCursor::pos() );
if ( item && isExecuteArea( vp.x() ) && (d->autoSelectDelay > -1) && d->bUseSingle ) {
d->autoSelect.start( d->autoSelectDelay, true );
d->pCurrentItem = item;
}
}
void KListView::slotOnViewport()
{
if ( d->bChangeCursorOverItem )
viewport()->unsetCursor();
d->autoSelect.stop();
d->pCurrentItem = 0L;
}
void KListView::slotSettingsChanged(int category)
{
//qDebug("KListView::slotSettingsChanged has to be verified");
switch (category)
{
//US I create my private category (=1) to set the settings
case 1:
d->dragDelay = 2;
//US set explicitly d->bUseSingle = KGlobalSettings::singleClick();
// qDebug("KListView::slotSettingsChanged: single%i", d->bUseSingle);
- disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
- this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int)));
+ disconnect(this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)),
+ this, SLOT (slotMouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)));
if( d->bUseSingle )
- connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
- this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int)));
+ connect (this, SIGNAL (mouseButtonClicked (int, Q3ListViewItem*, const QPoint &, int)),
+ this, SLOT (slotMouseButtonClicked( int, Q3ListViewItem*, const QPoint &, int)));
//US d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
//US d->autoSelectDelay = KGlobalSettings::autoSelectDelay();
if( !d->bUseSingle || !d->bChangeCursorOverItem )
viewport()->unsetCursor();
break;
/*US
case KApplication::SETTINGS_MOUSE:
d->dragDelay = KGlobalSettings::dndEventDelay();
d->bUseSingle = KGlobalSettings::singleClick();
disconnect(this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
this, SLOT (slotMouseButtonClicked (int, QListViewItem*, const QPoint &, int)));
if( d->bUseSingle )
connect (this, SIGNAL (mouseButtonClicked (int, QListViewItem*, const QPoint &, int)),
this, SLOT (slotMouseButtonClicked( int, QListViewItem*, const QPoint &, int)));
d->bChangeCursorOverItem = KGlobalSettings::changeCursorOverIcon();
d->autoSelectDelay = KGlobalSettings::autoSelectDelay();
@@ -590,438 +605,438 @@ void KListView::slotSettingsChanged(int category)
*/
default:
break;
}
}
void KListView::slotAutoSelect()
{
// check that the item still exists
if( itemIndex( d->pCurrentItem ) == -1 )
return;
if (!isActiveWindow())
{
d->autoSelect.stop();
return;
}
//Give this widget the keyboard focus.
if( !hasFocus() )
setFocus();
- QListViewItem* previousItem = currentItem();
+ Q3ListViewItem* previousItem = currentItem();
setCurrentItem( d->pCurrentItem );
#if 0
#ifndef Q_WS_QWS
// FIXME(E): Implement for Qt Embedded
if( d->pCurrentItem ) {
//Shift pressed?
if( (keybstate & ShiftMask) ) {
bool block = signalsBlocked();
blockSignals( true );
//No Ctrl? Then clear before!
if( !(keybstate & ControlMask) )
clearSelection();
bool select = !d->pCurrentItem->isSelected();
bool update = viewport()->isUpdatesEnabled();
viewport()->setUpdatesEnabled( false );
bool down = previousItem->itemPos() < d->pCurrentItem->itemPos();
- QListViewItemIterator lit( down ? previousItem : d->pCurrentItem );
+ Q3ListViewItemIterator lit( down ? previousItem : d->pCurrentItem );
for ( ; lit.current(); ++lit ) {
if ( down && lit.current() == d->pCurrentItem ) {
d->pCurrentItem->setSelected( select );
break;
}
if ( !down && lit.current() == previousItem ) {
previousItem->setSelected( select );
break;
}
lit.current()->setSelected( select );
}
blockSignals( block );
viewport()->setUpdatesEnabled( update );
triggerUpdate();
emit selectionChanged();
- if( selectionMode() == QListView::Single )
+ if( selectionMode() == Q3ListView::Single )
emit selectionChanged( d->pCurrentItem );
}
else if( (keybstate & ControlMask) )
setSelected( d->pCurrentItem, !d->pCurrentItem->isSelected() );
else {
bool block = signalsBlocked();
blockSignals( true );
if( !d->pCurrentItem->isSelected() )
clearSelection();
blockSignals( block );
setSelected( d->pCurrentItem, true );
}
}
else
kdDebug() << "KListView::slotAutoSelect: Thats not supposed to happen!!!!" << endl;
#endif
#endif
}
void KListView::slotHeaderChanged()
{
if (d->fullWidth && columns())
{
int w = 0;
for (int i = 0; i < columns() - 1; ++i) w += columnWidth(i);
setColumnWidth( columns() - 1, viewport()->width() - w - 1 );
}
}
-void KListView::emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c)
+void KListView::emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c)
{
// qDebug("KListView::emitExecute buttonstate=%i", buttonstate);
if( isExecuteArea( viewport()->mapFromGlobal(pos) ) ) {
// Double click mode ?
if ( !d->bUseSingle )
{
emit executed( item );
emit executed( item, pos, c );
}
else
{
//US special implementation for embedded systems
d->autoSelect.stop();
//Dont emit executed if in SC mode and Shift or Ctrl are pressed
- if( !( (buttonstate==ShiftButton) || (buttonstate==ControlButton) )) {
+ if( !( (buttonstate==Qt::ShiftButton) || (buttonstate==Qt::ControlButton) )) {
// if( !( ((keybstate & ShiftMask) || (keybstate & ControlMask)) ) ) {
emit executed( item );
emit executed( item, pos, c );
}
}
}
}
void KListView::focusInEvent( QFocusEvent *fe )
{
// kdDebug()<<"KListView::focusInEvent()"<<endl;
- QListView::focusInEvent( fe );
+ Q3ListView::focusInEvent( fe );
if ((d->selectedBySimpleMove)
&& (d->selectionMode == FileManager)
&& (fe->reason()!=QFocusEvent::Popup)
&& (fe->reason()!=QFocusEvent::ActiveWindow)
&& (currentItem()!=0))
{
currentItem()->setSelected(true);
currentItem()->repaint();
emit selectionChanged();
};
}
void KListView::focusOutEvent( QFocusEvent *fe )
{
cleanDropVisualizer();
cleanItemHighlighter();
d->autoSelect.stop();
if ((d->selectedBySimpleMove)
&& (d->selectionMode == FileManager)
&& (fe->reason()!=QFocusEvent::Popup)
&& (fe->reason()!=QFocusEvent::ActiveWindow)
&& (currentItem()!=0)
/*US && (!d->editor->isVisible()) */
)
{
currentItem()->setSelected(false);
currentItem()->repaint();
emit selectionChanged();
};
- QListView::focusOutEvent( fe );
+ Q3ListView::focusOutEvent( fe );
}
void KListView::leaveEvent( QEvent *e )
{
d->autoSelect.stop();
- QListView::leaveEvent( e );
+ Q3ListView::leaveEvent( e );
}
bool KListView::event( QEvent *e )
{
if (e->type() == QEvent::ApplicationPaletteChange) {
//qDebug("KListView::event make alternate color configurable");
//US d->alternateBackground=KGlobalSettings::alternateBackgroundColor();
d->alternateBackground = QColor(240, 240, 240);
}
- return QListView::event(e);
+ return Q3ListView::event(e);
}
void KListView::contentsMousePressEvent( QMouseEvent *e )
{
//qDebug("KListView::contentsMousePressEvent");
- if( (selectionModeExt() == Extended) && (e->state() & ShiftButton) && !(e->state() & ControlButton) )
+ if( (selectionModeExt() == Extended) && (e->state() & Qt::ShiftButton) && !(e->state() & Qt::ControlButton) )
{
bool block = signalsBlocked();
blockSignals( true );
clearSelection();
blockSignals( block );
}
else if ((selectionModeExt()==FileManager) && (d->selectedBySimpleMove))
{
d->selectedBySimpleMove=false;
d->selectedUsingMouse=true;
if (currentItem()!=0)
{
currentItem()->setSelected(false);
currentItem()->repaint();
// emit selectionChanged();
};
};
QPoint p( contentsToViewport( e->pos() ) );
- QListViewItem *at = itemAt (p);
+ Q3ListViewItem *at = itemAt (p);
// true if the root decoration of the item "at" was clicked (i.e. the +/- sign)
bool rootDecoClicked = at
&& ( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
&& ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
- if (e->button() == LeftButton && !rootDecoClicked)
+ if (e->button() == Qt::LeftButton && !rootDecoClicked)
{
//Start a drag
d->startDragPos = e->pos();
if (at)
{
d->validDrag = true;
d->pressedOnSelected = at->isSelected();
}
}
- QListView::contentsMousePressEvent( e );
+ Q3ListView::contentsMousePressEvent( e );
}
void KListView::contentsMouseMoveEvent( QMouseEvent *e )
{
if (!dragEnabled() || d->startDragPos.isNull() || !d->validDrag) {
- QListView::contentsMouseMoveEvent (e);
+ Q3ListView::contentsMouseMoveEvent (e);
return;
}
QPoint vp = contentsToViewport(e->pos());
- QListViewItem *item = itemAt( vp );
+ Q3ListViewItem *item = itemAt( vp );
//do we process cursor changes at all?
if ( item && d->bChangeCursorOverItem && d->bUseSingle )
{
//Cursor moved on a new item or in/out the execute area
if( (item != d->pCurrentItem) ||
(isExecuteArea(vp) != d->cursorInExecuteArea) )
{
d->cursorInExecuteArea = isExecuteArea(vp);
//qDebug("KListView::contentsMouseMoveEvent drag&drop not supported yet");
/*US
if( d->cursorInExecuteArea ) //cursor moved in execute area
viewport()->setCursor( KCursor::handCursor() );
else //cursor moved out of execute area
viewport()->unsetCursor();
*/
}
}
bool dragOn = dragEnabled();
QPoint newPos = e->pos();
if (dragOn && d->validDrag &&
(newPos.x() > d->startDragPos.x()+d->dragDelay ||
newPos.x() < d->startDragPos.x()-d->dragDelay ||
newPos.y() > d->startDragPos.y()+d->dragDelay ||
newPos.y() < d->startDragPos.y()-d->dragDelay))
//(d->startDragPos - e->pos()).manhattanLength() > QApplication::startDragDistance())
{
- QListView::contentsMouseReleaseEvent( 0 );
+ Q3ListView::contentsMouseReleaseEvent( 0 );
startDrag();
d->startDragPos = QPoint();
d->validDrag = false;
}
}
void KListView::contentsMouseReleaseEvent( QMouseEvent *e )
{
- if (e->button() == LeftButton)
+ if (e->button() == Qt::LeftButton)
{
// If the row was already selected, maybe we want to start an in-place editing
if ( d->pressedOnSelected && itemsRenameable() )
{
QPoint p( contentsToViewport( e->pos() ) );
- QListViewItem *at = itemAt (p);
+ Q3ListViewItem *at = itemAt (p);
if ( at )
{
// true if the root decoration of the item "at" was clicked (i.e. the +/- sign)
bool rootDecoClicked =
( p.x() <= header()->cellPos( header()->mapToActual( 0 ) ) +
treeStepSize() * ( at->depth() + ( rootIsDecorated() ? 1 : 0) ) + itemMargin() )
&& ( p.x() >= header()->cellPos( header()->mapToActual( 0 ) ) );
if (!rootDecoClicked)
{
int col = header()->mapToLogical( header()->cellAt( p.x() ) );
if ( d->renameable.contains(col) )
rename(at, col);
}
}
}
d->pressedOnSelected = false;
d->validDrag = false;
d->startDragPos = QPoint();
}
- QListView::contentsMouseReleaseEvent( e );
+ Q3ListView::contentsMouseReleaseEvent( e );
}
void KListView::contentsMouseDoubleClickEvent ( QMouseEvent *e )
{
//qDebug("KListView::contentsMouseDoubleClickEvent");
// We don't want to call the parent method because it does setOpen,
// whereas we don't do it in single click mode... (David)
//QListView::contentsMouseDoubleClickEvent( e );
QPoint vp = contentsToViewport(e->pos());
- QListViewItem *item = itemAt( vp );
- emit QListView::doubleClicked( item ); // we do it now
+ Q3ListViewItem *item = itemAt( vp );
+ emit Q3ListView::doubleClicked( item ); // we do it now
int col = item ? header()->mapToLogical( header()->cellAt( vp.x() ) ) : -1;
if( item ) {
//qDebug("KListView::contentsMouseDoubleClickEvent: emit doubleClicked");
emit doubleClicked( item, e->globalPos(), col );
- if( (e->button() == LeftButton) && !d->bUseSingle ) {
+ if( (e->button() == Qt::LeftButton) && !d->bUseSingle ) {
//qDebug("KListView::contentsMouseDoubleClickEvent: emitExecute");
emitExecute( e->button(), item, e->globalPos(), col);
}
}
}
-void KListView::slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c )
+void KListView::slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c )
{
//qDebug("KListView::slotMouseButtonClicked");
- if( (btn == LeftButton) && item ) {
+ if( (btn == Qt::LeftButton) && item ) {
//qDebug("KListView::slotMouseButtonClicked: emitExecute");
emitExecute(btn, item, pos, c);
}
}
void KListView::contentsDropEvent(QDropEvent* e)
{
qDebug("KListView::contentsDropEvent drag&drop not supported yet");
/*US
cleanDropVisualizer();
cleanItemHighlighter();
d->dragExpand.stop();
if (acceptDrag (e))
{
e->acceptAction();
QListViewItem *afterme;
QListViewItem *parent;
findDrop(e->pos(), parent, afterme);
if (e->source() == viewport() && itemsMovable())
movableDropEvent(parent, afterme);
else
{
emit dropped(e, afterme);
emit dropped(this, e, afterme);
emit dropped(e, parent, afterme);
emit dropped(this, e, parent, afterme);
}
}
*/
}
-void KListView::movableDropEvent (QListViewItem* parent, QListViewItem* afterme)
+void KListView::movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme)
{
- QPtrList<QListViewItem> items, afterFirsts, afterNows;
- QListViewItem *current=currentItem();
+ Q3PtrList<Q3ListViewItem> items, afterFirsts, afterNows;
+ Q3ListViewItem *current=currentItem();
bool hasMoved=false;
- for (QListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext)
+ for (Q3ListViewItem *i = firstChild(), *iNext=0; i != 0; i = iNext)
{
iNext=i->itemBelow();
if (!i->isSelected())
continue;
// don't drop an item after itself, or else
// it moves to the top of the list
if (i==afterme)
continue;
i->setSelected(false);
- QListViewItem *afterFirst = i->itemAbove();
+ Q3ListViewItem *afterFirst = i->itemAbove();
if (!hasMoved)
{
emit aboutToMove();
hasMoved=true;
}
moveItem(i, parent, afterme);
// ###### This should include the new parent !!! -> KDE 3.0
// If you need this right now, have a look at keditbookmarks.
emit moved(i, afterFirst, afterme);
items.append (i);
afterFirsts.append (afterFirst);
afterNows.append (afterme);
afterme = i;
}
clearSelection();
- for (QListViewItem *i=items.first(); i != 0; i=items.next() )
+ for (Q3ListViewItem *i=items.first(); i != 0; i=items.next() )
i->setSelected(true);
if (current)
setCurrentItem(current);
emit moved(items,afterFirsts,afterNows);
if (firstChild())
emit moved();
}
void KListView::contentsDragMoveEvent(QDragMoveEvent *event)
{
qDebug("KListView::contentsDropEvent drag&drop not supported yet");
/*US
if (acceptDrag(event))
{
event->acceptAction();
//Clean up the view
findDrop(event->pos(), d->parentItemDrop, d->afterItemDrop);
QPoint vp = contentsToViewport( event->pos() );
QListViewItem *item = isExecuteArea( vp ) ? itemAt( vp ) : 0L;
if ( item != d->dragOverItem )
@@ -1065,155 +1080,155 @@ void KListView::slotDragExpand()
}
void KListView::contentsDragLeaveEvent (QDragLeaveEvent*)
{
d->dragExpand.stop();
cleanDropVisualizer();
cleanItemHighlighter();
}
void KListView::cleanDropVisualizer()
{
if (d->mOldDropVisualizer.isValid())
{
QRect rect=d->mOldDropVisualizer;
d->mOldDropVisualizer = QRect();
viewport()->repaint(rect, true);
}
}
int KListView::depthToPixels( int depth )
{
return treeStepSize() * ( depth + (rootIsDecorated() ? 1 : 0) ) + itemMargin();
}
-void KListView::findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after)
+void KListView::findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after)
{
QPoint p (contentsToViewport(pos));
// Get the position to put it in
- QListViewItem *atpos = itemAt(p);
+ Q3ListViewItem *atpos = itemAt(p);
- QListViewItem *above;
+ Q3ListViewItem *above;
if (!atpos) // put it at the end
above = lastItem();
else
{
// Get the closest item before us ('atpos' or the one above, if any)
if (p.y() - itemRect(atpos).topLeft().y() < (atpos->height()/2))
above = atpos->itemAbove();
else
above = atpos;
}
if (above)
{
// Now, we know we want to go after "above". But as a child or as a sibling ?
// We have to ask the "above" item if it accepts children.
if (above->isExpandable())
{
// The mouse is sufficiently on the right ? - doesn't matter if 'above' has visible children
if (p.x() >= depthToPixels( above->depth() + 1 ) ||
(above->isOpen() && above->childCount() > 0) )
{
parent = above;
after = 0L;
return;
}
}
// Ok, there's one more level of complexity. We may want to become a new
// sibling, but of an upper-level group, rather than the "above" item
- QListViewItem * betterAbove = above->parent();
- QListViewItem * last = above;
+ Q3ListViewItem * betterAbove = above->parent();
+ Q3ListViewItem * last = above;
while ( betterAbove )
{
// We are allowed to become a sibling of "betterAbove" only if we are
// after its last child
if ( last->nextSibling() == 0 )
{
if (p.x() < depthToPixels ( betterAbove->depth() + 1 ))
above = betterAbove; // store this one, but don't stop yet, there may be a better one
else
break; // not enough on the left, so stop
last = betterAbove;
betterAbove = betterAbove->parent(); // up one level
} else
break; // we're among the child of betterAbove, not after the last one
}
}
// set as sibling
after = above;
parent = after ? after->parent() : 0L ;
}
-QListViewItem* KListView::lastChild () const
+Q3ListViewItem* KListView::lastChild () const
{
- QListViewItem* lastchild = firstChild();
+ Q3ListViewItem* lastchild = firstChild();
if (lastchild)
for (; lastchild->nextSibling(); lastchild = lastchild->nextSibling());
return lastchild;
}
-QListViewItem *KListView::lastItem() const
+Q3ListViewItem *KListView::lastItem() const
{
- QListViewItem* last = lastChild();
+ Q3ListViewItem* last = lastChild();
- for (QListViewItemIterator it (last); it.current(); ++it)
+ for (Q3ListViewItemIterator it (last); it.current(); ++it)
last = it.current();
return last;
}
KLineEdit *KListView::renameLineEdit() const
{
//US return d->editor;
qDebug("KListView::renameLineEdit returns 0. Might crash");
return 0;
}
void KListView::startDrag()
{
qDebug("KListView::startDrag drag&drop not supported yet.");
/*US
QDragObject *drag = dragObject();
if (!drag)
return;
if (drag->drag() && drag->target() != viewport())
emit moved();
*/
}
-QDragObject *KListView::dragObject()
+Q3DragObject *KListView::dragObject()
{
if (!currentItem())
return 0;
- return new QStoredDrag("application/x-qlistviewitem", viewport());
+ return new Q3StoredDrag("application/x-qlistviewitem", viewport());
}
void KListView::setItemsMovable(bool b)
{
d->itemsMovable=b;
}
bool KListView::itemsMovable() const
{
return d->itemsMovable;
}
void KListView::setItemsRenameable(bool b)
{
d->itemsRenameable=b;
}
bool KListView::itemsRenameable() const
{
return d->itemsRenameable;
}
void KListView::setDragEnabled(bool b)
@@ -1225,817 +1240,817 @@ bool KListView::dragEnabled() const
{
return d->dragEnabled;
}
void KListView::setAutoOpen(bool b)
{
d->autoOpen=b;
}
bool KListView::autoOpen() const
{
return d->autoOpen;
}
bool KListView::dropVisualizer() const
{
return d->dropVisualizer;
}
void KListView::setDropVisualizer(bool b)
{
d->dropVisualizer=b;
}
-QPtrList<QListViewItem> KListView::selectedItems() const
+Q3PtrList<Q3ListViewItem> KListView::selectedItems() const
{
- QPtrList<QListViewItem> list;
- for (QListViewItem *i=firstChild(); i!=0; i=i->itemBelow())
+ Q3PtrList<Q3ListViewItem> list;
+ for (Q3ListViewItem *i=firstChild(); i!=0; i=i->itemBelow())
if (i->isSelected()) list.append(i);
return list;
}
-void KListView::moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after)
+void KListView::moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after)
{
// sanity check - don't move a item into it's own child structure
- QListViewItem *i = parent;
+ Q3ListViewItem *i = parent;
while(i)
{
if(i == item)
return;
i = i->parent();
}
// Basically reimplementing the QListViewItem(QListViewItem*, QListViewItem*) constructor
// in here, without ever deleting the item.
if (item->parent())
item->parent()->takeItem(item);
else
takeItem(item);
if (parent)
parent->insertItem(item);
else
insertItem(item);
if (after)
;//item->moveToJustAfter(after);
}
void KListView::contentsDragEnterEvent(QDragEnterEvent *event)
{
qDebug("KListView::contentsDragEnterEvent drag&drop not supported yet.");
/*US
if (acceptDrag (event))
event->accept();
*/
}
void KListView::setDropVisualizerWidth (int w)
{
d->mDropVisualizerWidth = w > 0 ? w : 1;
}
-QRect KListView::drawDropVisualizer(QPainter *p, QListViewItem *parent,
- QListViewItem *after)
+QRect KListView::drawDropVisualizer(QPainter *p, Q3ListViewItem *parent,
+ Q3ListViewItem *after)
{
QRect insertmarker;
if (!after && !parent)
insertmarker = QRect (0, 0, viewport()->width(), d->mDropVisualizerWidth/2);
else
{
int level = 0;
if (after)
{
- QListViewItem* it = 0L;
+ Q3ListViewItem* it = 0L;
if (after->isOpen())
{
// Look for the last child (recursively)
it = after->firstChild();
if (it)
while (it->nextSibling() || it->firstChild())
if ( it->nextSibling() )
it = it->nextSibling();
else
it = it->firstChild();
}
insertmarker = itemRect (it ? it : after);
level = after->depth();
}
else if (parent)
{
insertmarker = itemRect (parent);
level = parent->depth() + 1;
}
insertmarker.setLeft( treeStepSize() * ( level + (rootIsDecorated() ? 1 : 0) ) + itemMargin() );
insertmarker.setRight (viewport()->width());
insertmarker.setTop (insertmarker.bottom() - d->mDropVisualizerWidth/2 + 1);
insertmarker.setBottom (insertmarker.bottom() + d->mDropVisualizerWidth/2);
}
// This is not used anymore, at least by KListView itself (see viewportPaintEvent)
// Remove for KDE 3.0.
if (p)
- p->fillRect(insertmarker, Dense4Pattern);
+ p->fillRect(insertmarker, Qt::Dense4Pattern);
return insertmarker;
}
-QRect KListView::drawItemHighlighter(QPainter *painter, QListViewItem *item)
+QRect KListView::drawItemHighlighter(QPainter *painter, Q3ListViewItem *item)
{
QRect r;
if (item)
{
r = itemRect(item);
r.setLeft(r.left()+(item->depth()+1)*treeStepSize());
if (painter) {
//US style().drawPrimitive(QStyle::PE_FocusRect, painter, r, colorGroup(),
//US QStyle::Style_FocusAtBorder, colorGroup().highlight());
const QColor* pHighl = &(colorGroup().highlight());
//LR style().drawFocusRect(painter, r, colorGroup(), pHighl, true);
qDebug("KListView::drawItemHighlighter has to be verified");
}
}
return r;
}
void KListView::cleanItemHighlighter ()
{
if (d->mOldDropHighlighter.isValid())
{
QRect rect=d->mOldDropHighlighter;
d->mOldDropHighlighter = QRect();
viewport()->repaint(rect, true);
}
}
-void KListView::rename(QListViewItem *item, int c)
+void KListView::rename(Q3ListViewItem *item, int c)
{
if (d->renameable.contains(c))
{
ensureItemVisible(item);
//US d->editor->load(item,c);
qDebug("KListView::rename has to be verified");
}
}
bool KListView::isRenameable (int col) const
{
return d->renameable.contains(col);
}
void KListView::setRenameable (int col, bool yesno)
{
if (col>=header()->count()) return;
d->renameable.remove(col);
if (yesno && d->renameable.find(col)==d->renameable.end())
d->renameable+=col;
else if (!yesno && d->renameable.find(col)!=d->renameable.end())
d->renameable.remove(col);
}
-void KListView::doneEditing(QListViewItem *item, int row)
+void KListView::doneEditing(Q3ListViewItem *item, int row)
{
emit itemRenamed(item, item->text(row), row);
emit itemRenamed(item);
}
bool KListView::acceptDrag(QDropEvent* e) const
{
qDebug("KListView::acceptDrag drag&drop not supported yet");
//US return acceptDrops() && itemsMovable() && (e->source()==viewport());
return false;
}
void KListView::setCreateChildren(bool b)
{
d->createChildren=b;
}
bool KListView::createChildren() const
{
return d->createChildren;
}
int KListView::tooltipColumn() const
{
return d->tooltipColumn;
}
void KListView::setTooltipColumn(int column)
{
d->tooltipColumn=column;
}
void KListView::setDropHighlighter(bool b)
{
d->dropHighlighter=b;
}
bool KListView::dropHighlighter() const
{
return d->dropHighlighter;
}
-bool KListView::showTooltip(QListViewItem *item, const QPoint &, int column) const
+bool KListView::showTooltip(Q3ListViewItem *item, const QPoint &, int column) const
{
return ((tooltip(item, column).length()>0) && (column==tooltipColumn()));
}
-QString KListView::tooltip(QListViewItem *item, int column) const
+QString KListView::tooltip(Q3ListViewItem *item, int column) const
{
return item->text(column);
}
void KListView::setTabOrderedRenaming(bool b)
{
d->tabRename = b;
}
bool KListView::tabOrderedRenaming() const
{
return d->tabRename;
}
void KListView::keyPressEvent (QKeyEvent* e)
{
//don't we need a contextMenuModifier too ? (aleXXX)
if (e->key() == d->contextMenuKey)
{
emit menuShortCutPressed (this, currentItem());
return;
}
if (e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace)
{
emit signalDelete ( );
return;
}
if (d->selectionMode != FileManager)
- QListView::keyPressEvent (e);
+ Q3ListView::keyPressEvent (e);
else
fileManagerKeyPressEvent (e);
}
void KListView::activateAutomaticSelection()
{
d->selectedBySimpleMove=true;
d->selectedUsingMouse=false;
if (currentItem()!=0)
{
selectAll(false);
currentItem()->setSelected(true);
currentItem()->repaint();
emit selectionChanged();
};
}
void KListView::deactivateAutomaticSelection()
{
d->selectedBySimpleMove=false;
}
bool KListView::automaticSelection() const
{
return d->selectedBySimpleMove;
}
void KListView::fileManagerKeyPressEvent (QKeyEvent* e)
{
//don't care whether it's on the keypad or not
- int e_state=(e->state() & ~Keypad);
+ int e_state=(e->state() & ~Qt::Keypad);
int oldSelectionDirection(d->selectionDirection);
- if ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
- && (e->key()!=Key_Meta) && (e->key()!=Key_Alt))
+ if ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control)
+ && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt))
{
- if ((e_state==ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove))
+ if ((e_state==Qt::ShiftButton) && (!d->wasShiftEvent) && (!d->selectedBySimpleMove))
selectAll(FALSE);
d->selectionDirection=0;
- d->wasShiftEvent = (e_state == ShiftButton);
+ d->wasShiftEvent = (e_state == Qt::ShiftButton);
};
- //d->wasShiftEvent = (e_state == ShiftButton);
+ //d->wasShiftEvent = (e_state == Qt::ShiftButton);
- QListViewItem* item = currentItem();
+ Q3ListViewItem* item = currentItem();
if (item==0) return;
- QListViewItem* repaintItem1 = item;
- QListViewItem* repaintItem2 = 0L;
- QListViewItem* visItem = 0L;
+ Q3ListViewItem* repaintItem1 = item;
+ Q3ListViewItem* repaintItem2 = 0L;
+ Q3ListViewItem* visItem = 0L;
- QListViewItem* nextItem = 0L;
+ Q3ListViewItem* nextItem = 0L;
int items = 0;
- bool shiftOrCtrl((e_state==ControlButton) || (e_state==ShiftButton));
+ bool shiftOrCtrl((e_state==Qt::ControlButton) || (e_state==Qt::ShiftButton));
int selectedItems(0);
- for (QListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling())
+ for (Q3ListViewItem *tmpItem=firstChild(); tmpItem!=0; tmpItem=tmpItem->nextSibling())
if (tmpItem->isSelected()) selectedItems++;
if (((selectedItems==0) || ((selectedItems==1) && (d->selectedUsingMouse)))
- && (e_state==NoButton)
- && ((e->key()==Key_Down)
- || (e->key()==Key_Up)
- || (e->key()==Key_Next)
- || (e->key()==Key_Prior)
- || (e->key()==Key_Home)
- || (e->key()==Key_End)))
+ && (e_state==Qt::NoButton)
+ && ((e->key()==Qt::Key_Down)
+ || (e->key()==Qt::Key_Up)
+ || (e->key()==Qt::Key_Next)
+ || (e->key()==Qt::Key_Prior)
+ || (e->key()==Qt::Key_Home)
+ || (e->key()==Qt::Key_End)))
{
d->selectedBySimpleMove=true;
d->selectedUsingMouse=false;
}
else if (selectedItems>1)
d->selectedBySimpleMove=false;
bool emitSelectionChanged(false);
switch (e->key())
{
- case Key_Escape:
+ case Qt::Key_Escape:
selectAll(FALSE);
emitSelectionChanged=TRUE;
break;
- case Key_Space:
+ case Qt::Key_Space:
//toggle selection of current item
if (d->selectedBySimpleMove)
d->selectedBySimpleMove=false;
item->setSelected(!item->isSelected());
emitSelectionChanged=TRUE;
break;
- case Key_Insert:
+ case Qt::Key_Insert:
//toggle selection of current item and move to the next item
if (d->selectedBySimpleMove)
{
d->selectedBySimpleMove=false;
if (!item->isSelected()) item->setSelected(TRUE);
}
else
{
item->setSelected(!item->isSelected());
};
nextItem=item->itemBelow();
if (nextItem!=0)
{
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
};
d->selectionDirection=1;
emitSelectionChanged=TRUE;
break;
- case Key_Down:
+ case Qt::Key_Down:
nextItem=item->itemBelow();
//toggle selection of current item and move to the next item
if (shiftOrCtrl)
{
d->selectionDirection=1;
if (d->selectedBySimpleMove)
d->selectedBySimpleMove=false;
else
{
if (oldSelectionDirection!=-1)
{
item->setSelected(!item->isSelected());
emitSelectionChanged=TRUE;
};
};
}
else if ((d->selectedBySimpleMove) && (nextItem!=0))
{
item->setSelected(false);
emitSelectionChanged=TRUE;
};
if (nextItem!=0)
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
};
break;
- case Key_Up:
+ case Qt::Key_Up:
nextItem=item->itemAbove();
d->selectionDirection=-1;
//move to the prev. item and toggle selection of this one
// => No, can't select the last item, with this. For symmetry, let's
// toggle selection and THEN move up, just like we do in down (David)
if (shiftOrCtrl)
{
if (d->selectedBySimpleMove)
d->selectedBySimpleMove=false;
else
{
if (oldSelectionDirection!=1)
{
item->setSelected(!item->isSelected());
emitSelectionChanged=TRUE;
};
}
}
else if ((d->selectedBySimpleMove) && (nextItem!=0))
{
item->setSelected(false);
emitSelectionChanged=TRUE;
};
if (nextItem!=0)
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
};
break;
- case Key_End:
+ case Qt::Key_End:
//move to the last item and toggle selection of all items inbetween
nextItem=item;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
d->selectedBySimpleMove=false;
while(nextItem!=0)
{
if (shiftOrCtrl)
nextItem->setSelected(!nextItem->isSelected());
if (nextItem->itemBelow()==0)
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
repaintItem2=nextItem;
visItem=nextItem;
setCurrentItem(nextItem);
}
nextItem=nextItem->itemBelow();
}
emitSelectionChanged=TRUE;
break;
- case Key_Home:
+ case Qt::Key_Home:
// move to the first item and toggle selection of all items inbetween
nextItem = firstChild();
visItem = nextItem;
repaintItem2 = visItem;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
{
d->selectedBySimpleMove=false;
while ( nextItem != item )
{
nextItem->setSelected( !nextItem->isSelected() );
nextItem = nextItem->itemBelow();
}
item->setSelected( !item->isSelected() );
}
setCurrentItem( firstChild() );
emitSelectionChanged=TRUE;
break;
- case Key_Next:
+ case Qt::Key_Next:
items=visibleHeight()/item->height();
nextItem=item;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
{
d->selectedBySimpleMove=false;
d->selectionDirection=1;
};
for (int i=0; i<items; i++)
{
if (shiftOrCtrl)
nextItem->setSelected(!nextItem->isSelected());
//the end
if ((i==items-1) || (nextItem->itemBelow()==0))
{
if (shiftOrCtrl)
nextItem->setSelected(!nextItem->isSelected());
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
ensureItemVisible(nextItem);
setCurrentItem(nextItem);
update();
if ((shiftOrCtrl) || (d->selectedBySimpleMove))
{
emit selectionChanged();
}
return;
}
nextItem=nextItem->itemBelow();
}
break;
- case Key_Prior:
+ case Qt::Key_Prior:
items=visibleHeight()/item->height();
nextItem=item;
if (d->selectedBySimpleMove)
item->setSelected(false);
if (shiftOrCtrl)
{
d->selectionDirection=-1;
d->selectedBySimpleMove=false;
};
for (int i=0; i<items; i++)
{
if ((nextItem!=item) &&(shiftOrCtrl))
nextItem->setSelected(!nextItem->isSelected());
//the end
if ((i==items-1) || (nextItem->itemAbove()==0))
{
if (d->selectedBySimpleMove)
nextItem->setSelected(true);
ensureItemVisible(nextItem);
setCurrentItem(nextItem);
update();
if ((shiftOrCtrl) || (d->selectedBySimpleMove))
{
emit selectionChanged();
}
return;
}
nextItem=nextItem->itemAbove();
}
break;
- case Key_Minus:
+ case Qt::Key_Minus:
if ( item->isOpen() )
setOpen( item, FALSE );
break;
- case Key_Plus:
+ case Qt::Key_Plus:
if ( !item->isOpen() && (item->isExpandable() || item->childCount()) )
setOpen( item, TRUE );
break;
default:
- bool realKey = ((e->key()!=Key_Shift) && (e->key()!=Key_Control)
- && (e->key()!=Key_Meta) && (e->key()!=Key_Alt));
+ bool realKey = ((e->key()!=Qt::Key_Shift) && (e->key()!=Qt::Key_Control)
+ && (e->key()!=Qt::Key_Meta) && (e->key()!=Qt::Key_Alt));
bool selectCurrentItem = (d->selectedBySimpleMove) && (item->isSelected());
if (realKey && selectCurrentItem)
item->setSelected(false);
//this is mainly for the "goto filename beginning with pressed char" feature (aleXXX)
- QListView::SelectionMode oldSelectionMode = selectionMode();
- setSelectionMode (QListView::Multi);
- QListView::keyPressEvent (e);
+ Q3ListView::SelectionMode oldSelectionMode = selectionMode();
+ setSelectionMode (Q3ListView::Multi);
+ Q3ListView::keyPressEvent (e);
setSelectionMode (oldSelectionMode);
if (realKey && selectCurrentItem)
{
currentItem()->setSelected(true);
emitSelectionChanged=TRUE;
}
repaintItem2=currentItem();
if (realKey)
visItem=currentItem();
break;
}
if (visItem)
ensureItemVisible(visItem);
QRect ir;
if (repaintItem1)
ir = ir.unite( itemRect(repaintItem1) );
if (repaintItem2)
ir = ir.unite( itemRect(repaintItem2) );
if ( !ir.isEmpty() )
{ // rectangle to be repainted
if ( ir.x() < 0 )
ir.moveBy( -ir.x(), 0 );
viewport()->repaint( ir, FALSE );
}
/*if (repaintItem1)
repaintItem1->repaint();
if (repaintItem2)
repaintItem2->repaint();*/
update();
if (emitSelectionChanged)
emit selectionChanged();
}
void KListView::setSelectionModeExt (SelectionModeExt mode)
{
d->selectionMode = mode;
switch (mode)
{
case Single:
case Multi:
case Extended:
case NoSelection:
- setSelectionMode (static_cast<QListView::SelectionMode>(static_cast<int>(mode)));
+ setSelectionMode (static_cast<Q3ListView::SelectionMode>(static_cast<int>(mode)));
break;
case FileManager:
- setSelectionMode (QListView::Extended);
+ setSelectionMode (Q3ListView::Extended);
break;
default:
kdWarning () << "Warning: illegal selection mode " << int(mode) << " set!" << endl;
break;
}
}
KListView::SelectionModeExt KListView::selectionModeExt () const
{
return d->selectionMode;
}
-int KListView::itemIndex( const QListViewItem *item ) const
+int KListView::itemIndex( const Q3ListViewItem *item ) const
{
if ( !item )
return -1;
if ( item == firstChild() )
return 0;
else {
- QListViewItemIterator it(firstChild());
+ Q3ListViewItemIterator it(firstChild());
uint j = 0;
for (; it.current() && it.current() != item; ++it, ++j );
if( !it.current() )
return -1;
return j;
}
}
-QListViewItem* KListView::itemAtIndex(int index)
+Q3ListViewItem* KListView::itemAtIndex(int index)
{
if (index<0)
return 0;
int j(0);
- for (QListViewItemIterator it=firstChild(); it.current(); it++)
+ for (Q3ListViewItemIterator it=firstChild(); it.current(); it++)
{
if (j==index)
return it.current();
j++;
};
return 0;
}
-void KListView::emitContextMenu (KListView*, QListViewItem* i)
+void KListView::emitContextMenu (KListView*, Q3ListViewItem* i)
{
QPoint p;
// qDebug("KListView::emitContextMenu ");
if (i)
p = viewport()->mapToGlobal(itemRect(i).center());
else
p = mapToGlobal(rect().center());
emit contextMenu (this, i, p);
}
-void KListView::emitContextMenu (QListViewItem* i, const QPoint& p, int col)
+void KListView::emitContextMenu (Q3ListViewItem* i, const QPoint& p, int col)
{
- QListViewItem* item = i;
+ Q3ListViewItem* item = i;
int c = col;
// do not trust the values for QListViewItem* i and int col;
// qDebug("KListView::emitContextMenu col");
if ( col == -1 ) {
QPoint pp = viewport()->mapFromGlobal(p);
item = itemAt( pp);
c = header()->sectionAt(pp.x() );
}
emit contextRequest( item, p, c );
emit contextMenu (this, item, p);
}
void KListView::setAcceptDrops (bool val)
{
- QListView::setAcceptDrops (val);
+ Q3ListView::setAcceptDrops (val);
viewport()->setAcceptDrops (val);
}
int KListView::dropVisualizerWidth () const
{
return d->mDropVisualizerWidth;
}
void KListView::viewportPaintEvent(QPaintEvent *e)
{
- QListView::viewportPaintEvent(e);
+ Q3ListView::viewportPaintEvent(e);
if (d->mOldDropVisualizer.isValid() && e->rect().intersects(d->mOldDropVisualizer))
{
QPainter painter(viewport());
// This is where we actually draw the drop-visualizer
- painter.fillRect(d->mOldDropVisualizer, Dense4Pattern);
+ painter.fillRect(d->mOldDropVisualizer, Qt::Dense4Pattern);
}
if (d->mOldDropHighlighter.isValid() && e->rect().intersects(d->mOldDropHighlighter))
{
QPainter painter(viewport());
qDebug("KListView::viewportPaintEvent has to be verified");
// This is where we actually draw the drop-highlighter
//US style().drawPrimitive(QStyle::PE_FocusRect, &painter, d->mOldDropHighlighter, colorGroup(),
//US QStyle::Style_FocusAtBorder);
//LR style().drawFocusRect(&painter, d->mOldDropHighlighter, colorGroup(), (const QColor*)0, true);
}
}
void KListView::setFullWidth()
{
setFullWidth(true);
}
void KListView::setFullWidth(bool fullWidth)
{
d->fullWidth = fullWidth;
//US header()->setStretchEnabled(fullWidth, columns()-1);
}
bool KListView::fullWidth() const
{
return d->fullWidth;
}
int KListView::addColumn(const QString& label, int width)
{
- int result = QListView::addColumn(label, width);
+ int result = Q3ListView::addColumn(label, width);
if (d->fullWidth) {
//US header()->setStretchEnabled(false, columns()-2);
//US header()->setStretchEnabled(true, columns()-1);
}
return result;
}
-int KListView::addColumn(const QIconSet& iconset, const QString& label, int width)
+int KListView::addColumn(const QIcon& iconset, const QString& label, int width)
{
- int result = QListView::addColumn(iconset, label, width);
+ int result = Q3ListView::addColumn(iconset, label, width);
if (d->fullWidth) {
//US header()->setStretchEnabled(false, columns()-2);
//US header()->setStretchEnabled(true, columns()-1);
}
return result;
}
void KListView::removeColumn(int index)
{
- QListView::removeColumn(index);
+ Q3ListView::removeColumn(index);
//US if (d->fullWidth && index == columns()) header()->setStretchEnabled(true, columns()-1);
}
void KListView::viewportResizeEvent(QResizeEvent* e)
{
- QListView::viewportResizeEvent(e);
+ Q3ListView::viewportResizeEvent(e);
}
const QColor &KListView::alternateBackground() const
{
return d->alternateBackground;
}
void KListView::setAlternateBackground(const QColor &c)
{
d->alternateBackground = c;
repaint();
}
void KListView::saveLayout(KConfig *config, const QString &group) const
{
KConfigGroupSaver saver(config, group);
QStringList widths, order;
for (int i = 0; i < columns(); ++i)
{
widths << QString::number(columnWidth(i));
order << QString::number(header()->mapToIndex(i));
}
config->writeEntry("ColumnWidths", widths);
config->writeEntry("ColumnOrder", order);
@@ -2049,113 +2064,113 @@ void KListView::restoreLayout(KConfig *config, const QString &group)
QStringList cols = config->readListEntry("ColumnWidths");
int i = 0;
for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it)
setColumnWidth(i++, (*it).toInt());
cols = config->readListEntry("ColumnOrder");
i = 0;
for (QStringList::ConstIterator it = cols.begin(); it != cols.end(); ++it)
header()->moveSection(i++, (*it).toInt());
/*US I changed the following code, because hasKey is not available.
!!! check if my version is correct
if (config->hasKey("SortColumn"))
setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true));
*/
QStringList langLst = config->readListEntry( "SortColumn" );
if (!langLst.isEmpty())
setSorting(config->readNumEntry("SortColumn"), config->readBoolEntry("SortAscending", true));
}
void KListView::setSorting(int column, bool ascending)
{
d->sortColumn = column;
d->sortAscending = ascending;
- QListView::setSorting(column, ascending);
+ Q3ListView::setSorting(column, ascending);
}
int KListView::columnSorted(void) const
{
return d->sortColumn;
}
bool KListView::ascendingSort(void) const
{
return d->sortAscending;
}
-KListViewItem::KListViewItem(QListView *parent)
- : QListViewItem(parent)
+KListViewItem::KListViewItem(Q3ListView *parent)
+ : Q3ListViewItem(parent)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent)
- : QListViewItem(parent)
+KListViewItem::KListViewItem(Q3ListViewItem *parent)
+ : Q3ListViewItem(parent)
{
init();
}
-KListViewItem::KListViewItem(QListView *parent, QListViewItem *after)
- : QListViewItem(parent, after)
+KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after)
+ : Q3ListViewItem(parent, after)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after)
- : QListViewItem(parent, after)
+KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after)
+ : Q3ListViewItem(parent, after)
{
init();
}
-KListViewItem::KListViewItem(QListView *parent,
+KListViewItem::KListViewItem(Q3ListView *parent,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent,
+KListViewItem::KListViewItem(Q3ListViewItem *parent,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
-KListViewItem::KListViewItem(QListView *parent, QListViewItem *after,
+KListViewItem::KListViewItem(Q3ListView *parent, Q3ListViewItem *after,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
-KListViewItem::KListViewItem(QListViewItem *parent, QListViewItem *after,
+KListViewItem::KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after,
QString label1, QString label2, QString label3, QString label4,
QString label5, QString label6, QString label7, QString label8)
- : QListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
+ : Q3ListViewItem(parent, after, label1, label2, label3, label4, label5, label6, label7, label8)
{
init();
}
KListViewItem::~KListViewItem()
{
}
void KListViewItem::init()
{
m_known = false;
}
const QColor &KListViewItem::backgroundColor()
{
if (isAlternate())
return static_cast< KListView* >(listView())->alternateBackground();
return listView()->viewport()->colorGroup().base();
}
bool KListViewItem::isAlternate()
{
KListView *lv = static_cast<KListView *>(listView());
if (lv && lv->alternateBackground().isValid())
@@ -2191,48 +2206,48 @@ bool KListViewItem::isAlternate()
{
item->m_odd = previous = !previous;
item->m_known = true;
//US item = dynamic_cast<KListViewItem *>(item->nextSibling());
item = (KListViewItem *)(item->nextSibling());
}
}
return m_odd;
}
return false;
}
void KListViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
{
QColorGroup _cg = cg;
const QPixmap *pm = listView()->viewport()->backgroundPixmap();
if (pm && !pm->isNull())
{
_cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm));
QPoint o = p->brushOrigin();
p->setBrushOrigin( o.x()-listView()->contentsX(), o.y()-listView()->contentsY() );
}
else if (isAlternate()) {
//US if (listView()->viewport()->backgroundMode()==Qt::FixedColor)
- if (listView()->viewport()->backgroundMode()==QWidget::PaletteBackground)
+ if (listView()->viewport()->backgroundMode()==Qt::PaletteBackground)
_cg.setColor(QColorGroup::Background, static_cast< KListView* >(listView())->alternateBackground());
else
_cg.setColor(QColorGroup::Base, static_cast< KListView* >(listView())->alternateBackground());
}
- QListViewItem::paintCell(p, _cg, column, width, alignment);
+ Q3ListViewItem::paintCell(p, _cg, column, width, alignment);
}
//US we do not have a "global KDE" variable to setup singleClick functionality
void KListView::setSingleClick(bool s)
{
d->bUseSingle = s;
slotSettingsChanged(1);
// qDebug("KListView::setSingleClick: single %i", d->bUseSingle);
}
void KListView::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "klistview.moc"
//US #include "klistviewlineedit.moc"
// vim: ts=2 sw=2 et
diff --git a/microkde/kdeui/klistview.h b/microkde/kdeui/klistview.h
index 9f0d9fd..2176525 100644
--- a/microkde/kdeui/klistview.h
+++ b/microkde/kdeui/klistview.h
@@ -1,207 +1,218 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Reginald Stadlbauer <reggie@kde.org>
Copyright (C) 2000 Charles Samuels <charles@kde.org>
Copyright (C) 2000 Peter Putzer <putzer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KLISTVIEW_H
#define KLISTVIEW_H
-#include <qlistview.h>
-
-#include <qptrlist.h>
+#include <q3listview.h>
+
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QDragMoveEvent>
+#include <QDropEvent>
+#include <QDragLeaveEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QFocusEvent>
+#include <QMouseEvent>
+#include <QKeyEvent>
+#include <QEvent>
+#include <QDragEnterEvent>
//US
class QDropEvent;
class QDragLeaveEvent;
class QDragMoveEvent;
class QDragEnterEvent;
-class QDragObject;
+class Q3DragObject;
class KConfig;
class KLineEdit;
/**
* This Widget extends the functionality of QListView to honor the system
* wide settings for Single Click/Double Click mode, AutoSelection and
* ChangeCursorOverLink (TM).
*
* There is a new signal executed(). It gets connected to either
* @ref QListView::clicked() or @ref QListView::doubleClicked() depending on the KDE
* wide Single Click/Double Click settings. It is strongly recommended that
* you use this signal instead of the above mentioned. This way you dont
* need to care about the current settings.
* If you want to get informed when the user selects something connect to the
* QListView::selectionChanged() signal.
*
* Drag-and-Drop is supported with the signal @ref #dropped(), just @ref #setAcceptDrops(true)
* and connect it to a suitable slot.
* To see where you are dropping, @ref setDropVisualizer(true).
* And also you'll need @ref acceptDrag(QDropEvent*)
*
* KListView is drag-enabled, too: to benefit from that you've got derive from it.
* Reimplement @ref dragObject() and (possibly) @ref startDrag(),
* and @ref setDragEnabled(true).
*
* @version $Id$
*/
-class KListView : public QListView
+class KListView : public Q3ListView
{
Q_OBJECT
Q_ENUMS( SelectionModeExt )
Q_PROPERTY( bool fullWidth READ fullWidth WRITE setFullWidth )
Q_PROPERTY( bool itemsMovable READ itemsMovable WRITE setItemsMovable )
Q_PROPERTY( bool itemsRenameable READ itemsRenameable WRITE setItemsRenameable )
Q_PROPERTY( bool dragEnabled READ dragEnabled WRITE setDragEnabled )
Q_PROPERTY( bool autoOpen READ autoOpen WRITE setAutoOpen )
Q_PROPERTY( bool dropVisualizer READ dropVisualizer WRITE setDropVisualizer )
//US Q_PROPERTY( int tooltipColumn READ tooltipColumn WRITE setTooltipColumn )
Q_PROPERTY( int dropVisualizerWidth READ dropVisualizerWidth WRITE setDropVisualizerWidth )
Q_PROPERTY( QColor alternateBackground READ alternateBackground WRITE setAlternateBackground )
Q_OVERRIDE( SelectionModeExt selectionMode READ selectionModeExt WRITE setSelectionModeExt )
public:
/**
* Possible selection modes.
*
* The first four correspond directly to QListView::SelectionMode, while
* the FileManager selection mode is defined as follows:
* @li home: move to the first
* @li end: move to the last
* @li PgUp/PgDn: move one page up/down
* @li up/down: move one item up/down
* @li insert: toggle selection of current and move to the next
* @li space: toggle selection of the current
* @li CTRL+up: move to the previous item and toggle selection of this one
* @li CTRL+down: toggle selection of the current item and move to the next
* @li CTRL+end: toggle selection from (including) the current
* item to (including) the last item
* @li CTRL+home: toggle selection from (including) the current
* item to the (including) the first item
* @li CTRL+PgDn: toggle selection from (including) the current
* item to (excluding) the item one page down
* @li CTRL+PgUp: toggle selection from (excluding) the current
* item to (including) the item one page up
*
* The combinations work the same with SHIFT instead of CTRL, except
* that if you start selecting something using SHIFT everything selected
* before will be deselected first.
*
* Additionally the current item is always selected automatically when
* navigating using the keyboard, except other items were selected explicitely.
*
* This way e.g. SHIFT+up/PgUp then SHIFT+down/PgDn leaves no item selected
*/
enum SelectionModeExt {
- Single = QListView::Single,
- Multi = QListView::Multi,
- Extended = QListView::Extended,
- NoSelection = QListView::NoSelection,
+ Single = Q3ListView::Single,
+ Multi = Q3ListView::Multi,
+ Extended = Q3ListView::Extended,
+ NoSelection = Q3ListView::NoSelection,
FileManager
};
void repaintContents( bool erase = true )
{
- QScrollView::repaintContents( contentsX(), contentsY(),
+ Q3ScrollView::repaintContents( contentsX(), contentsY(),
visibleWidth(), visibleHeight(), erase );
};
/**
* Constructor.
*
* The parameters @p parent and @p name are handled by
* @ref QListView, as usual.
*/
KListView (QWidget *parent = 0, const char *name = 0, bool emulateRightMouse = true );
/**
* Destructor.
*/
virtual ~KListView();
virtual QSize sizeHint() const;
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void setAcceptDrops (bool);
/**
* This function determines whether the given coordinates are within the
* execute area. The execute area is the part of a @ref QListViewItem where mouse
* clicks or double clicks respectively generate a @ref #executed() signal.
* Depending on @ref QListView::allColumnsShowFocus() this is either the
* whole item or only the first column.
* @return true if point is inside execute area of an item, false in all
* other cases including the case that it is over the viewport.
*/
virtual bool isExecuteArea( const QPoint& point );
/**
* Same thing, but from an x coordinate only. This only checks if x is in
* the first column (if all columns don't show focus), without testing if
* the y coordinate is over an item or not.
*/
bool isExecuteArea( int x );
/**
* @return a list containing the currently selected items.
*/
- QPtrList<QListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
+ Q3PtrList<Q3ListViewItem> selectedItems() const; // ### BIC: KDE 4: use an implicitly shared class! (QValueList?)
/**
* Arbitrarily move @p item to @p parent, positioned immediately after item @p after.
*/
- void moveItem(QListViewItem *item, QListViewItem *parent, QListViewItem *after);
+ void moveItem(Q3ListViewItem *item, Q3ListViewItem *parent, Q3ListViewItem *after);
/**
* @return the last item (not child!) of this listview.
*
* @see lastChild()
*/
- QListViewItem *lastItem() const;
+ Q3ListViewItem *lastItem() const;
/**
* @return the last child of this listview.
*
* @see lastItem()
*/
- QListViewItem* lastChild () const;
+ Q3ListViewItem* lastChild () const;
/**
* @return the lineedit used for inline renaming.
* Use that to setup a @ref KCompletion or @ref QValidator for the lineedit
*
* @since 3.2
*/
KLineEdit* renameLineEdit() const;
/**
* @returns if it is legal to move items in the list view. True by default.
*
* @see #setDragEnabled()
* @see #setItemsMovable()
*/
bool itemsMovable() const;
/**
* @return whether inplace-renaming has been enabled. False by default.
*
* @see #setItemsRenameable()
*/
bool itemsRenameable() const;
@@ -255,87 +266,87 @@ public:
*/
bool dropHighlighter() const;
/**
* The dropVisualizerWidth defaults to 4.
*
* @see #setDropVisualizerWidth()
* @return the current width of the drop-visualizer.
*/
int dropVisualizerWidth () const;
/**
* @return the "extended" selection mode of this listview.
*
* @see SelectionModeExt
* @see setSelectionModeExt
*/
SelectionModeExt selectionModeExt () const;
/**
* Returns the index of @p item within the item tree or -1 if
* @p item doesn't exist in this list view. This function takes
* all items into account not only the visible ones.
*/
- int itemIndex( const QListViewItem *item ) const;
+ int itemIndex( const Q3ListViewItem *item ) const;
/**
* Returns the item of @p index within the item tree or 0 if
* @p index doesn't exist in this list view. This function takes
* all items into account not only the visible ones.
*/
- QListViewItem* itemAtIndex(int index);
+ Q3ListViewItem* itemAtIndex(int index);
/**
* @deprecated
* @see #setFullWidth()
*/
void setFullWidth();
/**
* Let the last column fit exactly all the available width.
*
* @see #fullWidth()
*/
void setFullWidth(bool fullWidth);
/**
* Returns whether the last column is set to fit the available width.
*
* @see #setFullWidth()
*/
bool fullWidth() const;
/**
* Reimplemented for full width support
*
* @see #removeColumn()
*/
virtual int addColumn(const QString& label, int width = -1);
/**
* Reimplemented for full width support
*/
- virtual int addColumn(const QIconSet& iconset, const QString& label, int width = -1);
+ virtual int addColumn(const QIcon& iconset, const QString& label, int width = -1);
/**
* Reimplemented for full width support
*
* @see #addColumn()
*/
virtual void removeColumn(int index);
/**
* sets the alternate background background color.
* This only has an effect if the items are KListViewItems
*
* @param c the color to use for every other item. Set to an invalid
* colour to disable alternate colours.
*
* @see #alternateBackground()
**/
void setAlternateBackground(const QColor &c);
/**
* @return the alternate background color
*
* @see #setAlternateBackground()
*/
const QColor &alternateBackground() const;
@@ -367,214 +378,214 @@ public:
* @return the currently sorted column, or -1 if none is sorted
*/
int columnSorted(void) const;
/**
* @return whether the current sort is ascending (or descending)
*/
bool ascendingSort(void) const;
//US we do not have a "global KDE" variable to setup singleClick functionality
void setSingleClick(bool s);
signals:
/**
* This signal is emitted whenever the user executes an listview item.
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listview item.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*/
- void executed( QListViewItem *item );
+ void executed( Q3ListViewItem *item );
/**
* This signal is emitted whenever the user executes an listview item.
* That means depending on the KDE wide Single Click/Double Click
* setting the user clicked or double clicked on that item.
* @param item is the pointer to the executed listview item.
* @param pos is the position where the user has clicked
* @param c is the column into which the user clicked.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*/
- void executed( QListViewItem *item, const QPoint &pos, int c );
+ void executed( Q3ListViewItem *item, const QPoint &pos, int c );
/**
* This signal gets emitted whenever the user double clicks into the
* listview.
* @param item is the pointer to the clicked listview item.
* @param pos is the position where the user has clicked, and
* @param c is the column into which the user clicked.
*
* Note that you may not delete any @ref QListViewItem objects in slots
* connected to this signal.
*
* This signal is more or less here for the sake of completeness.
* You should normally not need to use this. In most cases its better
* to use @ref #executed() instead.
*/
- void doubleClicked( QListViewItem *item, const QPoint &pos, int c );
- void contextRequest( QListViewItem *item, const QPoint &pos, int c );
+ void doubleClicked( Q3ListViewItem *item, const QPoint &pos, int c );
+ void contextRequest( Q3ListViewItem *item, const QPoint &pos, int c );
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* @param e is the drop event itself (it has already been accepted)
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items)
*
* @see #acceptDrop()
*/
- void dropped (QDropEvent * e, QListViewItem *after);
+ void dropped (QDropEvent * e, Q3ListViewItem *after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This is an overloaded version of the above (provided to simplify
* processing drops outside of the class).
*
* @param list is the listview
* @param e is the drop event itself (it has already been accepted)
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (KListView* list, QDropEvent* e, QListViewItem* after);
+ void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This function also provides a parent, in the event that your listview
* is a tree
* @param list is the listview
* @param e is the drop event itself (it has already been accepted)
* @param parent the item that is to be the parent of the new item
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (KListView* list, QDropEvent* e, QListViewItem* parent, QListViewItem* after);
+ void dropped (KListView* list, QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
/**
* This signal gets emitted whenever something acceptable is
* dropped onto the listview.
*
* This function also provides a parent, in the event that your listview
* is a tree
* @param e is the drop event itself (it has already been accepted)
* @param parent the item that is to be the parent of the new item
* @param after is the item after which the drop occured (or 0L, if
* the drop was above all items
*/
- void dropped (QDropEvent* e, QListViewItem* parent, QListViewItem* after);
+ void dropped (QDropEvent* e, Q3ListViewItem* parent, Q3ListViewItem* after);
/**
* This signal is emitted when ever the user moves an item in the list via
* DnD.
* If more than one item is moved at the same time, this signal is only emitted
* once.
*/
void moved();
/**
* Connect to this signal if you want to do some preprocessing before
* a move is made, for example, to disable sorting
*
* This is sent only once per each groups of moves. That is, for each
* drop that is a move this will be emitted once, before KListView calls
* @see moveItem()
*/
void aboutToMove();
/**
* This signal is emitted when ever the user moves an item in the list via
* DnD.
* If more than one item is moved at the same time, @p afterFirst and
* @p afterNow will reflect what was true before the move.
* This differs from @ref moved(), so be careful. All the items will have been
* moved before @ref moved() is emitted, which is not true in this method. // FIXME
* @param item the item that was moved
* @param afterFirst the item that parameter item was in before the move, in the list
* @param afterNow the item it's currently after.
*/
- void moved (QListViewItem *item, QListViewItem *afterFirst, QListViewItem *afterNow);
+ void moved (Q3ListViewItem *item, Q3ListViewItem *afterFirst, Q3ListViewItem *afterNow);
/**
* This signal is emitted after all the items have been moved. It reports info for
* each and every item moved, in order. The first element in @p items associates
* with the first of afterFirst and afterNow.
*/
- void moved(QPtrList<QListViewItem> &items, QPtrList<QListViewItem> &afterFirst, QPtrList<QListViewItem> &afterNow);
+ void moved(Q3PtrList<Q3ListViewItem> &items, Q3PtrList<Q3ListViewItem> &afterFirst, Q3PtrList<Q3ListViewItem> &afterNow);
/**
* This signal gets emitted when an item is renamed via in-place renaming.
*
* @param item is the renamed item.
* @param str is the new value of column @p col.
* @param col is the renamed column.
*/
- void itemRenamed(QListViewItem* item, const QString &str, int col);
+ void itemRenamed(Q3ListViewItem* item, const QString &str, int col);
/**
* Same as above, but without the extra information.
*/
- void itemRenamed(QListViewItem* item);
+ void itemRenamed(Q3ListViewItem* item);
void signalDelete();
/**
* This signal is emitted when the shortcut key for popup-menus is pressed.
*
* Normally you should not use this, just connect a slot to signal
* @ref contextMenu (KListView*, QListViewItem*, const QPoint&) to correctly
* handle showing context menus regardless of settings.
*
* @param list is this listview.
* @param item is the @ref currentItem() at the time the key was pressed. May be 0L.
*/
- void menuShortCutPressed (KListView* list, QListViewItem* item);
+ void menuShortCutPressed (KListView* list, Q3ListViewItem* item);
/**
* This signal is emitted whenever a context-menu should be shown for item @p i.
* It automatically adjusts for all settings involved (Menu key, showMenuOnPress/Click).
*
* @param l is this listview.
* @param i is the item for which the menu should be shown. May be 0L.
* @param p is the point at which the menu should be shown.
*/
- void contextMenu (KListView* l, QListViewItem* i, const QPoint& p);
+ void contextMenu (KListView* l, Q3ListViewItem* i, const QPoint& p);
public slots:
/**
* Rename column @p c of @p item.
*/
- virtual void rename(QListViewItem *item, int c);
+ virtual void rename(Q3ListViewItem *item, int c);
/**
* By default, if you called setItemsRenameable(true),
* only the first column is renameable.
* Use this function to enable the feature on other columns.
*
* If you want more intelligent (dynamic) selection,
* you'll have to derive from KListView,
* and override @ref rename() and call only call it
* if you want the item to be renamed.
*/
void setRenameable (int column, bool yesno=true);
/**
* Set whether items in the list view can be moved.
* It is enabled by default.
*
* @see itemsMovable()
*/
virtual void setItemsMovable(bool b);
/**
* Enables inplace-renaming of items.
* It is disabled by default.
@@ -652,102 +663,102 @@ public slots:
protected:
/**
* Determine whether a drop on position @p p would count as
* being above or below the QRect @p rect.
*
* @param rect is the rectangle we examine.
* @param p is the point located in the rectangle, p is assumed to be in
* viewport coordinates.
*/
inline bool below (const QRect& rect, const QPoint& p)
{
return (p.y() > (rect.top() + (rect.bottom() - rect.top())/2));
}
/**
* An overloaded version of below(const QRect&, const QPoint&).
*
* It differs from the above only in what arguments it takes.
*
* @param i the item whose rect() is passed to the above function.
* @param p is translated from contents coordinates to viewport coordinates
* before being passed to the above function.
*/
- inline bool below (QListViewItem* i, const QPoint& p)
+ inline bool below (Q3ListViewItem* i, const QPoint& p)
{
return below (itemRect(i), contentsToViewport(p));
}
/**
* Reimplemented to reload the alternate background in palette changes.
* @internal
*/
virtual bool event( QEvent * );
/**
* Emit signal @ref #executed.
* @internal
*/
//US I added buttonstate to pass the current keyboard status
- void emitExecute( int buttonstate, QListViewItem *item, const QPoint &pos, int c);
+ void emitExecute( int buttonstate, Q3ListViewItem *item, const QPoint &pos, int c);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void focusInEvent(QFocusEvent* fe);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void focusOutEvent( QFocusEvent *fe );
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void leaveEvent( QEvent *e );
/**
* @return the tooltip for @p column of @p item.
*/
- virtual QString tooltip(QListViewItem* item, int column) const;
+ virtual QString tooltip(Q3ListViewItem* item, int column) const;
/**
* @return whether the tooltip for @p column of @p item shall be shown at point @p pos.
*/
- virtual bool showTooltip(QListViewItem *item, const QPoint &pos, int column) const;
+ virtual bool showTooltip(Q3ListViewItem *item, const QPoint &pos, int column) const;
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDragMoveEvent (QDragMoveEvent *event);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsMousePressEvent( QMouseEvent *e );
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
@@ -784,73 +795,73 @@ protected:
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDropEvent (QDropEvent*);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void contentsDragEnterEvent (QDragEnterEvent *);
/**
* @return a dragobject encoding the current selection.
*
* @see setDragEnabled()
*/
- virtual QDragObject *dragObject();
+ virtual Q3DragObject *dragObject();
/**
* @return true if the @p event provides some acceptable
* format.
* A common mistake is to forget the "const" in your reimplementation
*/
virtual bool acceptDrag (QDropEvent* event) const;
/**
* Paint the drag line. If painter is null, don't try to :)
*
* If after == 0 then the marker should be drawn at the top.
*
* @return the rectangle that you painted to.
*/
- virtual QRect drawDropVisualizer (QPainter *p, QListViewItem *parent, QListViewItem *after);
+ virtual QRect drawDropVisualizer (QPainter *p, Q3ListViewItem *parent, Q3ListViewItem *after);
/**
* Paint the drag rectangle. If painter is null, don't try to :)
*
*
* @return the rectangle that you painted to.
*/
- virtual QRect drawItemHighlighter(QPainter *painter, QListViewItem *item);
+ virtual QRect drawItemHighlighter(QPainter *painter, Q3ListViewItem *item);
/**
* This method calls @ref dragObject() and starts the drag.
*
* Reimplement it to do fancy stuff like setting a pixmap or
* using a non-default DragMode
*/
virtual void startDrag();
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
*/
virtual void keyPressEvent (QKeyEvent*);
/**
* Reimplemented for internal reasons.
* Further reimplementations should call this function or else
* some features may not work correctly.
*
* The API is unaffected.
@@ -865,169 +876,169 @@ protected:
/**
* In FileManager selection mode: explicitely deactivate the mode
* in which the current item is automatically selected.
*/
void deactivateAutomaticSelection();
/**
* In FileManager selection mode: return whether it is currently in the mode
* where the current item is selected automatically.
* Returns false if items were selected explicitely, e.g. using the mouse.
*/
bool automaticSelection() const;
/**
* Reimplemented for setFullWidth()
*/
virtual void viewportResizeEvent(QResizeEvent* e);
protected slots:
/**
* Update internal settings whenever the global ones change.
* @internal
*/
void slotSettingsChanged(int);
- void slotMouseButtonClicked( int btn, QListViewItem *item, const QPoint &pos, int c );
- void doneEditing(QListViewItem *item, int row);
+ void slotMouseButtonClicked( int btn, Q3ListViewItem *item, const QPoint &pos, int c );
+ void doneEditing(Q3ListViewItem *item, int row);
/**
* Repaint the rect where I was drawing the drop line.
*/
void cleanDropVisualizer();
/**
* Repaint the rect where I was drawing the drop rectangle.
*/
void cleanItemHighlighter();
/**
* Emit the @ref contextMenu signal. This slot is for mouse actions.
*/
- void emitContextMenu (QListViewItem*, const QPoint&, int);
+ void emitContextMenu (Q3ListViewItem*, const QPoint&, int);
/**
* Emit the @ref #contextMenu signal. This slot is for key presses.
*/
- void emitContextMenu (KListView*, QListViewItem*);
+ void emitContextMenu (KListView*, Q3ListViewItem*);
/**
* Accessory slot for AutoSelect
* @internal
*/
- void slotOnItem( QListViewItem *item );
+ void slotOnItem( Q3ListViewItem *item );
/**
* Accessory slot for AutoSelect/ChangeCursorOverItem
* @internal
*/
void slotOnViewport();
/**
* Process AutoSelection.
* @internal
*/
void slotAutoSelect();
void slotDragExpand();
/**
* Reacts to header changes in full width mode
* @internal
*/
void slotHeaderChanged();
protected:
/**
* Handle dropEvent when itemsMovable() is set to true.
*/
- virtual void movableDropEvent (QListViewItem* parent, QListViewItem* afterme);
+ virtual void movableDropEvent (Q3ListViewItem* parent, Q3ListViewItem* afterme);
/**
* Where is the nearest QListViewItem that I'm going to drop?
*
* FIXME KDE 4.0: Make this method const so it can be called from an
* acceptDrag method without ugly casts
*/
- virtual void findDrop(const QPoint &pos, QListViewItem *&parent, QListViewItem *&after);
+ virtual void findDrop(const QPoint &pos, Q3ListViewItem *&parent, Q3ListViewItem *&after);
/**
* A special keyPressEvent (for FileManager selection mode).
*/
void fileManagerKeyPressEvent (QKeyEvent*);
/**
* Convert the depth of an item into its indentation in pixels
*/
int depthToPixels( int depth );
private:
class Tooltip;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KListViewPrivate;
KListViewPrivate *d;
};
/**
* A listview item with support for alternate background colours. It is
* a drop-in replacement for @ref QListViewItem
*
* @short listview item with alternate background colour support
*/
-class KListViewItem : public QListViewItem
+class KListViewItem : public Q3ListViewItem
{
public:
/**
* constructors. The semantics remain as in @ref QListViewItem.
* Although they accept a @ref QListViewItem as parent, please
* don't mix KListViewItem (or subclasses) with QListViewItem
* (or subclasses).
*/
- KListViewItem(QListView *parent);
- KListViewItem(QListViewItem *parent);
- KListViewItem(QListView *parent, QListViewItem *after);
- KListViewItem(QListViewItem *parent, QListViewItem *after);
+ KListViewItem(Q3ListView *parent);
+ KListViewItem(Q3ListViewItem *parent);
+ KListViewItem(Q3ListView *parent, Q3ListViewItem *after);
+ KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after);
- KListViewItem(QListView *parent,
+ KListViewItem(Q3ListView *parent,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListViewItem *parent,
+ KListViewItem(Q3ListViewItem *parent,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListView *parent, QListViewItem *after,
+ KListViewItem(Q3ListView *parent, Q3ListViewItem *after,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
- KListViewItem(QListViewItem *parent, QListViewItem *after,
+ KListViewItem(Q3ListViewItem *parent, Q3ListViewItem *after,
QString, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null,
QString = QString::null, QString = QString::null);
virtual ~KListViewItem();
/**
* retuns true if this item is to be drawn with the alternate background
*/
bool isAlternate();
/**
* returns the background colour for this item
*/
const QColor &backgroundColor();
virtual void paintCell(QPainter *p, const QColorGroup &cg,
int column, int width, int alignment);
private:
void init();
private:
uint m_odd : 1;
diff --git a/microkde/kdeui/kmainwindow.cpp b/microkde/kdeui/kmainwindow.cpp
index fa678f2..bac0db8 100644
--- a/microkde/kdeui/kmainwindow.cpp
+++ b/microkde/kdeui/kmainwindow.cpp
@@ -1,81 +1,87 @@
/* This file is part of the KDE libraries
Copyright
(C) 2000 Reginald Stadlbauer (reggie@kde.org)
(C) 1997 Stephan Kulow (coolo@kde.org)
(C) 1997-2000 Sven Radej (radej@kde.org)
(C) 1997-2000 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 2002 Joseph Wenninger (jowenn@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qobjectlist.h>
+#include <qobject.h>
#include <qstringlist.h>
#include <qtimer.h>
#include <qmenubar.h>
#include <qstatusbar.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <QCloseEvent>
+#include <QPaintEvent>
+#include <QResizeEvent>
+#include <QChildEvent>
+#include <Q3PtrList>
#include "kdebug.h"
#include "kmainwindow.h"
#include "kglobalsettings.h"
#include "kactioncollection.h"
class KMainWindowPrivate {
public:
//US bool showHelpMenu:1;
bool autoSaveSettings:1;
bool settingsDirty:1;
bool autoSaveWindowSize:1;
bool care_about_geometry:1;
QString autoSaveGroup;
//US KAccel * kaccel;
//US KMainWindowInterface *m_interface;
KDEPrivate::ToolBarHandler *toolBarHandler;
QTimer* settingsTimer;
KToggleAction *showStatusBarAction;
QRect defaultWindowSize;
};
static bool no_query_exit = false;
KMainWindow::KMainWindow( QWidget* parent, const char *name )
- : QMainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/
+ : Q3MainWindow( parent, name ) /*LR, f ) with the default widget flag we cannot have fastload */ /*US, KXMLGUIBuilder( this ), helpMenu2( 0 ), factory_( 0 )*/
{
mQToolBar = 0;
initKMainWindow(name);
}
void KMainWindow::parseGeometry(bool parsewidth)
{
//US the following code is not getting used in the embedded version !! So disable it for now
/*US
assert ( !kapp->geometryArgument().isNull() );
assert ( d->care_about_geometry );
#ifndef Q_WS_QWS
// FIXME: (E) Implement something similar for Qt Embedded (or decide we don't need it)
int x, y;
int w, h;
int m = XParseGeometry( kapp->geometryArgument().latin1(), &x, &y, (unsigned int*)&w, (unsigned int*)&h);
if (parsewidth) {
QSize minSize = minimumSize();
QSize maxSize = maximumSize();
if ( (m & WidthValue) == 0 )
w = width();
if ( (m & HeightValue) == 0 )
@@ -255,49 +261,49 @@ application config.
if ( readPropertiesInternal( config, number ) ){
if ( show )
KMainWindow::show();
return FALSE;
}
return FALSE;
}
void KMainWindow::setCaption( const QString &caption )
{
//US setPlainCaption( kapp->makeStdCaption(caption) );
setPlainCaption( caption );
}
void KMainWindow::setCaption( const QString &caption, bool modified )
{
//US setPlainCaption( kapp->makeStdCaption(caption, true, modified) );
setPlainCaption( caption + "modified:" );
}
void KMainWindow::setPlainCaption( const QString &caption )
{
- QMainWindow::setCaption( caption );
+ Q3MainWindow::setCaption( caption );
#ifndef Q_WS_QWS
//US the following is disabled for the embedded version
//US NETWinInfo info( qt_xdisplay(), winId(), qt_xrootwin(), 0 );
//US info.setName( caption.utf8().data() );
#endif
}
void KMainWindow::slotStateChanged(const QString &newstate)
{
stateChanged(newstate, KXMLGUIClient::StateNoReverse);
}
/*
* Get rid of this for KDE 4.0
*/
void KMainWindow::slotStateChanged(const QString &newstate,
KXMLGUIClient::ReverseStateChange reverse)
{
stateChanged(newstate, reverse);
}
void KMainWindow::closeEvent ( QCloseEvent *e )
{
//qDebug("MainWindow::closeEvent ");
@@ -400,131 +406,132 @@ void KMainWindow::setStandardToolBarMenuEnabled( bool enable )
/*US
if ( factory() )
factory()->removeClient( d->toolBarHandler );
*/
delete d->toolBarHandler;
d->toolBarHandler = 0;
}
}
bool KMainWindow::isStandardToolBarMenuEnabled() const
{
return ( d->toolBarHandler != 0 );
}
void KMainWindow::createStandardStatusBarAction(){
if(!d->showStatusBarAction){
d->showStatusBarAction = KStdAction::showStatusbar(this, SLOT(setSettingsDirty()), actionCollection());
connect(d->showStatusBarAction, SIGNAL(toggled(bool)), statusBar(), SLOT(setShown(bool)));
if(internalStatusBar())
d->showStatusBarAction->setChecked(!internalStatusBar()->isHidden());
}
}
-QToolBar *KMainWindow::tBar( )
+Q3ToolBar *KMainWindow::tBar( )
{
if ( ! mQToolBar )
- mQToolBar = new QToolBar( this );
+ mQToolBar = new Q3ToolBar( this );
return mQToolBar;
}
KToolBar *KMainWindow::toolBar( const char * name )
{
if (!name)
name = "mainToolBar";
KToolBar *tb = (KToolBar*)child( name, "KToolBar" );
if ( tb )
return tb;
bool honor_mode = (name == "mainToolBar");
/*US
if ( builderClient() )
return new KToolBar(this, name, honor_mode); // XMLGUI constructor
else
*/
- return new KToolBar(this, Top, false, name, honor_mode ); // non-XMLGUI
+ return new KToolBar(this, Qt::Top, false, name, honor_mode ); // non-XMLGUI
}
-QPtrListIterator<KToolBar> KMainWindow::toolBarIterator()
+Q3PtrListIterator<KToolBar> KMainWindow::toolBarIterator()
{
toolbarList.clear();
- QPtrList<QToolBar> lst;
- for ( int i = (int)QMainWindow::Unmanaged; i <= (int)Minimized; ++i ) {
- lst = toolBars( (ToolBarDock)i );
- for ( QToolBar *tb = lst.first(); tb; tb = lst.next() ) {
+ QList<Q3ToolBar*> lst;
+ for ( int i = (int)Qt::Unmanaged; i <= (int)Qt::Minimized; ++i ) {
+ lst = toolBars( (Qt::ToolBarDock)i );
+ for(QList<Q3ToolBar*>::iterator i=lst.begin();i!=lst.end();++i) {
+ Q3ToolBar *tb = *i;
if ( !tb->inherits( "KToolBar" ) )
continue;
toolbarList.append( (KToolBar*)tb );
}
}
- return QPtrListIterator<KToolBar>( toolbarList );
+ return Q3PtrListIterator<KToolBar>( toolbarList );
}
void KMainWindow::setAutoSaveSettings( const QString & groupName, bool saveWindowSize )
{
d->autoSaveSettings = true;
d->autoSaveGroup = groupName;
d->autoSaveWindowSize = saveWindowSize;
// Get notified when the user moves a toolbar around
//US connect( this, SIGNAL( dockWindowPositionChanged( QDockWindow * ) ),
//US this, SLOT( setSettingsDirty() ) );
- connect( this, SIGNAL( toolBarPositionChanged(QToolBar *) ),
+ connect( this, SIGNAL( toolBarPositionChanged(Q3ToolBar *) ),
this, SLOT( setSettingsDirty() ) );
// Get default values
//US int scnum = QApplication::desktop()->screenNumber(parentWidget());
//US QRect desk = QApplication::desktop()->screenGeometry(scnum);
QRect desk = KGlobalSettings::desktopGeometry(0);
d->defaultWindowSize = QRect(desk.width(), width(), desk.height(), height());
// Now read the previously saved settings
applyMainWindowSettings( KGlobal::config(), groupName );
}
void KMainWindow::resetAutoSaveSettings()
{
d->autoSaveSettings = false;
if ( d->settingsTimer )
d->settingsTimer->stop();
}
bool KMainWindow::autoSaveSettings() const
{
return d->autoSaveSettings;
}
QString KMainWindow::autoSaveGroup() const
{
return d->autoSaveGroup;
}
void KMainWindow::saveAutoSaveSettings()
{
- ASSERT( d->autoSaveSettings );
+ Q_ASSERT( d->autoSaveSettings );
//kdDebug(200) << "KMainWindow::saveAutoSaveSettings -> saving settings" << endl;
saveMainWindowSettings( KGlobal::config(), d->autoSaveGroup );
KGlobal::config()->sync();
d->settingsDirty = false;
if ( d->settingsTimer )
d->settingsTimer->stop();
}
void KMainWindow::createGUI( const QString &xmlfile, bool _conserveMemory )
{
// disabling the updates prevents unnecessary redraws
setUpdatesEnabled( false );
// just in case we are rebuilding, let's remove our old client
//US guiFactory()->removeClient( this );
// make sure to have an empty GUI
QMenuBar* mb = internalMenuBar();
if ( mb )
mb->clear();
(void)toolBarIterator(); // make sure toolbarList is most-up-to-date
toolbarList.setAutoDelete( true );
toolbarList.clear();
@@ -618,49 +625,49 @@ void KMainWindow::saveMainWindowSettings(KConfig *config, const QString &configG
//US config->writeEntry(QString::fromLatin1("StatusBar"), entryList, ';');
config->writeEntry(QString::fromLatin1("StatusBar"), entryList);
else
config->deleteEntry(QString::fromLatin1("StatusBar"));
}
QMenuBar* mb = internalMenuBar();
if (mb) {
entryList.clear();
if ( mb->isHidden() )
entryList.append("Disabled");
else
entryList.append("Enabled");
// By default we don't hide.
if(mb->isHidden())
//US config->writeEntry(QString::fromLatin1("MenuBar"), entryList, ';');
config->writeEntry(QString::fromLatin1("MenuBar"), entryList);
else
config->deleteEntry(QString::fromLatin1("MenuBar"));
}
int n = 1; // Toolbar counter. toolbars are counted from 1,
KToolBar *toolbar = 0;
- QPtrListIterator<KToolBar> it( toolBarIterator() );
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() );
while ( ( toolbar = it.current() ) ) {
++it;
QString group;
if (!configGroup.isEmpty())
{
// Give a number to the toolbar, but prefer a name if there is one,
// because there's no real guarantee on the ordering of toolbars
group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name());
group.prepend(" Toolbar");
group.prepend(configGroup);
}
toolbar->saveSettings(config, group);
n++;
}
if (!configGroup.isEmpty())
config->setGroup(oldGroup);
}
bool KMainWindow::readPropertiesInternal( KConfig *config, int number )
{
if ( number == 1 )
readGlobalProperties( config );
// in order they are in toolbar list
@@ -693,91 +700,93 @@ void KMainWindow::applyMainWindowSettings(KConfig *config, const QString &config
if (!configGroup.isEmpty())
config->setGroup(configGroup);
restoreWindowSize(config);
QStatusBar* sb = internalStatusBar();
if (sb) {
entryList.clear();
//US i = config->readListEntry (QString::fromLatin1("StatusBar"), entryList, ';');
entryList = config->readListEntry (QString::fromLatin1("StatusBar"));
entry = entryList.first();
if (entry == QString::fromLatin1("Disabled"))
sb->hide();
else
sb->show();
if(d->showStatusBarAction)
d->showStatusBarAction->setChecked(!sb->isHidden());
}
QMenuBar* mb = internalMenuBar();
if (mb) {
entryList.clear();
//US i = config->readListEntry (QString::fromLatin1("MenuBar"), entryList, ';');
entryList = config->readListEntry (QString::fromLatin1("MenuBar"));
- entry = entryList.first();
- if (entry==QString::fromLatin1("Disabled"))
- {
- mb->hide();
- } else
- {
- mb->show();
- }
+ if(!entryList.empty()) {
+ entry = entryList.first();
+ if (entry==QString::fromLatin1("Disabled"))
+ {
+ mb->hide();
+ } else
+ {
+ mb->show();
+ }
+ }
}
int n = 1; // Toolbar counter. toolbars are counted from 1,
KToolBar *toolbar;
- QPtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() ); // must use own iterator
for ( ; it.current(); ++it) {
toolbar= it.current();
QString group;
if (!configGroup.isEmpty())
{
// Give a number to the toolbar, but prefer a name if there is one,
// because there's no real guarantee on the ordering of toolbars
group = (!::qstrcmp(toolbar->name(), "unnamed") ? QString::number(n) : QString(" ")+toolbar->name());
group.prepend(" Toolbar");
group.prepend(configGroup);
}
toolbar->applySettings(config, group);
n++;
}
finalizeGUI( true );
}
void KMainWindow::finalizeGUI( bool force )
{
//kdDebug(200) << "KMainWindow::finalizeGUI force=" << force << endl;
// The whole reason for this is that moveToolBar relies on the indexes
// of the other toolbars, so in theory it should be called only once per
// toolbar, but in increasing order of indexes.
// Since we can't do that immediately, we move them, and _then_
// we call positionYourself again for each of them, but this time
// the toolbariterator should give them in the proper order.
// Both the XMLGUI and applySettings call this, hence "force" for the latter.
- QPtrListIterator<KToolBar> it( toolBarIterator() );
+ Q3PtrListIterator<KToolBar> it( toolBarIterator() );
for ( ; it.current() ; ++ it )
it.current()->positionYourself( force );
d->settingsDirty = false;
}
void KMainWindow::saveWindowSize( KConfig * config ) const
{
/*US
int scnum = QApplication::desktop()->screenNumber(parentWidget());
QRect desk = QApplication::desktop()->screenGeometry(scnum);
*/
QRect desk = KGlobalSettings::desktopGeometry(0);
QRect size( desk.width(), width(), desk.height(), height() );
if(size != d->defaultWindowSize){
config->writeEntry(QString::fromLatin1("Width %1").arg(desk.width()), width() );
config->writeEntry(QString::fromLatin1("Height %1").arg(desk.height()), height() );
}
else{
config->deleteEntry(QString::fromLatin1("Width %1").arg(desk.width()));
config->deleteEntry(QString::fromLatin1("Height %1").arg(desk.height()));
}
}
@@ -830,141 +839,129 @@ void KMainWindow::setSettingsDirty()
// (to compress calls and save only once, in case of multiple changes)
if ( !d->settingsTimer )
{
d->settingsTimer = new QTimer( this );
connect( d->settingsTimer, SIGNAL( timeout() ), SLOT( saveAutoSaveSettings() ) );
}
d->settingsTimer->start( 500, true );
}
}
bool KMainWindow::settingsDirty() const
{
return d->settingsDirty;
}
QString KMainWindow::settingsGroup() const
{
return d->autoSaveGroup;
}
void KMainWindow::resizeEvent( QResizeEvent * e)
{
if ( d->autoSaveWindowSize )
setSettingsDirty();
- QMainWindow::resizeEvent( e );
+ Q3MainWindow::resizeEvent( e );
}
bool KMainWindow::hasMenuBar()
{
return (internalMenuBar());
}
//US KMenuBar *KMainWindow::menuBar()
QMenuBar *KMainWindow::menuBar()
{
//US KMenuBar * mb = internalMenuBar();
QMenuBar * mb = internalMenuBar();
if ( !mb ) {
//US mb = new KMenuBar( this );
mb = new QMenuBar( this );
// trigger a re-layout and trigger a call to the private
// setMenuBar method.
- QMainWindow::menuBar();
+ Q3MainWindow::menuBar();
}
return mb;
}
//US KStatusBar *KMainWindow::statusBar()
QStatusBar *KMainWindow::statusBar()
{
//US KStatusBar * sb = internalStatusBar();
QStatusBar * sb = internalStatusBar();
if ( !sb ) {
//US sb = new KStatusBar( this );
sb = new QStatusBar( this );
// trigger a re-layout and trigger a call to the private
// setStatusBar method.
- QMainWindow::statusBar();
+ Q3MainWindow::statusBar();
}
return sb;
}
void KMainWindow::shuttingDown()
{
// Needed for Qt <= 3.0.3 at least to prevent reentrancy
// when queryExit() shows a dialog. Check before removing!
static bool reentrancy_protection = false;
if (!reentrancy_protection)
{
reentrancy_protection = true;
// call the virtual queryExit
queryExit();
reentrancy_protection = false;
}
}
//US KMenuBar *KMainWindow::internalMenuBar()
QMenuBar *KMainWindow::internalMenuBar()
{
//US QObjectList *l = queryList( "KMenuBar", 0, false, false );
- QObjectList *l = queryList( "QMenuBar", 0, false, false );
- if ( !l || !l->first() ) {
- delete l;
- return 0;
- }
-
-//US KMenuBar *m = (KMenuBar*)l->first();
- QMenuBar *m = (QMenuBar*)l->first();
- delete l;
- return m;
+ QObjectList l = queryList( "QMenuBar", 0, false, false );
+ if(l.empty())
+ return 0;
+ return (QMenuBar*)l.front();
}
//US KStatusBar *KMainWindow::internalStatusBar()
QStatusBar *KMainWindow::internalStatusBar()
{
//US QObjectList *l = queryList( "KStatusBar", 0, false, false );
- QObjectList *l = queryList( "QStatusBar", 0, false, false );
- if ( !l || !l->first() ) {
- delete l;
- return 0;
- }
-
-//US KStatusBar *s = (KStatusBar*)l->first();
- QStatusBar *s = (QStatusBar*)l->first();
- delete l;
- return s;
+ QObjectList l = queryList( "QStatusBar", 0, false, false );
+ if(l.empty())
+ return 0;
+ return (QStatusBar*)l.front();
}
void KMainWindow::childEvent( QChildEvent* e)
{
- QMainWindow::childEvent( e );
+ Q3MainWindow::childEvent( e );
}
void KMainWindow::paintEvent( QPaintEvent * e)
{
- QMainWindow::paintEvent( e );
+ Q3MainWindow::paintEvent( e );
}
QSize KMainWindow::sizeForCentralWidgetSize(QSize size)
{
KToolBar *tb = (KToolBar*)child( "mainToolBar", "KToolBar" );
if (tb && !tb->isHidden()) {
switch( tb->barPos() )
{
case KToolBar::Top:
case KToolBar::Bottom:
size += QSize(0, tb->sizeHint().height());
break;
case KToolBar::Left:
case KToolBar::Right:
size += QSize(toolBar()->sizeHint().width(), 0);
break;
case KToolBar::Flat:
//US size += QSize(0, 3+kapp->style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
size += QSize(0, tb->sizeHint().height());
break;
default:
diff --git a/microkde/kdeui/kmainwindow.h b/microkde/kdeui/kmainwindow.h
index 2dc8033..a3ac82f 100644
--- a/microkde/kdeui/kmainwindow.h
+++ b/microkde/kdeui/kmainwindow.h
@@ -1,24 +1,29 @@
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QChildEvent>
+#include <QCloseEvent>
+#include <QPaintEvent>
/*
This file is part of the KDE libraries
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
$Id$
*/
#ifndef KMAINWINDOW_H
@@ -29,54 +34,54 @@
#include "kxmlguiclient.h"
#include "kxmlguibuilder.h"
#include <qmetaobject.h>
class KPopupMenu;
class KXMLGUIFactory;
class KConfig;
class KHelpMenu;
class KStatusBar;
class QStatusBar;
class KMenuBar;
class KMWSessionManaged;
class KAccel;
class KToolBarMenuAction;
*/
class QMenuBar;
class QStatusBar;
class KMainWindowPrivate;
class KAction;
#include <ktoolbar.h>
#include <ktoolbarhandler.h>
#include <kxmlguiclient.h>
-#include <qmainwindow.h>
-#include <qptrlist.h>
+#include <q3mainwindow.h>
+#include <q3ptrlist.h>
class KActionCollection;
-class KMainWindow : public QMainWindow, virtual public KXMLGUIClient
+class KMainWindow : public Q3MainWindow, virtual public KXMLGUIClient
{
Q_OBJECT
private:
//US create private defaultconstructor
KMainWindow() {;};
public:
/**
* Construct a main window.
*
* @param parent The widget parent. This is usually 0 but it may also be the window
* group leader. In that case, the KMainWindow becomes sort of a
* secondary window.
*
* @param name The object name. For session management and window management to work
* properly, all main windows in the application should have a
* different name. When passing 0 (the default), KMainWindow will create
* a unique name, but it's recommended to explicitly pass a window name that will
* also describe the type of the window. If there can be several windows of the same
* type, append '#' (hash) to the name, and KMainWindow will append numbers to make
* the names unique. For example, for a mail client which has one main window showing
* the mails and folders, and which can also have one or more windows for composing
@@ -299,54 +304,54 @@ public:
*
* If there is no
* status bar yet one will be created.
*/
//US KStatusBar *statusBar();
QStatusBar *statusBar();
/**
* List of members of KMainWindow class.
*/
//US static QPtrList<KMainWindow>* memberList;
/**
* Returns a pointer to the toolbar with the specified name.
* This refers to toolbars created dynamically from the XML UI
* framework. If the toolbar does not exist one will be created.
*
* @param name The internal name of the toolbar. If no name is
* specified "mainToolBar" is assumed.
*
* @return A pointer to the toolbar
**/
KToolBar *toolBar( const char *name=0 );
// method for getting rid of KDE-Crap
- QToolBar *tBar( );
+ Q3ToolBar *tBar( );
/**
* @return An iterator over the list of all toolbars for this window.
*/
- QPtrListIterator<KToolBar> toolBarIterator();
+ Q3PtrListIterator<KToolBar> toolBarIterator();
/**
* @return A KAccel instance bound to this mainwindow. Used automatically
* by KAction to make keybindings work in all cases.
*/
KAccel *accel();
void setFrameBorderWidth( int ) {}
/**
* Call this to enable "auto-save" of toolbar/menubar/statusbar settings
* (and optionally window size).
* If the *bars were moved around/shown/hidden when the window is closed,
* saveMainWindowSettings( KGlobal::config(), groupName ) will be called.
*
* @param groupName a name that identifies this "type of window".
* You can have several types of window in the same application.
*
* @param saveWindowSize set it to true to include the window size
* when saving.
*
* Typically, you will call setAutoSaveSettings() in your
* KMainWindow-inherited class constructor, and it will take care
* of restoring and saving automatically. Make sure you call this
@@ -737,41 +742,41 @@ protected slots:
* void MyMainLevel::setupInterface()
* {
* ..
* menuBar()->insertItem( i18n("&Help"), customHelpMenu() );
* ..
* }
*
* void MyMainLevel::showAboutApplication()
* {
* <activate your custom dialog>
* }
* </pre>
*/
//US virtual void showAboutApplication();
private slots:
/**
* Called when the app is shutting down.
*/
void shuttingDown();
void saveAutoSaveSettings();
private:
- QToolBar * mQToolBar;
+ Q3ToolBar * mQToolBar;
//US KMenuBar *internalMenuBar();
QMenuBar *internalMenuBar();
//US KStatusBar *internalStatusBar();
QStatusBar *internalStatusBar();
KMainWindowPrivate *d;
void initKMainWindow(const char *name);
- QPtrList<KToolBar> toolbarList;
+ Q3PtrList<KToolBar> toolbarList;
protected:
virtual void virtual_hook( int id, void* data );
};
#endif
diff --git a/microkde/kdeui/knuminput.cpp b/microkde/kdeui/knuminput.cpp
index 335d6f4..da01a20 100644
--- a/microkde/kdeui/knuminput.cpp
+++ b/microkde/kdeui/knuminput.cpp
@@ -21,48 +21,51 @@
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#include <assert.h>
#include <math.h>
#include <algorithm>
#include <qlabel.h>
#include <qlineedit.h>
#include <qsize.h>
#include <qslider.h>
#include <qspinbox.h>
#include <qstyle.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QEvent>
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include "knumvalidator.h"
#include "knuminput.h"
static inline int calcDiffByTen( int x, int y ) {
// calculate ( x - y ) / 10 without overflowing ints:
return ( x / 10 ) - ( y / 10 ) + ( x % 10 - y % 10 ) / 10;
}
// ----------------------------------------------------------------------------
KNumInput::KNumInput(QWidget* parent, const char* name)
: QWidget(parent, name)
{
init();
}
KNumInput::KNumInput(KNumInput* below, QWidget* parent, const char* name)
: QWidget(parent, name)
{
@@ -85,74 +88,74 @@ void KNumInput::init()
m_label = 0;
m_slider = 0;
m_alignment = 0;
}
KNumInput::~KNumInput()
{
if(m_prev)
m_prev->m_next = m_next;
if(m_next)
m_next->m_prev = m_prev;
}
void KNumInput::setLabel(const QString & label, int a)
{
if(label.isEmpty()) {
delete m_label;
m_label = 0;
m_alignment = 0;
}
else {
if (m_label) m_label->setText(label);
else m_label = new QLabel(label, this, "KNumInput::QLabel");
- m_label->setAlignment((a & (~(AlignTop|AlignBottom|AlignVCenter)))
- | AlignVCenter);
+ m_label->setAlignment((a & (~(Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter)))
+ | Qt::AlignVCenter);
// if no vertical alignment set, use Top alignment
- if(!(a & (AlignTop|AlignBottom|AlignVCenter)))
- a |= AlignTop;
+ if(!(a & (Qt::AlignTop|Qt::AlignBottom|Qt::AlignVCenter)))
+ a |= Qt::AlignTop;
m_alignment = a;
}
layout(true);
}
QString KNumInput::label() const
{
if (m_label) return m_label->text();
return QString::null;
}
void KNumInput::layout(bool deep)
{
int w1 = m_colw1;
int w2 = m_colw2;
// label sizeHint
m_sizeLabel = (m_label ? m_label->sizeHint() : QSize(0,0));
- if(m_label && (m_alignment & AlignVCenter))
+ if(m_label && (m_alignment & Qt::AlignVCenter))
m_colw1 = m_sizeLabel.width() + 4;
else
m_colw1 = 0;
// slider sizeHint
m_sizeSlider = (m_slider ? m_slider->sizeHint() : QSize(0, 0));
doLayout();
if(!deep) {
m_colw1 = w1;
m_colw2 = w2;
return;
}
KNumInput* p = this;
while(p) {
p->doLayout();
w1 = QMAX(w1, p->m_colw1);
w2 = QMAX(w2, p->m_colw2);
p = p->m_prev;
}
p = m_next;
@@ -181,92 +184,92 @@ void KNumInput::layout(bool deep)
}
QSizePolicy KNumInput::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed );
}
QSize KNumInput::sizeHint() const
{
return minimumSizeHint();
}
void KNumInput::setSteps(int minor, int major)
{
if(m_slider)
m_slider->setSteps( minor, major );
}
// ----------------------------------------------------------------------------
KIntSpinBox::KIntSpinBox(QWidget *parent, const char *name)
: QSpinBox(0, 99, 1, parent, name)
{
- editor()->setAlignment(AlignRight);
+ setAlignment(Qt::AlignRight);
val_base = 10;
setValue(0);
}
KIntSpinBox::~KIntSpinBox()
{
}
KIntSpinBox::KIntSpinBox(int lower, int upper, int step, int value, int base,
QWidget* parent, const char* name)
: QSpinBox(lower, upper, step, parent, name)
{
- editor()->setAlignment(AlignRight);
+ setAlignment(Qt::AlignRight);
val_base = base;
setValue(value);
}
void KIntSpinBox::setBase(int base)
{
val_base = base;
}
int KIntSpinBox::base() const
{
return val_base;
}
QString KIntSpinBox::mapValueToText(int v)
{
return QString::number(v, val_base);
}
int KIntSpinBox::mapTextToValue(bool* ok)
{
return cleanText().toInt(ok, val_base);
}
void KIntSpinBox::setEditFocus(bool mark)
{
- editor()->setFocus();
+ setFocus();
if(mark)
- editor()->selectAll();
+ selectAll();
}
// ----------------------------------------------------------------------------
class KIntNumInput::KIntNumInputPrivate {
public:
int referencePoint;
short blockRelative;
KIntNumInputPrivate( int r )
: referencePoint( r ),
blockRelative( 0 ) {}
};
KIntNumInput::KIntNumInput(KNumInput* below, int val, QWidget* parent,
int _base, const char* name)
: KNumInput(below, parent, name)
{
init(val, _base);
}
KIntNumInput::KIntNumInput(QWidget *parent, const char *name)
: KNumInput(parent, name)
@@ -304,184 +307,184 @@ int KIntNumInput::referencePoint() const {
return d->referencePoint;
}
void KIntNumInput::spinValueChanged(int val)
{
if(m_slider)
m_slider->setValue(val);
emit valueChanged(val);
}
void KIntNumInput::slotEmitRelativeValueChanged( int value ) {
if ( d->blockRelative || !d->referencePoint ) return;
emit relativeValueChanged( double( value ) / double( d->referencePoint ) );
}
void KIntNumInput::setRange(int lower, int upper, int step, bool slider)
{
upper = kMax(upper, lower);
lower = kMin(upper, lower);
m_spin->setMinValue(lower);
m_spin->setMaxValue(upper);
m_spin->setLineStep(step);
- step = m_spin->lineStep(); // maybe QRangeControl didn't like out lineStep?
+ step = m_spin->singleStep(); // maybe QRangeControl didn't like out lineStep?
if(slider) {
if (m_slider)
m_slider->setRange(lower, upper);
else {
m_slider = new QSlider(lower, upper, step, m_spin->value(),
- QSlider::Horizontal, this);
+ Qt::Horizontal, this);
m_slider->setTickmarks(QSlider::Below);
connect(m_slider, SIGNAL(valueChanged(int)),
m_spin, SLOT(setValue(int)));
}
// calculate (upper-lower)/10 without overflowing int's:
int major = calcDiffByTen( upper, lower );
if ( major==0 ) major = step; // #### workaround Qt bug in 2.1-beta4
m_slider->setSteps(step, major);
m_slider->setTickInterval(major);
}
else {
delete m_slider;
m_slider = 0;
}
// check that reference point is still inside valid range:
setReferencePoint( referencePoint() );
layout(true);
}
void KIntNumInput::setMinValue(int min)
{
- setRange(min, m_spin->maxValue(), m_spin->lineStep(), m_slider);
+ setRange(min, m_spin->maxValue(), m_spin->singleStep(), m_slider);
}
int KIntNumInput::minValue() const
{
return m_spin->minValue();
}
void KIntNumInput::setMaxValue(int max)
{
- setRange(m_spin->minValue(), max, m_spin->lineStep(), m_slider);
+ setRange(m_spin->minValue(), max, m_spin->singleStep(), m_slider);
}
int KIntNumInput::maxValue() const
{
return m_spin->maxValue();
}
void KIntNumInput::setSuffix(const QString &suffix)
{
m_spin->setSuffix(suffix);
layout(true);
}
QString KIntNumInput::suffix() const
{
return m_spin->suffix();
}
void KIntNumInput::setPrefix(const QString &prefix)
{
m_spin->setPrefix(prefix);
layout(true);
}
QString KIntNumInput::prefix() const
{
return m_spin->prefix();
}
void KIntNumInput::setEditFocus(bool mark)
{
m_spin->setEditFocus(mark);
}
QSize KIntNumInput::minimumSizeHint() const
{
constPolish();
int w;
int h;
h = 2 + QMAX(m_sizeSpin.height(), m_sizeSlider.height());
// if in extra row, then count it here
- if(m_label && (m_alignment & (AlignBottom|AlignTop)))
+ if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop)))
h += 4 + m_sizeLabel.height();
else
// label is in the same row as the other widgets
h = QMAX(h, m_sizeLabel.height() + 2);
w = m_slider ? m_slider->sizeHint().width() + 8 : 0;
w += m_colw1 + m_colw2;
- if(m_alignment & (AlignTop|AlignBottom))
+ if(m_alignment & (Qt::AlignTop|Qt::AlignBottom))
w = QMAX(w, m_sizeLabel.width() + 4);
return QSize(w, h);
}
void KIntNumInput::doLayout()
{
m_sizeSpin = m_spin->sizeHint();
m_colw2 = m_sizeSpin.width();
if (m_label)
m_label->setBuddy(m_spin);
}
void KIntNumInput::resizeEvent(QResizeEvent* e)
{
int w = m_colw1;
int h = 0;
- if(m_label && (m_alignment & AlignTop)) {
+ if(m_label && (m_alignment & Qt::AlignTop)) {
m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height());
h += m_sizeLabel.height() + 4;
}
- if(m_label && (m_alignment & AlignVCenter))
+ if(m_label && (m_alignment & Qt::AlignVCenter))
m_label->setGeometry(0, 0, w, m_sizeSpin.height());
m_spin->setGeometry(w, h, m_slider ? m_colw2 : QMAX(m_colw2, e->size().width() - w), m_sizeSpin.height());
w += m_colw2 + 8;
if(m_slider)
m_slider->setGeometry(w, h, e->size().width() - w, m_sizeSpin.height());
h += m_sizeSpin.height() + 2;
- if(m_label && (m_alignment & AlignBottom))
+ if(m_label && (m_alignment & Qt::AlignBottom))
m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height());
}
KIntNumInput::~KIntNumInput()
{
delete d;
}
void KIntNumInput::setValue(int val)
{
m_spin->setValue(val);
// slider value is changed by spinValueChanged
}
void KIntNumInput::setRelativeValue( double r ) {
if ( !d->referencePoint ) return;
++d->blockRelative;
setValue( int( d->referencePoint * r + 0.5 ) );
--d->blockRelative;
}
double KIntNumInput::relativeValue() const {
if ( !d->referencePoint ) return 0;
return double( value() ) / double ( d->referencePoint );
@@ -625,140 +628,140 @@ double KDoubleNumInput::mapSliderToSpin( int val ) const
return spinmin + rel * ( spinmax - spinmin );
}
void KDoubleNumInput::sliderMoved(int val)
{
d->spin->setValue( mapSliderToSpin( val ) );
}
void KDoubleNumInput::slotEmitRelativeValueChanged( double value )
{
if ( !d->referencePoint ) return;
emit relativeValueChanged( value / d->referencePoint );
}
QSize KDoubleNumInput::minimumSizeHint() const
{
constPolish();
int w;
int h;
h = 2 + QMAX(m_sizeEdit.height(), m_sizeSlider.height());
// if in extra row, then count it here
- if(m_label && (m_alignment & (AlignBottom|AlignTop)))
+ if(m_label && (m_alignment & (Qt::AlignBottom|Qt::AlignTop)))
h += 4 + m_sizeLabel.height();
else
// label is in the same row as the other widgets
h = QMAX(h, m_sizeLabel.height() + 2);
w = m_slider ? m_slider->sizeHint().width() + 8 : 0;
w += m_colw1 + m_colw2;
- if(m_alignment & (AlignTop|AlignBottom))
+ if(m_alignment & (Qt::AlignTop|Qt::AlignBottom))
w = QMAX(w, m_sizeLabel.width() + 4);
return QSize(w, h);
}
void KDoubleNumInput::resizeEvent(QResizeEvent* e)
{
int w = m_colw1;
int h = 0;
- if(m_label && (m_alignment & AlignTop)) {
+ if(m_label && (m_alignment & Qt::AlignTop)) {
m_label->setGeometry(0, 0, e->size().width(), m_sizeLabel.height());
h += m_sizeLabel.height() + 4;
}
- if(m_label && (m_alignment & AlignVCenter))
+ if(m_label && (m_alignment & Qt::AlignVCenter))
m_label->setGeometry(0, 0, w, m_sizeEdit.height());
d->spin->setGeometry(w, h, m_slider ? m_colw2
: e->size().width() - w, m_sizeEdit.height());
w += m_colw2 + 8;
if(m_slider)
m_slider->setGeometry(w, h, e->size().width() - w, m_sizeEdit.height());
h += m_sizeEdit.height() + 2;
- if(m_label && (m_alignment & AlignBottom))
+ if(m_label && (m_alignment & Qt::AlignBottom))
m_label->setGeometry(0, h, m_sizeLabel.width(), m_sizeLabel.height());
}
void KDoubleNumInput::doLayout()
{
m_sizeEdit = d->spin->sizeHint();
m_colw2 = m_sizeEdit.width();
}
void KDoubleNumInput::setValue(double val)
{
d->spin->setValue( val );
}
void KDoubleNumInput::setRelativeValue( double r )
{
if ( !d->referencePoint ) return;
++d->blockRelative;
setValue( r * d->referencePoint );
--d->blockRelative;
}
void KDoubleNumInput::setReferencePoint( double ref )
{
// clip to valid range:
ref = kMin( maxValue(), kMax( minValue(), ref ) );
d->referencePoint = ref;
}
void KDoubleNumInput::setRange(double lower, double upper, double step,
bool slider)
{
if( m_slider ) {
// don't update the slider to avoid an endless recursion
QSpinBox * spin = d->spin;
disconnect(spin, SIGNAL(valueChanged(int)),
m_slider, SLOT(setValue(int)) );
}
d->spin->setRange( lower, upper, step, d->spin->precision() );
if(slider) {
// upcast to base type to get the min/maxValue in int form:
QSpinBox * spin = d->spin;
int slmax = spin->maxValue();
int slmin = spin->minValue();
int slvalue = spin->value();
- int slstep = spin->lineStep();
+ int slstep = spin->singleStep();
if (m_slider) {
m_slider->setRange(slmin, slmax);
m_slider->setLineStep(slstep);
m_slider->setValue(slvalue);
} else {
m_slider = new QSlider(slmin, slmax, slstep, slvalue,
- QSlider::Horizontal, this);
+ Qt::Horizontal, this);
m_slider->setTickmarks(QSlider::Below);
// feedback line: when one moves, the other moves, too:
connect(m_slider, SIGNAL(valueChanged(int)),
SLOT(sliderMoved(int)) );
}
connect(spin, SIGNAL(valueChanged(int)),
m_slider, SLOT(setValue(int)) );
// calculate ( slmax - slmin ) / 10 without overflowing ints:
int major = calcDiffByTen( slmax, slmin );
if ( !major ) major = slstep; // ### needed?
m_slider->setTickInterval(major);
} else {
delete m_slider;
m_slider = 0;
}
setReferencePoint( referencePoint() );
layout(true);
updateLegacyMembers();
}
void KDoubleNumInput::setMinValue(double min)
{
@@ -891,59 +894,59 @@ public:
return INT_MAX;
} else if ( value < double(INT_MIN) / f ) {
kdWarning() << "KDoubleSpinBox: can't represent value " << value
<< "in terms of fixed-point numbers with precision "
<< mPrecision << endl;
*ok = false;
return INT_MIN;
} else {
*ok = true;
return int( value * f + ( value < 0 ? -0.5 : 0.5 ) );
}
}
double mapToDouble( int value ) const {
return double(value) * basicStep();
}
int mPrecision;
KDoubleValidator * mValidator;
};
KDoubleSpinBox::KDoubleSpinBox( QWidget * parent, const char * name )
: QSpinBox( parent, name )
{
- editor()->setAlignment( Qt::AlignRight );
+ setAlignment( Qt::AlignRight );
d = new Private();
updateValidator();
}
KDoubleSpinBox::KDoubleSpinBox( double lower, double upper, double step,
double value, int precision,
QWidget * parent, const char * name )
: QSpinBox( parent, name )
{
- editor()->setAlignment( Qt::AlignRight );
+ setAlignment( Qt::AlignRight );
d = new Private();
setRange( lower, upper, step, precision );
setValue( value );
connect( this, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int)) );
}
KDoubleSpinBox::~KDoubleSpinBox() {
delete d; d = 0;
}
bool KDoubleSpinBox::acceptLocalizedNumbers() const {
if ( !d->mValidator ) return true; // we'll set one that does;
// can't do it now, since we're const
return d->mValidator->acceptLocalizedNumbers();
}
void KDoubleSpinBox::setAcceptLocalizedNumbers( bool accept ) {
if ( !d->mValidator ) updateValidator();
d->mValidator->setAcceptLocalizedNumbers( accept );
}
void KDoubleSpinBox::setRange( double lower, double upper, double step,
int precision ) {
lower = kMin(upper, lower);
@@ -1006,90 +1009,90 @@ double KDoubleSpinBox::minValue() const {
}
void KDoubleSpinBox::setMinValue( double value ) {
bool ok = false;
int min = d->mapToInt( value, &ok );
if ( !ok ) return;
base::setMinValue( min );
updateValidator();
}
double KDoubleSpinBox::maxValue() const {
return d->mapToDouble( base::maxValue() );
}
void KDoubleSpinBox::setMaxValue( double value ) {
bool ok = false;
int max = d->mapToInt( value, &ok );
if ( !ok ) return;
base::setMaxValue( max );
updateValidator();
}
double KDoubleSpinBox::lineStep() const {
- return d->mapToDouble( base::lineStep() );
+ return d->mapToDouble( base::singleStep() );
}
void KDoubleSpinBox::setLineStep( double step ) {
bool ok = false;
if ( step > maxValue() - minValue() )
base::setLineStep( 1 );
else
base::setLineStep( kMax( d->mapToInt( step, &ok ), 1 ) );
}
QString KDoubleSpinBox::mapValueToText( int value ) {
if ( acceptLocalizedNumbers() )
return KGlobal::locale()
->formatNumber( d->mapToDouble( value ), d->mPrecision );
else
return QString().setNum( d->mapToDouble( value ), 'f', d->mPrecision );
}
int KDoubleSpinBox::mapTextToValue( bool * ok ) {
double value;
if ( acceptLocalizedNumbers() )
value = KGlobal::locale()->readNumber( cleanText(), ok );
else
value = cleanText().toDouble( ok );
if ( !*ok ) return 0;
if ( value > maxValue() )
value = maxValue();
else if ( value < minValue() )
value = minValue();
return d->mapToInt( value, ok );
}
void KDoubleSpinBox::setValidator( const QValidator * ) {
// silently discard the new validator. We don't want another one ;-)
}
void KDoubleSpinBox::slotValueChanged( int value ) {
emit valueChanged( d->mapToDouble( value ) );
}
void KDoubleSpinBox::updateValidator() {
if ( !d->mValidator ) {
d->mValidator = new KDoubleValidator( minValue(), maxValue(), precision(),
this, "d->mValidator" );
- base::setValidator( d->mValidator );
+ lineEdit()->setValidator( d->mValidator );
} else
d->mValidator->setRange( minValue(), maxValue(), precision() );
}
void KNumInput::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KIntNumInput::virtual_hook( int id, void* data )
{ KNumInput::virtual_hook( id, data ); }
void KDoubleNumInput::virtual_hook( int id, void* data )
{ KNumInput::virtual_hook( id, data ); }
void KIntSpinBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
void KDoubleSpinBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
//US #include "knuminput.moc"
diff --git a/microkde/kdeui/knuminput.h b/microkde/kdeui/knuminput.h
index 123fefa..9f9e200 100644
--- a/microkde/kdeui/knuminput.h
+++ b/microkde/kdeui/knuminput.h
@@ -8,48 +8,53 @@
* Requires the Qt widget libraries, available at no cost at
* http://www.troll.no/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef K_NUMINPUT_H
#define K_NUMINPUT_H
#include <qwidget.h>
#include <qspinbox.h>
+#include <QLineEdit>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
+#include <QEvent>
class QLabel;
class QSlider;
class QLineEdit;
class QLayout;
class QValidator;
class KIntSpinBox;
/* ------------------------------------------------------------------------ */
/**
* You need to inherit from this class if you want to implement K*NumInput
* for a different variable type
*
*/
class KNumInput : public QWidget
{
Q_OBJECT
Q_PROPERTY( QString label READ label WRITE setLabel )
public:
/**
* Default constructor
*
@@ -60,49 +65,49 @@ public:
* @param below A pointer to another KNumInput.
*
*/
KNumInput(KNumInput* below, QWidget* parent=0, const char* name=0);
~KNumInput();
/**
* Sets the text and alignment of the main description label.
*
* @param label The text of the label.
* Use QString::null to remove an existing one.
*
* @param a one of @p AlignLeft, @p AlignHCenter, YAlignRight and
* @p AlignTop, @p AlignVCenter, @p AlignBottom.
* default is @p AlignLeft | @p AlignTop.
*
* The vertical alignment flags have special meaning with this
* widget:
*
* @li @p AlignTop The label is placed above the edit/slider
* @li @p AlignVCenter The label is placed left beside the edit
* @li @p AlignBottom The label is placed below the edit/slider
*
*/
- virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop);
+ virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop);
/**
* @return the text of the label.
*/
QString label() const;
/**
* @return if the num input has a slider.
* @since 3.1
*/
bool showSlider() const { return m_slider; }
/**
* Sets the spacing of tickmarks for the slider.
*
* @param minor Minor tickmark separation.
* @param major Major tickmark separation.
*/
void setSteps(int minor, int major);
/**
* Specifies that this widget may stretch horizontally, but is
* fixed vertically (like @ref QSpinBox itself).
*/
@@ -281,49 +286,49 @@ public:
/**
* @return the minimum value.
*/
int minValue() const;
/**
* Sets the maximum value.
*/
void setMaxValue(int max);
/**
* @return the maximum value.
*/
int maxValue() const;
/**
* Sets the special value text. If set, the SpinBox will display
* this text instead of the numeric value whenever the current
* value is equal to minVal(). Typically this is used for indicating
* that the choice has a special (default) meaning.
*/
void setSpecialValueText(const QString& text);
/**
* @reimplemented
*/
- virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop);
+ virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop);
/**
* This method returns the minimum size necessary to display the
* control. The minimum size is enough to show all the labels
* in the current font (font change may invalidate the return value).
*
* @return the minimum size necessary to show the control
*/
virtual QSize minimumSizeHint() const;
public slots:
/**
* Sets the value of the control.
*/
void setValue(int);
/**
* Sets the value in units of the @ref referencePoint
* @since 3.1
*/
void setRelativeValue(double);
/**
* Sets the reference point for @ref relativeValue.
@@ -567,49 +572,49 @@ public:
/**
* @return the reference point for @ref #relativeValue calculation
* @since 3.1
*/
double referencePoint() const;
/**
* @return the current value in units of @ref #referencePoint.
* @since 3.1
*/
double relativeValue() const;
/**
* Sets the special value text. If set, the spin box will display
* this text instead of the numeric value whenever the current
* value is equal to @ref #minVal(). Typically this is used for indicating
* that the choice has a special (default) meaning.
*/
void setSpecialValueText(const QString& text);
/**
* @reimplemented
*/
- virtual void setLabel(const QString & label, int a = AlignLeft | AlignTop);
+ virtual void setLabel(const QString & label, int a = Qt::AlignLeft | Qt::AlignTop);
/**
* @reimplemented
*/
virtual QSize minimumSizeHint() const;
/**
* @reimplemented
*/
virtual bool eventFilter(QObject*, QEvent*);
public slots:
/**
* Sets the value of the control.
*/
void setValue(double);
/**
* Sets the value in units of @ref #referencePoint.
* @since 3.1
*/
void setRelativeValue(double);
/**
* Sets the reference Point to @p ref. It @p ref == 0, emitting of
* @ref #relativeValueChanged is blocked and @ref #relativeValue
@@ -737,48 +742,52 @@ public:
* @param name The Name of the widget.
*/
KIntSpinBox(int lower, int upper, int step, int value, int base = 10,
QWidget* parent = 0, const char* name = 0);
/**
* Destructor.
*/
virtual ~KIntSpinBox();
/**
* Sets the base in which the numbers in the spin box are represented.
*/
void setBase(int base);
/**
* @return the base in which numbers in the spin box are represented.
*/
int base() const;
/**
* sets focus and optionally marks all text
*
*/
void setEditFocus(bool mark);
+ void setValidator(const QValidator *v) {
+ lineEdit()->setValidator(v);
+ }
+
protected:
/**
* Overloaded the method in QSpinBox
* to make use of the base given in the constructor.
*/
virtual QString mapValueToText(int);
/**
* Overloaded the method in QSpinBox
* to make use of the base given in the constructor.
*/
virtual int mapTextToValue(bool*);
private:
int val_base;
protected:
virtual void virtual_hook( int id, void* data );
private:
class KIntSpinBoxPrivate;
KIntSpinBoxPrivate *d;
};
diff --git a/microkde/kdeui/kpopupmenu.cpp b/microkde/kdeui/kpopupmenu.cpp
index 96d2a87..7e1503c 100644
--- a/microkde/kdeui/kpopupmenu.cpp
+++ b/microkde/kdeui/kpopupmenu.cpp
@@ -1,19 +1,22 @@
#include <kpopupmenu.h>
#include <qtimer.h>
+//Added by qt3to4:
+#include <QFocusEvent>
+#include <Q3PopupMenu>
KPopupMenu::KPopupMenu ( QWidget * parent, const char * name )
- : QPopupMenu ( parent, name ) {;}
+ : Q3PopupMenu ( parent, name ) {;}
KMenuBar::KMenuBar ( QWidget * parent, const char * name )
: QPEMenuBar ( parent, name ) {}
void KMenuBar::focusOutEvent ( QFocusEvent * e)
{
QPEMenuBar::focusOutEvent( e );
QTimer::singleShot( 100, this, SIGNAL ( lostFocus() ) );
}
diff --git a/microkde/kdeui/kpopupmenu.h b/microkde/kdeui/kpopupmenu.h
index fd00f36..1c903ad 100644
--- a/microkde/kdeui/kpopupmenu.h
+++ b/microkde/kdeui/kpopupmenu.h
@@ -1,32 +1,34 @@
#ifndef KPOPUPMENU_H
#define KPOPUPMENU_H
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <QFocusEvent>
#ifdef DESKTOP_VERSION
#include <qmenubar.h>
#define QPEMenuBar QMenuBar
#else
#include <qpe/qpemenubar.h>
#endif
-class KPopupMenu : public QPopupMenu
+class KPopupMenu : public Q3PopupMenu
{
Q_OBJECT
public:
KPopupMenu ( QWidget * parent=0, const char * name=0 );
};
class KMenuBar : public QPEMenuBar
{
Q_OBJECT
public:
KMenuBar ( QWidget * parent=0, const char * name=0 );
signals:
void lostFocus();
protected:
void focusOutEvent ( QFocusEvent * e);
};
#endif
diff --git a/microkde/kdeui/kseparator.cpp b/microkde/kdeui/kseparator.cpp
index d028420..66000f0 100644
--- a/microkde/kdeui/kseparator.cpp
+++ b/microkde/kdeui/kseparator.cpp
@@ -1,88 +1,90 @@
/*
* Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#include <qstyle.h>
+//Added by qt3to4:
+#include <Q3Frame>
#include <kdebug.h>
//US #include <kapplication.h>
//US #include "kseparator.moc"
#include "kseparator.h"
-KSeparator::KSeparator(QWidget* parent, const char* name, WFlags f)
- : QFrame(parent, name, f)
+KSeparator::KSeparator(QWidget* parent, const char* name, Qt::WFlags f)
+ : Q3Frame(parent, name, f)
{
setLineWidth(1);
setMidLineWidth(0);
setOrientation( HLine );
}
-KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, WFlags f)
- : QFrame(parent, name, f)
+KSeparator::KSeparator(int orientation, QWidget* parent, const char* name, Qt::WFlags f)
+ : Q3Frame(parent, name, f)
{
setLineWidth(1);
setMidLineWidth(0);
setOrientation( orientation );
}
void KSeparator::setOrientation(int orientation)
{
switch(orientation)
{
- case Vertical:
+ case Qt::Vertical:
case VLine:
- setFrameStyle( QFrame::VLine | QFrame::Sunken );
+ setFrameStyle( Q3Frame::VLine | Q3Frame::Sunken );
setMinimumSize(2, 0);
break;
default:
kdWarning() << "KSeparator::setOrientation(): invalid orientation, using default orientation HLine" << endl;
- case Horizontal:
+ case Qt::Horizontal:
case HLine:
- setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ setFrameStyle( Q3Frame::HLine | Q3Frame::Sunken );
setMinimumSize(0, 2);
break;
}
}
int KSeparator::orientation() const
{
if ( frameStyle() & VLine )
return VLine;
if ( frameStyle() & HLine )
return HLine;
return 0;
}
void KSeparator::drawFrame(QPainter *p)
{
QPoint p1, p2;
QRect r = frameRect();
const QColorGroup & g = colorGroup();
diff --git a/microkde/kdeui/kseparator.h b/microkde/kdeui/kseparator.h
index 6d2712a..c673475 100644
--- a/microkde/kdeui/kseparator.h
+++ b/microkde/kdeui/kseparator.h
@@ -1,71 +1,71 @@
/*
* Copyright (C) 1997 Michael Roth <mroth@wirlweb.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __KSEPARATOR_H__
#define __KSEPARATOR_H__
-#include <qframe.h>
+#include <q3frame.h>
/**
* Standard horizontal or vertical separator.
*
* @author Michael Roth <mroth@wirlweb.de>
* @version $Id$
*/
-class KSeparator : public QFrame
+class KSeparator : public Q3Frame
{
Q_OBJECT
Q_PROPERTY( int orientation READ orientation WRITE setOrientation )
public:
/**
* Constructor.
**/
- KSeparator(QWidget* parent=0, const char* name=0, WFlags f=0);
+ KSeparator(QWidget* parent=0, const char* name=0, Qt::WFlags f=0);
/**
* Constructor.
*
* @param orientation Set the orientation of the separator.
* Possible values are HLine or Horizontal and VLine or Vertical.
**/
KSeparator(int orientation, QWidget* parent=0, const char* name=0,
- WFlags f=0);
+ Qt::WFlags f=0);
/**
* Returns the orientation of the separator.
*
* Possible values are VLine and HLine.
**/
int orientation() const;
/**
* Set the orientation of the separator to @p orient
*
* Possible values are VLine and HLine.
*/
void setOrientation(int orient);
/**
* The recommended height (width) for a horizontal (vertical) separator.
**/
virtual QSize sizeHint() const;
protected:
virtual void drawFrame( QPainter * );
protected:
virtual void virtual_hook( int id, void* data );
diff --git a/microkde/kdeui/ksqueezedtextlabel.cpp b/microkde/kdeui/ksqueezedtextlabel.cpp
index 37fa29a..e2c61fd 100644
--- a/microkde/kdeui/ksqueezedtextlabel.cpp
+++ b/microkde/kdeui/ksqueezedtextlabel.cpp
@@ -1,44 +1,47 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "ksqueezedtextlabel.h"
#include <qtooltip.h>
+//Added by qt3to4:
+#include <QResizeEvent>
+#include <QLabel>
KSqueezedTextLabel::KSqueezedTextLabel( const QString &text , QWidget *parent, const char *name )
: QLabel ( parent, name ) {
setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
fullText = text;
squeezeTextToLabel();
}
KSqueezedTextLabel::KSqueezedTextLabel( QWidget *parent, const char *name )
: QLabel ( parent, name ) {
setSizePolicy(QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ));
}
void KSqueezedTextLabel::resizeEvent( QResizeEvent * ) {
squeezeTextToLabel();
}
QSize KSqueezedTextLabel::minimumSizeHint() const
{
QSize sh = QLabel::minimumSizeHint();
sh.setWidth(-1);
return sh;
}
diff --git a/microkde/kdeui/ksqueezedtextlabel.h b/microkde/kdeui/ksqueezedtextlabel.h
index 1634adc..487d0b0 100644
--- a/microkde/kdeui/ksqueezedtextlabel.h
+++ b/microkde/kdeui/ksqueezedtextlabel.h
@@ -1,46 +1,48 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Ronny Standtke <Ronny.Standtke@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KSQUEEZEDTEXTLABEL_H
#define KSQUEEZEDTEXTLABEL_H
#include <qlabel.h>
+//Added by qt3to4:
+#include <QResizeEvent>
/**
* A label class that squeezes its text into the label
*
* If the text is too long to fit into the label it is divided into
* remaining left and right parts which are separated by three dots.
*
* Example:
* http://www.kde.org/documentation/index.html could be squeezed to
* http://www.kde...ion/index.html
* @short A replacement for QLabel that squeezes its text
* @author Ronny Standtke <Ronny.Standtke@gmx.de>
* @version $Id$
*
*/
/*
* @ref QLabel
*/
class KSqueezedTextLabel : public QLabel {
Q_OBJECT
public:
diff --git a/microkde/kdeui/kstdaction.cpp b/microkde/kdeui/kstdaction.cpp
index cfd7b54..f0d162d 100644
--- a/microkde/kdeui/kstdaction.cpp
+++ b/microkde/kdeui/kstdaction.cpp
@@ -1,46 +1,46 @@
/* This file is part of the KDE libraries
Copyright (C) 1999,2000 Kurt Granroth <granroth@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kstdaction.h"
#include <qtoolbutton.h>
-#include <qwhatsthis.h>
+#include <q3whatsthis.h>
//US #include <kaboutdata.h>
#include <kaction.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klocale.h>
//US #include <kstdaccel.h>
//US #include <kmainwindow.h>
namespace KStdAction
{
struct KStdActionInfo
{
StdAction id;
/*US KStdAccel::StdAccel idAccel;*/
const char* psName;
const char* psLabel;
const char* psWhatsThis;
const char* psIconName;
};
diff --git a/microkde/kdeui/ktoolbar.cpp b/microkde/kdeui/ktoolbar.cpp
index 027e5e9..02db316 100644
--- a/microkde/kdeui/ktoolbar.cpp
+++ b/microkde/kdeui/ktoolbar.cpp
@@ -4,305 +4,316 @@
(C) 1997, 1998 Stephan Kulow (coolo@kde.org)
(C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
(C) 1997, 1998 Sven Radej (radej@kde.org)
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 1999 Chris Schlaeger (cs@kde.org)
(C) 1999 Kurt Granroth (granroth@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifdef KDE_USE_FINAL
#undef Always
-#include <qdockwindow.h>
+#include <q3dockwindow.h>
#endif
-
+//Added by qt3to4:
+#include <Q3ValueList>
+#include <Q3PtrList>
+#include <QPixmap>
+#include <Q3Frame>
+#include <QResizeEvent>
+#include <QMouseEvent>
+#include <QChildEvent>
+#include <QEvent>
+#include <QShowEvent>
+#include <QDesktopWidget>
+#include <QBoxLayout>
#include "ktoolbar.h"
#include "kmainwindow.h"
#include <string.h>
#include <qpainter.h>
#include <qtooltip.h>
#include <qdrawutil.h>
#include <qstring.h>
#include <qrect.h>
-#include <qobjectlist.h>
+#include <qobject.h>
#include <qtimer.h>
#include <qstyle.h>
#include <qapplication.h>
//US #include <config.h>
#include "klineedit.h"
#include "kseparator.h"
#include <klocale.h>
#include <kapplication.h>
#include <kaction.h>
#include <kstdaction.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kiconloader.h>
#include <kcombobox.h>
//US #include <kpopupmenu.h>
//US #include <kanimwidget.h>
//US #include <kipc.h>
//US #include <kwin.h>
#include <kdebug.h>
#include <qlayout.h>
#include "ktoolbarbutton.h"
//US
#include "kconfigbase.h"
-#include <qpopupmenu.h>
-#include <qmainwindow.h>
+#include <q3popupmenu.h>
+#include <q3mainwindow.h>
enum {
CONTEXT_TOP = 0,
CONTEXT_LEFT = 1,
CONTEXT_RIGHT = 2,
CONTEXT_BOTTOM = 3,
CONTEXT_FLOAT = 4,
CONTEXT_FLAT = 5,
CONTEXT_ICONS = 6,
CONTEXT_TEXT = 7,
CONTEXT_TEXTRIGHT = 8,
CONTEXT_TEXTUNDER = 9,
CONTEXT_ICONSIZES = 50 // starting point for the icon size list, put everything else before
};
class KToolBarPrivate
{
public:
KToolBarPrivate() {
m_iconSize = 0;
m_iconText = KToolBar::IconOnly;
m_highlight = true;
m_transparent = true;
m_honorStyle = false;
m_enableContext = true;
m_xmlguiClient = 0;
m_configurePlugged = false;
//US oldPos = Qt::DockUnmanaged;
- oldPos = QMainWindow::Unmanaged;
+ oldPos = Qt::Unmanaged;
modified = m_isHorizontal = positioned = FALSE;
HiddenDefault = false;
IconSizeDefault = 0;
IconTextDefault = "IconOnly";
IndexDefault = -1;
NewLineDefault = false;
OffsetDefault = -1;
PositionDefault = "Top";
idleButtons.setAutoDelete(true);
}
int m_iconSize;
KToolBar::IconText m_iconText;
bool m_highlight : 1;
bool m_transparent : 1;
bool m_honorStyle : 1;
bool m_isHorizontal : 1;
bool m_enableContext : 1;
bool m_configurePlugged : 1;
bool modified : 1;
bool positioned : 1;
QWidget *m_parent;
- QMainWindow::ToolBarDock oldPos;
+ Qt::ToolBarDock oldPos;
KXMLGUIClient *m_xmlguiClient;
struct ToolBarInfo
{
//US ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
- ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( QMainWindow::Top ) {}
+ ToolBarInfo() : index( 0 ), offset( -1 ), newline( FALSE ), dock( Qt::DockTop ) {}
//US ToolBarInfo( Qt::Dock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
- ToolBarInfo( QMainWindow::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
+ ToolBarInfo( Qt::ToolBarDock d, int i, bool n, int o ) : index( i ), offset( o ), newline( n ), dock( d ) {}
int index, offset;
bool newline;
//US Qt::Dock dock;
- QMainWindow::ToolBarDock dock;
+ Qt::ToolBarDock dock;
};
ToolBarInfo toolBarInfo;
- QValueList<int> iconSizes;
+ Q3ValueList<int> iconSizes;
QTimer repaintTimer;
// Default Values.
bool HiddenDefault;
int IconSizeDefault;
QString IconTextDefault;
int IndexDefault;
bool NewLineDefault;
int OffsetDefault;
QString PositionDefault;
- QPtrList<QWidget> idleButtons;
+ Q3PtrList<QWidget> idleButtons;
};
-KToolBarSeparator::KToolBarSeparator(Orientation o , bool l, QToolBar *parent,
+KToolBarSeparator::KToolBarSeparator(Qt::Orientation o , bool l, Q3ToolBar *parent,
const char* name )
- :QFrame( parent, name ), line( l )
+ :Q3Frame( parent, name ), line( l )
{
- connect( parent, SIGNAL(orientationChanged(Orientation)),
- this, SLOT(setOrientation(Orientation)) );
+ connect( parent, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(setOrientation(Qt::Orientation)) );
setOrientation( o );
setBackgroundMode( parent->backgroundMode() );
setBackgroundOrigin( ParentOrigin );
}
-void KToolBarSeparator::setOrientation( Orientation o )
+void KToolBarSeparator::setOrientation( Qt::Orientation o )
{
orient = o;
if ( line ) {
- if ( orientation() == Vertical )
+ if ( orientation() == Qt::Vertical )
setFrameStyle( HLine + Sunken );
else
setFrameStyle( VLine + Sunken );
} else {
setFrameStyle( NoFrame );
}
}
void KToolBarSeparator::styleChange( QStyle& )
{
setOrientation( orient );
}
QSize KToolBarSeparator::sizeHint() const
{
- return orientation() == Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
+ return orientation() == Qt::Vertical ? QSize( 0, 6 ) : QSize( 6, 0 );
}
QSizePolicy KToolBarSeparator::sizePolicy() const
{
return QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
}
KToolBar::KToolBar( QWidget *parent, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
- : QToolBar( QString::fromLatin1( name ),
- parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
+ : Q3ToolBar( QString::fromLatin1( name ),
+ parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0,
parent, FALSE,
name ? name : "mainToolBar")
#else
- : QPEToolBar( parent && parent->inherits( "QMainWindow" ) ? static_cast<QMainWindow*>(parent) : 0,
+ : QPEToolBar( parent && parent->inherits( "Q3MainWindow" ) ? static_cast<Q3MainWindow*>(parent) : 0,
QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
-KToolBar::KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
+KToolBar::KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
- : QToolBar( QString::fromLatin1( name ),
+ : Q3ToolBar( QString::fromLatin1( name ),
parentWindow, dock, newLine,
name ? name : "mainToolBar")
#else
: QPEToolBar( parentWindow,QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
-KToolBar::KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
+KToolBar::KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine, const char *name, bool honorStyle, bool readConfig )
#ifdef DESKTOP_VERSION
- : QToolBar( QString::fromLatin1( name ),
+ : Q3ToolBar( QString::fromLatin1( name ),
parentWindow, dock, newLine,
name ? name : "mainToolBar")
#else
: QPEToolBar( parentWindow,QString::fromLatin1( name ))
#endif
{
init( readConfig, honorStyle );
}
KToolBar::~KToolBar()
{
inshutdownprocess = true;
emit toolbarDestroyed();
delete d;
}
void KToolBar::init( bool readConfig, bool honorStyle )
{
sizeHintW = 240;
sizeHintH = 22;
inshutdownprocess = false;
d = new KToolBarPrivate;
setFullSize( TRUE );
d->m_honorStyle = honorStyle;
context = 0;
layoutTimer = new QTimer( this );
connect( layoutTimer, SIGNAL( timeout() ),
this, SLOT( rebuildLayout() ) );
connect( &(d->repaintTimer), SIGNAL( timeout() ),
this, SLOT( slotRepaint() ) );
/*US
if ( kapp ) { // may be null when started inside designer
connect(kapp, SIGNAL(toolbarAppearanceChanged(int)), this, SLOT(slotAppearanceChanged()));
// request notification of changes in icon style
kapp->addKipcEventMask(KIPC::IconChanged);
connect(kapp, SIGNAL(iconChanged(int)), this, SLOT(slotIconChanged(int)));
}
*/
// finally, read in our configurable settings
if ( readConfig )
slotReadConfig();
if ( mainWindow() )
- connect( mainWindow(), SIGNAL( toolBarPositionChanged( QToolBar * ) ),
- this, SLOT( toolBarPosChanged( QToolBar * ) ) );
+ connect( mainWindow(), SIGNAL( toolBarPositionChanged( Q3ToolBar * ) ),
+ this, SLOT( toolBarPosChanged( Q3ToolBar * ) ) );
// Hack to make sure we recalculate our size when we dock.
//US connect( this, SIGNAL(placeChanged(QDockWindow::Place)), SLOT(rebuildLayout()) );
}
int KToolBar::insertButton(const QString& icon, int id, bool enabled,
const QString& text, int index/*US, KInstance *_instance*/ )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/ );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
doConnections( button );
return index;
}
int KToolBar::insertButton(const QString& icon, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled, const QString& text, int index/*US, KInstance *_instance*/ )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text/*US, _instance*/);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
@@ -320,61 +331,61 @@ int KToolBar::insertButton(const QPixmap& pixmap, int id, bool enabled,
button->setEnabled( enabled );
doConnections( button );
return index;
}
#if 0
bar->insertButton( icon, id_, SIGNAL( clicked() ), this,
SLOT( slotActivated() ),
d->isEnabled(), d->plainText(), index/*US, instance*/ );
#endif
int KToolBar::insertButton(const QPixmap& pixmap, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled, const QString& text,
int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text);
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
connect( button, signal, receiver, slot );
doConnections( button );
return index;
}
-int KToolBar::insertButton(const QString& icon, int id, QPopupMenu *popup,
+int KToolBar::insertButton(const QString& icon, int id, Q3PopupMenu *popup,
bool enabled, const QString &text, int index )
{
KToolBarButton *button = new KToolBarButton( icon, id, this, 0, text );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
button->setPopup( popup );
doConnections( button );
return index;
}
-int KToolBar::insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup,
+int KToolBar::insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup,
bool enabled, const QString &text, int index )
{
KToolBarButton *button = new KToolBarButton( pixmap, id, this, 0, text );
insertWidgetInternal( button, index, id );
button->setEnabled( enabled );
button->setPopup( popup );
doConnections( button );
return index;
}
int KToolBar::insertLined (const QString& text, int id,
const char *signal,
const QObject *receiver, const char *slot,
bool enabled ,
const QString& toolTipText,
int size, int index )
{
KLineEdit *lined = new KLineEdit ( this, 0 );
if ( !toolTipText.isEmpty() )
QToolTip::add( lined, toolTipText );
if ( size > 0 )
lined->setMinimumWidth( size );
insertWidgetInternal( lined, index, id );
@@ -519,61 +530,61 @@ void KToolBar::setItemEnabled( int id, bool enabled )
void KToolBar::setButtonPixmap( int id, const QPixmap& _pixmap )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setPixmap( _pixmap );
}
void KToolBar::setButtonIcon( int id, const QString& _icon )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setIcon( _icon );
}
-void KToolBar::setButtonIconSet( int id, const QIconSet& iconset )
+void KToolBar::setButtonIconSet( int id, const QIcon& iconset )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setIconSet( iconset );
}
-void KToolBar::setDelayedPopup (int id , QPopupMenu *_popup, bool toggle )
+void KToolBar::setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setDelayedPopup( _popup, toggle );
}
void KToolBar::setAutoRepeat (int id, bool flag)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if ( button )
button->setAutoRepeat( flag );
}
void KToolBar::setToggle (int id, bool flag )
@@ -766,49 +777,49 @@ void KToolBar::alignItemRight (int id, bool right )
if ( rightAligned && !right && (*it) == rightAligned )
rightAligned = 0;
if ( (*it) && right )
rightAligned = (*it);
}
QWidget *KToolBar::getWidget (int id)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
return ( it == id2widget.end() ) ? 0 : (*it);
}
void KToolBar::setItemAutoSized (int id, bool yes )
{
QWidget *w = getWidget(id);
if ( w && yes )
setStretchableWidget( w );
}
void KToolBar::clear ()
{
- QToolBar::clear();
+ Q3ToolBar::clear();
widget2id.clear();
id2widget.clear();
}
void KToolBar::removeItem(int id)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
{
kdDebug(220) << "KToolBar::removeItem item " << id << " not found" << endl;
return;
}
QWidget * w = (*it);
id2widget.remove( id );
widget2id.remove( w );
widgets.removeRef( w );
delete w;
}
void KToolBar::removeItemDelayed(int id)
{
Id2WidgetMap::Iterator it = id2widget.find( id );
@@ -855,63 +866,63 @@ void KToolBar::setFullSize(bool flag )
{
setHorizontalStretchable( flag );
setVerticalStretchable( flag );
}
bool KToolBar::fullSize() const
{
return isHorizontalStretchable() || isVerticalStretchable();
}
void KToolBar::enableMoving(bool flag )
{
//US setMovingEnabled(flag);
this->mainWindow()->setToolBarsMovable(flag);
}
void KToolBar::setBarPos (BarPosition bpos)
{
if ( !mainWindow() )
return;
//US mainWindow()->moveDockWindow( this, (Dock)bpos );
- mainWindow()->moveToolBar( this, (QMainWindow::ToolBarDock)bpos );
+ mainWindow()->moveToolBar( this, (Qt::ToolBarDock)bpos );
}
const KToolBar::BarPosition KToolBar::barPos()
{
- if ( !(QMainWindow*)mainWindow() )
+ if ( !(Q3MainWindow*)mainWindow() )
return KToolBar::Top;
//US Dock dock;
- QMainWindow::ToolBarDock dock;
+ Qt::ToolBarDock dock;
int dm1, dm2;
bool dm3;
- ((QMainWindow*)mainWindow())->getLocation( (QToolBar*)this, dock, dm1, dm3, dm2 );
+ ((Q3MainWindow*)mainWindow())->getLocation( (Q3ToolBar*)this, dock, dm1, dm3, dm2 );
//US if ( dock == DockUnmanaged ) {
- if ( dock == QMainWindow::Unmanaged ) {
+ if ( dock == Qt::Unmanaged ) {
return (KToolBar::BarPosition)Top;
}
return (BarPosition)dock;
}
bool KToolBar::enable(BarStatus stat)
{
bool mystat = isVisible();
if ( (stat == Toggle && mystat) || stat == Hide )
hide();
else
show();
return isVisible() == mystat;
}
void KToolBar::setMaxHeight ( int h )
{
setMaximumHeight( h );
}
@@ -946,86 +957,86 @@ void KToolBar::enableFloating (bool )
void KToolBar::setIconText(IconText it)
{
setIconText( it, true );
}
void KToolBar::setIconText(IconText icontext, bool update)
{
bool doUpdate=false;
if (icontext != d->m_iconText) {
d->m_iconText = icontext;
doUpdate=true;
}
if (update == false)
return;
if (doUpdate)
emit modechange(); // tell buttons what happened
// ugly hack to force a QMainWindow::triggerLayout( TRUE )
if ( mainWindow() ) {
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
mw->setUpdatesEnabled( FALSE );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setUpdatesEnabled( TRUE );
}
}
KToolBar::IconText KToolBar::iconText() const
{
return d->m_iconText;
}
void KToolBar::setIconSize(int size)
{
setIconSize( size, true );
}
void KToolBar::setIconSize(int size, bool update)
{
bool doUpdate=false;
if ( size != d->m_iconSize ) {
d->m_iconSize = size;
doUpdate=true;
}
if (update == false)
return;
if (doUpdate)
emit modechange(); // tell buttons what happened
// ugly hack to force a QMainWindow::triggerLayout( TRUE )
if ( mainWindow() ) {
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
mw->setUpdatesEnabled( FALSE );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setToolBarsMovable( !mw->toolBarsMovable() );
mw->setUpdatesEnabled( TRUE );
}
}
int KToolBar::iconSize() const
{
/*US
if ( !d->m_iconSize ) // default value?
{
if (!::qstrcmp(QObject::name(), "mainToolBar"))
return KGlobal::iconLoader()->currentSize(KIcon::MainToolbar);
else
return KGlobal::iconLoader()->currentSize(KIcon::Toolbar);
}
return d->m_iconSize;
*/
int ret = 18;
if ( QApplication::desktop()->width() > 320 )
ret = 30;
return ret;
@@ -1041,52 +1052,52 @@ void KToolBar::setEnableContextMenu(bool enable )
bool KToolBar::contextMenuEnabled() const
{
return d->m_enableContext;
}
void KToolBar::setItemNoStyle(int id, bool no_style )
{
Id2WidgetMap::Iterator it = id2widget.find( id );
if ( it == id2widget.end() )
return;
//US KToolBarButton * button = dynamic_cast<KToolBarButton *>( *it );
KToolBarButton * button = (KToolBarButton *)( *it );
if (button)
button->setNoStyle( no_style );
}
void KToolBar::setFlat (bool flag)
{
if ( !mainWindow() )
return;
if ( flag )
//US mainWindow()->moveDockWindow( this, DockMinimized );
- mainWindow()->moveToolBar( this, QMainWindow::Minimized );
+ mainWindow()->moveToolBar( this, Qt::Minimized );
else
//US mainWindow()->moveDockWindow( this, DockTop );
- mainWindow()->moveToolBar( this, QMainWindow::Top );
+ mainWindow()->moveToolBar( this, Qt::Top );
// And remember to save the new look later
/*US
if ( mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
}
int KToolBar::count() const
{
return id2widget.count();
}
void KToolBar::saveState()
{
/*US
// first, try to save to the xml file
if ( d->m_xmlguiClient && !d->m_xmlguiClient->xmlFile().isEmpty() ) {
// go down one level to get to the right tags
QDomElement elem = d->m_xmlguiClient->domDocument().documentElement().toElement();
elem = elem.firstChild().toElement();
QString barname(!::qstrcmp(name(), "unnamed") ? "mainToolBar" : name());
QDomElement current;
@@ -1228,76 +1239,76 @@ void KToolBar::setText( const QString & txt )
setLabel( txt + " ( " + KGlobal::getAppName() + " ) " );
}
QString KToolBar::text() const
{
return label();
}
void KToolBar::doConnections( KToolBarButton *button )
{
connect(button, SIGNAL(clicked(int)), this, SIGNAL( clicked( int ) ) );
connect(button, SIGNAL(doubleClicked(int)), this, SIGNAL( doubleClicked( int ) ) );
connect(button, SIGNAL(released(int)), this, SIGNAL( released( int ) ) );
connect(button, SIGNAL(pressed(int)), this, SIGNAL( pressed( int ) ) );
connect(button, SIGNAL(toggled(int)), this, SIGNAL( toggled( int ) ) );
connect(button, SIGNAL(highlighted(int, bool)), this, SIGNAL( highlighted( int, bool ) ) );
}
void KToolBar::mousePressEvent ( QMouseEvent *m )
{
if ( !mainWindow() )
return;
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
if ( mw->toolBarsMovable() && d->m_enableContext ) {
- if ( m->button() == RightButton ) {
+ if ( m->button() == Qt::RightButton ) {
int i = contextMenu()->exec( m->globalPos(), 0 );
switch ( i ) {
case -1:
return; // popup cancelled
case CONTEXT_LEFT:
//US mw->moveDockWindow( this, DockLeft );
- mw->moveToolBar( this, QMainWindow::Left );
+ mw->moveToolBar( this, Qt::Left );
break;
case CONTEXT_RIGHT:
//US mw->moveDockWindow( this, DockRight );
- mw->moveToolBar( this, QMainWindow::Right );
+ mw->moveToolBar( this, Qt::Right );
break;
case CONTEXT_TOP:
//US mw->moveDockWindow( this, DockTop );
- mw->moveToolBar( this, QMainWindow::Top );
+ mw->moveToolBar( this, Qt::Top );
break;
case CONTEXT_BOTTOM:
//US mw->moveDockWindow( this, DockBottom );
- mw->moveToolBar( this, QMainWindow::Bottom );
+ mw->moveToolBar( this, Qt::Bottom );
break;
case CONTEXT_FLOAT:
break;
case CONTEXT_FLAT:
//US mw->moveDockWindow( this, DockMinimized );
- mw->moveToolBar( this, QMainWindow::Minimized );
+ mw->moveToolBar( this, Qt::Minimized );
break;
case CONTEXT_ICONS:
setIconText( IconOnly );
break;
case CONTEXT_TEXTRIGHT:
setIconText( IconTextRight );
break;
case CONTEXT_TEXT:
setIconText( TextOnly );
break;
case CONTEXT_TEXTUNDER:
setIconText( IconTextBottom );
break;
default:
if ( i >= CONTEXT_ICONSIZES )
setIconSize( i - CONTEXT_ICONSIZES );
else
return; // assume this was an action handled elsewhere, no need for setSettingsDirty()
}
/*US
if ( mw->inherits("KMainWindow") )
static_cast<KMainWindow *>(mw)->setSettingsDirty();
*/
}
@@ -1311,159 +1322,159 @@ void KToolBar::rebuildLayout()
for(QWidget *w=d->idleButtons.first(); w; w=d->idleButtons.next())
w->blockSignals(false);
d->idleButtons.clear();
layoutTimer->stop();
QApplication::sendPostedEvents( this, QEvent::ChildInserted );
QBoxLayout *l = boxLayout();
l->setMargin( 1 );
// clear the old layout
QLayoutIterator it = l->iterator();
while ( it.current() ) {
it.deleteCurrent();
}
for ( QWidget *w = widgets.first(); w; w = widgets.next() ) {
if ( w == rightAligned ) {
continue;
}
if ( w->inherits( "KToolBarSeparator" ) &&
!( (KToolBarSeparator*)w )->showLine() ) {
l->addSpacing( 6 );
w->hide();
continue;
}
- if ( w->inherits( "QPopupMenu" ) )
+ if ( w->inherits( "Q3PopupMenu" ) )
continue;
l->addWidget( w );
w->show();
}
if ( rightAligned ) {
l->addStretch();
l->addWidget( rightAligned );
rightAligned->show();
}
if ( fullSize() ) {
// This code sucks. It makes the last combo in a toolbar VERY big (e.g. zoom combo in kword).
//if ( !stretchableWidget && widgets.last() &&
// !widgets.last()->inherits( "QButton" ) && !widgets.last()->inherits( "KAnimWidget" ) )
// setStretchableWidget( widgets.last() );
if ( !rightAligned )
l->addStretch();
if ( stretchableWidget )
l->setStretchFactor( stretchableWidget, 10 );
}
l->invalidate();
QApplication::postEvent( this, new QEvent( QEvent::LayoutHint ) );
//#endif //DESKTOP_VERSION
}
void KToolBar::childEvent( QChildEvent *e )
{
if ( e->child()->isWidgetType() ) {
QWidget * w = (QWidget*)e->child();
if ( e->type() == QEvent::ChildInserted ) {
- if ( !e->child()->inherits( "QPopupMenu" ) &&
+ if ( !e->child()->inherits( "Q3PopupMenu" ) &&
::qstrcmp( "qt_dockwidget_internal", e->child()->name() ) != 0 ) {
// prevent items that have been explicitly inserted by insert*() from
// being inserted again
if ( !widget2id.contains( w ) )
{
int dummy = -1;
insertWidgetInternal( w, dummy, -1 );
}
}
- } else {
+ } else if( e->type() == QEvent::ChildRemoved ) {
removeWidgetInternal( w );
}
- if ( isVisibleTo( 0 ) )
+ /* TODO:hacker: if ( isVisibleTo( 0 ) )
{
QBoxLayout *l = boxLayout();
// QLayout *l = layout();
// clear the old layout so that we don't get unnecassery layout
// changes till we have rebuild the thing
QLayoutIterator it = l->iterator();
while ( it.current() ) {
it.deleteCurrent();
}
layoutTimer->start( 50, TRUE );
- }
+ } */
}
- QToolBar::childEvent( e );
+ Q3ToolBar::childEvent( e );
}
void KToolBar::insertWidgetInternal( QWidget *w, int &index, int id )
{
// we can't have it in widgets, or something is really wrong
//widgets.removeRef( w );
connect( w, SIGNAL( destroyed() ),
this, SLOT( widgetDestroyed() ) );
if ( index == -1 || index > (int)widgets.count() ) {
widgets.append( w );
index = (int)widgets.count();
}
else
widgets.insert( index, w );
if ( id == -1 )
id = id2widget.count();
id2widget.insert( id, w );
widget2id.insert( w, id );
}
void KToolBar::repaintMe()
{
setUpdatesEnabled( true );
- QToolBar::repaint( true );
+ Q3ToolBar::repaint( true );
qDebug(" KToolBar::repaintMe() ");
}
void KToolBar::showEvent( QShowEvent *e )
{
rebuildLayout();
- QToolBar::showEvent( e );
+ Q3ToolBar::showEvent( e );
}
void KToolBar::setStretchableWidget( QWidget *w )
{
- QToolBar::setStretchableWidget( w );
+ Q3ToolBar::setStretchableWidget( w );
stretchableWidget = w;
}
QSizePolicy KToolBar::sizePolicy() const
{
- if ( orientation() == Horizontal )
+ if ( orientation() == Qt::Horizontal )
return QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
else
return QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
}
QSize KToolBar::sizeHint() const
{
- QSize sh = QToolBar::sizeHint();
+ QSize sh = Q3ToolBar::sizeHint();
//qDebug("%x KToolBar::sizeHint() %d %d ",this, QToolBar::sizeHint().width(),QToolBar::sizeHint().height() );
if ( sh.height() <= 20 || sh.width() < 60 )
return QSize( sizeHintW, sizeHintH );
KToolBar* ttt = (KToolBar*) this;
ttt->sizeHintW = sh.width();
ttt->sizeHintH = sh.height();
return sh;
//return QToolBar::sizeHint();
#if 0
QWidget::polish();
static int iii = 0;
++iii;
qDebug("++++++++ KToolBar::sizeHint() %d ", iii );
int margin = static_cast<QWidget*>(ncThis)->layout()->margin();
switch( barPos() )
{
case KToolBar::Top:
case KToolBar::Bottom:
for ( QWidget *w = widgets.first(); w; w =widgets.next() )
{
if ( w->inherits( "KToolBarSeparator" ) &&
!( static_cast<KToolBarSeparator*>(w)->showLine() ) )
{
minSize += QSize(6, 0);
@@ -1487,85 +1498,85 @@ QSize KToolBar::sizeHint() const
case KToolBar::Right:
for ( QWidget *w = widgets.first(); w; w = widgets.next() )
{
if ( w->inherits( "KToolBarSeparator" ) &&
!( static_cast<KToolBarSeparator*>(w)->showLine() ) )
{
minSize += QSize(0, 6);
}
else
{
QSize sh = w->sizeHint();
if (!sh.isValid())
sh = w->minimumSize();
minSize = minSize.expandedTo(QSize(sh.width(), 0));
minSize += QSize(0, sh.height()+1);
}
}
/*US
minSize += QSize(0, QApplication::style().pixelMetric( QStyle::PM_DockWindowHandleExtent ));
*/
minSize += QSize(margin*2, margin*2);
break;
default:
- minSize = QToolBar::sizeHint();
+ minSize = Q3ToolBar::sizeHint();
break;
}
return minSize;
#endif
}
QSize KToolBar::minimumSize() const
{
return minimumSizeHint();
}
QSize KToolBar::minimumSizeHint() const
{
return sizeHint();
}
bool KToolBar::highlight() const
{
return d->m_highlight;
}
void KToolBar::hide()
{
- QToolBar::hide();
+ Q3ToolBar::hide();
}
void KToolBar::show()
{
- QToolBar::show();
+ Q3ToolBar::show();
}
void KToolBar::resizeEvent( QResizeEvent *e )
{
bool b = isUpdatesEnabled();
setUpdatesEnabled( FALSE );
- QToolBar::resizeEvent( e );
+ Q3ToolBar::resizeEvent( e );
if (b)
d->repaintTimer.start( 100, true );
}
void KToolBar::slotIconChanged(int group)
{
if ((group != KIcon::Toolbar) && (group != KIcon::MainToolbar))
return;
if ((group == KIcon::MainToolbar) != !::qstrcmp(name(), "mainToolBar"))
return;
emit modechange();
if (isVisible())
updateGeometry();
}
void KToolBar::slotReadConfig()
{
//kdDebug(220) << "KToolBar::slotReadConfig" << endl;
// Read appearance settings (hmm, we used to do both here,
// but a well behaved application will call applyMainWindowSettings
// anyway, right ?)
applyAppearanceSettings(KGlobal::config(), QString::null );
}
@@ -1705,49 +1716,49 @@ void KToolBar::applyAppearanceSettings(KConfig *config, const QString &_configGr
IconText icon_text;
if ( icontext == "IconTextRight" )
icon_text = IconTextRight;
else if ( icontext == "IconTextBottom" )
icon_text = IconTextBottom;
else if ( icontext == "TextOnly" )
icon_text = TextOnly;
else
icon_text = IconOnly;
// check if the icon/text has changed
if (icon_text != d->m_iconText) {
//kdDebug(220) << "KToolBar::applyAppearanceSettings setIconText " << icon_text << endl;
setIconText(icon_text, false);
doUpdate = true;
}
// ...and check if the icon size has changed
if (iconsize != d->m_iconSize) {
setIconSize(iconsize, false);
doUpdate = true;
}
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
// ...and if we should highlight
if ( highlight != d->m_highlight ) {
d->m_highlight = highlight;
doUpdate = true;
}
// ...and if we should move transparently
if ( mw && transparent != (!mw->opaqueMoving()) ) {
mw->setOpaqueMoving( !transparent );
}
if (doUpdate)
emit modechange(); // tell buttons what happened
if (isVisible ())
updateGeometry();
}
void KToolBar::applySettings(KConfig *config, const QString &_configGroup)
{
//kdDebug(220) << "KToolBar::applySettings group=" << _configGroup << endl;
QString configGroup = _configGroup.isEmpty() ? settingsGroup() : _configGroup;
@@ -1784,131 +1795,131 @@ void KToolBar::applySettings(KConfig *config, const QString &_configGroup)
bool newLine = config->readBoolEntry(attrNewLine, d->NewLineDefault);
bool hidden = config->readBoolEntry(attrHidden, d->HiddenDefault);
*/
QString position = config->readEntry("Position", d->PositionDefault);
int index = config->readNumEntry("Index", d->IndexDefault);
int offset = config->readNumEntry("Offset", d->OffsetDefault);
bool newLine = config->readBoolEntry("NewLine", d->NewLineDefault);
bool hidden = config->readBoolEntry("Hidden", d->HiddenDefault);
/*US Dock pos(DockTop);
if ( position == "Top" )
pos = DockTop;
else if ( position == "Bottom" )
pos = DockBottom;
else if ( position == "Left" )
pos = DockLeft;
else if ( position == "Right" )
pos = DockRight;
else if ( position == "Floating" )
pos = DockTornOff;
else if ( position == "Flat" )
pos = DockMinimized;
*/
- QMainWindow::ToolBarDock pos(QMainWindow::Top);
+ Qt::ToolBarDock pos(Qt::DockTop);
if ( position == "Top" )
- pos = QMainWindow::Top;
+ pos = Qt::Top;
else if ( position == "Bottom" )
- pos = QMainWindow::Bottom;
+ pos = Qt::Bottom;
else if ( position == "Left" )
- pos = QMainWindow::Left;
+ pos = Qt::Left;
else if ( position == "Right" )
- pos = QMainWindow::Right;
+ pos = Qt::Right;
else if ( position == "Floating" )
- pos = QMainWindow::TornOff;
+ pos = Qt::TornOff;
else if ( position == "Flat" )
- pos = QMainWindow::Minimized;
+ pos = Qt::Minimized;
//kdDebug(220) << "KToolBar::applySettings hidden=" << hidden << endl;
if (hidden)
hide();
else
show();
if ( mainWindow() )
{
- QMainWindow *mw = mainWindow();
+ Q3MainWindow *mw = mainWindow();
//kdDebug(220) << "KToolBar::applySettings updating ToolbarInfo" << endl;
d->toolBarInfo = KToolBarPrivate::ToolBarInfo( pos, index, newLine, offset );
// moveDockWindow calls QDockArea which does a reparent() on us with
// showIt = true, so we loose our visibility status
bool doHide = isHidden();
//US mw->moveDockWindow( this, pos, newLine, index, offset );
mw->moveToolBar( this, pos, newLine, index, offset );
//kdDebug(220) << "KToolBar::applySettings " << name() << " moveDockWindow with pos=" << pos << " newLine=" << newLine << " idx=" << index << " offs=" << offset << endl;
if ( doHide )
hide();
}
if (isVisible ())
updateGeometry();
}
}
bool KToolBar::event( QEvent *e )
{
if ( (e->type() == QEvent::LayoutHint) && isUpdatesEnabled() )
d->repaintTimer.start( 100, true );
if (e->type() == QEvent::ChildInserted )
{
// By pass QToolBar::event,
// it will show() the inserted child and we don't want to
// do that until we have rebuild the layout.
childEvent((QChildEvent *)e);
return true;
}
- return QToolBar::event( e );
+ return Q3ToolBar::event( e );
}
void KToolBar::slotRepaint()
{
setUpdatesEnabled( FALSE );
// Send a resizeEvent to update the "toolbar extension arrow"
// (The button you get when your toolbar-items don't fit in
// the available space)
QResizeEvent ev(size(), size());
resizeEvent(&ev);
//#ifdef DESKTOP_VERSION
QApplication::sendPostedEvents( this, QEvent::LayoutHint );
//#endif //DESKTOP_VERSION
setUpdatesEnabled( TRUE );
repaint( TRUE );
}
-void KToolBar::toolBarPosChanged( QToolBar *tb )
+void KToolBar::toolBarPosChanged( Q3ToolBar *tb )
{
if ( tb != this )
return;
//US if ( d->oldPos == DockMinimized )
- if ( d->oldPos == QMainWindow::Minimized )
+ if ( d->oldPos == Qt::Minimized )
rebuildLayout();
- d->oldPos = (QMainWindow::ToolBarDock)barPos();
+ d->oldPos = (Qt::ToolBarDock)barPos();
/*US
if ( mainWindow() && mainWindow()->inherits( "KMainWindow" ) )
static_cast<KMainWindow *>(mainWindow())->setSettingsDirty();
*/
}
/*US
void KToolBar::loadState( const QDomElement &element )
{
//kdDebug(220) << "KToolBar::loadState " << this << endl;
if ( !mainWindow() )
return;
{
QCString text = element.namedItem( "text" ).toElement().text().utf8();
if ( text.isEmpty() )
text = element.namedItem( "Text" ).toElement().text().utf8();
if ( !text.isEmpty() )
setText( i18n( text ) );
}
{
QCString attrFullWidth = element.attribute( "fullWidth" ).lower().latin1();
if ( !attrFullWidth.isEmpty() )
@@ -2010,49 +2021,49 @@ void KToolBar::getAttributes( QString &position, QString &icontext, int &index )
// get all of the stuff to save
switch ( barPos() ) {
case KToolBar::Flat:
position = "Flat";
break;
case KToolBar::Bottom:
position = "Bottom";
break;
case KToolBar::Left:
position = "Left";
break;
case KToolBar::Right:
position = "Right";
break;
case KToolBar::Floating:
position = "Floating";
break;
case KToolBar::Top:
default:
position = "Top";
break;
}
if ( mainWindow() ) {
- QMainWindow::ToolBarDock dock;
+ Qt::ToolBarDock dock;
bool newLine;
int offset;
mainWindow()->getLocation( this, dock, index, newLine, offset );
}
switch (d->m_iconText) {
case KToolBar::IconTextRight:
icontext = "IconTextRight";
break;
case KToolBar::IconTextBottom:
icontext = "IconTextBottom";
break;
case KToolBar::TextOnly:
icontext = "TextOnly";
break;
case KToolBar::IconOnly:
default:
icontext = "IconOnly";
break;
}
}
/*US
void KToolBar::saveState( QDomElement &current )
{
@@ -2079,94 +2090,94 @@ void KToolBar::positionYourself( bool force )
if ( d->positioned || !mainWindow() )
{
//kdDebug(220) << "KToolBar::positionYourself d->positioned=true ALREADY DONE" << endl;
return;
}
// we can't test for ForceHide after moveDockWindow because QDockArea
// does a reparent() with showIt == true
bool doHide = isHidden();
//kdDebug(220) << "positionYourself " << name() << " dock=" << d->toolBarInfo.dock << " newLine=" << d->toolBarInfo.newline << " offset=" << d->toolBarInfo.offset << endl;
/*US mainWindow()->moveDockWindow( this, d->toolBarInfo.dock,
d->toolBarInfo.newline,
d->toolBarInfo.index,
d->toolBarInfo.offset );
*/
mainWindow()->moveToolBar( this, d->toolBarInfo.dock, d->NewLineDefault, d->IndexDefault, d->OffsetDefault );
if ( doHide )
hide();
// This method can only have an effect once - unless force is set
d->positioned = TRUE;
}
//US KPopupMenu *KToolBar::contextMenu()
-QPopupMenu *KToolBar::contextMenu()
+Q3PopupMenu *KToolBar::contextMenu()
{
if ( context )
return context;
// Construct our context popup menu. Name it qt_dockwidget_internal so it
// won't be deleted by QToolBar::clear().
//US context = new KPopupMenu( this, "qt_dockwidget_internal" );
- context = new QPopupMenu( this, "qt_dockwidget_internal" );
+ context = new Q3PopupMenu( this, "qt_dockwidget_internal" );
//US context->insertTitle(i18n("Toolbar Menu"));
//US KPopupMenu *orient = new KPopupMenu( context, "orient" );
- QPopupMenu *orient = new QPopupMenu( context, "orient" );
+ Q3PopupMenu *orient = new Q3PopupMenu( context, "orient" );
orient->insertItem( i18n("toolbar position string","Top"), CONTEXT_TOP );
orient->insertItem( i18n("toolbar position string","Left"), CONTEXT_LEFT );
orient->insertItem( i18n("toolbar position string","Right"), CONTEXT_RIGHT );
orient->insertItem( i18n("toolbar position string","Bottom"), CONTEXT_BOTTOM );
orient->insertSeparator(-1);
//orient->insertItem( i18n("toolbar position string","Floating"), CONTEXT_FLOAT );
orient->insertItem( i18n("min toolbar", "Flat"), CONTEXT_FLAT );
//US KPopupMenu *mode = new KPopupMenu( context, "mode" );
- QPopupMenu *mode = new QPopupMenu( context, "mode" );
+ Q3PopupMenu *mode = new Q3PopupMenu( context, "mode" );
mode->insertItem( i18n("Icons Only"), CONTEXT_ICONS );
mode->insertItem( i18n("Text Only"), CONTEXT_TEXT );
mode->insertItem( i18n("Text Alongside Icons"), CONTEXT_TEXTRIGHT );
mode->insertItem( i18n("Text Under Icons"), CONTEXT_TEXTUNDER );
//US KPopupMenu *size = new KPopupMenu( context, "size" );
- QPopupMenu *size = new QPopupMenu( context, "size" );
+ Q3PopupMenu *size = new Q3PopupMenu( context, "size" );
size->insertItem( i18n("Default"), CONTEXT_ICONSIZES );
// Query the current theme for available sizes
- QValueList<int> avSizes;
+ Q3ValueList<int> avSizes;
/*US
KIconTheme *theme = KGlobal::instance()->iconLoader()->theme();
if (!::qstrcmp(QObject::name(), "mainToolBar"))
avSizes = theme->querySizes( KIcon::MainToolbar);
else
avSizes = theme->querySizes( KIcon::Toolbar);
*/
avSizes << 16;
avSizes << 32;
d->iconSizes = avSizes;
- QValueList<int>::Iterator it;
+ Q3ValueList<int>::Iterator it;
for (it=avSizes.begin(); it!=avSizes.end(); it++) {
QString text;
if ( *it < 19 )
text = i18n("Small (%1x%2)").arg(*it).arg(*it);
else if (*it < 25)
text = i18n("Medium (%1x%2)").arg(*it).arg(*it);
else
text = i18n("Large (%1x%2)").arg(*it).arg(*it);
//we use the size as an id, with an offset
size->insertItem( text, CONTEXT_ICONSIZES + *it );
}
context->insertItem( i18n("Orientation"), orient );
orient->setItemChecked(CONTEXT_TOP, true);
context->insertItem( i18n("Text Position"), mode );
context->setItemChecked(CONTEXT_ICONS, true);
context->insertItem( i18n("Icon Size"), size );
/*US
if (mainWindow()->inherits("KMainWindow"))
{
if ( (static_cast<KMainWindow*>(mainWindow())->toolBarMenuAction()) &&
(static_cast<KMainWindow*>(mainWindow())->hasMenuBar()) )
@@ -2197,50 +2208,50 @@ void KToolBar::slotContextAboutToShow()
}
}
}
for(int i = CONTEXT_ICONS; i <= CONTEXT_TEXTUNDER; ++i)
context->setItemChecked(i, false);
switch( d->m_iconText )
{
case IconOnly:
default:
context->setItemChecked(CONTEXT_ICONS, true);
break;
case IconTextRight:
context->setItemChecked(CONTEXT_TEXTRIGHT, true);
break;
case TextOnly:
context->setItemChecked(CONTEXT_TEXT, true);
break;
case IconTextBottom:
context->setItemChecked(CONTEXT_TEXTUNDER, true);
break;
}
- QValueList<int>::ConstIterator iIt = d->iconSizes.begin();
- QValueList<int>::ConstIterator iEnd = d->iconSizes.end();
+ Q3ValueList<int>::ConstIterator iIt = d->iconSizes.begin();
+ Q3ValueList<int>::ConstIterator iEnd = d->iconSizes.end();
for (; iIt != iEnd; ++iIt )
context->setItemChecked( CONTEXT_ICONSIZES + *iIt, false );
context->setItemChecked( CONTEXT_ICONSIZES, false );
context->setItemChecked( CONTEXT_ICONSIZES + d->m_iconSize, true );
for ( int i = CONTEXT_TOP; i <= CONTEXT_FLAT; ++i )
context->setItemChecked( i, false );
switch ( barPos() )
{
case KToolBar::Flat:
context->setItemChecked( CONTEXT_FLAT, true );
break;
case KToolBar::Bottom:
context->setItemChecked( CONTEXT_BOTTOM, true );
break;
case KToolBar::Left:
context->setItemChecked( CONTEXT_LEFT, true );
break;
case KToolBar::Right:
context->setItemChecked( CONTEXT_RIGHT, true );
break;
diff --git a/microkde/kdeui/ktoolbar.h b/microkde/kdeui/ktoolbar.h
index 3319fa8..4e00abd 100644
--- a/microkde/kdeui/ktoolbar.h
+++ b/microkde/kdeui/ktoolbar.h
@@ -5,216 +5,224 @@
(C) 1997, 1998 Mark Donohoe (donohoe@kde.org)
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 1999, 2000 Kurt Granroth (granroth@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KTOOLBAR_H
#define KTOOLBAR_H
#ifndef DESKTOP_VERSION
#define private public
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#undef private
#include <qpe/qpetoolbar.h>
#else
-#include <qtoolbar.h>
+#include <q3toolbar.h>
#endif
-#include <qmainwindow.h>
+#include <q3mainwindow.h>
#include <qcombobox.h>
#include <qmap.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QResizeEvent>
+#include <Q3PopupMenu>
+#include <QMouseEvent>
+#include <QChildEvent>
+#include <QEvent>
+#include <QShowEvent>
#include <kglobal.h>
-#include <qguardedptr.h>
-#include <qframe.h>
-#include <qiconset.h>
+#include <qpointer.h>
+#include <q3frame.h>
+#include <qicon.h>
class QDomElement;
class QSize;
class QPixmap;
-class QPopupMenu;
+class Q3PopupMenu;
class QStringList;
class QDomDocument;
class QTimer;
class KLineEdit;
class KToolBar;
class KToolBarButton;
class KToolBoxManager;
//US class KAnimWidget;
//US class KPopupMenu;
//US class KInstance;
class KComboBox;
class KXMLGUIClient;
class KToolBarPrivate;
-class KToolBarSeparator : public QFrame
+class KToolBarSeparator : public Q3Frame
{
Q_OBJECT
public:
- KToolBarSeparator( Orientation, bool l, QToolBar *parent, const char* name=0 );
+ KToolBarSeparator( Qt::Orientation, bool l, Q3ToolBar *parent, const char* name=0 );
QSize sizeHint() const;
- Orientation orientation() const { return orient; }
+ Qt::Orientation orientation() const { return orient; }
QSizePolicy sizePolicy() const;
bool showLine() const { return line; }
public slots:
- void setOrientation( Orientation );
+ void setOrientation( Qt::Orientation );
protected:
void styleChange( QStyle& );
private:
- Orientation orient;
+ Qt::Orientation orient;
bool line;
};
/**
* A KDE-style toolbar.
*
* KToolBar can be dragged around in and between different docks.
*
* A KToolBar can contain all sorts of widgets.
*
* KToolBar can be used as a standalone widget, but @ref KMainWindow
* provides easy factories and management of one or more toolbars.
* Once you have a KToolBar object, you can insert items into it with the
* insert... methods, or remove them with the @ref removeItem() method. This
* can be done at any time; the toolbar will be automatically updated.
* There are also many methods to set per-child properties like alignment
* and toggle behaviour.
*
* KToolBar uses a global config group to load toolbar settings on
* construction. It will reread this config group on a
* @ref KApplication::appearanceChanged() signal.
*
* @short Floatable toolbar with auto resize.
* @version $Id$
* @author Reginald Stadlbauer <reggie@kde.org>, Stephan Kulow <coolo@kde.org>, Sven Radej <radej@kde.org>.
*/
// strange things are happening ... so I have to use strange define methods ...
// porting KToolBar back to Qt2 really needs some strange hacks
#ifndef DESKTOP_VERSION
-#define QToolBar QPEToolBar
+#define Q3ToolBar QPEToolBar
#endif
- class KToolBar : public QToolBar
+ class KToolBar : public Q3ToolBar
{
Q_OBJECT
Q_ENUMS( IconText BarPosition )
Q_PROPERTY( IconText iconText READ iconText WRITE setIconText )
Q_PROPERTY( BarPosition barPos READ barPos WRITE setBarPos )
Q_PROPERTY( bool fullSize READ fullSize WRITE setFullSize )
Q_PROPERTY( int iconSize READ iconSize WRITE setIconSize )
Q_PROPERTY( QString text READ text WRITE setText )
#ifndef DESKTOP_VERSION
-#undef QToolBar
+#undef Q3ToolBar
#endif
public:
enum IconText{IconOnly = 0, IconTextRight, TextOnly, IconTextBottom};
/**
* The state of the status bar.
* @deprecated
**/
enum BarStatus{Toggle, Show, Hide};
/**
* Possible bar positions.
**/
enum BarPosition{ Unmanaged, Floating, Top, Bottom, Right, Left, Flat};
/**
* Constructor.
* This constructor is used by the XML-GUI. If you use it, you need
* to call QMainWindow::addToolBar to specify the position of the toolbar.
* So it's simpler to use the other constructor.
*
* The toolbar will read in various global config settings for
* things like icon size and text position, etc. However, some of
* the settings will be honored only if @ref #_honor_mode is set to
* true. All other toolbars will be IconOnly and use Medium icons.
*
* @param parent The standard toolbar parent (usually a
* @ref KMainWindow)
* @param name The standard internal name
* @param honor_style If true, then global settings for IconSize and IconText will be honored
* @param readConfig whether to apply the configuration (global and application-specific)
*/
KToolBar( QWidget *parent, const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
/**
* Constructor for non-XML-GUI applications.
*
* The toolbar will read in various global config settings for
* things like icon size and text position, etc. However, some of
* the settings will be honored only if @ref #_honor_mode is set to
* true. All other toolbars will be IconOnly and use Medium icons.
*
* @param parentWindow The window that should be the parent of this toolbar
* @param dock The position of the toolbar. Usually QMainWindow::Top.
* @param newLine If true, start a new line in the dock for this toolbar.
* @param name The standard internal name
* @param honor_style If true, then global settings for IconSize and IconText will be honored
* @param readConfig whether to apply the configuration (global and application-specific)
*/
- KToolBar( QMainWindow *parentWindow, QMainWindow::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false,
+ KToolBar( Q3MainWindow *parentWindow, Qt::ToolBarDock dock /*= QMainWindow::Top*/, bool newLine = false,
const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
/**
* Constructor for non-XML-GUI applications.
*
* The toolbar will read in various global config settings for
* things like icon size and text position, etc. However, some of
* the settings will be honored only if @ref #_honor_mode is set to
* true. All other toolbars will be IconOnly and use Medium icons.
*
* @param parentWindow The window that should be the parent of this toolbar
* @param dock Another widget than the mainwindow to dock toolbar to.
* @param newLine If true, start a new line in the dock for this toolbar.
* @param name The standard internal name
* @param honor_style If true, then global settings for IconSize and IconText will be honored
* @param readConfig whether to apply the configuration (global and application-specific)
*/
- KToolBar( QMainWindow *parentWindow, QWidget *dock, bool newLine = false,
+ KToolBar( Q3MainWindow *parentWindow, QWidget *dock, bool newLine = false,
const char *name = 0, bool honor_style = FALSE, bool readConfig = TRUE );
virtual ~KToolBar();
/**
* Insert a button (a @ref KToolBarButton) with a pixmap. The
* pixmap is loaded by the button itself based on the global icon
* settings.
*
* You should connect to one or more signals in KToolBar:
* @ref clicked() , @ref pressed() , @ref released() , or
* @ref highlighted() and if the button is a toggle button
* (@ref setToggle() ) @ref toggled() . Those signals have @p id
* of a button that caused the signal. If you want to bind a popup
* to button, see @ref setButton().
*
* @param icon The name of the icon to use as the active pixmap
* @param id The id of this button
* @param enabled Enable or disable the button at startup
* @param text The tooltip or toolbar text (depending on state)
* @param index The position of the button. (-1 = at end).
*
* @return The item index.
*/
@@ -282,121 +290,121 @@ public:
* @param receiver The slot's parent
* @param enabled Enable or disable the button at startup
* @param text The tooltip or toolbar text (depending on state)
* @param index The position of the button. (-1 = at end).
*
* @return The item index.
*/
int insertButton(const QPixmap& pixmap, int id, const char *signal,
const QObject *receiver, const char *slot,
bool enabled = true, const QString& text = QString::null,
int index=-1 );
/**
* Inserts a button with popupmenu.
*
* Button will have small
* triangle. You have to connect to popup's signals. The
* signals @ref KButton::pressed(), @ref KButton::released(),
* @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not
* emmited by
* this button (see @ref setDelayedPopup() for that).
* You can add custom popups which inherit @ref QPopupMenu to get popups
* with tables, drawings etc. Just don't fiddle with events there.
*/
- int insertButton(const QString& icon, int id, QPopupMenu *popup,
+ int insertButton(const QString& icon, int id, Q3PopupMenu *popup,
bool enabled, const QString&_text, int index=-1);
/**
* Inserts a button with popupmenu.
*
* Button will have small
* triangle. You have to connect to popup's signals. The
* signals @ref KButton::pressed(), @ref KButton::released(),
* @ref KButton::clicked() or @ref KButton::doubleClicked() are @p not
* emmited by
* this button (see @ref setDelayedPopup() for that).
* You can add custom popups which inherit @ref QPopupMenu to get popups
* with tables, drawings etc. Just don't fiddle with events there.
*/
- int insertButton(const QPixmap& pixmap, int id, QPopupMenu *popup,
+ int insertButton(const QPixmap& pixmap, int id, Q3PopupMenu *popup,
bool enabled, const QString&_text, int index=-1);
/**
* Inserts a @ref KLineEdit. You have to specify signals and slots to
* which KLineEdit will be connected. KLineEdit has all slots QLineEdit
* has, plus signals @ref KLineEdit::completion and @ref KLineEdit::textRotation
* KLineEdit can be set to autoresize itself to full free width
* in toolbar, that is to last right aligned item. For that,
* toolbar must be set to full width (which it is by default).
* @see setFullWidth()
* @see setItemAutoSized()
* @see KLineEdit
* @return Item index.
*/
int insertLined (const QString& text, int id,
const char *signal,
const QObject *receiver, const char *slot,
bool enabled = true,
const QString& toolTipText = QString::null,
int size = 70, int index =-1);
/**
* Inserts a @ref KComboBox with list.
*
* Can be writable, but cannot contain
* pixmaps. By default inserting policy is AtBottom, i.e. typed items
* are placed at the bottom of the list. Can be autosized. If the size
* argument is specified as -1, the width of the combobox is automatically
* computed.
*
* @see setFullWidth()
* @see setItemAutoSized()
* @see KComboBox
* @return Item index.
*/
int insertCombo (const QStringList &list, int id, bool writable,
const char *signal, const QObject *receiver,
const char *slot, bool enabled=true,
const QString& tooltiptext=QString::null,
int size=70, int index=-1,
- QComboBox::Policy policy = QComboBox::AtBottom);
+ QComboBox::Policy policy = QComboBox::InsertAtBottom);
/**
* Insert a @ref KComboBox with text.
*
* The rest is the same as above.
* @see setItemAutoSized()
*
* @see KComboBox
* @return Item index.
*/
int insertCombo (const QString& text, int id, bool writable,
const char *signal, QObject *recevier,
const char *slot, bool enabled=true,
const QString& tooltiptext=QString::null,
int size=70, int index=-1,
- QComboBox::Policy policy = QComboBox::AtBottom);
+ QComboBox::Policy policy = QComboBox::InsertAtBottom);
/**
* Inserts a separator into the toolbar with the given id.
* Returns the separator's index
*/
int insertSeparator( int index = -1, int id = -1 );
/**
* Inserts a line separator into the toolbar with the given id.
* Returns the separator's index
*/
int insertLineSeparator( int index = -1, int id = -1 );
/**
* Inserts a user-defined widget. The widget @p must have this
* toolbar as its parent.
*
* Widget must have a QWidget for base class. Widget can be
* autosized to full width. If you forget about it, you can get a
* pointer to this widget with @ref getWidget().
* @see setItemAutoSized()
* @return Item index.
*/
int insertWidget(int id, int width, QWidget *_widget, int index=-1);
@@ -444,75 +452,75 @@ public:
/**
* Enables/disables item.
*/
void setItemEnabled( int id, bool enabled );
/**
* Sets the icon for a button.
*
* Can be used while button is visible.
*/
void setButtonIcon( int id, const QString& _icon );
/**
* Sets button pixmap.
*
* Can be used while button is visible.
*/
void setButtonPixmap( int id, const QPixmap& _pixmap );
/**
* Sets a button icon from a QIconSet.
*
* Can be used while button is visible.
*/
- void setButtonIconSet( int id, const QIconSet& iconset );
+ void setButtonIconSet( int id, const QIcon& iconset );
/**
* Sets a delayed popup for a button.
*
* Delayed popup is what you see in
* Netscape Navigator's Previous and Next buttons: If you click them you
* go back
* or forth. If you press them long enough, you get a history-menu.
* This is exactly what we do here.
*
* You will insert normal a button with connection (or use signals from
* toolbar):
* <pre>
* bar->insertButton(icon, id, SIGNAL(clicked ()), this,
* SLOT (slotClick()), true, "click or wait for popup");
* </pre> And then add a delayed popup:
* <pre>
* bar->setDelayedPopup (id, historyPopup); </pre>
*
* Don't add delayed popups to buttons which have normal popups.
*
* You may add popups which are derived from @ref QPopupMenu. You may
* add popups that are already in the menu bar or are submenus of
* other popups.
*/
- void setDelayedPopup (int id , QPopupMenu *_popup, bool toggle = false);
+ void setDelayedPopup (int id , Q3PopupMenu *_popup, bool toggle = false);
/**
* Turns a button into an autorepeat button.
*
* Toggle buttons, buttons with menus, or
* buttons with delayed menus cannot be made into autorepeat buttons.
* Moreover, you can and will receive
* only the signal clicked(), but not pressed() or released().
* When the user presses this button, you will receive the signal clicked(),
* and if the button is still pressed after some time,
* you will receive more clicked() signals separated by regular
* intervals. Since this uses @ref QButton::setAutoRepeat() ,
* I can't quantify 'some'.
*/
void setAutoRepeat (int id, bool flag=true);
/**
* Turns button into a toggle button if @p flag is true.
*/
void setToggle (int id, bool flag = true);
/**
* Toggles a togglebutton.
@@ -1039,72 +1047,72 @@ signals:
* Used by KWidgetAction.
* @since 3.2
*/
void toolbarDestroyed();
public:
/**
* @return global setting for "Highlight buttons under mouse"
*/
void repaintMe();
static bool highlightSetting();
/**
* @return global setting for "Toolbars transparent when moving"
*/
static bool transparentSetting();
/**
* @return global setting for "Icon Text"
*/
static IconText iconTextSetting();
public slots:
virtual void setIconText( const QString &txt )
- { QToolBar::setIconText( txt ); }
+ { Q3ToolBar::setIconText( txt ); }
void slotRepaint();
protected:
void mousePressEvent( QMouseEvent * );
void childEvent( QChildEvent *e );
void showEvent( QShowEvent *e );
void resizeEvent( QResizeEvent *e );
bool event( QEvent *e );
void applyAppearanceSettings(KConfig *config, const QString &_configGroup, bool forceGlobal = false);
QString settingsGroup();
private slots:
void rebuildLayout();
void slotReadConfig ();
void slotAppearanceChanged();
void slotIconChanged(int);
- void toolBarPosChanged( QToolBar *tb );
+ void toolBarPosChanged( Q3ToolBar *tb );
void slotContextAboutToShow();
void widgetDestroyed();
private:
int sizeHintW;
int sizeHintH;
void init( bool readConfig = true, bool honorStyle = false );
void doConnections( KToolBarButton *button );
void insertWidgetInternal( QWidget *w, int &index, int id );
void removeWidgetInternal( QWidget *w );
void getAttributes( QString &position, QString &icontext, int &index );
//US KPopupMenu *contextMenu();
- QPopupMenu *contextMenu();
+ Q3PopupMenu *contextMenu();
QMap<QWidget*, int > widget2id;
typedef QMap<int, QWidget* > Id2WidgetMap;
Id2WidgetMap id2widget;
//US KPopupMenu *context;
- QPopupMenu *context;
- QPtrList<QWidget> widgets;
+ Q3PopupMenu *context;
+ Q3PtrList<QWidget> widgets;
QTimer *layoutTimer;
- QGuardedPtr<QWidget> stretchableWidget, rightAligned;
+ QPointer<QWidget> stretchableWidget, rightAligned;
protected:
virtual void virtual_hook( int id, void* data );
private:
KToolBarPrivate *d;
bool inshutdownprocess;
};
#endif
diff --git a/microkde/kdeui/ktoolbarbutton.cpp b/microkde/kdeui/ktoolbarbutton.cpp
index 1d5d0e5..7b98b32 100644
--- a/microkde/kdeui/ktoolbarbutton.cpp
+++ b/microkde/kdeui/ktoolbarbutton.cpp
@@ -12,64 +12,68 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
//US #include <config.h>
#include <string.h>
#include "ktoolbarbutton.h"
#include "ktoolbar.h"
#include <qstyle.h>
#include <qimage.h>
#include <qtimer.h>
#include <qdrawutil.h>
#include <qtooltip.h>
#include <qbitmap.h>
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
#include <qcursor.h>
#include <qpainter.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <QMouseEvent>
+#include <QEvent>
#include <kapplication.h>
#include <kdebug.h>
#include <kglobal.h>
#include <kglobalsettings.h>
//US #include <kiconeffect.h>
#include <kiconloader.h>
// needed to get our instance
#include <kmainwindow.h>
-template class QIntDict<KToolBarButton>;
+template class Q3IntDict<KToolBarButton>;
class KToolBarButtonPrivate
{
public:
KToolBarButtonPrivate()
{
m_noStyle = false;
m_isSeparator = false;
m_isRadio = false;
m_highlight = false;
m_isRaised = false;
m_isActive = false;
m_iconName = QString::null;
m_iconText = KToolBar::IconOnly;
m_iconSize = 0;
//US m_instance = KGlobal::instance();
}
~KToolBarButtonPrivate()
{
}
int m_id;
@@ -94,95 +98,95 @@ public:
// This will construct a separator
KToolBarButton::KToolBarButton( QWidget *_parent, const char *_name )
: QToolButton( _parent , _name)
{
d = new KToolBarButtonPrivate;
resize(6,6);
hide();
d->m_isSeparator = true;
}
KToolBarButton::KToolBarButton( const QString& _icon, int _id,
QWidget *_parent, const char *_name,
const QString &_txt/*US, KInstance *_instance*/ )
: QToolButton( _parent, _name ), d( 0 )
{
d = new KToolBarButtonPrivate;
d->m_id = _id;
d->m_parent = (KToolBar*)_parent;
QToolButton::setTextLabel(_txt);
//US d->m_instance = _instance;
- setFocusPolicy( NoFocus );
+ setFocusPolicy( Qt::NoFocus );
// connect all of our slots and start trapping events
connect(d->m_parent, SIGNAL( modechange() ),
this, SLOT( modeChange() ));
connect(this, SIGNAL( clicked() ),
this, SLOT( slotClicked() ) );
connect(this, SIGNAL( pressed() ),
this, SLOT( slotPressed() ) );
connect(this, SIGNAL( released() ),
this, SLOT( slotReleased() ) );
installEventFilter(this);
d->m_iconName = _icon;
// do our initial setup
modeChange();
}
KToolBarButton::KToolBarButton( const QPixmap& pixmap, int _id,
QWidget *_parent, const char *name,
const QString& txt)
: QToolButton( _parent, name ), d( 0 )
{
d = new KToolBarButtonPrivate;
d->m_id = _id;
d->m_parent = (KToolBar *) _parent;
QToolButton::setTextLabel(txt);
- setFocusPolicy( NoFocus );
+ setFocusPolicy( Qt::NoFocus );
// connect all of our slots and start trapping events
connect(d->m_parent, SIGNAL( modechange()),
this, SLOT(modeChange()));
connect(this, SIGNAL( clicked() ),
this, SLOT( slotClicked() ));
connect(this, SIGNAL( pressed() ),
this, SLOT( slotPressed() ));
connect(this, SIGNAL( released() ),
this, SLOT( slotReleased() ));
installEventFilter(this);
// set our pixmap and do our initial setup
- setIconSet( QIconSet( pixmap ));
+ setIconSet( QIcon( pixmap ));
modeChange();
}
KToolBarButton::~KToolBarButton()
{
delete d; d = 0;
}
void KToolBarButton::modeChange()
{
QSize mysize;
// grab a few global variables for use in this function and others
d->m_highlight = d->m_parent->highlight();
d->m_iconText = d->m_parent->iconText();
d->m_iconSize = d->m_parent->iconSize();
if (!d->m_iconName.isNull())
setIcon(d->m_iconName);
// we'll start with the size of our pixmap
int pix_width = d->m_iconSize;
if ( d->m_iconSize == 0 ) {
@@ -271,123 +275,123 @@ void KToolBarButton::setTextLabel( const QString& text, bool tipToo)
void KToolBarButton::setText( const QString& text)
{
setTextLabel(text, true);
modeChange();
}
void KToolBarButton::setIcon( const QString &icon )
{
d->m_iconName = icon;
d->m_iconSize = d->m_parent->iconSize();
// QObject::name() return "const char *" instead of QString.
if (!strcmp(d->m_parent->name(), "mainToolBar"))
/*US QToolButton::setIconSet( d->m_instance->iconLoader()->loadIconSet(
d->m_iconName, KIcon::MainToolbar, d->m_iconSize ));
*/
QToolButton::setIconSet( KGlobal::iconLoader()->loadIconSet(d->m_iconName ));
else
/*US QToolButton::setIconSet(d->m_instance->iconLoader()->loadIconSet(
d->m_iconName, KIcon::Toolbar, d->m_iconSize ));
*/
QToolButton::setIconSet(KGlobal::iconLoader()->loadIconSet(d->m_iconName));
}
-void KToolBarButton::setIconSet( const QIconSet &iconset )
+void KToolBarButton::setIconSet( const QIcon &iconset )
{
QToolButton::setIconSet( iconset );
}
// remove?
void KToolBarButton::setPixmap( const QPixmap &pixmap )
{
if( pixmap.isNull()) // called by QToolButton
{
QToolButton::setPixmap( pixmap );
return;
}
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Active );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Active );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDefaultPixmap( const QPixmap &pixmap )
{
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Normal );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Normal );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDisabledPixmap( const QPixmap &pixmap )
{
- QIconSet set = iconSet();
- set.setPixmap( pixmap, QIconSet::Automatic, QIconSet::Disabled );
+ QIcon set = iconSet();
+ set.setPixmap( pixmap, QIcon::Automatic, QIcon::Disabled );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDefaultIcon( const QString& icon )
{
- QIconSet set = iconSet();
+ QIcon set = iconSet();
QPixmap pm;
if (!strcmp(d->m_parent->name(), "mainToolBar"))
pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar,
d->m_iconSize );
else
pm = /*US d->m_instance->iconLoader()*/KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar,
d->m_iconSize );
- set.setPixmap( pm, QIconSet::Automatic, QIconSet::Normal );
+ set.setPixmap( pm, QIcon::Automatic, QIcon::Normal );
QToolButton::setIconSet( set );
}
void KToolBarButton::setDisabledIcon( const QString& icon )
{
- QIconSet set = iconSet();
+ QIcon set = iconSet();
QPixmap pm;
if (!strcmp(d->m_parent->name(), "mainToolBar"))
pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::MainToolbar,
d->m_iconSize );
else
pm = /*US d->m_instance->iconLoader()*/ KGlobal::iconLoader()->loadIcon( icon, KIcon::Toolbar,
d->m_iconSize );
- set.setPixmap( pm, QIconSet::Automatic, QIconSet::Disabled );
+ set.setPixmap( pm, QIcon::Automatic, QIcon::Disabled );
QToolButton::setIconSet( set );
}
-QPopupMenu *KToolBarButton::popup()
+QMenu *KToolBarButton::popup()
{
// obsolete
// KDE4: remove me
return QToolButton::popup();
}
-void KToolBarButton::setPopup(QPopupMenu *p, bool)
+void KToolBarButton::setPopup(Q3PopupMenu *p, bool)
{
QToolButton::setPopup(p);
QToolButton::setPopupDelay(1);
}
-void KToolBarButton::setDelayedPopup (QPopupMenu *p, bool)
+void KToolBarButton::setDelayedPopup (Q3PopupMenu *p, bool)
{
QToolButton::setPopup(p);
//US QToolButton::setPopupDelay(QApplication::startDragTime());
}
void KToolBarButton::leaveEvent(QEvent *)
{
if( d->m_isRaised || d->m_isActive )
{
d->m_isRaised = false;
d->m_isActive = false;
repaint(false);
}
emit highlighted(d->m_id, false);
}
void KToolBarButton::enterEvent(QEvent *)
{
if (d->m_highlight)
{
if (isEnabled())
{
d->m_isActive = true;
@@ -430,215 +434,225 @@ bool KToolBarButton::eventFilter(QObject *o, QEvent *ev)
return true;
}
}
}
if ((ev->type() == QEvent::MouseButtonPress ||
ev->type() == QEvent::MouseButtonRelease ||
ev->type() == QEvent::MouseButtonDblClick) && d->m_isRadio && isOn())
return true;
// From Kai-Uwe Sattler <kus@iti.CS.Uni-Magdeburg.De>
if (ev->type() == QEvent::MouseButtonDblClick)
{
emit doubleClicked(d->m_id);
return true;
}
}
return QToolButton::eventFilter(o, ev);
}
void KToolBarButton::drawButton( QPainter *_painter )
{
#ifdef DESKTOP_VERSION
- QStyle::SFlags flags = QStyle::Style_Default;
- QStyle::SCFlags active = QStyle::SC_None;
+ QStyle::State flags = QStyle::State_None;
+ QStyle::SubControls active = QStyle::SC_None;
if (isDown()) {
- flags |= QStyle::Style_Down;
+ flags |= QStyle::State_DownArrow;
active |= QStyle::SC_ToolButton;
}
- if (isEnabled()) flags |= QStyle::Style_Enabled;
- if (isOn()) flags |= QStyle::Style_On;
- if (isEnabled() && d->m_isRaised) flags |= QStyle::Style_Raised;
- if (hasFocus()) flags |= QStyle::Style_HasFocus;
+ if (isEnabled()) flags |= QStyle::State_Enabled;
+ if (isOn()) flags |= QStyle::State_On;
+ if (isEnabled() && d->m_isRaised) flags |= QStyle::State_Raised;
+ if (hasFocus()) flags |= QStyle::State_HasFocus;
+
+ QStyleOptionToolButton qsotb;
+ qsotb.initFrom(this);
+ qsotb.state = flags;
+ qsotb.activeSubControls = active;
+ qsotb.rect = rect();
+ qsotb.palette = palette();
// Draw a styled toolbutton
- style().drawComplexControl(QStyle::CC_ToolButton, _painter, this, rect(),
- colorGroup(), flags, QStyle::SC_ToolButton, active, QStyleOption());
+ style()->drawComplexControl(QStyle::CC_ToolButton, &qsotb, _painter, this);
#else
style().drawToolButton(_painter, rect().x(), rect().y(), rect().width(), rect().height(), colorGroup());
#endif
int dx, dy;
QFont tmp_font(KGlobalSettings::toolBarFont());
QFontMetrics fm(tmp_font);
QRect textRect;
int textFlags = 0;
if (d->m_iconText == KToolBar::IconOnly) // icon only
{
/*US
QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
QIconSet::Disabled,
isOn() ? QIconSet::On : QIconSet::Off );
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
if( !pixmap.isNull())
{
dx = ( width() - pixmap.width() ) / 2;
dy = ( height() - pixmap.height() ) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
_painter->drawPixmap( dx, dy, pixmap );
}
}
else if (d->m_iconText == KToolBar::IconTextRight) // icon and text (if any)
{
/*US
QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
QIconSet::Disabled,
isOn() ? QIconSet::On : QIconSet::Off );
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
if( !pixmap.isNull())
{
dx = 4;
dy = ( height() - pixmap.height() ) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
_painter->drawPixmap( dx, dy, pixmap );
}
if (!textLabel().isNull())
{
- textFlags = AlignVCenter|AlignLeft;
+ textFlags = Qt::AlignVCenter|Qt::AlignLeft;
if (!pixmap.isNull())
dx = 4 + pixmap.width() + 2;
else
dx = 4;
dy = 0;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
textRect = QRect(dx, dy, width()-dx, height());
}
}
else if (d->m_iconText == KToolBar::TextOnly)
{
if (!textLabel().isNull())
{
- textFlags = AlignVCenter|AlignLeft;
+ textFlags = Qt::AlignVCenter|Qt::AlignLeft;
dx = (width() - fm.width(textLabel())) / 2;
dy = (height() - fm.lineSpacing()) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() );
}
}
else if (d->m_iconText == KToolBar::IconTextBottom)
{
/*US
QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
QIconSet::Disabled,
isOn() ? QIconSet::On : QIconSet::Off );
*/
- QPixmap pixmap = iconSet().pixmap( QIconSet::Automatic,
- isEnabled() ? (d->m_isActive ? QIconSet::Active : QIconSet::Normal) :
- QIconSet::Disabled);
+ QPixmap pixmap = iconSet().pixmap( QIcon::Automatic,
+ isEnabled() ? (d->m_isActive ? QIcon::Active : QIcon::Normal) :
+ QIcon::Disabled);
if( !pixmap.isNull())
{
dx = (width() - pixmap.width()) / 2;
dy = (height() - fm.lineSpacing() - pixmap.height()) / 2;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
_painter->drawPixmap( dx, dy, pixmap );
}
if (!textLabel().isNull())
{
- textFlags = AlignBottom|AlignHCenter;
+ textFlags = Qt::AlignBottom|Qt::AlignHCenter;
dx = (width() - fm.width(textLabel())) / 2;
dy = height() - fm.lineSpacing() - 4;
if ( isDown() /*US && style().styleHint(QStyle::SH_GUIStyle) == WindowsStyle*/ )
{
++dx;
++dy;
}
textRect = QRect( dx, dy, fm.width(textLabel()), fm.lineSpacing() );
}
}
// Draw the text at the position given by textRect, and using textFlags
if (!textLabel().isNull() && !textRect.isNull())
{
_painter->setFont(KGlobalSettings::toolBarFont());
if (!isEnabled())
_painter->setPen(palette().disabled().dark());
else if(d->m_isRaised)
_painter->setPen(KGlobalSettings::toolBarHighlightColor());
else
_painter->setPen( colorGroup().buttonText() );
_painter->drawText(textRect, textFlags, textLabel());
}
if (QToolButton::popup())
{
#ifdef DESKTOP_VERSION
- QStyle::SFlags arrowFlags = QStyle::Style_Default;
+ QStyle::State arrowFlags = QStyle::State_None;
+
+ if (isDown()) arrowFlags |= QStyle::State_DownArrow;
+ if (isEnabled()) arrowFlags |= QStyle::State_Enabled;
- if (isDown()) arrowFlags |= QStyle::Style_Down;
- if (isEnabled()) arrowFlags |= QStyle::Style_Enabled;
+ QStyleOption qso;
+ qso.initFrom(this);
+ qso.state = arrowFlags;
+ qso.rect = QRect(width()-7, height()-7, 7, 7);
+ qso.palette = palette();
- style().drawPrimitive(QStyle::PE_ArrowDown, _painter,
- QRect(width()-7, height()-7, 7, 7), colorGroup(),
- arrowFlags, QStyleOption() );
+ style()->drawPrimitive(QStyle::PE_IndicatorArrowDown, &qso, _painter);
#else
style().drawArrow(_painter, Qt::DownArrow, isDown(),
width()-7, height()-7, 7, 7, colorGroup(), isEnabled() );
#endif
}
}
void KToolBarButton::paletteChange(const QPalette &)
{
if(!d->m_isSeparator)
{
modeChange();
repaint(false); // no need to delete it first therefore only false
}
}
void KToolBarButton::showMenu()
{
// obsolete
// KDE4: remove me
}
void KToolBarButton::slotDelayTimeout()
diff --git a/microkde/kdeui/ktoolbarbutton.h b/microkde/kdeui/ktoolbarbutton.h
index 9aaa13c..ad02e4e 100644
--- a/microkde/kdeui/ktoolbarbutton.h
+++ b/microkde/kdeui/ktoolbarbutton.h
@@ -5,57 +5,60 @@
(C) 1997, 1998 Matthias Ettrich (ettrich@kde.org)
(C) 2000 Kurt Granroth (granroth@kde.org)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
// $Id$
#ifndef _KTOOLBARBUTTON_H
#define _KTOOLBARBUTTON_H
#include <qpixmap.h>
#include <qtoolbutton.h>
-#include <qintdict.h>
+#include <q3intdict.h>
#include <qstring.h>
+//Added by qt3to4:
+#include <QEvent>
+#include <Q3PopupMenu>
#include <kglobal.h>
class KToolBar;
class KToolBarButtonPrivate;
//USclass KInstance;
class QEvent;
-class QPopupMenu;
+class Q3PopupMenu;
class QPainter;
/**
* A toolbar button. This is used internally by @ref KToolBar, use the
* KToolBar methods instead.
* @internal
*/
class KToolBarButton : public QToolButton
{
Q_OBJECT
public:
/**
* Construct a button with an icon loaded by the button itself.
* This will trust the button to load the correct icon with the
* correct size.
*
* @param icon Name of icon to load (may be absolute or relative)
* @param id Id of this button
* @param parent This button's parent
* @param name This button's internal name
* @param txt This button's text (in a tooltip or otherwise)
*/
KToolBarButton(const QString& icon, int id, QWidget *parent,
@@ -129,49 +132,49 @@ public:
* tooltip (IconOnly) or will be along side the icon
*
* @param text The button (or tooltip) text
*/
virtual void setText(const QString &text);
/**
* Set the icon for this button. The icon will be loaded internally
* with the correct size. This function is preferred over @ref setIconSet
*
* @param icon The name of the icon
*/
virtual void setIcon(const QString &icon);
/// @since 3.1
virtual void setIcon( const QPixmap &pixmap )
{ QToolButton::setIcon( pixmap ); }
/**
* Set the pixmaps for this toolbar button from a QIconSet.
* If you call this you don't need to call any of the other methods
* that set icons or pixmaps.
* @param iconset The iconset to use
*/
- virtual void setIconSet( const QIconSet &iconset );
+ virtual void setIconSet( const QIcon &iconset );
#ifndef KDE_NO_COMPAT
/**
* @deprecated
* Set the active icon for this button. The pixmap itself is loaded
* internally based on the icon size... .. the disabled and default
* pixmaps, however will only be constructed if @ref #generate is
* true. This function is preferred over @ref setPixmap
*
* @param icon The name of the active icon
* @param generate If true, then the other icons are automagically
* generated from this one
*/
void setIcon(const QString &icon, bool /*generate*/ ) { setIcon( icon ); }
/**
* @deprecated
* Force the button to use this icon as the default one rather
* then generating it using effects.
*
* @param icon The icon to use as the default (normal) one
*/
void setDefaultIcon(const QString& icon);
@@ -188,75 +191,75 @@ public:
/**
* Turn this button on or off
*
* @param flag true or false
*/
void on(bool flag = true);
/**
* Toggle this button
*/
void toggle();
/**
* Turn this button into a toggle button or disable the toggle
* aspects of it. This does not toggle the button itself.
* Use @ref toggle() for that.
*
* @param toggle true or false
*/
void setToggle(bool toggle = true);
/**
* Return a pointer to this button's popup menu (if it exists)
*/
- QPopupMenu *popup();
+ QMenu *popup();
/**
* Returns the button's id.
* @since 3.2
*/
int id() const;
/**
* Give this button a popup menu. There will not be a delay when
* you press the button. Use @ref setDelayedPopup if you want that
* behavior.
*
* @param p The new popup menu
*/
- void setPopup (QPopupMenu *p, bool unused = false);
+ void setPopup (Q3PopupMenu *p, bool unused = false);
/**
* Gives this button a delayed popup menu.
*
* This function allows you to add a delayed popup menu to the button.
* The popup menu is then only displayed when the button is pressed and
* held down for about half a second.
*
* @param p the new popup menu
*/
- void setDelayedPopup(QPopupMenu *p, bool unused = false);
+ void setDelayedPopup(Q3PopupMenu *p, bool unused = false);
/**
* Turn this button into a radio button
*
* @param f true or false
*/
void setRadio(bool f = true);
/**
* Toolbar buttons naturally will assume the global styles
* concerning icons, icons sizes, etc. You can use this function to
* explicitely turn this off, if you like.
*
* @param no_style Will disable styles if true
*/
void setNoStyle(bool no_style = true);
signals:
void clicked(int);
void doubleClicked(int);
void pressed(int);
void released(int);
void toggled(int);
void highlighted(int, bool);
@@ -282,32 +285,32 @@ protected:
bool isRaised() const;
/// @since 3.1
bool isActive() const;
/// @since 3.1
int iconTextMode() const;
protected slots:
void slotClicked();
void slotPressed();
void slotReleased();
void slotToggled();
void slotDelayTimeout();
protected:
virtual void virtual_hook( int id, void* data );
private:
KToolBarButtonPrivate *d;
};
/**
* List of @ref KToolBarButton objects.
* @internal
* @version $Id$
*/
-class KToolBarButtonList : public QIntDict<KToolBarButton>
+class KToolBarButtonList : public Q3IntDict<KToolBarButton>
{
public:
KToolBarButtonList();
~KToolBarButtonList() {}
};
#endif
diff --git a/microkde/kdeui/ktoolbarhandler.cpp b/microkde/kdeui/ktoolbarhandler.cpp
index 7b97233..4d3ace7 100644
--- a/microkde/kdeui/ktoolbarhandler.cpp
+++ b/microkde/kdeui/ktoolbarhandler.cpp
@@ -1,143 +1,145 @@
/* This file is part of the KDE libraries
Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "ktoolbarhandler.h"
-#include <qpopupmenu.h>
+#include <q3popupmenu.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include <kapplication.h>
#include <ktoolbar.h>
#include <kmainwindow.h>
#include <klocale.h>
#include <kaction.h>
#include <assert.h>
namespace
{
const char *actionListName = "show_menu_and_toolbar_actionlist";
const char *guiDescription = ""
"<!DOCTYPE kpartgui><kpartgui name=\"StandardToolBarMenuHandler\">"
"<MenuBar>"
" <Menu name=\"settings\">"
" <ActionList name=\"%1\" />"
" </Menu>"
"</MenuBar>"
"</kpartgui>";
const char *resourceFileName = "barhandler.rc";
class BarActionBuilder
{
public:
- BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, QPtrList<KToolBar> &oldToolBarList )
+ BarActionBuilder( KActionCollection *actionCollection, KMainWindow *mainWindow, Q3PtrList<KToolBar> &oldToolBarList )
: m_actionCollection( actionCollection ), m_mainWindow( mainWindow ), m_needsRebuild( false )
{
/*US
QPtrList<QDockWindow> dockWindows = m_mainWindow->dockWindows();
QPtrListIterator<QDockWindow> dockWindowIt( dockWindows );
for ( ; dockWindowIt.current(); ++dockWindowIt ) {
//US KToolBar *toolBar = dynamic_cast<KToolBar *>( dockWindowIt.current() );
KToolBar *toolBar = (KToolBar *)( dockWindowIt.current() );
if ( !toolBar )
continue;
if ( oldToolBarList.findRef( toolBar ) == -1 )
m_needsRebuild = true;
m_toolBars.append( toolBar );
}
*/
if ( !m_needsRebuild )
m_needsRebuild = ( oldToolBarList.count() != m_toolBars.count() );
}
bool needsRebuild() const { return m_needsRebuild; }
- QPtrList<KAction> create()
+ Q3PtrList<KAction> create()
{
if ( !m_needsRebuild )
- return QPtrList<KAction>();
+ return Q3PtrList<KAction>();
- QPtrListIterator<KToolBar> toolBarIt( m_toolBars );
+ Q3PtrListIterator<KToolBar> toolBarIt( m_toolBars );
for ( ; toolBarIt.current(); ++toolBarIt )
handleToolBar( toolBarIt.current() );
- QPtrList<KAction> actions;
+ Q3PtrList<KAction> actions;
if ( m_toolBarActions.count() == 0 )
return actions;
if ( m_toolBarActions.count() == 1 ) {
m_toolBarActions.getFirst()->setText( i18n( "Show Toolbar" ) );
return m_toolBarActions;
}
KActionMenu *menuAction = new KActionMenu( i18n( "Toolbars" ), m_actionCollection, "toolbars_submenu_action" );
- QPtrListIterator<KAction> actionIt( m_toolBarActions );
+ Q3PtrListIterator<KAction> actionIt( m_toolBarActions );
for ( ; actionIt.current(); ++actionIt )
menuAction->insert( actionIt.current() );
actions.append( menuAction );
return actions;
}
- const QPtrList<KToolBar> &toolBars() const { return m_toolBars; }
+ const Q3PtrList<KToolBar> &toolBars() const { return m_toolBars; }
private:
void handleToolBar( KToolBar *toolBar )
{
KAction *action = new KToggleToolBarAction( toolBar,
i18n( "Show %1" ).arg( toolBar->label() ),
m_actionCollection,
toolBar->name() );
m_toolBarActions.append( action );
}
KActionCollection *m_actionCollection;
KMainWindow *m_mainWindow;
- QPtrList<KToolBar> m_toolBars;
- QPtrList<KAction> m_toolBarActions;
+ Q3PtrList<KToolBar> m_toolBars;
+ Q3PtrList<KAction> m_toolBarActions;
bool m_needsRebuild : 1;
};
}
using namespace KDEPrivate;
ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, const char *name )
: QObject( mainWindow, name ), KXMLGUIClient( mainWindow )
{
init( mainWindow );
}
ToolBarHandler::ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name )
: QObject( parent, name ), KXMLGUIClient( mainWindow )
{
init( mainWindow );
}
ToolBarHandler::~ToolBarHandler()
{
m_actions.setAutoDelete( true );
m_actions.clear();
}
@@ -203,51 +205,51 @@ void ToolBarHandler::init( KMainWindow *mainWindow )
m_mainWindow = mainWindow;
/*US
connect( m_mainWindow->guiFactory(), SIGNAL( clientAdded( KXMLGUIClient * ) ),
this, SLOT( clientAdded( KXMLGUIClient * ) ) );
*/
/* re-use an existing resource file if it exists. can happen if the user launches the
* toolbar editor */
/*
setXMLFile( resourceFileName );
*/
/*US
if ( domDocument().documentElement().isNull() ) {
QString completeDescription = QString::fromLatin1( guiDescription )
.arg( actionListName );
setXML( completeDescription, false*/ /*merge*/ /*);
}
*/
}
void ToolBarHandler::connectToActionContainers()
{
- QPtrListIterator<KAction> actionIt( m_actions );
+ Q3PtrListIterator<KAction> actionIt( m_actions );
for ( ; actionIt.current(); ++actionIt )
connectToActionContainer( actionIt.current() );
}
void ToolBarHandler::connectToActionContainer( KAction *action )
{
uint containerCount = action->containerCount();
for ( uint i = 0; i < containerCount; ++i )
connectToActionContainer( action->container( i ) );
}
void ToolBarHandler::connectToActionContainer( QWidget *container )
{
//US QPopupMenu *popupMenu = dynamic_cast<QPopupMenu *>( container );
- QPopupMenu *popupMenu = (QPopupMenu *)( container );
+ Q3PopupMenu *popupMenu = (Q3PopupMenu *)( container );
if ( !popupMenu )
return;
connect( popupMenu, SIGNAL( aboutToShow() ),
this, SLOT( setupActions() ) );
}
//US #include "ktoolbarhandler.moc"
/* vim: et sw=4 ts=4
*/
diff --git a/microkde/kdeui/ktoolbarhandler.h b/microkde/kdeui/ktoolbarhandler.h
index a1340ae..35f0d18 100644
--- a/microkde/kdeui/ktoolbarhandler.h
+++ b/microkde/kdeui/ktoolbarhandler.h
@@ -1,70 +1,70 @@
/* This file is part of the KDE libraries
Copyright (C) 2002 Simon Hausmann <hausmann@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KBARHANDLER_H
#define KBARHANDLER_H
#include <qobject.h>
-#include <qguardedptr.h>
-#include <qptrlist.h>
+#include <qpointer.h>
+#include <q3ptrlist.h>
#include <kxmlguiclient.h>
#include <kaction.h>
class KMainWindow;
class KToolBar;
namespace KDEPrivate
{
/// @since 3.1
class ToolBarHandler : public QObject, public KXMLGUIClient
{
Q_OBJECT
public:
ToolBarHandler( KMainWindow *mainWindow, const char *name = 0 );
ToolBarHandler( KMainWindow *mainWindow, QObject *parent, const char *name = 0 );
virtual ~ToolBarHandler();
KAction *toolBarMenuAction();
public slots:
void setupActions();
private slots:
//US void clientAdded( KXMLGUIClient *client );
private:
void init( KMainWindow *mainWindow );
void connectToActionContainers();
void connectToActionContainer( KAction *action );
void connectToActionContainer( QWidget *container );
struct Data;
Data *d;
- QGuardedPtr<KMainWindow> m_mainWindow;
- QPtrList<KAction> m_actions;
- QPtrList<KToolBar> m_toolBars;
+ QPointer<KMainWindow> m_mainWindow;
+ Q3PtrList<KAction> m_actions;
+ Q3PtrList<KToolBar> m_toolBars;
};
} // namespace KDEPrivate
#endif // KBARHANDLER_H
/* vim: et sw=4 ts=4
*/
diff --git a/microkde/kdeui/kxmlguiclient.cpp b/microkde/kdeui/kxmlguiclient.cpp
index 073e30b..8740bde 100644
--- a/microkde/kdeui/kxmlguiclient.cpp
+++ b/microkde/kdeui/kxmlguiclient.cpp
@@ -18,109 +18,111 @@
*/
#include "kxmlguiclient.h"
/*US
#include "kxmlguifactory.h"
#include "kxmlguibuilder.h"
*/
/*US
#include <qdir.h>
#include <qfile.h>
#include <qdom.h>
#include <qtextstream.h>
#include <qregexp.h>
*/
//US #include <kinstance.h>
#include <kstandarddirs.h>
#include <kdebug.h>
#include <kaction.h>
#include <kapplication.h>
#include <assert.h>
+//Added by qt3to4:
+#include <Q3PtrList>
class KXMLGUIClientPrivate
{
public:
KXMLGUIClientPrivate()
{
//US m_instance = KGlobal::instance();
//US m_factory = 0L;
m_parent = 0L;
//US m_builder = 0L;
m_actionCollection = 0;
}
~KXMLGUIClientPrivate()
{
}
//US KInstance *m_instance;
//US QDomDocument m_doc;
KActionCollection *m_actionCollection;
//US QDomDocument m_buildDocument;
//US KXMLGUIFactory *m_factory;
KXMLGUIClient *m_parent;
//QPtrList<KXMLGUIClient> m_supers;
- QPtrList<KXMLGUIClient> m_children;
+ Q3PtrList<KXMLGUIClient> m_children;
//US KXMLGUIBuilder *m_builder;
//US QString m_xmlFile;
//US QString m_localXMLFile;
};
KXMLGUIClient::KXMLGUIClient()
{
d = new KXMLGUIClientPrivate;
}
KXMLGUIClient::KXMLGUIClient( KXMLGUIClient *parent )
{
d = new KXMLGUIClientPrivate;
parent->insertChildClient( this );
}
KXMLGUIClient::~KXMLGUIClient()
{
if ( d->m_parent )
d->m_parent->removeChildClient( this );
- QPtrListIterator<KXMLGUIClient> it( d->m_children );
+ Q3PtrListIterator<KXMLGUIClient> it( d->m_children );
for ( ; it.current(); ++it ) {
assert( it.current()->d->m_parent == this );
it.current()->d->m_parent = 0;
}
delete d->m_actionCollection;
delete d;
}
KAction *KXMLGUIClient::action( const char *name ) const
{
KAction* act = actionCollection()->action( name );
if ( !act ) {
- QPtrListIterator<KXMLGUIClient> childIt( d->m_children );
+ Q3PtrListIterator<KXMLGUIClient> childIt( d->m_children );
for (; childIt.current(); ++childIt ) {
act = childIt.current()->actionCollection()->action( name );
if ( act )
break;
}
}
return act;
}
KActionCollection *KXMLGUIClient::actionCollection() const
{
if ( !d->m_actionCollection )
d->m_actionCollection = new KActionCollection( 0, 0,
"KXMLGUILClient-KActionCollection" );
return d->m_actionCollection;
}
/*US
KAction *KXMLGUIClient::action( const QDomElement &element ) const
{
static const QString &attrName = KGlobal::staticQString( "name" );
return actionCollection()->action( element.attribute( attrName ).latin1() );
}
@@ -567,67 +569,67 @@ KXMLGUIClient *KXMLGUIClient::parentClient() const
void KXMLGUIClient::insertChildClient( KXMLGUIClient *child )
{
if ( child->d->m_parent )
child->d->m_parent->removeChildClient( child );
d->m_children.append( child );
child->d->m_parent = this;
}
void KXMLGUIClient::removeChildClient( KXMLGUIClient *child )
{
assert( d->m_children.containsRef( child ) );
d->m_children.removeRef( child );
child->d->m_parent = 0;
}
/*bool KXMLGUIClient::addSuperClient( KXMLGUIClient *super )
{
if ( d->m_supers.contains( super ) )
return false;
d->m_supers.append( super );
return true;
}*/
-const QPtrList<KXMLGUIClient> *KXMLGUIClient::childClients()
+const Q3PtrList<KXMLGUIClient> *KXMLGUIClient::childClients()
{
return &d->m_children;
}
/*US
void KXMLGUIClient::setClientBuilder( KXMLGUIBuilder *builder )
{
d->m_builder = builder;
if ( builder )
builder->setBuilderInstance( instance() );
}
KXMLGUIBuilder *KXMLGUIClient::clientBuilder() const
{
return d->m_builder;
}
*/
-void KXMLGUIClient::plugActionList( const QString &name, const QPtrList<KAction> &actionList )
+void KXMLGUIClient::plugActionList( const QString &name, const Q3PtrList<KAction> &actionList )
{
/*US
if ( !d->m_factory )
return;
d->m_factory->plugActionList( this, name, actionList );
*/
}
void KXMLGUIClient::unplugActionList( const QString &name )
{
/*US
if ( !d->m_factory )
return;
d->m_factory->unplugActionList( this, name );
*/
}
/*US
QString KXMLGUIClient::findMostRecentXMLFile( const QStringList &files, QString &doc )
{
QValueList<DocStruct> allDocuments;
diff --git a/microkde/kdeui/kxmlguiclient.h b/microkde/kdeui/kxmlguiclient.h
index cd74c8e..b9d7b09 100644
--- a/microkde/kdeui/kxmlguiclient.h
+++ b/microkde/kdeui/kxmlguiclient.h
@@ -1,48 +1,48 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef _KXMLGUICLIENT_H
#define _KXMLGUICLIENT_H
//US #include <qdom.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qmap.h>
#include <qstringlist.h>
class QWidget;
class KAction;
class KActionCollection;
class KInstance;
class KXMLGUIClientPrivate;
class KXMLGUIFactory;
class KXMLGUIBuilder;
/**
*
* A KXMLGUIClient can be used with @ref KXMLGUIFactory to create a
* GUI from actions and an XML document, and can be dynamically merged
* with other KXMLGUIClients.
*/
class KXMLGUIClient
{
friend class KEditToolbarWidget; // for setXMLFile(3 args)
public:
/**
* Constructs a KXMLGUIClient which can be used with a
@@ -140,49 +140,49 @@ public:
/**
* KXMLGUIClients can form a simple child/parent object tree. This
* method returns a pointer to the parent client or 0L if it has no
* parent client assigned.
*/
KXMLGUIClient *parentClient() const;
/**
* Use this method to make a client a child client of another client.
* Usually you don't need to call this method, as it is called
* automatically when using the second constructor, which takes a
* arent argument.
*/
void insertChildClient( KXMLGUIClient *child );
/**
* Removes the given @p child from the client's children list.
*/
void removeChildClient( KXMLGUIClient *child );
/**
* Retrieves a list of all child clients.
*/
- const QPtrList<KXMLGUIClient> *childClients();
+ const Q3PtrList<KXMLGUIClient> *childClients();
/**
* A client can have an own @ref KXMLGUIBuilder.
* Use this method to assign your builder instance to the client (so that the
* @ref KXMLGUIFactory can use it when building the client's GUI)
*
* Client specific guibuilders are useful if you want to create
* custom container widgets for your GUI.
*/
//US void setClientBuilder( KXMLGUIBuilder *builder );
/**
* Retrieves the client's GUI builder or 0L if no client specific
* builder has been assigned via @ref #setClientBuilder()
*/
//US KXMLGUIBuilder *clientBuilder() const;
/**
* Forces this client to re-read its XML resource file. This is
* intended to be used when you know that the resource file has
* changed and you will soon be rebuilding the GUI. It has no
* useful effect with non-KParts GUIs, so don't bother using it
* unless your app is component based.
*/
@@ -207,49 +207,49 @@ public:
* ...
* </MenuBar>
* </kpartgui>
* \endverbatim
*
* This tag will get expanded to a list of actions. In the example
* above ( a file manager with a dynamic file menu ), you would call
* \code
* QPtrList<KAction> file_actions;
* for( ... )
* if( ... )
* file_actions.append( cool_action );
* unplugActionList( "xxx_file_actionlist" );
* plugActionList( "xxx_file_actionlist", file_actions );
* \endcode
* every time a file is selected, unselected or ...
*
* \note You should not call createGUI() after calling this
* function. In fact, that would remove the newly added
* actionlists again...
* \note Forgetting to call unplugActionList() before
* plugActionList() would leave the previous actions in the
* menu too..
*/
- void plugActionList( const QString &name, const QPtrList<KAction> &actionList );
+ void plugActionList( const QString &name, const Q3PtrList<KAction> &actionList );
/**
* The complement of \ref plugActionList() ...
*/
void unplugActionList( const QString &name );
//US static QString findMostRecentXMLFile( const QStringList &files, QString &doc );
void addStateActionEnabled(const QString& state, const QString& action);
void addStateActionDisabled(const QString& state, const QString& action);
enum ReverseStateChange { StateNoReverse, StateReverse };
struct StateChange
{
QStringList actionsToEnable;
QStringList actionsToDisable;
};
StateChange getActionsToChangeForState(const QString& state);
/// @since 3.1
//US void beginXMLPlug( QWidget * );
/// @since 3.1
diff --git a/microkde/kdialog.cpp b/microkde/kdialog.cpp
index 8398956..57e7ea6 100644
--- a/microkde/kdialog.cpp
+++ b/microkde/kdialog.cpp
@@ -1,59 +1,61 @@
#include <kdialog.h>
-#include <qapp.h>
+#include <qapplication.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qprogressbar.h>
+#include <q3progressbar.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#include <klocale.h>
KDialog::KDialog( QWidget *parent, const char *name, bool modal ) :
QDialog( parent, name, modal )
{
;
}
#ifdef DESKTOP_VERSION
int KDialog::spacingHint() { return 7; }
int KDialog::marginHint() { return 7; }
int KDialog::spacingHintSmall() { return 4; }
int KDialog::marginHintSmall() { return 4; }
#else
int KDialog::spacingHint() { return 3; }
int KDialog::marginHint() { return 3; }
int KDialog::spacingHintSmall() { return 1; }
int KDialog::marginHintSmall() { return 1; }
#endif
KProgressDialog::KProgressDialog( QWidget *parent, const char *name, bool modal ) :
QDialog( parent, name, modal )
{
- QVBoxLayout* lay= new QVBoxLayout ( this );
+ Q3VBoxLayout* lay= new Q3VBoxLayout ( this );
mLabel = new QLabel ( "abc",this );
- mBar = new QProgressBar ( this );
+ mBar = new Q3ProgressBar ( this );
mButton = new QPushButton ( i18n("Cancel"),this );
lay->addWidget ( mLabel );
lay->addWidget ( mBar );
lay->addWidget ( mButton );
connect ( mButton , SIGNAL ( clicked () ), this, SIGNAL ( cancelled () ));
resize ( 220, sizeHint().height() +mLabel->sizeHint().height());
}
void KProgressDialog::setLabelText ( const QString & t)
{
mLabel->setText( t );
}
void KProgressDialog::setTotalSteps ( int totalSteps )
{
setActiveWindow();
setFocus();
mBar->setTotalSteps ( totalSteps );
}
void KProgressDialog::setProgress ( int progress )
{
setActiveWindow();
setFocus();
diff --git a/microkde/kdialog.h b/microkde/kdialog.h
index bc80689..5f9bf0e 100644
--- a/microkde/kdialog.h
+++ b/microkde/kdialog.h
@@ -1,38 +1,40 @@
#ifndef MINIKDE_KDIALOG_H
#define MINIKDE_KDIALOG_H
#include <qdialog.h>
+//Added by qt3to4:
+#include <QLabel>
class QLabel;
-class QProgressBar;
+class Q3ProgressBar;
class QPushButton ;
class KDialog : public QDialog
{
Q_OBJECT
public:
KDialog( QWidget *parent=0, const char *name=0, bool modal=true );
static int spacingHint();
static int marginHint();
static int spacingHintSmall();
static int marginHintSmall();
};
class KProgressDialog : public QDialog
{
Q_OBJECT
public:
KProgressDialog( QWidget *parent=0, const char *name=0, bool modal=false );
void setLabelText ( const QString & );
void setTotalSteps ( int totalSteps );
void setProgress ( int progress );
void accept();
void reject();
private:
QLabel * mLabel;
- QProgressBar *mBar;
+ Q3ProgressBar *mBar;
QPushButton *mButton;
signals:
void cancelled ();
};
#endif
diff --git a/microkde/kdialogbase.cpp b/microkde/kdialogbase.cpp
index d5c7e61..a40bad6 100644
--- a/microkde/kdialogbase.cpp
+++ b/microkde/kdialogbase.cpp
@@ -1,28 +1,32 @@
#include <qtabwidget.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qframe.h>
+#include <q3frame.h>
+//Added by qt3to4:
+#include <QPixmap>
+#include <Q3HBoxLayout>
+#include <Q3VBoxLayout>
#include "klocale.h"
#include "kdebug.h"
#include "kdialogbase.h"
KDialogBase::KDialogBase()
{
}
KDialogBase::KDialogBase( QWidget *parent, const char *name, bool modal,
const QString &caption,
int buttonMask, ButtonCode defaultButton,
bool separator,
const QString &user1,
const QString &user2,
const QString &user3) :
KDialog( parent, name, modal )
{
init( caption, buttonMask, user1, user2 );
if (findButton( defaultButton ) ) {
(findButton( defaultButton ) )->setFocus();
(findButton( defaultButton ) )->setDefault( true );
@@ -114,77 +118,77 @@ void KDialogBase::init( const QString &caption, int buttonMask,
QTabWidget *KDialogBase::tabWidget()
{
if ( !mTabWidget ) {
mTabWidget = new QTabWidget( this );
setMainWidget( mTabWidget );
}
return mTabWidget;
}
void KDialogBase::hideButtons()
{
if ( mUser1Button ) mUser1Button->hide() ;
if ( mUser2Button ) mUser2Button->hide() ;
if ( mOkButton ) mOkButton->hide() ;
if ( mApplyButton ) mApplyButton->hide() ;
if ( mDefaultButton ) mDefaultButton->hide();
if ( mCancelButton ) mCancelButton->hide() ;
if ( mCloseButton ) mCloseButton->hide() ;
}
void KDialogBase::initLayout()
{
delete mTopLayout;
- mTopLayout = new QVBoxLayout( this );
+ mTopLayout = new Q3VBoxLayout( this );
mTopLayout->setMargin( marginHintSmall() );
mTopLayout->setSpacing( spacingHintSmall() );
mTopLayout->addWidget( mMainWidget );
- QBoxLayout *buttonLayout = new QHBoxLayout;
+ Q3BoxLayout *buttonLayout = new Q3HBoxLayout;
mTopLayout->addLayout( buttonLayout );
if ( mUser1Button ) buttonLayout->addWidget( mUser1Button );
if ( mUser2Button ) buttonLayout->addWidget( mUser2Button );
if ( mOkButton ) buttonLayout->addWidget( mOkButton );
if ( mApplyButton ) buttonLayout->addWidget( mApplyButton );
if ( mDefaultButton ) buttonLayout->addWidget( mDefaultButton );
if ( mCancelButton ) buttonLayout->addWidget( mCancelButton );
if ( mCloseButton ) buttonLayout->addWidget( mCloseButton );
buttonLayout->setMargin( marginHintSmall() );
buttonLayout->setSpacing( spacingHintSmall() );
}
-QFrame *KDialogBase::addPage( const QString &name )
+Q3Frame *KDialogBase::addPage( const QString &name )
{
// kdDebug() << "KDialogBase::addPage(): " << name << endl;
- QFrame *frame = new QFrame( tabWidget() );
+ Q3Frame *frame = new Q3Frame( tabWidget() );
tabWidget()->addTab( frame, name );
return frame;
}
-QFrame *KDialogBase::addPage( const QString &name, int, const QPixmap & )
+Q3Frame *KDialogBase::addPage( const QString &name, int, const QPixmap & )
{
return addPage( name );
}
void KDialogBase::setMainWidget( QWidget *widget )
{
kdDebug() << "KDialogBase::setMainWidget()" << endl;
mMainWidget = widget;
initLayout();
}
void KDialogBase::setButtonText( ButtonCode id, const QString &text )
{
QPushButton *button = findButton( id );
if ( button ) {
button->setText( text );
}
}
void KDialogBase::enableButton( ButtonCode id, bool state )
{
QPushButton *button = findButton( id );
@@ -233,52 +237,52 @@ void KDialogBase::enableButtonApply( bool state )
{
enableButton( Apply, state );
}
void KDialogBase::showButton( ButtonCode id, bool show )
{
QPushButton *button = findButton( id );
if ( button ) {
if ( show ) button->show();
else button->hide();
}
}
int KDialogBase::pageIndex( QWidget *widget ) const
{
return 0;
}
bool KDialogBase::showPage( int index )
{
tabWidget()->setCurrentPage( index );return false;
}
-QFrame *KDialogBase::plainPage()
+Q3Frame *KDialogBase::plainPage()
{
if ( !mPlainPage ) {
- mPlainPage = new QFrame( this );
+ mPlainPage = new Q3Frame( this );
setMainWidget( mPlainPage );
}
return mPlainPage;
}
void KDialogBase::slotOk()
{
emit okClicked();
accept();
}
void KDialogBase::slotApply()
{
emit applyClicked();
}
void KDialogBase::slotCancel()
{
emit cancelClicked();
reject();
}
void KDialogBase::slotClose()
{
diff --git a/microkde/kdialogbase.h b/microkde/kdialogbase.h
index 17c186b..64cbd17 100644
--- a/microkde/kdialogbase.h
+++ b/microkde/kdialogbase.h
@@ -1,35 +1,37 @@
#ifndef MINIKDE_KDIALOGBASE_H
#define MINIKDE_KDIALOGBASE_H
-#include <qframe.h>
+#include <q3frame.h>
+//Added by qt3to4:
+#include <QPixmap>
#include "kdialog.h"
class QPushButton;
class QLayout;
class QTabWidget;
-class QBoxLayout;
+class Q3BoxLayout;
class KDialogBase : public KDialog
{
Q_OBJECT
public:
enum ButtonCode
{
Help = 0x00000001,
Default = 0x00000002,
Ok = 0x00000004,
Apply = 0x00000008,
Try = 0x00000010,
Cancel = 0x00000020,
Close = 0x00000040,
User1 = 0x00000080,
User2 = 0x00000100,
User3 = 0x00000200,
No = 0x00000080,
Yes = 0x00000100,
Details = 0x00000400,
Filler = 0x40000000,
Stretch = 0x80000000
};
@@ -38,67 +40,67 @@ class KDialogBase : public KDialog
TreeList,
Tabbed,
Plain,
Swallow,
IconList
};
KDialogBase();
KDialogBase( QWidget *parent=0, const char *name=0, bool modal=true,
const QString &caption=QString::null,
int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
bool separator=false,
const QString &user1=QString::null,
const QString &user2=QString::null,
const QString &user3=QString::null);
KDialogBase( int dialogFace, const QString &caption,
int buttonMask, ButtonCode defaultButton,
QWidget *parent=0, const char *name=0, bool modal=true,
bool separator=false,
const QString &user1=QString::null,
const QString &user2=QString::null,
const QString &user3=QString::null);
virtual ~KDialogBase();
- QFrame *addPage( const QString & );
- QFrame *addPage( const QString &, int, const QPixmap & );
+ Q3Frame *addPage( const QString & );
+ Q3Frame *addPage( const QString &, int, const QPixmap & );
void setMainWidget( QWidget *widget );
void setButtonText( ButtonCode id, const QString &text );
void enableButton( ButtonCode id, bool state );
void enableButtonOK( bool state );
void enableButtonApply( bool state );
void showButton( ButtonCode, bool show );
int pageIndex( QWidget *widget ) const;
bool showPage( int index );
void hideButtons();
- QFrame *plainPage();
+ Q3Frame *plainPage();
signals:
void user1Clicked();
void user2Clicked();
/**
* The Apply button was pressed. This signal is only emitted if
* @ref slotApply() is not replaced.
*/
void applyClicked();
/**
* The OK button was pressed. This signal is only emitted if
* @ref slotOk() is not replaced.
*/
void okClicked();
/**
* The Cancel button was pressed. This signal is only emitted if
* @ref slotCancel() is not replaced.
*/
void cancelClicked();
/**
* The Close button was pressed. This signal is only emitted if
@@ -107,37 +109,37 @@ class KDialogBase : public KDialog
void closeClicked();
void defaultClicked();
void acceptClicked();
protected slots:
virtual void slotOk();
virtual void slotApply();
virtual void slotCancel();
virtual void slotClose();
virtual void slotUser1();
virtual void slotUser2();
virtual void accept ();
protected:
QPushButton *findButton( ButtonCode );
QTabWidget *tabWidget();
private:
void init( const QString &caption, int buttonMask,
const QString &user1=QString::null, const QString &user2=QString::null );
void initLayout();
QWidget *mMainWidget;
QTabWidget *mTabWidget;
- QFrame *mPlainPage;
- QBoxLayout *mTopLayout;
+ Q3Frame *mPlainPage;
+ Q3BoxLayout *mTopLayout;
QPushButton *mUser1Button;
QPushButton *mUser2Button;
QPushButton *mCloseButton;
QPushButton *mOkButton;
QPushButton *mApplyButton;
QPushButton *mCancelButton;
QPushButton *mDefaultButton;
};
#endif
diff --git a/microkde/keditlistbox.cpp b/microkde/keditlistbox.cpp
index 55b7784..257a44a 100644
--- a/microkde/keditlistbox.cpp
+++ b/microkde/keditlistbox.cpp
@@ -1,136 +1,139 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
2000, 2002 Carsten Pfeiffer <pfeiffer@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qstringlist.h>
#include <qpushbutton.h>
#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qlistbox.h>
-#include <qwhatsthis.h>
+#include <q3groupbox.h>
+#include <q3listbox.h>
+#include <q3whatsthis.h>
#include <qlabel.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3StrList>
#include <kcombobox.h>
#include <kdebug.h>
#include <kdialog.h>
#include <klineedit.h>
#include <klocale.h>
#include <kapplication.h>
#include <knotifyclient.h>
#include "keditlistbox.h"
#include <assert.h>
class KEditListBoxPrivate
{
public:
bool m_checkAtEntering;
int buttons;
};
KEditListBox::KEditListBox(QWidget *parent, const char *name,
bool checkAtEntering, int buttons )
- :QGroupBox(parent, name )
+ :Q3GroupBox(parent, name )
{
init( checkAtEntering, buttons );
}
KEditListBox::KEditListBox(const QString& title, QWidget *parent,
const char *name, bool checkAtEntering, int buttons)
- :QGroupBox(title, parent, name )
+ :Q3GroupBox(title, parent, name )
{
init( checkAtEntering, buttons );
}
KEditListBox::KEditListBox(const QString& title, const CustomEditor& custom,
QWidget *parent, const char *name,
bool checkAtEntering, int buttons)
- :QGroupBox(title, parent, name )
+ :Q3GroupBox(title, parent, name )
{
m_lineEdit = custom.lineEdit();
init( checkAtEntering, buttons, custom.representationWidget() );
}
KEditListBox::~KEditListBox()
{
delete d;
d=0;
}
void KEditListBox::init( bool checkAtEntering, int buttons,
QWidget *representationWidget )
{
d=new KEditListBoxPrivate;
d->m_checkAtEntering=checkAtEntering;
d->buttons = buttons;
int lostButtons = 0;
if ( (buttons & Add) == 0 )
lostButtons++;
if ( (buttons & Remove) == 0 )
lostButtons++;
if ( (buttons & UpDown) == 0 )
lostButtons += 2;
servNewButton = servRemoveButton = servUpButton = servDownButton = 0L;
setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::MinimumExpanding));
QWidget * gb = this;
- QGridLayout * grid = new QGridLayout(gb, 7 - lostButtons, 2,
+ Q3GridLayout * grid = new Q3GridLayout(gb, 7 - lostButtons, 2,
KDialog::marginHint(),
KDialog::spacingHint());
grid->addRowSpacing(0, fontMetrics().lineSpacing());
for ( int i = 1; i < 7 - lostButtons; i++ )
grid->setRowStretch(i, 1);
grid->setMargin(15);
if ( representationWidget )
representationWidget->reparent( gb, QPoint(0,0) );
else
m_lineEdit=new KLineEdit(gb);
- m_listBox = new QListBox(gb);
+ m_listBox = new Q3ListBox(gb);
QWidget *editingWidget = representationWidget ?
representationWidget : m_lineEdit;
grid->addMultiCellWidget(editingWidget,1,1,0,1);
grid->addMultiCellWidget(m_listBox, 2, 6 - lostButtons, 0, 0);
int row = 2;
if ( buttons & Add ) {
servNewButton = new QPushButton(i18n("&Add"), gb);
servNewButton->setEnabled(false);
connect(servNewButton, SIGNAL(clicked()), SLOT(addItem()));
grid->addWidget(servNewButton, row++, 1);
}
if ( buttons & Remove ) {
servRemoveButton = new QPushButton(i18n("&Remove"), gb);
servRemoveButton->setEnabled(false);
connect(servRemoveButton, SIGNAL(clicked()), SLOT(removeItem()));
grid->addWidget(servRemoveButton, row++, 1);
}
if ( buttons & UpDown ) {
servUpButton = new QPushButton(i18n("Move &Up"), gb);
@@ -183,72 +186,72 @@ void KEditListBox::typedSomething(const QString& text)
}
else
{
bool enable = (m_listBox->findItem( text ) == 0L);
servNewButton->setEnabled( enable );
}
}
}
void KEditListBox::moveItemUp()
{
if (!m_listBox->isEnabled())
{
KNotifyClient::beep();
return;
}
unsigned int selIndex = m_listBox->currentItem();
if (selIndex == 0)
{
KNotifyClient::beep();
return;
}
- QListBoxItem *selItem = m_listBox->item(selIndex);
+ Q3ListBoxItem *selItem = m_listBox->item(selIndex);
m_listBox->takeItem(selItem);
m_listBox->insertItem(selItem, selIndex-1);
m_listBox->setCurrentItem(selIndex - 1);
emit changed();
}
void KEditListBox::moveItemDown()
{
if (!m_listBox->isEnabled())
{
KNotifyClient::beep();
return;
}
unsigned int selIndex = m_listBox->currentItem();
if (selIndex == m_listBox->count() - 1)
{
KNotifyClient::beep();
return;
}
- QListBoxItem *selItem = m_listBox->item(selIndex);
+ Q3ListBoxItem *selItem = m_listBox->item(selIndex);
m_listBox->takeItem(selItem);
m_listBox->insertItem(selItem, selIndex+1);
m_listBox->setCurrentItem(selIndex + 1);
emit changed();
}
void KEditListBox::addItem()
{
// when m_checkAtEntering is true, the add-button is disabled, but this
// slot can still be called through Key_Return/Key_Enter. So we guard
// against this.
if ( !servNewButton || !servNewButton->isEnabled() )
return;
const QString& currentTextLE=m_lineEdit->text();
bool alreadyInList(false);
//if we didn't check for dupes at the inserting we have to do it now
if (!d->m_checkAtEntering)
{
// first check current item instead of dumb iterating the entire list
if ( m_listBox->currentText() == currentTextLE )
alreadyInList = true;
else
@@ -328,56 +331,58 @@ void KEditListBox::enableMoveButtons(int index)
}
else
{
servUpButton->setEnabled(true);
servDownButton->setEnabled(true);
}
}
if ( servRemoveButton )
servRemoveButton->setEnabled(true);
}
void KEditListBox::clear()
{
m_lineEdit->clear();
m_listBox->clear();
emit changed();
}
void KEditListBox::insertStringList(const QStringList& list, int index)
{
m_listBox->insertStringList(list,index);
}
-void KEditListBox::insertStrList(const QStrList* list, int index)
+void KEditListBox::insertStrList(const Q3StrList* list, int index)
{
- m_listBox->insertStrList(list,index);
+ for(Q3StrList::const_iterator i=list->begin();i!=list->end();++i)
+ m_listBox->insertItem(*i,index++);
}
-void KEditListBox::insertStrList(const QStrList& list, int index)
+void KEditListBox::insertStrList(const Q3StrList& list, int index)
{
- m_listBox->insertStrList(list,index);
+ for(Q3StrList::const_iterator i=list.begin();i!=list.end();++i)
+ m_listBox->insertItem(*i,index++);
}
void KEditListBox::insertStrList(const char ** list, int numStrings, int index)
{
m_listBox->insertStrList(list,numStrings,index);
}
QStringList KEditListBox::items() const
{
QStringList list;
for ( uint i = 0; i < m_listBox->count(); i++ )
list.append( m_listBox->text( i ));
return list;
}
void KEditListBox::virtual_hook( int, void* )
{ /*BASE::virtual_hook( id, data );*/ }
///////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
KEditListBox::CustomEditor::CustomEditor( KComboBox *combo )
diff --git a/microkde/keditlistbox.h b/microkde/keditlistbox.h
index 130d933..e43d958 100644
--- a/microkde/keditlistbox.h
+++ b/microkde/keditlistbox.h
@@ -1,63 +1,65 @@
/* This file is part of the KDE libraries
Copyright (C) 2000 David Faure <faure@kde.org>, Alexander Neundorf <neundorf@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KEDITLISTBOX_H
#define KEDITLISTBOX_H
-#include <qgroupbox.h>
-#include <qlistbox.h>
+#include <q3groupbox.h>
+#include <q3listbox.h>
+//Added by qt3to4:
+#include <Q3StrList>
class KLineEdit;
class KComboBox;
class QPushButton;
class KEditListBoxPrivate;
/**
* An editable listbox
*
* This class provides a editable listbox ;-), this means
* a listbox which is accompanied by a line edit to enter new
* items into the listbox and pushbuttons to add and remove
* items from the listbox and two buttons to move items up and down.
*/
-class KEditListBox : public QGroupBox
+class KEditListBox : public Q3GroupBox
{
Q_OBJECT
public:
/// @since 3.1
class CustomEditor
{
public:
CustomEditor()
: m_representationWidget( 0L ),
m_lineEdit( 0L ) {}
CustomEditor( QWidget *repWidget, KLineEdit *edit )
: m_representationWidget( repWidget ),
m_lineEdit( edit ) {}
CustomEditor( KComboBox *combo );
void setRepresentationWidget( QWidget *repWidget ) {
m_representationWidget = repWidget;
}
void setLineEdit( KLineEdit *edit ) {
m_lineEdit = edit;
}
virtual QWidget *representationWidget() const {
@@ -105,122 +107,122 @@ public:
int buttons = All );
/**
* Another constructor, which allows to use a custom editing widget
* instead of the standard KLineEdit widget. E.g. you can use a
* @ref KURLRequester or a @ref KComboBox as input widget. The custom
* editor must consist of a lineedit and optionally another widget that
* is used as representation. A KComboBox or a KURLRequester have a
* KLineEdit as child-widget for example, so the KComboBox is used as
* the representation widget.
*
* @see KURLRequester::customEditor()
* @since 3.1
*/
KEditListBox( const QString& title,
const CustomEditor &customEditor,
QWidget *parent = 0, const char *name = 0,
bool checkAtEntering = false, int buttons = All );
virtual ~KEditListBox();
/**
* Return a pointer to the embedded QListBox.
*/
- QListBox* listBox() const { return m_listBox; }
+ Q3ListBox* listBox() const { return m_listBox; }
/**
* Return a pointer to the embedded QLineEdit.
*/
KLineEdit* lineEdit() const { return m_lineEdit; }
/**
* Return a pointer to the Add button
*/
QPushButton* addButton() const { return servNewButton; }
/**
* Return a pointer to the Remove button
*/
QPushButton* removeButton() const { return servRemoveButton; }
/**
* Return a pointer to the Up button
*/
QPushButton* upButton() const { return servUpButton; }
/**
* Return a pointer to the Down button
*/
QPushButton* downButton() const { return servDownButton; }
/**
* See @ref QListBox::count()
*/
int count() const { return int(m_listBox->count()); }
/**
* See @ref QListBox::insertStringList()
*/
void insertStringList(const QStringList& list, int index=-1);
/**
* See @ref QListBox::insertStringList()
*/
- void insertStrList(const QStrList* list, int index=-1);
+ void insertStrList(const Q3StrList* list, int index=-1);
/**
* See @ref QListBox::insertStrList()
*/
- void insertStrList(const QStrList& list, int index=-1);
+ void insertStrList(const Q3StrList& list, int index=-1);
/**
* See @ref QListBox::insertStrList()
*/
void insertStrList(const char ** list, int numStrings=-1, int index=-1);
/**
* See @ref QListBox::insertItem()
*/
void insertItem(const QString& text, int index=-1) {m_listBox->insertItem(text,index);}
/**
* Clears both the listbox and the line edit.
*/
void clear();
/**
* See @ref QListBox::text()
*/
QString text(int index) const { return m_listBox->text(index); }
/**
* See @ref QListBox::currentItem()
*/
int currentItem() const;
/**
* See @ref QListBox::currentText()
*/
QString currentText() const { return m_listBox->currentText(); }
/**
* @returns a stringlist of all items in the listbox
*/
QStringList items() const;
signals:
void changed();
protected slots:
//the names should be self-explaining
void moveItemUp();
void moveItemDown();
void addItem();
void removeItem();
void enableMoveButtons(int index);
void typedSomething(const QString& text);
private:
- QListBox *m_listBox;
+ Q3ListBox *m_listBox;
QPushButton *servUpButton, *servDownButton;
QPushButton *servNewButton, *servRemoveButton;
KLineEdit *m_lineEdit;
//this is called in both ctors, to avoid code duplication
void init( bool checkAtEntering, int buttons,
QWidget *representationWidget = 0L );
protected:
virtual void virtual_hook( int id, void* data );
private:
//our lovely private d-pointer
KEditListBoxPrivate *d;
};
#endif
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 383e711..c1bfdef 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -1,88 +1,90 @@
#include <kfiledialog.h>
#include <qdialog.h>
#include <qlayout.h>
#include <qdir.h>
#include <qfileinfo.h>
#include <qapplication.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
#ifndef DESKTOP_VERSION
//US orig#include <ofileselector.h>
#include <ofileselector_p.h>
QString KFileDialog::getSaveFileName( const QString & fn,
const QString & cap , QWidget * par )
{
QString retfile = "";
QDialog dia ( par, "input-dialog", true );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
QString file = fn;
if ( file.isEmpty() )
file = QDir::homeDirPath()+"/*";
QFileInfo fi ( file );
OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Save, fi.dirPath(true), fi.fileName() );
QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
lay.addWidget( &o);
// o.setNewVisible( true );
// o.setNameVisible( true );
dia.showMaximized();
if ( cap.isEmpty() )
dia.setCaption( file );
else
dia.setCaption( cap );
int res = dia.exec();
if ( res )
retfile = o.selectedName();
return retfile;
}
QString KFileDialog::getOpenFileName( const QString & fn,
const QString & cap, QWidget * par )
{
QString retfile = "";
QDialog dia ( par, "input-dialog", true );
// QLineEdit lab ( &dia );
- QVBoxLayout lay( &dia );
+ Q3VBoxLayout lay( &dia );
lay.setMargin(7);
lay.setSpacing(7);
QString file = fn;
if ( file.isEmpty() )
file = QDir::homeDirPath()+"/*";;
QFileInfo fi ( file );
OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
lay.addWidget( &o);
dia.showMaximized();
dia.setCaption( cap );
int res = dia.exec();
if ( res )
retfile = o.selectedName();
return retfile;
}
QString KFileDialog::getExistingDirectory( const QString & fn,
const QString & cap, QWidget * par )
{
return KFileDialog::getSaveFileName( fn, cap, par );
}
#else
-#include <qfiledialog.h>
+#include <q3filedialog.h>
QString KFileDialog::getSaveFileName( const QString & fn,
const QString & cap , QWidget * par )
{
- return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
+ return Q3FileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap );
}
QString KFileDialog::getOpenFileName( const QString & fn,
const QString & cap, QWidget * par )
{
- return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
+ return Q3FileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap );
}
QString KFileDialog::getExistingDirectory( const QString & fn,
const QString & cap, QWidget * par )
{
- return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap );
+ return Q3FileDialog::getExistingDirectory( fn, par, "exidtingdir", cap );
}
#endif
diff --git a/microkde/kfontdialog.cpp b/microkde/kfontdialog.cpp
index 174123c..f83c2a8 100644
--- a/microkde/kfontdialog.cpp
+++ b/microkde/kfontdialog.cpp
@@ -1,32 +1,34 @@
#include "kfontdialog.h"
#ifndef DESKTOP_VERSION
#include "ofontselector.h"
#else
#include <qfontdialog.h>
#endif
#include <qdialog.h>
#include <qlayout.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
QFont KFontDialog::getFont( const QFont & f, bool & ok )
{
#ifndef DESKTOP_VERSION
QDialog d( 0, "fd", true );;
OFontSelector s ( true, &d, "fontsel");
- QVBoxLayout l ( &d );
+ Q3VBoxLayout l ( &d );
l.addWidget( &s );
s.setSelectedFont ( f );
QPushButton b ( "OK", &d );
l.addWidget( &b );
qDebug("size %d ", f.bold());
QObject::connect( &b, SIGNAL( clicked () ), &d, SLOT ( accept () ) );
d.show();
ok = false;
if ( d.exec () ) {
ok = true;
return s.selectedFont ( );
}
return f;
#else
return QFontDialog::getFont ( &ok, f, 0, "fontdialog" );
#endif
}
diff --git a/microkde/kglobal.cpp b/microkde/kglobal.cpp
index 53edd08..9cc5835 100644
--- a/microkde/kglobal.cpp
+++ b/microkde/kglobal.cpp
@@ -1,40 +1,41 @@
#include "kglobal.h"
#include "kstandarddirs.h"
-#include <qkeycode.h>
+#include <qnamespace.h>
#include <qapplication.h>
+#include <QDesktopWidget>
KLocale *KGlobal::mLocale = 0;
KConfig *KGlobal::mConfig = 0;
KIconLoader *KGlobal::mIconLoader = 0;
KStandardDirs *KGlobal::mDirs = 0;
QString KGlobal::mAppName = "godot";
KLocale *KGlobal::locale()
{
if ( !mLocale ) {
- ASSERT(mAppName);
+ Q_ASSERT(!mAppName.isEmpty());
mLocale = new KLocale();//mAppName);
}
return mLocale;
}
//US
void KGlobal::setLocale(KLocale *kg)
{
mLocale = kg;
}
KConfig *KGlobal::config()
{
//mConfig is set inside setAppName. Though it has to be the first function you call.
return mConfig;
}
KGlobal::Size KGlobal::getDesktopSize()
{
#ifdef DESKTOP_VERSION
return KGlobal::Desktop;
#else
diff --git a/microkde/kglobalsettings.cpp b/microkde/kglobalsettings.cpp
index 2e483e9..1f08255 100644
--- a/microkde/kglobalsettings.cpp
+++ b/microkde/kglobalsettings.cpp
@@ -1,30 +1,31 @@
#include "kglobalsettings.h"
#include "kconfig.h"
#include "kglobal.h"
#include "kconfigbase.h"
#include <qapplication.h>
+#include <QDesktopWidget>
#ifdef DESKTOP_VERSION
QColor KGlobalSettings::mAlternate = QColor( 235, 235, 235 );
#else
QColor KGlobalSettings::mAlternate = QColor( 210, 210, 210 );
#endif
QFont KGlobalSettings::generalFont()
{
int size = 12;
if (QApplication::desktop()->width() < 480 ) {
size = 10;
}
#ifndef DESKTOP_VERSION
else
if (QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 )
size = 18;
#endif
QFont f = QApplication::font();
//qDebug("pointsize %d %s", f.pointSize(),f.family().latin1());
f.setPointSize( size );
return f;
}
diff --git a/microkde/kiconloader.cpp b/microkde/kiconloader.cpp
index 4842d71..e7f657d 100644
--- a/microkde/kiconloader.cpp
+++ b/microkde/kiconloader.cpp
@@ -1,48 +1,50 @@
#include "kiconloader.h"
#include "kglobal.h"
#ifndef DESKTOP_VERSION_OEGEL
#include <qdir.h>
+//Added by qt3to4:
+#include <QPixmap>
QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int,
int, QString *, bool ) const
{
QPixmap pix;
QString file;
file = iconPath() + name+".png";
pix.load ( file );
// qDebug("KIconLoader::loadIcon %s -----------", file.latin1());
return pix;
}
-QIconSet KIconLoader::loadIconSet( const QString& name) const
+QIcon KIconLoader::loadIconSet( const QString& name) const
{
QPixmap pixmapLoader;
QString file;
file = iconPath() + name+".png";
pixmapLoader.load( file );
//qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() );
- QIconSet is ( pixmapLoader );
+ QIcon is ( pixmapLoader );
return is;
}
QPixmap BarIcon( const QString &name )
{
QPixmap pix;
pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" );
return pix;
}
QPixmap DesktopIcon( const QString &name, int )
{
QPixmap pix;
pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" );
return pix;
}
QPixmap SmallIcon( const QString &name )
{
QPixmap pixmapLoader;
QString file;
file =KGlobal::iconLoader()->iconPath() + name +".png";
pixmapLoader.load( file );
@@ -56,54 +58,54 @@ QPixmap SmallIconSet( const QString &name )
QString file;
file =KGlobal::iconLoader()->iconPath() + name +".png";
pixmapLoader.load( file );
return pixmapLoader;
}
#else
#include <qpe/resource.h>
#include <kglobal.h>
QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int,
int, QString *, bool ) const
{
QString px = this->iconPath() + "/" + name;
QPixmap p = Resource::loadPixmap( px );
QPixmap* pPtr = &p;
if (pPtr == 0)
qDebug("KIconLoader::loadIcon: %s not found", px.latin1());
return p;
}
-QIconSet KIconLoader::loadIconSet( const QString& name) const
+QIcon KIconLoader::loadIconSet( const QString& name) const
{
QString px = this->iconPath() + "/" + name;
- QIconSet is ;//= Resource::loadIconSet( px );
- QIconSet* isPtr = 0;//LR&is;
+ QIcon is ;//= Resource::loadIconSet( px );
+ QIcon* isPtr = 0;//LR&is;
if (isPtr == 0)
qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1());
return is;
}
QPixmap BarIcon( const QString &name )
{
QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
return p;
}
QPixmap DesktopIcon( const QString &name, int )
{
QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
return p;
}
QPixmap SmallIcon( const QString &name )
{
QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop);
return p;
}
diff --git a/microkde/kiconloader.h b/microkde/kiconloader.h
index 68fec4e..2abb667 100644
--- a/microkde/kiconloader.h
+++ b/microkde/kiconloader.h
@@ -1,52 +1,52 @@
#ifndef MINIKDE_KICONLOADER_H
#define MINIKDE_KICONLOADER_H
#include <qpixmap.h>
#include <qstring.h>
//US
-#include <qiconset.h>
+#include <qicon.h>
class KIcon
{
public:
enum Group { NoGroup=-1, Desktop=0, Toolbar, MainToolbar, Small,
Panel, LastGroup, User };
enum StdSizes { SizeSmall=16, SizeMedium=32, SizeLarge=48 };
enum States { DefaultState, ActiveState, DisabledState, LastState };
};
class KIconLoader
{
public:
KIconLoader()
: mIconpath(0) {}
KIconLoader( const QString &iconpath )
: mIconpath(iconpath) {}
//US QPixmap loadIcon( const QString &name, int );
QPixmap loadIcon(const QString& name, KIcon::Group group, int size=0,
int state=KIcon::DefaultState, QString *path_store=0,
bool canReturnNull=false) const;
//US
QString setIconPath( const QString &);
QString iconPath( /*US const QString &, int */) const;
QString iconPath( const QString &, int ) const;
- QIconSet loadIconSet( const QString &name) const;
+ QIcon loadIconSet( const QString &name) const;
//US to make this class usable for different applications, we have to add a iconpathvariable
private:
QString mIconpath;
};
QPixmap BarIcon(const QString& name);
QPixmap DesktopIcon(const QString& name, int);
QPixmap SmallIcon(const QString& name);
QPixmap SmallIconSet( const QString &name );
#endif
diff --git a/microkde/kio/kfile/kurlrequester.cpp b/microkde/kio/kfile/kurlrequester.cpp
index ca94570..ce62da7 100644
--- a/microkde/kio/kfile/kurlrequester.cpp
+++ b/microkde/kio/kfile/kurlrequester.cpp
@@ -6,48 +6,50 @@
License version 2, as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <sys/stat.h>
#ifdef _WIN32_
#else
#include <unistd.h>
#endif
#include <qstring.h>
//US #include <qtooltip.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <QPixmap>
//US #include <kaccel.h>
//US #include <kcombobox.h>
#include <kdebug.h>
#include <kdialog.h>
#include <kfiledialog.h>
#include <kglobal.h>
#include <kiconloader.h>
#include <klineedit.h>
#include <klocale.h>
//US #include <kurlcompletion.h>
//US #include <kurldrag.h>
//US #include <kprotocolinfo.h>
#include "kurlrequester.h"
class KURLDragPushButton : public QPushButton
{
public:
KURLDragPushButton( QWidget *parent, const char *name=0 )
: QPushButton( parent, name ) {
//US setDragEnabled( true );
@@ -161,84 +163,84 @@ public:
//US KComboBox *combo;
int fileDialogMode;
QString fileDialogFilter;
};
/*US
KURLRequester::KURLRequester( QWidget *editWidget, QWidget *parent,
const char *name )
: QHBox( parent, name )
{
d = new KURLRequesterPrivate;
// must have this as parent
editWidget->reparent( this, 0, QPoint(0,0) );
//US d->edit = dynamic_cast<KLineEdit*>( editWidget );
d->edit = (KLineEdit*)( editWidget );
//US d->combo = dynamic_cast<KComboBox*>( editWidget );
init();
}
*/
KURLRequester::KURLRequester( QWidget *parent, const char *name )
- : QHBox( parent, name )
+ : Q3HBox( parent, name )
{
d = new KURLRequesterPrivate;
init();
}
KURLRequester::KURLRequester( const QString& url, QWidget *parent,
const char *name )
- : QHBox( parent, name )
+ : Q3HBox( parent, name )
{
d = new KURLRequesterPrivate;
init();
setURL( url );
}
KURLRequester::~KURLRequester()
{
//US delete myCompletion;
delete myFileDialog;
delete d;
}
void KURLRequester::init()
{
myFileDialog = 0L;
myShowLocalProt = false;
mPathIsDir = false;
if (/*US !d->combo && */ !d->edit )
d->edit = new KLineEdit( this, "KURLRequester::KLineEdit" );
myButton = new KURLDragPushButton( this, "kfile button");
- QIconSet iconSet = SmallIconSet("fileopen");
- QPixmap pixMap = iconSet.pixmap( QIconSet::Small, QIconSet::Normal );
+ QIcon iconSet = SmallIconSet("fileopen");
+ QPixmap pixMap = iconSet.pixmap( QIcon::Small, QIcon::Normal );
myButton->setIconSet( iconSet );
myButton->setFixedSize( pixMap.width()+8, pixMap.height()+8 );
//US QToolTip::add(myButton, i18n("Open file dialog"));
connect( myButton, SIGNAL( pressed() ), SLOT( slotUpdateURL() ));
setSpacing( KDialog::spacingHint() );
QWidget *widget = /*US d->combo ? (QWidget*) d->combo : */ (QWidget*) d->edit;
setFocusProxy( widget );
d->connectSignals( this );
connect( myButton, SIGNAL( clicked() ), this, SLOT( slotOpenDialog() ));
/*US
myCompletion = new KURLCompletion();
d->setCompletionObject( myCompletion );
KAccel *accel = new KAccel( this );
accel->insert( KStdAccel::Open, this, SLOT( slotOpenDialog() ));
accel->readSettings();
*/
}
diff --git a/microkde/kio/kfile/kurlrequester.h b/microkde/kio/kfile/kurlrequester.h
index faa3326..5d4fa11 100644
--- a/microkde/kio/kfile/kurlrequester.h
+++ b/microkde/kio/kfile/kurlrequester.h
@@ -1,80 +1,80 @@
/* This file is part of the KDE libraries
Copyright (C) 1999,2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KURLREQUESTER_H
#define KURLREQUESTER_H
-#include <qhbox.h>
+#include <q3hbox.h>
#include <keditlistbox.h>
//US #include <kfile.h>
//US #include <kpushbutton.h>
#include <kurl.h>
//US class KComboBox;
class KFileDialog;
class KLineEdit;
//US class KURLCompletion;
class KURLDragPushButton;
class QPushButton;
class QString;
class QTimer;
/**
* This class is a widget showing a lineedit and a button, which invokes a
* filedialog. File name completion is available in the lineedit.
*
* The defaults for the filedialog are to ask for one existing local file, i.e.
* KFileDialog::setMode( KFile::File | KFile::ExistingOnly | KFile::LocalOnly )
* The default filter is "*", i.e. show all files, and the start directory is
* the current working directory, or the last directory where a file has been
* selected.
*
* You can change this behavior by using @ref setMode() or @ref setFilter().
*
* @short A widget to request a filename/url from the user
* @author Carsten Pfeiffer <pfeiffer@kde.org>
*/
-class KURLRequester : public QHBox
+class KURLRequester : public Q3HBox
{
Q_OBJECT
Q_PROPERTY( QString url READ url WRITE setURL )
public:
/**
* Constructs a KURLRequester widget.
*/
KURLRequester( QWidget *parent=0, const char *name=0 );
/**
* Constructs a KURLRequester widget with the initial URL @p url.
*/
KURLRequester( const QString& url, QWidget *parent=0, const char *name=0 );
/**
* Special constructor, which creates a KURLRequester widget with a custom
* edit-widget. The edit-widget can be either a KComboBox or a KLineEdit
* (or inherited thereof). Note: for geometry management reasons, the
* edit-widget is reparented to have the KURLRequester as parent.
* @param modal specifies whether the filedialog should be opened as modal
* or not.
*/
//US KURLRequester( QWidget *editWidget, QWidget *parent, const char *name=0 );
diff --git a/microkde/kio/kio/kdirwatch.cpp b/microkde/kio/kio/kdirwatch.cpp
index 1596d1f..5f07c54 100644
--- a/microkde/kio/kio/kdirwatch.cpp
+++ b/microkde/kio/kio/kdirwatch.cpp
@@ -31,53 +31,55 @@ $Id$
// Jan 28, 2000 - Usage of FAM service on IRIX (Josef.Weidendorfer@in.tum.de)
// May 24. 1998 - List of times introduced, and some bugs are fixed. (sven)
// May 23. 1998 - Removed static pointer - you can have more instances.
// It was Needed for KRegistry. KDirWatch now emits signals and doesn't
// call (or need) KFM. No more URL's - just plain paths. (sven)
// Mar 29. 1998 - added docs, stop/restart for particular Dirs and
// deep copies for list of dirs. (sven)
// Mar 28. 1998 - Created. (sven)
//US #include <config.h>
#ifdef HAVE_DNOTIFY
#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#endif
#include <sys/stat.h>
#include <assert.h>
#include <qdir.h>
#include <qfile.h>
-#include <qintdict.h>
-#include <qptrlist.h>
+#include <q3intdict.h>
+#include <q3ptrlist.h>
#include <qsocketnotifier.h>
#include <qstringlist.h>
#include <qtimer.h>
+//Added by qt3to4:
+#include <Q3CString>
#include <kapplication.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kconfigbase.h>
#include <kglobal.h>
#include <kstaticdeleter.h>
#include "kdirwatch.h"
#include "kdirwatch_p.h"
//US #include "global.h" // KIO::probably_slow_mounted
#define NO_NOTIFY (time_t) 0
static KDirWatchPrivate* dwp_self = 0;
#ifdef HAVE_DNOTIFY
#include <sys/utsname.h>
static int dnotify_signal = 0;
/* DNOTIFY signal handler
*
@@ -163,49 +165,49 @@ void KDirWatchPrivate::dnotify_sigio_handler(int sig, siginfo_t *si, void *p)
* (IMON, sending change events to /dev/imon) and a user
* level damon (fam), to which applications connect for
* notification of file changes. For NFS, the fam damon
* on the NFS server machine is used; if IMON is not built
* into the kernel, fam uses polling for local files.
* - DNOTIFY: In late LINUX 2.3.x, directory notification was
* introduced. By opening a directory, you can request for
* UNIX signals to be sent to the process when a directory
* is changed.
*/
KDirWatchPrivate::KDirWatchPrivate()
{
timer = new QTimer(this);
connect (timer, SIGNAL(timeout()), this, SLOT(slotRescan()));
freq = 3600000; // 1 hour as upper bound
statEntries = 0;
delayRemove = false;
m_ref = 0;
//US KConfigGroup config(KGlobal::config(), QCString("DirWatch"));
//US m_nfsPollInterval = config.readNumEntry("NFSPollInterval", 5000);
//US m_PollInterval = config.readNumEntry("PollInterval", 500);
KConfig *config = KGlobal::config();
- KConfigGroupSaver saver( config, QCString("DirWatch") );
+ KConfigGroupSaver saver( config, Q3CString("DirWatch") );
m_nfsPollInterval = config->readNumEntry("NFSPollInterval", 5000);
m_PollInterval = config->readNumEntry("PollInterval", 500);
QString available("Stat");
#ifdef HAVE_FAM
// It's possible that FAM server can't be started
if (FAMOpen(&fc) ==0) {
available += ", FAM";
use_fam=true;
sn = new QSocketNotifier( FAMCONNECTION_GETFD(&fc),
QSocketNotifier::Read, this);
connect( sn, SIGNAL(activated(int)),
this, SLOT(famEventReceived()) );
}
else {
kdDebug(7001) << "Can't use FAM (fam daemon not running?)" << endl;
use_fam=false;
}
#endif
#ifdef HAVE_DNOTIFY
@@ -710,49 +712,49 @@ void KDirWatchPrivate::removeEntry( KDirWatch* instance,
}
#endif
if (e->m_mode == StatMode) {
statEntries--;
if ( statEntries == 0 ) {
timer->stop(); // stop timer if lists are empty
kdDebug(7001) << " Stopped Polling Timer" << endl;
}
}
kdDebug(7001) << "Removed " << (e->isDir ? "Dir ":"File ") << e->path
<< (sub_entry ? QString(" for %1").arg(sub_entry->path) : QString(""))
<< (instance ? QString(" [%1]").arg(instance->name()) : QString(""))
<< endl;
m_mapEntries.remove( e->path ); // <e> not valid any more
}
/* Called from KDirWatch destructor:
* remove <instance> as client from all entries
*/
void KDirWatchPrivate::removeEntries( KDirWatch* instance )
{
- QPtrList<Entry> list;
+ Q3PtrList<Entry> list;
int minfreq = 3600000;
// put all entries where instance is a client in list
EntryMap::Iterator it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it ) {
Client* c = (*it).m_clients.first();
for(;c;c=(*it).m_clients.next())
if (c->instance == instance) break;
if (c) {
c->count = 1; // forces deletion of instance as client
list.append(&(*it));
}
else if ( (*it).m_mode == StatMode && (*it).freq < minfreq )
minfreq = (*it).freq;
}
for(Entry* e=list.first();e;e=list.next())
removeEntry(instance, e->path, 0);
if (minfreq > freq) {
// we can decrease the global polling frequency
freq = minfreq;
if (timer->isActive()) timer->changeInterval(freq);
kdDebug(7001) << "Poll Freq now " << freq << " msec" << endl;
@@ -986,49 +988,49 @@ void KDirWatchPrivate::slotRemoveDelayed()
for(e=removeList.first();e;e=removeList.next())
removeEntry(0, e->path, 0);
removeList.clear();
}
/* Scan all entries to be watched for changes. This is done regularly
* when polling and once after a DNOTIFY signal. This is NOT used by FAM.
*/
void KDirWatchPrivate::slotRescan()
{
EntryMap::Iterator it;
// People can do very long things in the slot connected to dirty(),
// like showing a message box. We don't want to keep polling during
// that time, otherwise the value of 'delayRemove' will be reset.
bool timerRunning = timer->isActive();
if ( timerRunning )
timer->stop();
// We delay deletions of entries this way.
// removeDir(), when called in slotDirty(), can cause a crash otherwise
delayRemove = true;
#ifdef HAVE_DNOTIFY
- QPtrList<Entry> dList, cList;
+ Q3PtrList<Entry> dList, cList;
// for DNotify method,
if (rescan_all)
{
// mark all as dirty
it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it )
(*it).dn_dirty = true;
rescan_all = false;
}
else
{
// progate dirty flag to dependant entries (e.g. file watches)
it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it )
if ( ((*it).m_mode == DNotifyMode) && (*it).dn_dirty )
(*it).propagate_dirty();
}
#endif
it = m_mapEntries.begin();
for( ; it != m_mapEntries.end(); ++it ) {
// we don't check invalid entries (i.e. remove delayed)
diff --git a/microkde/kio/kio/kdirwatch_p.h b/microkde/kio/kio/kdirwatch_p.h
index 0ab482f..be74f2a 100644
--- a/microkde/kio/kio/kdirwatch_p.h
+++ b/microkde/kio/kio/kdirwatch_p.h
@@ -1,87 +1,87 @@
/* Private Header for class of KDirWatchPrivate
*
* this separate header file is needed for MOC processing
* because KDirWatchPrivate has signals and slots
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef _KDIRWATCH_P_H
#define _KDIRWATCH_P_H
#ifdef HAVE_FAM
#include <fam.h>
#endif
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <kdirwatch.h>
#include <ctime>
#define invalid_ctime ((time_t)-1)
/* KDirWatchPrivate is a singleton and does the watching
* for every KDirWatch instance in the application.
*/
class KDirWatchPrivate : public QObject
{
Q_OBJECT
public:
enum entryStatus { Normal = 0, NonExistent };
enum entryMode { UnknownMode = 0, StatMode, DNotifyMode, FAMMode };
enum { NoChange=0, Changed=1, Created=2, Deleted=4 };
struct Client {
KDirWatch* instance;
int count;
// did the instance stop watching
bool watchingStopped;
// events blocked when stopped
int pending;
};
class Entry
{
public:
// the last observed modification time
time_t m_ctime;
// the last observed link count
int m_nlink;
entryStatus m_status;
entryMode m_mode;
bool isDir;
// instances interested in events
- QPtrList<Client> m_clients;
+ Q3PtrList<Client> m_clients;
// nonexistent entries of this directory
- QPtrList<Entry> m_entries;
+ Q3PtrList<Entry> m_entries;
QString path;
int msecLeft, freq;
void addClient(KDirWatch*);
void removeClient(KDirWatch*);
int clients();
bool isValid() { return m_clients.count() || m_entries.count(); }
#ifdef HAVE_FAM
FAMRequest fr;
#endif
#ifdef HAVE_DNOTIFY
int dn_fd;
bool dn_dirty;
void propagate_dirty();
#endif
};
typedef QMap<QString,Entry> EntryMap;
KDirWatchPrivate();
~KDirWatchPrivate();
@@ -103,51 +103,51 @@ public:
void emitEvent(Entry* e, int event, const QString &fileName = QString::null);
// Memory management - delete when last KDirWatch gets deleted
void ref() { m_ref++; }
bool deref() { return ( --m_ref == 0 ); }
public slots:
void slotRescan();
void famEventReceived(); // for FAM
void slotActivated(); // for DNOTIFY
void slotRemoveDelayed();
public:
QTimer *timer;
EntryMap m_mapEntries;
private:
int freq;
int statEntries;
int m_nfsPollInterval, m_PollInterval;
int m_ref;
bool useStat(Entry*);
bool delayRemove;
- QPtrList<Entry> removeList;
+ Q3PtrList<Entry> removeList;
#ifdef HAVE_FAM
QSocketNotifier *sn;
FAMConnection fc;
bool use_fam;
void checkFAMEvent(FAMEvent*);
bool useFAM(Entry*);
#endif
#ifdef HAVE_DNOTIFY
bool supports_dnotify;
bool rescan_all;
int mPipe[2];
QTimer mTimer;
QSocketNotifier *mSn;
- QIntDict<Entry> fd_Entry;
+ Q3IntDict<Entry> fd_Entry;
static void dnotify_handler(int, siginfo_t *si, void *);
static void dnotify_sigio_handler(int, siginfo_t *si, void *);
bool useDNotify(Entry*);
#endif
};
#endif // KDIRWATCH_P_H
diff --git a/microkde/klineedit.h b/microkde/klineedit.h
index 70c72d1..9eb749d 100644
--- a/microkde/klineedit.h
+++ b/microkde/klineedit.h
@@ -1,28 +1,30 @@
#ifndef MINIKDE_KLINEEDIT_H
#define MINIKDE_KLINEEDIT_H
#include <qlineedit.h>
+//Added by qt3to4:
+#include <QKeyEvent>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
#endif
class KLineEdit : public QLineEdit
{
Q_OBJECT
public:
KLineEdit( QWidget *parent=0, const char *name=0 ) :
QLineEdit( parent, name )
{
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
}
void keyPressEvent ( QKeyEvent * e)
{
switch ( e->key() ) {
case Qt::Key_Down:
emit scrollDOWN();
diff --git a/microkde/klineeditdlg.h b/microkde/klineeditdlg.h
index 68e9252..d0004cd 100644
--- a/microkde/klineeditdlg.h
+++ b/microkde/klineeditdlg.h
@@ -1,34 +1,36 @@
#ifndef MICROKDE_KLINEEDITDLG_H
#define MICROKDE_KLINEEDITDLG_H
#include "kdialogbase.h"
#include <klineedit.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qpushbutton.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
class KLineEditDlg : public QDialog
{
public:
KLineEditDlg( const QString & text, const QString & editText, QWidget *parent ) :
QDialog( parent,"lineedit", true ) {
QLabel* lab = new QLabel( text, this );
mEdit = new KLineEdit( this );
- QVBoxLayout* vl = new QVBoxLayout( this );
+ Q3VBoxLayout* vl = new Q3VBoxLayout( this );
vl->setSpacing(5);
vl->setMargin(7);
vl->addWidget( lab );
vl->addWidget( mEdit );
mEdit->setText( editText );
QPushButton * p = new QPushButton (" OK ", this );
vl->addWidget( p );
connect( p, SIGNAL ( clicked () ), this , SLOT (accept() ) );
}
QString text() { return mEdit->text(); }
private:
KLineEdit* mEdit;
};
#endif
diff --git a/microkde/kresources/configdialog.cpp b/microkde/kresources/configdialog.cpp
index 55253c0..4820faf 100644
--- a/microkde/kresources/configdialog.cpp
+++ b/microkde/kresources/configdialog.cpp
@@ -4,106 +4,109 @@
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <klocale.h>
#include <kglobal.h>
#include <kmessagebox.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
-#include <qvbox.h>
+#include <q3vbox.h>
#include <qcheckbox.h>
-#include <qscrollview.h>
+#include <q3scrollview.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
#include <kbuttonbox.h>
#include <kdialog.h>
#include <klineedit.h>
#include "factory.h"
#include "configwidget.h"
#include "configdialog.h"
using namespace KRES;
ConfigDialog::ConfigDialog( QWidget *parent, const QString& resourceFamily,
Resource* resource, const char *name )
: KDialogBase( parent, name, true, i18n( "Resource Configuration" ),
Ok|Cancel, Ok, true )/*, mConfig( config )*/, mResource( resource ), mPersistentReadOnly(false)
{
Factory *factory = Factory::self( resourceFamily );
//US resize( 250, 240 );
resize( KMIN(KGlobal::getDesktopWidth(), 250), KMIN(KGlobal::getDesktopHeight(), 240));
- QFrame *main;
+ Q3Frame *main;
main = plainPage();
- QVBoxLayout *mainLayout = new QVBoxLayout( main, 0, spacingHint() );
+ Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main, 0, spacingHint() );
- QGroupBox *generalGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
+ Q3GroupBox *generalGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main );
generalGroupBox->layout()->setSpacing( spacingHint() );
generalGroupBox->setTitle( i18n( "General Settings" ) );
new QLabel( i18n( "Name:" ), generalGroupBox );
mName = new KLineEdit( generalGroupBox );
new QLabel("", generalGroupBox );
mReadOnly = new QCheckBox( i18n( "Read-only" ), generalGroupBox );
mReadOnly->setChecked( mResource->readOnly() );
new QLabel("", generalGroupBox );
mIncludeInSync = new QCheckBox( i18n( "Include in sync" ), generalGroupBox );
mIncludeInSync->setChecked( mResource->includeInSync() );
mName->setText( mResource->resourceName() );
mainLayout->addWidget( generalGroupBox );
- QGroupBox *resourceGroupBox = new QGroupBox( 2, Qt::Horizontal, main );
+ Q3GroupBox *resourceGroupBox = new Q3GroupBox( 2, Qt::Horizontal, main );
resourceGroupBox->layout()->setSpacing( spacingHint());
resourceGroupBox->setTitle( i18n( "%1 Resource Settings" )
.arg( factory->typeName( resource->type() ) ) );
mainLayout->addWidget( resourceGroupBox );
mainLayout->addStretch();
mConfigWidget = factory->configWidget( resource->type(), resourceGroupBox );
if ( mConfigWidget ) {
connect( mConfigWidget, SIGNAL( setReadOnly( bool ) ),
SLOT( setReadOnly( bool ) ) );
connect( mConfigWidget, SIGNAL( setIncludeInSync( bool ) ),
SLOT( setIncludeInSync( bool ) ) );
connect( mConfigWidget, SIGNAL( setPersistentReadOnly( bool ) ),
SLOT( setPersistentReadOnly( bool ) ) );
mConfigWidget->setInEditMode( false );
mConfigWidget->loadSettings( mResource );
mConfigWidget->show();
}
connect( mName, SIGNAL( textChanged(const QString &)),
SLOT( slotNameChanged(const QString &)));
diff --git a/microkde/kresources/configpage.cpp b/microkde/kresources/configpage.cpp
index fc7a42e..1a9d063 100644
--- a/microkde/kresources/configpage.cpp
+++ b/microkde/kresources/configpage.cpp
@@ -7,180 +7,184 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
-#include <qgroupbox.h>
+#include <q3groupbox.h>
#ifdef DESKTOP_VERSION
#include <qinputdialog.h>
#else
#include <qtcompat/qinputdialog.h>
#endif
#include <qlabel.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3GridLayout>
+#include <Q3ValueList>
+#include <Q3VBoxLayout>
#include <kapplication.h>
#include <kcombobox.h>
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kurlrequester.h>
#include <klistview.h>
#include <kbuttonbox.h>
//US #include <ktrader.h>
#include "resource.h"
#include "configdialog.h"
#include "configpage.h"
//US
#include <qpushbutton.h>
#include <qfile.h>
#include <kglobal.h>
using namespace KRES;
-class ConfigViewItem : public QCheckListItem
+class ConfigViewItem : public Q3CheckListItem
{
public:
- ConfigViewItem( QListView *parent, Resource* resource ) :
- QCheckListItem( parent, resource->resourceName(), CheckBox ),
+ ConfigViewItem( Q3ListView *parent, Resource* resource ) :
+ Q3CheckListItem( parent, resource->resourceName(), CheckBox ),
mResource( resource ),
mIsStandard( false )
{
setText( 1, mResource->type() );
setOn( mResource->isActive() );
}
void setStandard( bool value )
{
setText( 2, ( value ? i18n( "Yes" ) : QString::null ) );
mIsStandard = value;
}
bool standard() const { return mIsStandard; }
bool readOnly() const { return mResource->readOnly(); }
Resource *resource() { return mResource; }
private:
Resource* mResource;
bool mIsStandard;
};
ConfigPage::ConfigPage( QWidget *parent, const char *name )
: QWidget( parent, name ),
mCurrentManager( 0 ),
mCurrentConfig( 0 )
{
setCaption( i18n( "Resource Configuration" ) );
- QVBoxLayout *mainLayout = new QVBoxLayout( this );
+ Q3VBoxLayout *mainLayout = new Q3VBoxLayout( this );
- QGroupBox *groupBox = new QGroupBox( i18n( "Resources" ), this );
+ Q3GroupBox *groupBox = new Q3GroupBox( i18n( "Resources" ), this );
groupBox->setColumnLayout(0, Qt::Vertical );
groupBox->layout()->setSpacing( 3 );
groupBox->layout()->setMargin( 5 );
- QGridLayout *groupBoxLayout = new QGridLayout( groupBox->layout(), 4, 2 );
+ Q3GridLayout *groupBoxLayout = new Q3GridLayout( groupBox->layout(), 4, 2 );
//US mFamilyCombo = new KComboBox( false, groupBox );
mFamilyCombo = new KComboBox( groupBox );
groupBoxLayout->addMultiCellWidget( mFamilyCombo, 0, 0, 0, 1 );
mListView = new KListView( groupBox );
mListView->setAllColumnsShowFocus( true );
mListView->addColumn( i18n( "Name" ) );
mListView->addColumn( i18n( "Type" ) );
mListView->addColumn( i18n( "Standard" ) );
//US groupBoxLayout->addWidget( mListView, 1, 0 );
groupBoxLayout->addMultiCellWidget( mListView, 1, 1, 0, 1 );
mAddButton = new QPushButton( i18n( "&Add..." ), groupBox );
groupBoxLayout->addWidget( mAddButton, 2, 0 );
mRemoveButton = new QPushButton( i18n( "&Remove" ), groupBox );
groupBoxLayout->addWidget( mRemoveButton, 2, 1 );
mEditButton = new QPushButton( i18n( "&Edit..." ), groupBox );
groupBoxLayout->addWidget( mEditButton, 3, 0 );
mStandardButton = new QPushButton( i18n( "&Use as Standard" ), groupBox );
groupBoxLayout->addWidget( mStandardButton, 3, 1 );
mRemoveButton->setEnabled( false );
mEditButton->setEnabled( false );
mStandardButton->setEnabled( false );
connect( mAddButton, SIGNAL( clicked() ), SLOT(slotAdd()) );
connect( mRemoveButton, SIGNAL( clicked() ), SLOT(slotRemove()) );
connect( mEditButton, SIGNAL( clicked() ), SLOT(slotEdit()) );
connect( mStandardButton, SIGNAL( clicked() ), SLOT(slotStandard()) );
mainLayout->addWidget( groupBox );
connect( mFamilyCombo, SIGNAL( activated( int ) ),
SLOT( slotFamilyChanged( int ) ) );
connect( mListView, SIGNAL( selectionChanged() ),
SLOT( slotSelectionChanged() ) );
- connect( mListView, SIGNAL( clicked( QListViewItem * ) ),
- SLOT( slotItemClicked( QListViewItem * ) ) );
+ connect( mListView, SIGNAL( clicked( Q3ListViewItem * ) ),
+ SLOT( slotItemClicked( Q3ListViewItem * ) ) );
mLastItem = 0;
//US mConfig = new KConfig( "kcmkresourcesrc" );
mConfig = new KConfig( locateLocal( "config", "kcmkresourcesrc") );
mConfig->setGroup( "General" );
load();
}
ConfigPage::~ConfigPage()
{
- QValueList<ResourcePageInfo>::Iterator it;
+ Q3ValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it ) {
(*it).mManager->removeListener( this );
delete (*it).mManager;
delete (*it).mConfig;
}
mConfig->writeEntry( "CurrentFamily", mFamilyCombo->currentItem() );
delete mConfig;
mConfig = 0;
}
void ConfigPage::load()
{
kdDebug(5650) << "ConfigPage::load()" << endl;
mListView->clear();
//US we remove the dynamic pluginloader, and set the one family we need (contact) manually.
//US KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin" );
//US KTrader::OfferList::ConstIterator it;
//US for ( it = plugins.begin(); it != plugins.end(); ++it ) {
//US QVariant tmp = (*it)->property( "X-KDE-ResourceFamily" );
//US QString family = tmp.toString();
@@ -209,49 +213,49 @@ void ConfigPage::load()
} else {
QString configFile = locateLocal( "config", QString( "kresources/%1/stdrc" ).arg( family ) );
info.mConfig = new KConfig( configFile );
}
info.mManager->readConfig( info.mConfig );
mInfoMap.append( info );
}
}
}
}
mCurrentManager = 0;
mFamilyCombo->insertStringList( mFamilyMap );
int currentFamily = mConfig->readNumEntry( "CurrentFamily", 0 );
mFamilyCombo->setCurrentItem( currentFamily );
slotFamilyChanged( currentFamily );
}
void ConfigPage::save()
{
saveResourceSettings();
- QValueList<ResourcePageInfo>::Iterator it;
+ Q3ValueList<ResourcePageInfo>::Iterator it;
for ( it = mInfoMap.begin(); it != mInfoMap.end(); ++it )
(*it).mManager->writeConfig( (*it).mConfig );
emit changed( false );
}
void ConfigPage::defaults()
{
}
void ConfigPage::slotFamilyChanged( int pos )
{
if ( pos < 0 || pos >= (int)mFamilyMap.count() )
return;
saveResourceSettings();
mFamily = mFamilyMap[ pos ];
//US qDebug("ConfigPage::slotFamilyChanged 4 family=%s", mFamily.latin1());
mCurrentManager = mInfoMap[ pos ].mManager;
mCurrentConfig = mInfoMap[ pos ].mConfig;
@@ -320,212 +324,212 @@ void ConfigPage::slotAdd()
// Create new resource
Resource *resource = mCurrentManager->createResource( type );
if ( !resource ) {
KMessageBox::error( this, i18n("Unable to create resource of type '%1'.")
.arg( type ) );
return;
}
resource->setResourceName( type + "-resource" );
ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" );
if ( dlg.exec() ) {
mCurrentManager->add( resource );
ConfigViewItem *item = new ConfigViewItem( mListView, resource );
mLastItem = item;
// if there are only read-only resources we'll set this resource
// as standard resource
if ( !resource->readOnly() ) {
bool onlyReadOnly = true;
- QListViewItem *it = mListView->firstChild();
+ Q3ListViewItem *it = mListView->firstChild();
while ( it != 0 ) {
ConfigViewItem *confIt = static_cast<ConfigViewItem*>( it );
if ( !confIt->readOnly() && confIt != item )
onlyReadOnly = false;
it = it->itemBelow();
}
if ( onlyReadOnly )
item->setStandard( true );
}
emit changed( true );
} else {
delete resource;
resource = 0;
}
}
void ConfigPage::slotRemove()
{
if ( !mCurrentManager )
return;
- QListViewItem *item = mListView->currentItem();
+ Q3ListViewItem *item = mListView->currentItem();
ConfigViewItem *confItem = static_cast<ConfigViewItem*>( item );
if ( !confItem )
return;
if ( confItem->standard() ) {
KMessageBox::sorry( this, i18n( "You cannot remove your standard resource!\n Please select a new standard resource first." ) );
return;
}
mCurrentManager->remove( confItem->resource() );
if ( item == mLastItem )
mLastItem = 0;
mListView->takeItem( item );
delete item;
emit changed( true );
}
void ConfigPage::slotEdit()
{
if ( !mCurrentManager )
return;
- QListViewItem *item = mListView->currentItem();
+ Q3ListViewItem *item = mListView->currentItem();
ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item );
if ( !configItem )
return;
Resource *resource = configItem->resource();
ConfigDialog dlg( this, mFamily, resource, "KRES::ConfigDialog" );
if ( dlg.exec() ) {
configItem->setText( 0, resource->resourceName() );
configItem->setText( 1, resource->type() );
if ( configItem->standard() && configItem->readOnly() ) {
KMessageBox::sorry( this, i18n( "You cannot use a read-only<br> resource as standard!" ) );
configItem->setStandard( false );
}
mCurrentManager->resourceChanged( resource );
emit changed( true );
}
}
void ConfigPage::slotStandard()
{
if ( !mCurrentManager )
return;
ConfigViewItem *item = static_cast<ConfigViewItem*>( mListView->currentItem() );
if ( !item )
return;
if ( item->readOnly() ) {
KMessageBox::sorry( this, i18n( "You cannot use a read-only<br>resource as standard!" ) );
return;
}
if ( !item->isOn() ) {
KMessageBox::sorry( this, i18n( "You cannot use an inactive<br>resource as standard!" ) );
return;
}
- QListViewItem *it = mListView->firstChild();
+ Q3ListViewItem *it = mListView->firstChild();
while ( it != 0 ) {
ConfigViewItem *configItem = static_cast<ConfigViewItem*>( it );
if ( configItem->standard() )
configItem->setStandard( false );
it = it->itemBelow();
}
item->setStandard( true );
mCurrentManager->setStandardResource( item->resource() );
emit changed( true );
}
void ConfigPage::slotSelectionChanged()
{
bool state = ( mListView->currentItem() != 0 );
mRemoveButton->setEnabled( state );
mEditButton->setEnabled( state );
mStandardButton->setEnabled( state );
}
void ConfigPage::resourceAdded( Resource* resource )
{
qDebug("ConfigPage::resourceAdded : %s", resource->resourceName().latin1());
ConfigViewItem *item = new ConfigViewItem( mListView, resource );
// FIXME: this sucks. This should be in the config file,
// or application-dependent, in which case it's always Off
item->setOn( false );
mLastItem = item;
emit changed( true );
}
void ConfigPage::resourceModified( Resource* resource )
{
qDebug("ConfigPage::resourceModified : %s", resource->resourceName().latin1());
}
void ConfigPage::resourceDeleted( Resource* resource )
{
qDebug("ConfigPage::resourceDeleted : %s", resource->resourceName().latin1());
}
-void ConfigPage::slotItemClicked( QListViewItem *item )
+void ConfigPage::slotItemClicked( Q3ListViewItem *item )
{
ConfigViewItem *configItem = static_cast<ConfigViewItem *>( item );
if ( !configItem ) return;
if ( configItem->standard() && !configItem->isOn() ) {
KMessageBox::sorry( this, i18n( "You cannot deactivate the<br>standard resource. Choose<br>another standard resource first." ) );
configItem->setOn( true );
return;
}
if ( configItem->isOn() != configItem->resource()->isActive() ) {
emit changed( true );
}
}
void ConfigPage::saveResourceSettings()
{
//qDebug("ConfigPage::saveResourceSettings() begin");
if ( mCurrentManager ) {
- QListViewItem *item = mListView->firstChild();
+ Q3ListViewItem *item = mListView->firstChild();
while ( item ) {
ConfigViewItem *configItem = static_cast<ConfigViewItem*>( item );
// check if standard resource
if ( configItem->standard() && !configItem->readOnly() &&
configItem->isOn() ) {
mCurrentManager->setStandardResource( configItem->resource() );
}
// check if active or passive resource
configItem->resource()->setActive( configItem->isOn() );
item = item->nextSibling();
}
mCurrentManager->writeConfig( mCurrentConfig );
if ( !mCurrentManager->standardResource() )
KMessageBox::sorry( this, i18n( "There is no valid standard resource!<br>Please select one which is neither read-only nor inactive." ) );
}
//qDebug("ConfigPage::saveResourceSettings() end");
}
diff --git a/microkde/kresources/configpage.h b/microkde/kresources/configpage.h
index be9239e..dc1aa50 100644
--- a/microkde/kresources/configpage.h
+++ b/microkde/kresources/configpage.h
@@ -4,101 +4,103 @@
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_CONFIGPAGE_H
#define KRESOURCES_CONFIGPAGE_H
#include <qstringlist.h>
#include <qwidget.h>
+//Added by qt3to4:
+#include <Q3ValueList>
#include "manager.h"
class KComboBox;
class KListView;
-class QListViewItem;
+class Q3ListViewItem;
class QPushButton;
namespace KRES {
class ResourcePageInfo
{
public:
Manager<Resource> *mManager;
KConfig *mConfig;
};
class Resource;
class ConfigPage : public QWidget, public ManagerListener<Resource>
{
Q_OBJECT
public:
ConfigPage( QWidget *parent = 0, const char *name = 0 );
virtual ~ConfigPage();
void load();
void save();
virtual void defaults();
public slots:
void slotFamilyChanged( int );
void slotAdd();
void slotRemove();
void slotEdit();
void slotStandard();
void slotSelectionChanged();
// From ManagerListener<Resource>
public:
virtual void resourceAdded( Resource* resource );
virtual void resourceModified( Resource* resource );
virtual void resourceDeleted( Resource* resource );
protected slots:
- void slotItemClicked( QListViewItem * );
+ void slotItemClicked( Q3ListViewItem * );
signals:
void changed( bool );
private:
void saveResourceSettings();
Manager<Resource>* mCurrentManager;
KConfig* mCurrentConfig;
KConfig* mConfig;
QString mFamily;
QStringList mFamilyMap;
- QValueList<ResourcePageInfo> mInfoMap;
+ Q3ValueList<ResourcePageInfo> mInfoMap;
KComboBox* mFamilyCombo;
KListView* mListView;
QPushButton* mAddButton;
QPushButton* mRemoveButton;
QPushButton* mEditButton;
QPushButton* mStandardButton;
- QListViewItem* mLastItem;
+ Q3ListViewItem* mLastItem;
static const QString syncfamily;
};
}
#endif
diff --git a/microkde/kresources/factory.cpp b/microkde/kresources/factory.cpp
index 86b22b2..4f286d1 100644
--- a/microkde/kresources/factory.cpp
+++ b/microkde/kresources/factory.cpp
@@ -20,59 +20,59 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <kdebug.h>
#include <klocale.h>
#include <ksimpleconfig.h>
#include <kstandarddirs.h>
#include <kstaticdeleter.h>
//#ifndef DESKTOP_VERSION
#include <klibloader.h>
//#endif
#include <qfile.h>
#include "resource.h"
#include "factory.h"
#ifdef STATIC_RESOURCES
#include <file/resourcefile.h>
#include <dir/resourcedir.h>
#include <qtopia/resourceqtopia.h>
#endif
using namespace KRES;
-QDict<Factory> *Factory::mSelves = 0;
-static KStaticDeleter< QDict<Factory> > staticDeleter;
+Q3Dict<Factory> *Factory::mSelves = 0;
+static KStaticDeleter< Q3Dict<Factory> > staticDeleter;
Factory *Factory::self( const QString& resourceFamily)
{
Factory *factory = 0;
if ( !mSelves )
{
- mSelves = staticDeleter.setObject( new QDict<Factory> );
+ mSelves = staticDeleter.setObject( new Q3Dict<Factory> );
}
factory = mSelves->find( resourceFamily );
if ( !factory ) {
factory = new Factory( resourceFamily);
mSelves->insert( resourceFamily, factory );
}
return factory;
}
Factory::Factory( const QString& resourceFamily) :
mResourceFamily( resourceFamily )
{
//US so far we have three types available for resourceFamily "contact"
// and that are "file", "dir", "ldap"
/*US
KTrader::OfferList plugins = KTrader::self()->query( "KResources/Plugin", QString( "[X-KDE-ResourceFamily] == '%1'" )
.arg( resourceFamily ) );
KTrader::OfferList::ConstIterator it;
for ( it = plugins.begin(); it != plugins.end(); ++it ) {
QVariant type = (*it)->property( "X-KDE-ResourceType" );
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
index ea01b23..709fde0 100644
--- a/microkde/kresources/factory.h
+++ b/microkde/kresources/factory.h
@@ -3,49 +3,49 @@
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_FACTORY_H
#define KRESOURCES_FACTORY_H
-#include <qdict.h>
+#include <q3dict.h>
#include <qstring.h>
#include <kconfig.h>
#include "resource.h"
namespace KRES {
class ConfigWidget;
//US
struct PluginInfo
{
QString library;
QString nameLabel;
QString descriptionLabel;
};
/**
* Class for loading resource plugins.
* Do not use this class directly. Use ResourceManager instead
*
@@ -93,34 +93,34 @@ class Factory
* @param ab The address book, the resource should belong to
* @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
*/
Resource *resource( const QString& type, const KConfig *config);
/**
* Returns a list of all available resource types.
*/
QStringList typeNames() const;
/**
* Returns the name for a special type.
*/
QString typeName( const QString &type ) const;
/**
* Returns the description for a special type.
*/
QString typeDescription( const QString &type ) const;
protected:
Factory( const QString& resourceFamily);
private:
- static QDict<Factory> *mSelves;
+ static Q3Dict<Factory> *mSelves;
QString mResourceFamily;
//US QMap<QString, KService::Ptr> mTypeMap;
//US lets store the pluginfo struct as value instead of a KService
QMap<QString, PluginInfo*> mTypeMap;
};
}
#endif
diff --git a/microkde/kresources/kcmkresources.cpp b/microkde/kresources/kcmkresources.cpp
index d600a31..f5eb826 100644
--- a/microkde/kresources/kcmkresources.cpp
+++ b/microkde/kresources/kcmkresources.cpp
@@ -1,69 +1,72 @@
/*
This file is part of libkresources.
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
//US #include <kaboutdata.h>
//US #include <kgenericfactory.h>
#include <klocale.h>
#include "configpage.h"
#include "kcmkresources.h"
using namespace KRES;
//US typedef KGenericFactory<KCMKResources, QWidget> ResourcesFactory;
//US K_EXPORT_COMPONENT_FACTORY( kcm_kresources, ResourcesFactory( "kcmkresources" ) );
//US KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& )
//US : KCModule( ResourcesFactory::instance(), parent, name )
KCMKResources::KCMKResources( QWidget *parent, const char *name, const QStringList& )
: KDialogBase( parent, name, true, i18n( "Configure Resources" ),
Ok|Cancel, Ok, true )
{
- QFrame *main = plainPage();
+ Q3Frame *main = plainPage();
- QVBoxLayout *layout = new QVBoxLayout( main );
+ Q3VBoxLayout *layout = new Q3VBoxLayout( main );
mConfigPage = new KRES::ConfigPage( main );
layout->addWidget( mConfigPage );
connect( mConfigPage, SIGNAL( changed( bool ) ), SLOT( changed( bool ) ) );
#ifndef DESKTOP_VERSION
showMaximized();
#endif
}
void KCMKResources::changed( bool changed)
{
modified = changed;
}
void KCMKResources::slotOk()
{
if (modified) {
mConfigPage->save();
modified = false;
}
KDialogBase::slotOk();
}
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h
index 69062da..88705d4 100644
--- a/microkde/kresources/manager.h
+++ b/microkde/kresources/manager.h
@@ -11,50 +11,52 @@
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KRESOURCES_MANAGER_H
#define KRESOURCES_MANAGER_H
-#include <qdict.h>
+#include <q3dict.h>
#include <qstringlist.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "factory.h"
#include "managerimpl.h"
namespace KRES {
class Resource;
template<class T>
class ManagerListener
{
public:
virtual void resourceAdded( T *resource ) = 0;
virtual void resourceModified( T *resource ) = 0;
virtual void resourceDeleted( T *resource ) = 0;
};
// TODO:
// The resource manager should provide some signals
// to warn applications that resources have been added,
// removed or modified.
//
// The manager should also keep track of which (or at least
// how many) applications hve opened a resource, so that it
@@ -154,49 +156,49 @@ class Manager : private ManagerImplListener
if ( it.mIt != mImpl->resourceList()->end() ) {
if ( !(*it)->isActive() ) it++;
}
return it;
}
ActiveIterator activeEnd()
{
ActiveIterator it;
it.mIt = mImpl->resourceList()->end();
it.mList = mImpl->resourceList();
return it;
}
bool isEmpty() const { return mImpl->resourceList()->isEmpty(); }
Manager( const QString &family )
{
mFactory = Factory::self( family );
// The managerimpl will use the same Factory object as the manager
// because of the Factory::self() pattern
mImpl = new ManagerImpl( family );
mImpl->setListener( this );
- mListeners = new QPtrList<ManagerListener<T> >;
+ mListeners = new Q3PtrList<ManagerListener<T> >;
}
virtual ~Manager()
{
mImpl->setListener( 0 );
delete mListeners;
delete mImpl;
}
/**
Recreate Resource objects from configuration file. If cfg is 0, read standard
configuration file.
*/
void readConfig( KConfig *cfg = 0 )
{
mImpl->readConfig( cfg );
}
/**
Write configuration of Resource objects to configuration file. If cfg is 0, write
to standard configuration file.
*/
void writeConfig( KConfig *cfg = 0 )
{
@@ -309,30 +311,30 @@ class Manager : private ManagerImplListener
}
virtual void resourceModified( Resource *res )
{
T* resource = (T *)( res );
ManagerListener<T> *listener;
for ( listener = mListeners->first(); listener; listener = mListeners->next() )
listener->resourceModified( resource );
}
virtual void resourceDeleted( Resource *res )
{
T* resource = (T *)( res );
ManagerListener<T> *listener;
for ( listener = mListeners->first(); listener; listener = mListeners->next() ) {
listener->resourceDeleted( resource );
}
}
private:
ManagerImpl *mImpl;
Factory *mFactory;
- QPtrList<ManagerListener<T> > *mListeners;
+ Q3PtrList<ManagerListener<T> > *mListeners;
};
}
#endif
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp
index a6d2007..4c0751c 100644
--- a/microkde/kresources/managerimpl.cpp
+++ b/microkde/kresources/managerimpl.cpp
@@ -14,48 +14,50 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <kglobal.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kconfig.h>
#include <kstandarddirs.h>
#include <qfile.h>
+//Added by qt3to4:
+#include <Q3PtrList>
#include "resource.h"
#include "factory.h"
#include "managerimpl.h"
using namespace KRES;
ManagerImpl::ManagerImpl( const QString &family )
: mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ),
mFactory( 0 )
{
kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl;
}
ManagerImpl::~ManagerImpl()
{
kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl;
Resource::List::ConstIterator it;
@@ -211,62 +213,62 @@ void ManagerImpl::resourceChanged( Resource *resource )
// ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() );
// allManagers.dcopResourceModified( resource->identifier() );
}
// DCOP asynchronous functions
//US since we work from inside the application, we call the methods directly.
QStringList ManagerImpl::resourceNames()
{
QStringList result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( (*it)->resourceName() );
}
return result;
}
Resource::List *ManagerImpl::resourceList()
{
return &mResources;
}
-QPtrList<Resource> ManagerImpl::resources()
+Q3PtrList<Resource> ManagerImpl::resources()
{
- QPtrList<Resource> result;
+ Q3PtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( *it );
}
return result;
}
-QPtrList<Resource> ManagerImpl::resources( bool active )
+Q3PtrList<Resource> ManagerImpl::resources( bool active )
{
- QPtrList<Resource> result;
+ Q3PtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
if ( (*it)->isActive() == active ) {
result.append( *it );
}
}
return result;
}
void ManagerImpl::setListener( ManagerImplListener *listener )
{
mListener = listener;
}
Resource* ManagerImpl::readResourceConfig( const QString& identifier,
bool checkActive )
{
kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl;
// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1());
mConfig->setGroup( "Resource_" + identifier );
#ifdef _WIN32_
diff --git a/microkde/kresources/managerimpl.h b/microkde/kresources/managerimpl.h
index 56a2db6..1f728e5 100644
--- a/microkde/kresources/managerimpl.h
+++ b/microkde/kresources/managerimpl.h
@@ -11,101 +11,101 @@
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#ifndef KRESOURCES_MANAGERIMPL_H
#define KRESOURCES_MANAGERIMPL_H
#include <qstring.h>
-#include <qptrlist.h>
-#include <qdict.h>
+#include <q3ptrlist.h>
+#include <q3dict.h>
//US
#include <qobject.h>
#include "resource.h"
class KConfig;
namespace KRES {
class Resource;
class Factory;
class ManagerImplListener
{
public:
virtual void resourceAdded( Resource *resource ) = 0;
virtual void resourceModified( Resource *resource ) = 0;
virtual void resourceDeleted( Resource *resource ) = 0;
};
/**
@internal
Do not use this class directly. Use ResourceManager instead
*/
class ManagerImpl : public QObject
{
Q_OBJECT
public:
ManagerImpl( const QString &family);
~ManagerImpl();
void readConfig( KConfig * );
void writeConfig( KConfig * );
void add( Resource *resource, bool useDCOP = true );
void remove( Resource *resource, bool useDCOP = true );
Resource *standardResource();
void setStandardResource( Resource *resource );
void setActive( Resource *resource, bool active );
Resource::List *resourceList();
- QPtrList<Resource> resources();
+ Q3PtrList<Resource> resources();
// Get only active or passive resources
- QPtrList<Resource> resources( bool active );
+ Q3PtrList<Resource> resources( bool active );
QStringList resourceNames();
void setListener( ManagerImplListener *listener );
public slots:
void resourceChanged( Resource *resource );
private:
// dcop calls
private:
void createStandardConfig();
Resource *readResourceConfig( const QString& identifier, bool checkActive );
void writeResourceConfig( Resource *resource, bool checkActive );
void removeResource( Resource *resource );
Resource *getResource( Resource *resource );
Resource *getResource( const QString& identifier );
QString mFamily;
KConfig *mConfig;
KConfig *mStdConfig;
diff --git a/microkde/kresources/resource.h b/microkde/kresources/resource.h
index ed5af96..1f9527c 100644
--- a/microkde/kresources/resource.h
+++ b/microkde/kresources/resource.h
@@ -7,49 +7,49 @@
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_RESOURCE_H
#define KRESOURCES_RESOURCE_H
//US
#ifdef QT_THREAD_SUPPORT
#include <qmutex.h>
#endif //QT_THREAD_SUPPORT
-#include <qvaluelist.h>
+#include <q3valuelist.h>
#include <qwidget.h>
#include <qobject.h>
#include <klibloader.h>
class KConfig;
namespace KRES {
class ConfigWidget;
/**
* @internal
* @libdoc The KDE Resource library
*
* NOTE: this library is NOT (YET?) PUBLIC. Do not publish this
* interface, it is in constant flux.
*
* The KDE Resource framework can be used to manage resources of
* different types, organized in families. The Resource framework
* is currently used for addressbook resources in libkabc and for
* calendar resources in libkcal.
*
@@ -218,49 +218,49 @@ kde_module_LTLIBRARIES = resourceexample.la
resourceexample_la_SOURCES = resourceexample.cpp resourceexampleconfig.cpp
resourceexample_la_LDFLAGS= $(all_libraries) -module $(KDE_PLUGIN)
resourceexample_la_LIBADD= -lkderesources
linkdir= $(kde_datadir)/resources/family
link_DATA= resourceexample.desktop
</pre>
*
*
*/
/**
* A @ref Resource is a ...
*
* A subclass should reimplement at least the constructor and the
k * @ref writeConfig method.
*
*/
class Resource : public QObject
{
Q_OBJECT
public:
- typedef QValueList<Resource *> List;
+ typedef Q3ValueList<Resource *> List;
/**
* Constructor. Construct resource from config.
* @param config Configuration to read persistence information from.
* If config==0, create object using default settings.
*/
Resource( const KConfig* config );
/**
* Destructor.
*/
virtual ~Resource();
/**
* Write configuration information for this resource to a configuration
* file. If you override this method, remember to call Resource::writeConfig
* or Terrible Things(TM) will happen.
* @param config Configuration to write persistence information to.
*/
virtual void writeConfig( KConfig* config );
/**
* Open this resource, if it not already open. Increase the open
* count of this object, and open the resource by calling @ref doOpen().
diff --git a/microkde/kresources/selectdialog.cpp b/microkde/kresources/selectdialog.cpp
index fba8648..d5b83e9 100644
--- a/microkde/kresources/selectdialog.cpp
+++ b/microkde/kresources/selectdialog.cpp
@@ -13,128 +13,132 @@
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*US
#include <kbuttonbox.h>
#include <klistbox.h>
#include <klocale.h>
#include <kmessagebox.h>
*/
#include <klocale.h>
#include <kmessagebox.h>
//US
#include <kglobal.h>
-#include <qlistbox.h>
+#include <q3listbox.h>
#include <qlayout.h>
-#include <qgroupbox.h>
+#include <q3groupbox.h>
+//Added by qt3to4:
+#include <Q3VBoxLayout>
+#include <Q3Frame>
+#include <Q3PtrList>
#include "resource.h"
#include "selectdialog.h"
using namespace KRES;
//US I am using KBaseDialog instead of KDialog
//US : KDialog( parent, name, true )
-SelectDialog::SelectDialog( QPtrList<Resource> list, QWidget *parent,
+SelectDialog::SelectDialog( Q3PtrList<Resource> list, QWidget *parent,
const char *name )
: KDialogBase( parent, name, true, i18n( "Resource Selection" ), Help | Ok | Cancel,
Ok, true)
{
//US setCaption( i18n( "Resource Selection" ) );
//US resize( 300, 200 );
resize( KMIN(KGlobal::getDesktopWidth(), 300), KMIN(KGlobal::getDesktopHeight(), 200) );
//US
- QFrame *main = plainPage();
+ Q3Frame *main = plainPage();
/*US
QVBoxLayout *layout = new QVBoxLayout( main );
mConfigPage = new KRES::ConfigPage( main );
layout->addWidget( mConfigPage );
*/
//US QVBoxLayout *mainLayout = new QVBoxLayout( this );
- QVBoxLayout *mainLayout = new QVBoxLayout( main );
+ Q3VBoxLayout *mainLayout = new Q3VBoxLayout( main );
mainLayout->setMargin( marginHint() );
//US QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, this );
- QGroupBox *groupBox = new QGroupBox( 2, Qt::Horizontal, main );
+ Q3GroupBox *groupBox = new Q3GroupBox( 2, Qt::Horizontal, main );
groupBox->setTitle( i18n( "Resources" ) );
//US mResourceId = new KListBox( groupBox );
- mResourceId = new QListBox( groupBox );
+ mResourceId = new Q3ListBox( groupBox );
mainLayout->addWidget( groupBox );
mainLayout->addSpacing( 40 );
/*US
KButtonBox *buttonBox = new KButtonBox( this );
buttonBox->addStretch();
buttonBox->addButton( i18n( "&OK" ), this, SLOT( accept() ) );
buttonBox->addButton( i18n( "&Cancel" ), this, SLOT( reject() ) );
buttonBox->layout();
mainLayout->addWidget( buttonBox );
*/
// setup listbox
uint counter = 0;
for ( uint i = 0; i < list.count(); ++i ) {
Resource *resource = list.at( i );
if ( resource && !resource->readOnly() ) {
mResourceMap.insert( counter, resource );
mResourceId->insertItem( resource->resourceName() );
counter++;
}
}
mResourceId->setCurrentItem( 0 );
- connect( mResourceId, SIGNAL(returnPressed(QListBoxItem*)),
+ connect( mResourceId, SIGNAL(returnPressed(Q3ListBoxItem*)),
SLOT(accept()) );
}
Resource *SelectDialog::resource()
{
if ( mResourceId->currentItem() != -1 )
return mResourceMap[ mResourceId->currentItem() ];
else
return 0;
}
-Resource *SelectDialog::getResource( QPtrList<Resource> list, QWidget *parent )
+Resource *SelectDialog::getResource( Q3PtrList<Resource> list, QWidget *parent )
{
if ( list.count() == 0 ) {
KMessageBox::error( parent, i18n( "There is no resource available!" ) );
return 0;
}
if ( list.count() == 1 ) return list.first();
// the following lines will return a writeable resource if only _one_ writeable
// resource exists
Resource *found = 0;
Resource *it = list.first();
while ( it ) {
if ( !it->readOnly() ) {
if ( found ) {
found = 0;
break;
} else
found = it;
}
it = list.next();
}
if ( found )
diff --git a/microkde/kresources/selectdialog.h b/microkde/kresources/selectdialog.h
index 7026212..be5152b 100644
--- a/microkde/kresources/selectdialog.h
+++ b/microkde/kresources/selectdialog.h
@@ -4,89 +4,89 @@
Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KRESOURCES_SELECTDIALOG_H
#define KRESOURCES_SELECTDIALOG_H
#include <qobject.h>
-#include <qptrlist.h>
+#include <q3ptrlist.h>
#include <qmap.h>
#include <kdialogbase.h>
//US class KListBox;
-class QListBox;
+class Q3ListBox;
namespace KRES {
class Resource;
/**
* Dialog for selecting a resource.
*
* Example:
*
* <pre>
* KABC::Resource *res = KABC::SelectDialog::getResource();
* if ( !( res ) ) {
* // no resource selected
* } else {
* // do something with resource
* }
* </pre>
*/
//US class SelectDialog : KDialog
class SelectDialog : KDialogBase
{
// Q_OBJECT
public:
/**
* Constructor.
* @param ab The address book you want to select the resource from
* @param parent The parent widget
* @param name The name of the dialog
*/
- SelectDialog( QPtrList<Resource> list, QWidget *parent = 0,
+ SelectDialog( Q3PtrList<Resource> list, QWidget *parent = 0,
const char *name = 0);
// ~SelectDialog();
/**
* Return selected resource.
*/
Resource *resource();
/**
* Open a dialog showing the available resources and return the resource the
* user has selected. Returns 0, if the dialog was canceled.
*/
- static Resource *getResource( QPtrList<Resource> list, QWidget *parent = 0 );
+ static Resource *getResource( Q3PtrList<Resource> list, QWidget *parent = 0 );
private:
//US KListBox *mResourceId;
- QListBox *mResourceId;
+ Q3ListBox *mResourceId;
QMap<int, Resource*> mResourceMap;
};
}
#endif
diff --git a/microkde/ksystemtray.cpp b/microkde/ksystemtray.cpp
index 4f81d02..0d0045f 100644
--- a/microkde/ksystemtray.cpp
+++ b/microkde/ksystemtray.cpp
@@ -1,11 +1,14 @@
#include "ksystemtray.h"
+//Added by qt3to4:
+#include <QMouseEvent>
+#include <QLabel>
void KSystemTray::mousePressEvent( QMouseEvent *)
{
; //qDebug("hallo");
}
KSystemTray::KSystemTray( QWidget *parent ) : QLabel( parent )
{
}
diff --git a/microkde/ksystemtray.h b/microkde/ksystemtray.h
index f3e4f6a..6708c86 100644
--- a/microkde/ksystemtray.h
+++ b/microkde/ksystemtray.h
@@ -1,14 +1,16 @@
#ifndef MICROKDE_KSYSTEMTRAY_H
#define MICROKDE_KSYSTEMTRAY_H
#include <qlabel.h>
+//Added by qt3to4:
+#include <QMouseEvent>
class KSystemTray : public QLabel
{
Q_OBJECT
public:
KSystemTray( QWidget *parent = 0 );
void mousePressEvent( QMouseEvent *);
};
#endif
diff --git a/microkde/ktempfile.cpp b/microkde/ktempfile.cpp
index b9166bd..d61d22e 100644
--- a/microkde/ktempfile.cpp
+++ b/microkde/ktempfile.cpp
@@ -1,25 +1,25 @@
-#include <qtextstream.h>
+#include <q3textstream.h>
#include "ktempfile.h"
KTempFile::KTempFile()
{
}
KTempFile::KTempFile( const QString &filename, const QString &extension )
{
}
void KTempFile::setAutoDelete( bool )
{
}
QString KTempFile::name()
{
return QString::null;
}
-QTextStream *KTempFile::textStream()
+Q3TextStream *KTempFile::textStream()
{
return 0;
}
diff --git a/microkde/ktempfile.h b/microkde/ktempfile.h
index 20dfa82..1ac7258 100644
--- a/microkde/ktempfile.h
+++ b/microkde/ktempfile.h
@@ -1,20 +1,20 @@
#ifndef MINIKDE_KTEMPFILE_H
#define MINIKDE_KTEMPFILE_H
#include <qstring.h>
-class QTextStream;
+class Q3TextStream;
class KTempFile
{
public:
KTempFile();
KTempFile( const QString &filename, const QString &extension );
void setAutoDelete( bool );
QString name();
- QTextStream *textStream();
+ Q3TextStream *textStream();
};
#endif
diff --git a/microkde/ktextedit.cpp b/microkde/ktextedit.cpp
index 4dd6875..d74706b 100644
--- a/microkde/ktextedit.cpp
+++ b/microkde/ktextedit.cpp
@@ -1,53 +1,55 @@
#include <ktextedit.h>
#ifndef DESKTOP_VERSION
#include <qpe/qpeapplication.h>
+//Added by qt3to4:
+#include <QMouseEvent>
#endif
-KTextEdit::KTextEdit ( QWidget *parent ) : QMultiLineEdit( parent )
+KTextEdit::KTextEdit ( QWidget *parent ) : Q3MultiLineEdit( parent )
{
mAllowPopupMenu = false;
mMouseDown = false;
mIgnoreMark = false;
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
#endif
}
void KTextEdit::mousePressEvent(QMouseEvent *e)
{
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
mAllowPopupMenu = true;
mYMousePos = mapToGlobal( (e->pos())).y();
mXMousePos = mapToGlobal( (e->pos())).x();
}
- if ( e->button() == RightButton && !mAllowPopupMenu )
+ if ( e->button() == Qt::RightButton && !mAllowPopupMenu )
return;
- if ( e->button() == LeftButton ) {
+ if ( e->button() == Qt::LeftButton ) {
if ( hasMarkedText () )
mIgnoreMark = !mIgnoreMark;
if ( mIgnoreMark && hasMarkedText () ) {
mMouseDown = false;
return ;
}
}
- QMultiLineEdit::mousePressEvent( e );
+ Q3MultiLineEdit::mousePressEvent( e );
}
void KTextEdit::mouseReleaseEvent(QMouseEvent *e)
{
- QMultiLineEdit::mouseReleaseEvent(e);
+ Q3MultiLineEdit::mouseReleaseEvent(e);
}
void KTextEdit::mouseMoveEvent(QMouseEvent *e)
{
int diff = mYMousePos - mapToGlobal( (e->pos())).y();
if ( diff < 0 ) diff = -diff;
int diff2 = mXMousePos - mapToGlobal( (e->pos())).x();
if ( diff2 < 0 ) diff2 = -diff2;
if ( diff+ diff2 > 20 )
mAllowPopupMenu = false;
- QMultiLineEdit::mouseMoveEvent(e);
+ Q3MultiLineEdit::mouseMoveEvent(e);
}
diff --git a/microkde/ktextedit.h b/microkde/ktextedit.h
index 87c0602..b7c8924 100644
--- a/microkde/ktextedit.h
+++ b/microkde/ktextedit.h
@@ -1,23 +1,25 @@
#ifndef MICROKDE_KTEXTEDIT_H
#define MICROKDE_KTEXTEDIT_H
-#include <qmultilineedit.h>
+#include <q3multilineedit.h>
+//Added by qt3to4:
+#include <QMouseEvent>
-class KTextEdit : public QMultiLineEdit
+class KTextEdit : public Q3MultiLineEdit
{
public:
KTextEdit( QWidget *parent ) ;
void setIgnoreMark( bool b ) { mIgnoreMark = b; }
private:
bool mAllowPopupMenu;
bool mMouseDown;
bool mIgnoreMark;
int mYMousePos;
int mXMousePos;
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
};
#endif
diff --git a/microkde/kurl.cpp b/microkde/kurl.cpp
index 2574e25..122ad71 100644
--- a/microkde/kurl.cpp
+++ b/microkde/kurl.cpp
@@ -13,115 +13,117 @@
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "kurl.h"
#ifndef KDE_QT_ONLY
#include <kdebug.h>
#include <kglobal.h>
//US#include <kidna.h>
#endif
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#ifdef _WIN32_
#else
#include <unistd.h>
#endif
-#include <qurl.h>
+#include <q3url.h>
#include <qdir.h>
#include <qstringlist.h>
#include <qregexp.h>
//US#include <qstylesheet.h>
#include <qmap.h>
#include <qtextcodec.h>
+//Added by qt3to4:
+#include <Q3CString>
static const QString fileProt = "file";
static QTextCodec * codecForHint( int encoding_hint /* not 0 ! */ )
{
return QTextCodec::codecForMib( encoding_hint );
}
static QString encode( const QString& segment, bool encode_slash, int encoding_hint )
{
const char *encode_string;
if (encode_slash)
encode_string = "<>#@\"&%?={}|^~[]\'`\\:+/";
else
encode_string = "<>#@\"&%?={}|^~[]\'`\\:+";
- QCString local;
+ Q3CString local;
if (encoding_hint==0)
local = segment.local8Bit();
else
{
QTextCodec * textCodec = codecForHint( encoding_hint );
if (!textCodec)
local = segment.local8Bit();
else
local = textCodec->fromUnicode( segment );
}
int old_length = local.length();
if ( !old_length )
return segment.isNull() ? QString::null : QString(""); // differenciate null and empty
// a worst case approximation
QChar *new_segment = new QChar[ old_length * 3 + 1 ];
int new_length = 0;
for ( int i = 0; i < old_length; i++ )
{
// 'unsave' and 'reserved' characters
// according to RFC 1738,
// 2.2. URL Character Encoding Issues (pp. 3-4)
// WABA: Added non-ascii
unsigned char character = local[i];
if ( (character <= 32) || (character >= 127) ||
strchr(encode_string, character) )
{
new_segment[ new_length++ ] = '%';
unsigned int c = character / 16;
c += (c > 9) ? ('A' - 10) : '0';
new_segment[ new_length++ ] = c;
c = character % 16;
c += (c > 9) ? ('A' - 10) : '0';
new_segment[ new_length++ ] = c;
}
else
- new_segment[ new_length++ ] = local[i];
+ new_segment[ new_length++ ] = character;
}
QString result = QString(new_segment, new_length);
delete [] new_segment;
return result;
}
static QString encodeHost( const QString& segment, bool encode_slash, int encoding_hint )
{
// Hostnames are encoded differently
// we use the IDNA transformation instead
// Note: when merging qt-addon, use QResolver::domainToAscii here
#ifndef KDE_QT_ONLY
Q_UNUSED( encode_slash );
Q_UNUSED( encoding_hint );
return KIDNA::toAscii(segment);
#else
return encode(segment, encode_slash, encoding_hint);
#endif
}
static int hex2int( unsigned int _char )
{
@@ -184,49 +186,49 @@ static QString lazy_encode( const QString& segment )
new_segment[ new_length++ ] = segment[i];
}
QString result = QString(new_segment, new_length);
delete [] new_segment;
return result;
}
static void decode( const QString& segment, QString &decoded, QString &encoded, int encoding_hint=0, bool updateDecoded = true )
{
decoded = QString::null;
encoded = segment;
int old_length = segment.length();
if ( !old_length )
return;
QTextCodec *textCodec = 0;
if (encoding_hint)
textCodec = codecForHint( encoding_hint );
if (!textCodec)
textCodec = QTextCodec::codecForLocale();
- QCString csegment = textCodec->fromUnicode(segment);
+ Q3CString csegment = textCodec->fromUnicode(segment);
// Check if everything went ok
if (textCodec->toUnicode(csegment) != segment)
{
// Uh oh
textCodec = codecForHint( 106 ); // Fall back to utf-8
csegment = textCodec->fromUnicode(segment);
}
old_length = csegment.length();
int new_length = 0;
int new_length2 = 0;
// make a copy of the old one
char *new_segment = new char[ old_length + 1 ];
QChar *new_usegment = new QChar[ old_length * 3 + 1 ];
int i = 0;
while( i < old_length )
{
bool bReencode = false;
unsigned char character = csegment[ i++ ];
if ((character <= ' ') || (character > 127))
bReencode = true;
@@ -257,49 +259,49 @@ static void decode( const QString& segment, QString &decoded, QString &encoded,
new_usegment [ new_length2++ ] = '%';
unsigned int c = character / 16;
c += (c > 9) ? ('A' - 10) : '0';
new_usegment[ new_length2++ ] = c;
c = character % 16;
c += (c > 9) ? ('A' - 10) : '0';
new_usegment[ new_length2++ ] = c;
}
new_segment [ new_length++ ] = character;
}
new_segment [ new_length ] = 0;
encoded = QString( new_usegment, new_length2);
// Encoding specified
if (updateDecoded)
{
QByteArray array;
array.setRawData(new_segment, new_length);
decoded = textCodec->toUnicode( array, new_length );
array.resetRawData(new_segment, new_length);
- QCString validate = textCodec->fromUnicode(decoded);
+ Q3CString validate = textCodec->fromUnicode(decoded);
if (strcmp(validate.data(), new_segment) != 0)
{
decoded = QString::fromLocal8Bit(new_segment, new_length);
}
}
delete [] new_segment;
delete [] new_usegment;
}
static QString decode(const QString &segment, int encoding_hint = 0)
{
QString result;
QString tmp;
decode(segment, result, tmp, encoding_hint);
return result;
}
static QString cleanpath(const QString &path, bool cleanDirSeparator=true)
{
if (path.isEmpty()) return QString::null;
int len = path.length();
bool slash = (len && path[len-1] == '/') ||
@@ -398,90 +400,90 @@ QStringList KURL::List::toStringList() const
KURL::KURL()
{
reset();
}
KURL::~KURL()
{
}
KURL::KURL( const QString &url, int encoding_hint )
{
reset();
parse( url, encoding_hint );
}
KURL::KURL( const char * url, int encoding_hint )
{
reset();
parse( QString::fromLatin1(url), encoding_hint );
}
-KURL::KURL( const QCString& url, int encoding_hint )
+KURL::KURL( const Q3CString& url, int encoding_hint )
{
reset();
parse( QString::fromLatin1(url), encoding_hint );
}
KURL::KURL( const KURL& _u )
{
*this = _u;
}
QDataStream & operator<< (QDataStream & s, const KURL & a)
{
QString QueryForWire=a.m_strQuery_encoded;
if (!a.m_strQuery_encoded.isNull())
QueryForWire.prepend("?");
s << a.m_strProtocol << a.m_strUser << a.m_strPass << a.m_strHost
<< a.m_strPath << a.m_strPath_encoded << QueryForWire << a.m_strRef_encoded
<< Q_INT8(a.m_bIsMalformed ? 1 : 0) << a.m_iPort;
return s;
}
QDataStream & operator>> (QDataStream & s, KURL & a)
{
Q_INT8 malf;
QString QueryFromWire;
s >> a.m_strProtocol >> a.m_strUser >> a.m_strPass >> a.m_strHost
>> a.m_strPath >> a.m_strPath_encoded >> QueryFromWire >> a.m_strRef_encoded
>> malf >> a.m_iPort;
a.m_bIsMalformed = (malf != 0);
if ( QueryFromWire.isEmpty() )
a.m_strQuery_encoded = QString::null;
else
a.m_strQuery_encoded = QueryFromWire.mid(1);
return s;
}
#ifndef QT_NO_NETWORKPROTOCOL
-KURL::KURL( const QUrl &u )
+KURL::KURL( const Q3Url &u )
{
*this = u;
}
#endif
KURL::KURL( const KURL& _u, const QString& _rel_url, int encoding_hint )
{
// WORKAROUND THE RFC 1606 LOOPHOLE THAT ALLOWS
// http:/index.html AS A VALID SYNTAX FOR RELATIVE
// URLS. ( RFC 2396 section 5.2 item # 3 )
QString rUrl = _rel_url;
int len = _u.m_strProtocol.length();
if ( !_u.m_strHost.isEmpty() && !rUrl.isEmpty() &&
rUrl.find( _u.m_strProtocol, 0, false ) == 0 &&
rUrl[len] == ':' && (rUrl[len+1] != '/' ||
(rUrl[len+1] == '/' && rUrl[len+2] != '/')) )
{
rUrl.remove( 0, rUrl.find( ':' ) + 1 );
}
if ( rUrl.isEmpty() )
{
*this = _u;
}
@@ -568,55 +570,55 @@ void KURL::parse( const QString& _url, int encoding_hint )
// Return immediately whenever the given url
// is empty or null.
if ( _url.isEmpty() )
{
m_strProtocol = _url;
return;
}
QString port;
bool badHostName = false;
int start = 0;
uint len = _url.length();
const QChar* buf = _url.unicode();
const QChar* orig = buf;
QChar delim;
QString tmp;
uint pos = 0;
// Node 1: Accept alpha or slash
QChar x = buf[pos++];
if ( x == '/' )
goto Node9;
- if ( !isalpha( (int)x ) )
+ if ( !x.isLetter() )
goto NodeErr;
// Node 2: Accept any amount of (alpha|digit|'+'|'-')
// '.' is not currently accepted, because current KURL may be confused.
// Proceed with :// :/ or :
- while( pos < len && (isalpha((int)buf[pos]) || isdigit((int)buf[pos]) ||
+ while( pos < len && ( buf[pos].isLetter() || buf[pos].isDigit() ||
buf[pos] == '+' || buf[pos] == '-')) pos++;
if ( pos+2 < len && buf[pos] == ':' && buf[pos+1] == '/' && buf[pos+2] == '/' )
{
m_strProtocol = QString( orig, pos ).lower();
pos += 3;
}
else if (pos+1 < len && buf[pos] == ':' ) // Need to always compare length()-1 otherwise KURL passes "http:" as legal!!
{
m_strProtocol = QString( orig, pos ).lower();
//kdDebug(126)<<"setting protocol to "<<m_strProtocol<<endl;
pos++;
start = pos;
goto Node9;
}
else
goto NodeErr;
//Node 3: We need at least one character here
if ( pos == len )
goto NodeErr;
start = pos;
// Node 4: Accept any amount of characters.
@@ -748,53 +750,53 @@ void KURL::parse( const QString& _url, int encoding_hint )
}
if (badHostName)
goto NodeErr;
if ( pos == len )
{
setHost(decode(QString( buf + start, pos - start ), encoding_hint));
goto NodeOk;
}
setHost(decode(QString( buf + start, pos - start ), encoding_hint));
}
x = buf[pos];
if ( x == '/' )
{
start = pos++;
goto Node9;
}
else if ( x != ':' )
goto NodeErr;
pos++;
// Node 8a: Accept at least one digit
if ( pos == len )
goto NodeErr;
start = pos;
- if ( !isdigit( buf[pos++] ) )
+ if ( !buf[pos++].isDigit() )
goto NodeErr;
// Node 8b: Accept any amount of digits
- while( pos < len && isdigit( buf[pos] ) ) pos++;
+ while( pos < len && buf[pos].isDigit() ) pos++;
port = QString( buf + start, pos - start );
m_iPort = port.toUShort();
if ( pos == len )
goto NodeOk;
start = pos++;
Node9: // parse path until query or reference reached
while( pos < len && buf[pos] != '#' && buf[pos]!='?' ) pos++;
tmp = QString( buf + start, pos - start );
//kdDebug(126)<<" setting encoded path&query to:"<<tmp<<endl;
setEncodedPath( tmp, encoding_hint );
if ( pos == len )
goto NodeOk;
//Node10: // parse query or reference depending on what comes first
delim = (buf[pos++]=='#'?'?':'#');
start = pos;
while(pos < len && buf[pos]!=delim ) pos++;
@@ -827,49 +829,49 @@ void KURL::parse( const QString& _url, int encoding_hint )
NodeErr:
// kdDebug(126) << "KURL couldn't parse URL \"" << _url << "\"" << endl;
reset();
m_strProtocol = _url;
}
KURL& KURL::operator=( const QString& _url )
{
reset();
parse( _url );
return *this;
}
KURL& KURL::operator=( const char * _url )
{
reset();
parse( QString::fromLatin1(_url) );
return *this;
}
#ifndef QT_NO_NETWORKPROTOCOL
-KURL& KURL::operator=( const QUrl & u )
+KURL& KURL::operator=( const Q3Url & u )
{
m_strProtocol = u.protocol();
m_strUser = u.user();
m_strPass = u.password();
m_strHost = u.host();
m_strPath = u.path( FALSE );
m_strPath_encoded = QString::null;
m_strQuery_encoded = u.query();
m_strRef_encoded = u.ref();
m_bIsMalformed = !u.isValid();
m_iPort = u.port();
return *this;
}
#endif
KURL& KURL::operator=( const KURL& _u )
{
m_strProtocol = _u.m_strProtocol;
m_strUser = _u.m_strUser;
m_strPass = _u.m_strPass;
m_strHost = _u.m_strHost;
m_strPath = _u.m_strPath;
m_strPath_encoded = _u.m_strPath_encoded;
@@ -1353,93 +1355,93 @@ KURL::List KURL::split( const KURL& _url )
for( it = lst.begin() ; it != lst.end(); ++it )
{
(*it).m_strRef_encoded = ref;
}
return lst;
}
KURL::List KURL::split( const QString& _url )
{
return split(KURL(_url));
}
KURL KURL::join( const KURL::List & lst )
{
if (lst.isEmpty()) return KURL();
KURL tmp;
KURL::List::ConstIterator first = lst.fromLast();
for( KURL::List::ConstIterator it = first; it != lst.end(); --it )
{
KURL u(*it);
if (it != first)
{
- if (!u.m_strRef_encoded) u.m_strRef_encoded = tmp.url();
+ if (u.m_strRef_encoded.isEmpty()) u.m_strRef_encoded = tmp.url();
else u.m_strRef_encoded += "#" + tmp.url(); // Support more than one suburl thingy
}
tmp = u;
}
return tmp;
}
QString KURL::fileName( bool _strip_trailing_slash ) const
{
QString fname;
if (hasSubURL()) { // If we have a suburl, then return the filename from there
KURL::List list = KURL::split(*this);
KURL::List::Iterator it = list.fromLast();
return (*it).fileName(_strip_trailing_slash);
}
const QString &path = m_strPath;
int len = path.length();
if ( len == 0 )
return fname;
if ( _strip_trailing_slash )
{
while ( len >= 1 && path[ len - 1 ] == '/' )
len--;
}
else if ( path[ len - 1 ] == '/' )
return fname;
// Does the path only consist of '/' characters ?
if ( len == 1 && path[ 0 ] == '/' )
return fname;
// Skip last n slashes
int n = 1;
if (!m_strPath_encoded.isEmpty())
{
// This is hairy, we need the last unencoded slash.
// Count in the encoded string how many encoded slashes follow the last
// unencoded one.
int i = m_strPath_encoded.findRev( '/', len - 1 );
QString fileName_encoded = m_strPath_encoded.mid(i+1);
- n += fileName_encoded.contains("%2f", false);
+ n += fileName_encoded.count("%2f", Qt::CaseInsensitive);
}
int i = len;
do {
i = path.findRev( '/', i - 1 );
}
while (--n && (i > 0));
// If ( i == -1 ) => the first character is not a '/'
// So it's some URL like file:blah.tgz, return the whole path
if ( i == -1 ) {
if ( len == (int)path.length() )
fname = path;
else
// Might get here if _strip_trailing_slash is true
fname = path.left( len );
}
else
{
fname = path.mid( i + 1, len - i - 1 ); // TO CHECK
}
return fname;
}
void KURL::addPath( const QString& _txt )
diff --git a/microkde/kurl.h b/microkde/kurl.h
index cd65a1c..016eb24 100644
--- a/microkde/kurl.h
+++ b/microkde/kurl.h
@@ -1,91 +1,93 @@
/* This file is part of the KDE libraries
* Copyright (C) 1999 Torben Weis <weis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
**/
#ifndef __kurl_h__
#define __kurl_h__ "$Id$"
#include <qstring.h>
-#include <qvaluelist.h>
+#include <q3valuelist.h>
+//Added by qt3to4:
+#include <Q3CString>
-class QUrl;
+class Q3Url;
class QStringList;
template <typename K, typename V> class QMap;
class KURLPrivate;
/**
* Represents and parses a URL.
*
* A prototypical URL looks like:
* <pre>
* protocol:/user:password\@hostname:port/path/to/file.ext#reference
* </pre>
*
* KURL has some restrictions regarding the path
* encoding. KURL works internally with the decoded path and
* and encoded query. For example,
* <pre>
* http://localhost/cgi-bin/test%20me.pl?cmd=Hello%20you
* </pre>
* would result in a decoded path "/cgi-bin/test me.pl"
* and in the encoded query "?cmd=Hello%20you".
* Since path is internally always encoded you may @em not use
* "%00" in the path, although this is OK for the query.
*
* @author Torben Weis <weis@kde.org>
*/
class KURL
{
public:
enum AdjustementFlags
{
NoAdjustements = 0,
StripFileProtocol = 1
};
/**
* KURL::List is a QValueList that contains KURLs with a few
* convenience methods.
* @see KURL
* @see QValueList
*/
- class List : public QValueList<KURL>
+ class List : public Q3ValueList<KURL>
{
public:
/**
* Creates an empty List.
*/
List() { }
/**
* Creates a list that contains the given URL as only
* item.
* @param url the url to add.
*/
List(const KURL &url);
/**
* Creates a list that contains the URLs from the given
* list.
* @param list the list containing the URLs as strings
*/
List(const QStringList &list);
/**
* Converts the URLs of this list to a list of strings.
* @return the list of strings
*/
QStringList toStringList() const;
};
@@ -114,59 +116,59 @@ public:
* @ref setPath().
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
KURL( const QString& url, int encoding_hint = 0 );
/**
* Constructor taking a char * @p url, which is an _encoded_ representation
* of the URL, exactly like the usual constructor. This is useful when
* then URL, in its encoded form, is strictly ascii.
* @param url A encoded URL. If the URL does not have a protocol part,
* "file:" is assumed.
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
KURL( const char * url, int encoding_hint = 0 );
/**
* Constructor taking a QCString @p url, which is an _encoded_ representation
* of the URL, exactly like the usual constructor. This is useful when
* then URL, in its encoded form, is strictly ascii.
* @param url A encoded URL. If the URL does not have a protocol part,
* "file:" is assumed.
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
- KURL( const QCString& url, int encoding_hint = 0 );
+ KURL( const Q3CString& url, int encoding_hint = 0 );
/**
* Copy constructor.
* @param u the KURL to copy
*/
KURL( const KURL& u );
/**
* Converts from a @ref QUrl.
* @param u the QUrl
*/
- KURL( const QUrl &u );
+ KURL( const Q3Url &u );
/**
* Constructor allowing relative URLs.
*
* @param _baseurl The base url.
* @param _rel_url A relative or absolute URL.
* If this is an absolute URL then @p _baseurl will be ignored.
* If this is a relative URL it will be combined with @p _baseurl.
* Note that _rel_url should be encoded too, in any case.
* So do NOT pass a path here (use setPath or addPath instead).
* @param encoding_hint MIB of original encoding of URL.
* @see QTextCodec::mibEnum()
*/
KURL( const KURL& _baseurl, const QString& _rel_url, int encoding_hint=0 );
/**
* Returns the protocol for the URL (i.e., file, http, etc.).
* @return the protocol of the URL, does not include the colon. If the
* URL is malformed, QString::null will be returned.
**/
QString protocol() const { return m_bIsMalformed ? QString::null : m_strProtocol; }
/**
* Sets the protocol for the URL (i.e., file, http, etc.)
* @param _txt the new protocol of the URL (without colon)
**/
@@ -637,49 +639,49 @@ public:
* characters. Password will not be shown.
*/
QString prettyURL( int _trailing, AdjustementFlags _flags) const;
// ### BIC: Merge the two above
/**
* Test to see if the KURL is empty.
* @return true if the URL is empty
**/
bool isEmpty() const;
/**
* This function is useful to implement the "Up" button in a file manager for example.
* @ref cd() never strips a sub-protocol. That means that if you are in
* file:/home/x.tgz#gzip:/#tar:/ and hit the up button you expect to see
* file:/home. The algorithm tries to go up on the right-most URL. If that is not
* possible it strips the right most URL. It continues stripping URLs.
* @return a URL that is a level higher
*/
KURL upURL( ) const;
KURL& operator=( const KURL& _u );
KURL& operator=( const QString& _url );
KURL& operator=( const char * _url );
- KURL& operator=( const QUrl & u );
+ KURL& operator=( const Q3Url & u );
bool operator==( const KURL& _u ) const;
bool operator==( const QString& _u ) const;
bool operator!=( const KURL& _u ) const { return !( *this == _u ); }
bool operator!=( const QString& _u ) const { return !( *this == _u ); }
/**
* The same as equals(), just with a less obvious name.
* Compares this url with @p u.
* @param ignore_trailing set to true to ignore trailing '/' characters.
* @return true if both urls are the same
* @see operator==. This function should be used if you want to
* ignore trailing '/' characters.
* @deprecated
*/
bool cmp( const KURL &u, bool ignore_trailing = false ) const;
/**
* Compares this url with @p u.
* @param ignore_trailing set to true to ignore trailing '/' characters.
* @return true if both urls are the same
* @see operator==. This function should be used if you want to
* ignore trailing '/' characters.
* @since 3.1
diff --git a/microkde/kutils/kcmultidialog.cpp b/microkde/kutils/kcmultidialog.cpp
index 9c87682..88f17e5 100644
--- a/microkde/kutils/kcmultidialog.cpp
+++ b/microkde/kutils/kcmultidialog.cpp
@@ -1,49 +1,51 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-#include <qhbox.h>
-#include <qvbox.h>
+#include <q3hbox.h>
+#include <q3vbox.h>
#include <qcursor.h>
#include <qlayout.h>
+//Added by qt3to4:
+#include <QPixmap>
#include <klocale.h>
#include <kglobal.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
//US #include <klibloader.h>
#include <krun.h>
#include <kprocess.h>
#include <kglobalsettings.h>
#include "kcmultidialog.h"
//US #include "kcmultidialog.moc"
//US #include "kcmoduleloader.h"
KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const char *name, bool modal)
: KDialogBase(IconList, i18n("Configure"), Default |Cancel | Apply | Ok, Ok,
parent, name, modal, true), d(0L)
{
setFont( KGlobalSettings::generalMaxFont() );
enableButton(Apply, false);
//connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
connect( this, SIGNAL( defaultClicked() ), SLOT( slotDefault() ) );
@@ -52,131 +54,131 @@ KCMultiDialog::KCMultiDialog(const QString& baseGroup, QWidget *parent, const ch
mMainWidget = new KJanusWidget( this, "JanusWidget", KJanusWidget::Tabbed );
setMainWidget(mMainWidget );
#ifdef DESKTOP_VERSION
resize(640,480);
#else
//resize(640,480);
//setMaximumSize( KMIN(KGlobal::getDesktopWidth()-5, 640), KMIN(KGlobal::getDesktopHeight()-20, 480));
resize(800,800);
setMaximumSize( 800, 800 );
//showMaximized();
#endif
}
KCMultiDialog::~KCMultiDialog()
{
//US moduleDict.setAutoDelete(true);
}
void KCMultiDialog::slotDefault()
{
int curPageIndex = activePageIndex();
- QPtrListIterator<KCModule> it(modules);
+ Q3PtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
{
if (pageIndex((QWidget *)(*it)->parent()) == curPageIndex)
{
(*it)->defaults();
clientChanged(true);
return;
}
}
}
void KCMultiDialog::accept()
{
slotOk();
}
void KCMultiDialog::slotApply()
{
- QPtrListIterator<KCModule> it(modules);
+ Q3PtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
(*it)->save();
clientChanged(false);
emit applyClicked();
}
void KCMultiDialog::slotOk()
{
qDebug("KCMultiDialog::slotOk clicked");
- QPtrListIterator<KCModule> it(modules);
+ Q3PtrListIterator<KCModule> it(modules);
for (; it.current(); ++it)
(*it)->save();
QDialog::accept();
emit okClicked();
}
void KCMultiDialog::slotHelp()
{
/*US
KURL url( KURL("help:/"), _docPath );
if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
KProcess process;
process << "khelpcenter"
<< url.url();
process.start(KProcess::DontCare);
process.detach();
} else {
new KRun(url);
}
*/
}
void KCMultiDialog::clientChanged(bool state)
{
enableButton(Apply, state);
}
/*US
void KCMultiDialog::addModule(const QString& path, bool withfallback)
{
kdDebug(1208) << "KCMultiDialog::addModule " << path << endl;
KCModuleInfo info(path, _baseGroup);
QHBox* page = addHBoxPage(info.moduleName(), info.comment(),
KGlobal::iconLoader()->loadIcon(info.icon(), KIcon::Desktop, KIcon::SizeMedium));
if(!page) {
KCModuleLoader::unloadModule(info);
return;
}
moduleDict.insert(page, new LoadInfo(path, withfallback));
if (modules.isEmpty())
slotAboutToShow(page);
}
*/
-QVBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
+Q3VBox * KCMultiDialog::getNewVBoxPage( const QString & modulename )
{
- QVBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
+ Q3VBox *page = mMainWidget->addVBoxPage(modulename , QString::null,QPixmap() );
return page;
}
//US special method for microkde. We dop noty want to load everything dynamically.
void KCMultiDialog::addModule(KCModule* module ) //, const QString& modulename, const QString& iconname)
{
modules.append(module);
connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));
//US
module->load();
}
void KCMultiDialog::slotAboutToShow(QWidget *page)
{
/*US
LoadInfo *loadInfo = moduleDict[page];
if (!loadInfo)
return;
QApplication::setOverrideCursor(Qt::WaitCursor);
diff --git a/microkde/kutils/kcmultidialog.h b/microkde/kutils/kcmultidialog.h
index 66412ac..78f8a00 100644
--- a/microkde/kutils/kcmultidialog.h
+++ b/microkde/kutils/kcmultidialog.h
@@ -1,50 +1,50 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef KCMULTIDIALOG_H
#define KCMULTIDIALOG_H
-#include <qptrlist.h>
-#include <qptrdict.h>
+#include <q3ptrlist.h>
+#include <q3ptrdict.h>
#include <kdialogbase.h>
#include <kjanuswidget.h>
#include <kcmodule.h>
/**
* A class that offers a @ref KDialogBase containing arbitrary KControl Modules
*
* @short A method that offers a @ref KDialogBase containing arbitrary
* KControl Modules.
*
* @author Matthias Elter <elter@kde.org>, Daniel Molkentin <molkentin@kde.org>
* @since 3.2
*/
class KCMultiDialog : public KDialogBase
{
Q_OBJECT
public:
/**
* Constructs a new KCMultiDialog
*
* @param parent The parent Widget
* @param name The widget name
@@ -54,49 +54,49 @@ public:
**/
KCMultiDialog(const QString& baseGroup = QString::fromLatin1("settings"),
QWidget *parent=0, const char *name=0,
bool modal=false);
/**
* Destructor
**/
virtual ~KCMultiDialog();
/**
* Add a module.
*
* @param module Specify the name of the module that is to be added
* to the list of modules the dialog will show.
*
* @param withfallback Try harder to load the module. Might result
* in the module appearing outside the dialog.
**/
//US void addModule(const QString& module, bool withfallback=true);
//US special method for microkde. We do not want to load everything dynamically.
void addModule(KCModule* module );//, const QString& modulename, const QString& iconname);
- QVBox* getNewVBoxPage(const QString & modulename) ;
+ Q3VBox* getNewVBoxPage(const QString & modulename) ;
bool showPage( int index );
int activePageIndex() const;
int pageIndex( QWidget *widget ) const;
protected slots:
/**
* This slot is called when the user presses the "Default" Button
* You can reimplement it if needed.
*
* @note Make sure you call the original implementation!
**/
virtual void slotDefault();
/**
* This slot is called when the user presses the "Apply" Button
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotApply();
/**
@@ -112,40 +112,40 @@ protected slots:
* You can reimplement it if needed
*
* @note Make sure you call the original implementation!
**/
virtual void slotHelp();
void accept();
private slots:
void slotAboutToShow(QWidget *);
void clientChanged(bool state);
private:
/*US
struct LoadInfo {
LoadInfo(const QString &_path, bool _withfallback)
: path(_path), withfallback(_withfallback)
{ }
QString path;
bool withfallback;
};
*/
- QPtrList<KCModule> modules;
+ Q3PtrList<KCModule> modules;
/*
QPtrDict<LoadInfo> moduleDict;
QString _docPath;
*/
QString _baseGroup;
//US
KJanusWidget* mMainWidget;
// For future use
class KCMultiDialogPrivate;
KCMultiDialogPrivate *d;
};
#endif //KCMULTIDIALOG_H
diff --git a/microkde/microkde.pro b/microkde/microkde.pro
index 7120bdd..4ff06a3 100644
--- a/microkde/microkde.pro
+++ b/microkde/microkde.pro
@@ -1,33 +1,33 @@
TEMPLATE = lib
CONFIG += qt warn_on
include( ../variables.pri )
#INCLUDEPATH += $(QTDIR)/include .
#DEPENDPATH += $(QTDIR)/include
INCLUDEPATH += . ../ ../kabc ./kdecore ./kdeui ./kio/kfile ./kio/kio
#LIBS += -lqtcompat
-TARGET = microkde
+TARGET = xmicrokde
DESTDIR= ../bin
DEFINES += DESKTOP_VERSION KDE_QT_ONLY
unix : {
staticlib: {
INCLUDEPATH += ../kabc/plugins
DEFINES += STATIC_RESOURCES
}
OBJECTS_DIR = obj/unix
MOC_DIR = moc/unix
}
win32: {
DEFINES += _WIN32_
OBJECTS_DIR = obj/win
MOC_DIR = moc/win
}
HEADERS = \
qlayoutengine_p.h \
KDGanttMinimizeSplitter.h \
kapplication.h \
@@ -157,24 +157,26 @@ KDGanttMinimizeSplitter.cpp \
kio/kio/kdirwatch.cpp \
kio/kfile/kurlrequester.cpp \
kresources/configpage.cpp \
kresources/configdialog.cpp \
kresources/configwidget.cpp \
kresources/factory.cpp \
kresources/kcmkresources.cpp \
kresources/managerimpl.cpp \
kresources/resource.cpp \
kresources/selectdialog.cpp \
kutils/kcmultidialog.cpp \
kdeui/kaction.cpp \
kdeui/kpopupmenu.cpp \
kdeui/kactionclasses.cpp \
kdeui/kactioncollection.cpp \
kdeui/kmainwindow.cpp \
kdeui/ktoolbar.cpp \
kdeui/ktoolbarbutton.cpp \
kdeui/ktoolbarhandler.cpp \
kdeui/kstdaction.cpp \
kdeui/kxmlguiclient.cpp \
kdecore/kprefs.cpp \
kdecore/klibloader.cpp \
kidmanager.cpp
+#The following line was inserted by qt3to4
+QT += xml qt3support
diff --git a/microkde/microkdeE.pro b/microkde/microkdeE.pro
index 8fe2bd5..514e7b3 100644
--- a/microkde/microkdeE.pro
+++ b/microkde/microkdeE.pro
@@ -1,34 +1,34 @@
TEMPLATE = lib
CONFIG += qt warn_on
INCLUDEPATH += . .. $(KDEPIMDIR)/qtcompat $(KDEPIMDIR)/kabc kdecore kdeui kio/kfile kio/kio $(QPEDIR)/include
DEPENDPATH += $(QPEDIR)/include
LIBS += -lmicroqtcompat -L$(QPEDIR)/lib
DEFINES += KDE_QT_ONLY
-TARGET = microkde
+TARGET = xmicrokde
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
DESTDIR=$(QPEDIR)/lib
INTERFACES = \
HEADERS = \
qlayoutengine_p.h fncolordialog.h\
KDGanttMinimizeSplitter.h \
kapplication.h \
kaudioplayer.h \
kcalendarsystem.h \
kcalendarsystemgregorian.h \
kcolorbutton.h \
kcolordialog.h \
kcombobox.h \
kconfig.h \
kdatetbl.h \
kdebug.h \
kdialog.h \
kdialogbase.h \
keditlistbox.h \
kemailsettings.h \
diff --git a/microkde/ofileselector_p.cpp b/microkde/ofileselector_p.cpp
index f4f112e..0f95c84 100644
--- a/microkde/ofileselector_p.cpp
+++ b/microkde/ofileselector_p.cpp
@@ -244,49 +244,49 @@ OFileViewFileListView::OFileViewFileListView( QWidget* parent, const QString& st
btn->setIconSet( Resource::loadPixmap("home") );
connect(btn, SIGNAL(clicked() ),
this, SLOT( cdHome() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadPixmap("DocsIcon") );
connect(btn, SIGNAL(clicked() ),
this, SLOT(cdDoc() ) );
m_btnNew = new QToolButton( box );
m_btnNew->setIconSet( Resource::loadPixmap("new") );
connect(m_btnNew, SIGNAL(clicked() ),
this, SLOT(slotNew() ) );
m_btnClose = new QToolButton( box );
m_btnClose->setIconSet( Resource::loadPixmap("close") );
connect(m_btnClose, SIGNAL(clicked() ),
selector(), SIGNAL(closeMe() ) );
btn = new QToolButton( box );
btn->setIconSet( Resource::loadPixmap("cardmon/pcmcia") );
/* let's fill device parts */
- QPopupMenu* pop = new QPopupMenu(this);
+ Q3PopupMenu* pop = new Q3PopupMenu(this);
connect(pop, SIGNAL( activated(int) ),
this, SLOT(slotFSActivated(int) ) );
StorageInfo storage;
const QList<FileSystem> &fs = storage.fileSystems();
QListIterator<FileSystem> it(fs);
for ( ; it.current(); ++it ) {
const QString disk = (*it)->name();
const QString path = (*it)->path();
m_dev.insert( disk, path );
pop->insertItem( disk );
}
m_fsPop = pop;
btn->setPopup( pop );
btn->setPopupDelay ( 0 );
lay->addWidget( box );
m_view = new QListView( this );
m_view->installEventFilter(this);
QPEApplication::setStylusOperation( m_view->viewport(),
diff --git a/microkde/ofileselector_p.h b/microkde/ofileselector_p.h
index 834fd70..a7d97fe 100644
--- a/microkde/ofileselector_p.h
+++ b/microkde/ofileselector_p.h
@@ -116,49 +116,49 @@ public:
void reread( bool all = false );
int fileCount()const;
QString currentDir()const;
protected:
bool eventFilter (QObject *o, QEvent *e);
private slots:
void slotNew(); // will emit newSelected
void cdUP();
void cdHome();
void cdDoc();
void changeDir( const QString& );
void slotCurrentChanged( QListViewItem* );
void slotClicked(int, QListViewItem*, const QPoint&, int );
void slotDoubleClicked(QListViewItem*);
void slotFSActivated(int);
protected:
OFileSelector* selector();
private:
QMap<QString, QString> m_dev;
bool m_all : 1;
OFileSelector* m_sel;
- QPopupMenu* m_fsPop;
+ Q3PopupMenu* m_fsPop;
bool compliesMime( const QString& );
QStringList m_mimes; // used in compy mime
QString m_currentDir;
QToolButton *m_btnNew, *m_btnClose;
void connectSlots();
void addFile( QFileInfo* info, bool symlink = FALSE );
void addDir ( QFileInfo* info, bool symlink = FALSE );
void addSymlink( QFileInfo* info, bool = FALSE );
private:
QListView* m_view;
};
typedef QMap<QString, QStringList> MimeTypes;
class OFileViewInterface;
class OFileViewFileListView;
class QLineEdit;
class QComboBox;
class QWidgetStack;
class QHBox;
class OFileSelector : public QWidget {
Q_OBJECT
diff --git a/microkde/qlayoutengine_p.h b/microkde/qlayoutengine_p.h
index 2d6a556..e782703 100644
--- a/microkde/qlayoutengine_p.h
+++ b/microkde/qlayoutengine_p.h
@@ -1,24 +1,26 @@
+//Added by qt3to4:
+#include <Q3MemArray>
// THIS IS A COPY OF THE FILE FOUND IN $QTDIR/src/kernel. Needed to modify qsplitter
/****************************************************************************
** $Id$
**
** Internal header file.
**
** Created : 981027
**
** Copyright (C) 1998-99 by Trolltech AS. All rights reserved.
**
** This file is part of the kernel module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
@@ -34,75 +36,71 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QLAYOUTENGINE_P_H
#define QLAYOUTENGINE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of qlayout.cpp, qlayoutengine.cpp, qmainwindow.cpp and qsplitter.cpp.
// This header file may change from version to version without notice,
// or even be removed.
//
// We mean it.
//
//
-#ifndef QT_H
-#include "qabstractlayout.h"
-#endif // QT_H
-
#ifndef QT_NO_LAYOUT
struct QLayoutStruct
{
void initParameters() { minimumSize = sizeHint = 0;
maximumSize = QWIDGETSIZE_MAX; expansive = FALSE; empty = TRUE; }
void init() { stretch = 0; initParameters(); }
//permanent storage:
int stretch;
//parameters:
QCOORD sizeHint;
QCOORD maximumSize;
QCOORD minimumSize;
bool expansive;
bool empty;
//temporary storage:
bool done;
//result:
int pos;
int size;
};
-void qGeomCalc( QMemArray<QLayoutStruct> &chain, int start, int count, int pos,
+void qGeomCalc( Q3MemArray<QLayoutStruct> &chain, int start, int count, int pos,
int space, int spacer );
/*
Modify total maximum (max) and total expansion (exp)
when adding boxmax/boxexp.
Expansive boxes win over non-expansive boxes.
*/
static inline void qMaxExpCalc( QCOORD & max, bool &exp,
QCOORD boxmax, bool boxexp )
{
if ( exp ) {
if ( boxexp )
max = QMAX( max, boxmax );
} else {
if ( boxexp )
max = boxmax;
else
max = QMIN( max, boxmax );
}
exp = exp || boxexp;
}