summaryrefslogtreecommitdiffstats
path: root/kdeui/tests
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /kdeui/tests
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdeui/tests')
-rw-r--r--kdeui/tests/Makefile.am105
-rw-r--r--kdeui/tests/RayTracedGear.pngbin0 -> 5844 bytes
-rw-r--r--kdeui/tests/background_1.pngbin0 -> 7209 bytes
-rw-r--r--kdeui/tests/go.pngbin0 -> 3286 bytes
-rw-r--r--kdeui/tests/itemcontainertest.cpp225
-rw-r--r--kdeui/tests/itemcontainertest.h45
-rw-r--r--kdeui/tests/kaboutdialogtest.cpp72
-rw-r--r--kdeui/tests/kaccelgentest.cpp51
-rw-r--r--kdeui/tests/kactiontest.cpp38
-rw-r--r--kdeui/tests/kalphaicontest.h24
-rw-r--r--kdeui/tests/kblendtest.cpp98
-rw-r--r--kdeui/tests/kblendtest.h24
-rw-r--r--kdeui/tests/kbuttonboxtest.cpp205
-rw-r--r--kdeui/tests/kcharselecttest.cpp16
-rw-r--r--kdeui/tests/kcolordlgtest.cpp41
-rw-r--r--kdeui/tests/kcolortest.cpp169
-rw-r--r--kdeui/tests/kcolortest.h21
-rw-r--r--kdeui/tests/kcomboboxtest.cpp227
-rw-r--r--kdeui/tests/kcomboboxtest.h44
-rw-r--r--kdeui/tests/kcompletiontest.cpp198
-rw-r--r--kdeui/tests/kcompletiontest.h67
-rw-r--r--kdeui/tests/kdatepicktest.cpp16
-rw-r--r--kdeui/tests/kdatetimewidgettest.cpp14
-rw-r--r--kdeui/tests/kdatewidgettest.cpp16
-rw-r--r--kdeui/tests/kdesattest.cpp65
-rw-r--r--kdeui/tests/kdesattest.h31
-rw-r--r--kdeui/tests/kdialogbasetest.cpp77
-rw-r--r--kdeui/tests/kdocktest.cpp65
-rw-r--r--kdeui/tests/kdocktest.h19
-rw-r--r--kdeui/tests/kdockwidgetdemo.cpp796
-rw-r--r--kdeui/tests/kdockwidgetdemo.h164
-rw-r--r--kdeui/tests/kdockwidgettest.cpp255
-rw-r--r--kdeui/tests/kdockwidgettest.h72
-rw-r--r--kdeui/tests/kdualcolortest.cpp63
-rw-r--r--kdeui/tests/kdualcolortest.h20
-rw-r--r--kdeui/tests/keditlistboxtest.cpp21
-rw-r--r--kdeui/tests/kedittest.cpp14
-rw-r--r--kdeui/tests/kfontdialogtest.cpp51
-rw-r--r--kdeui/tests/kgradienttest.cpp108
-rw-r--r--kdeui/tests/kgradienttest.h24
-rw-r--r--kdeui/tests/khashtest.cpp137
-rw-r--r--kdeui/tests/khashtest.h26
-rw-r--r--kdeui/tests/kinputdialogtest.cpp67
-rw-r--r--kdeui/tests/kjanuswidgettest.cpp25
-rw-r--r--kdeui/tests/kledtest.cpp160
-rw-r--r--kdeui/tests/kledtest.h56
-rw-r--r--kdeui/tests/klineeditdlgtest.cpp19
-rw-r--r--kdeui/tests/klineedittest.cpp137
-rw-r--r--kdeui/tests/klineedittest.h41
-rw-r--r--kdeui/tests/klistviewtest.cpp39
-rw-r--r--kdeui/tests/kmainwindowrestoretest.cpp41
-rw-r--r--kdeui/tests/kmainwindowrestoretest.h48
-rw-r--r--kdeui/tests/kmainwindowtest.cpp38
-rw-r--r--kdeui/tests/kmainwindowtest.h18
-rw-r--r--kdeui/tests/kmessageboxtest.cpp242
-rw-r--r--kdeui/tests/knuminputtest.cpp145
-rw-r--r--kdeui/tests/knuminputtest.h23
-rw-r--r--kdeui/tests/kpalettetest.cpp38
-rw-r--r--kdeui/tests/kpanelmenutest.cpp72
-rw-r--r--kdeui/tests/kpanelmenutest.h21
-rw-r--r--kdeui/tests/kpixmapregionselectordialogtest.cpp33
-rw-r--r--kdeui/tests/kpopuptest.cpp40
-rw-r--r--kdeui/tests/kprogresstest.cpp58
-rw-r--r--kdeui/tests/krulertest.cpp375
-rw-r--r--kdeui/tests/krulertest.h91
-rw-r--r--kdeui/tests/kseparatortest.cpp51
-rw-r--r--kdeui/tests/kspelltest.cpp57
-rw-r--r--kdeui/tests/ksqueezedtextlabeltest.cpp13
-rw-r--r--kdeui/tests/kstatusbartest.cpp121
-rw-r--r--kdeui/tests/kstatusbartest.h33
-rw-r--r--kdeui/tests/ksystemtraytest.cpp14
-rw-r--r--kdeui/tests/ktabctltest.cpp105
-rw-r--r--kdeui/tests/ktabctltest.h30
-rw-r--r--kdeui/tests/ktabwidgettest.cpp366
-rw-r--r--kdeui/tests/ktabwidgettest.h69
-rw-r--r--kdeui/tests/ktextedittest.cpp43
-rw-r--r--kdeui/tests/ktimewidgettest.cpp14
-rw-r--r--kdeui/tests/ktoolbarlabelactiontest.cpp97
-rw-r--r--kdeui/tests/ktoolbarlabelactiontestui.rc9
-rw-r--r--kdeui/tests/kunbalancedgrdtest.cpp176
-rw-r--r--kdeui/tests/kunbalancedgrdtest.h49
-rw-r--r--kdeui/tests/kwindowtest.cpp528
-rw-r--r--kdeui/tests/kwindowtest.h71
-rw-r--r--kdeui/tests/kwizardtest.cpp54
-rw-r--r--kdeui/tests/kwordwraptest.cpp43
-rw-r--r--kdeui/tests/kxmlguitest.cpp64
-rw-r--r--kdeui/tests/kxmlguitest.h19
-rw-r--r--kdeui/tests/kxmlguitest_part.rc8
-rw-r--r--kdeui/tests/kxmlguitest_shell.rc7
-rw-r--r--kdeui/tests/qxembedtest.cpp88
-rw-r--r--kdeui/tests/testimage.pngbin0 -> 35951 bytes
91 files changed, 7680 insertions, 0 deletions
diff --git a/kdeui/tests/Makefile.am b/kdeui/tests/Makefile.am
new file mode 100644
index 000000000..560c9b6dc
--- /dev/null
+++ b/kdeui/tests/Makefile.am
@@ -0,0 +1,105 @@
+# This file is part of the KDE libraries
+# Copyright (C) 1996-1997 Matthias Kalle Dalheimer (kalle@kde.org)
+# (C) 1997-1998 Stephan Kulow (coolo@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., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES = -I$(top_srcdir)/kdefx -I$(top_srcdir)/kdecore -I$(top_srcdir)/kdeui \
+ $(all_includes)
+
+AM_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS) $(KDE_RPATH)
+
+check_PROGRAMS = kaboutdialogtest kblendtest kbuttonboxtest kcharselecttest \
+ kcolortest kcolordlgtest kcomboboxtest kcompletiontest \
+ kdatepicktest kdatewidgettest kdialogbasetest \
+ kdockwidgetdemo kdockwidgettest \
+ kdualcolortest keditlistboxtest kfontdialogtest \
+ kgradienttest khashtest kdesattest\
+ kledtest klineedittest klineeditdlgtest \
+ kmessageboxtest knuminputtest \
+ kpalettetest \
+ kpopuptest kprogresstest krulertest kseparatortest \
+ kstatusbartest ktabctltest \
+ kunbalancedgrdtest kwindowtest kwizardtest \
+ itemcontainertest kpanelmenutest kedittest \
+ kxmlguitest kaccelgentest ksystemtraytest klistviewtest \
+ ktextedittest kmainwindowtest kmainwindowrestoretest \
+ kactiontest kdatetimewidgettest ktimewidgettest \
+ kspelltest kinputdialogtest ktabwidgettest kwordwraptest \
+ kdocktest qxembedtest ksqueezedtextlabeltest \
+ kpixmapregionselectordialogtest kjanuswidgettest ktoolbarlabelactiontest
+
+METASOURCES = AUTO
+
+LDADD = ../libkdeui.la
+
+kaboutdialogtest_SOURCES = kaboutdialogtest.cpp
+kblendtest_SOURCES = kblendtest.cpp
+kdesattest_SOURCES = kdesattest.cpp
+kbuttonboxtest_SOURCES = kbuttonboxtest.cpp
+kcharselecttest_SOURCES = kcharselecttest.cpp
+kcolordlgtest_SOURCES = kcolordlgtest.cpp
+kcolortest_SOURCES = kcolortest.cpp
+kcomboboxtest_SOURCES = kcomboboxtest.cpp
+kcompletiontest_SOURCES = kcompletiontest.cpp
+kdatepicktest_SOURCES = kdatepicktest.cpp
+kdatetimewidgettest_SOURCES = kdatetimewidgettest.cpp
+kdatewidgettest_SOURCES = kdatewidgettest.cpp
+kdialogbasetest_SOURCES = kdialogbasetest.cpp
+kdualcolortest_SOURCES = kdualcolortest.cpp
+kedittest_SOURCES = kedittest.cpp
+keditlistboxtest_SOURCES = keditlistboxtest.cpp
+kfontdialogtest_SOURCES = kfontdialogtest.cpp
+kgradienttest_SOURCES = kgradienttest.cpp
+khashtest_SOURCES = khashtest.cpp
+kledtest_SOURCES = kledtest.cpp
+klineedittest_SOURCES = klineedittest.cpp
+klineeditdlgtest_SOURCES = klineeditdlgtest.cpp
+kmessageboxtest_SOURCES = kmessageboxtest.cpp
+knuminputtest_SOURCES = knuminputtest.cpp
+kpalettetest_SOURCES = kpalettetest.cpp
+kpopuptest_SOURCES = kpopuptest.cpp
+kprogresstest_SOURCES = kprogresstest.cpp
+krulertest_SOURCES = krulertest.cpp
+kseparatortest_SOURCES = kseparatortest.cpp
+kstatusbartest_SOURCES = kstatusbartest.cpp
+ktabctltest_SOURCES = ktabctltest.cpp
+ktimewidgettest_SOURCES = ktimewidgettest.cpp
+kunbalancedgrdtest_SOURCES = kunbalancedgrdtest.cpp
+kwindowtest_SOURCES = kwindowtest.cpp
+kwizardtest_SOURCES = kwizardtest.cpp
+itemcontainertest_SOURCES = itemcontainertest.cpp
+kpanelmenutest_SOURCES = kpanelmenutest.cpp
+kdockwidgetdemo_SOURCES = kdockwidgetdemo.cpp
+kdockwidgettest_SOURCES = kdockwidgettest.cpp
+kxmlguitest_SOURCES = kxmlguitest.cpp
+kaccelgentest_SOURCES = kaccelgentest.cpp
+ksystemtraytest_SOURCES = ksystemtraytest.cpp
+klistviewtest_SOURCES = klistviewtest.cpp
+ktextedittest_SOURCES = ktextedittest.cpp
+kmainwindowtest_SOURCES = kmainwindowtest.cpp
+kmainwindowrestoretest_SOURCES = kmainwindowrestoretest.cpp
+kactiontest_SOURCES = kactiontest.cpp
+kspelltest_SOURCES = kspelltest.cpp
+kinputdialogtest_SOURCES = kinputdialogtest.cpp
+ktabwidgettest_SOURCES = ktabwidgettest.cpp
+kwordwraptest_SOURCES = kwordwraptest.cpp
+kdocktest_SOURCES=kdocktest.cpp
+qxembedtest_SOURCES=qxembedtest.cpp
+ksqueezedtextlabeltest_SOURCES = ksqueezedtextlabeltest.cpp
+kjanuswidgettest_SOURCES = kjanuswidgettest.cpp
+kpixmapregionselectordialogtest_SOURCES = kpixmapregionselectordialogtest.cpp
+ktoolbarlabelactiontest_SOURCES = ktoolbarlabelactiontest.cpp
diff --git a/kdeui/tests/RayTracedGear.png b/kdeui/tests/RayTracedGear.png
new file mode 100644
index 000000000..03314ca53
--- /dev/null
+++ b/kdeui/tests/RayTracedGear.png
Binary files differ
diff --git a/kdeui/tests/background_1.png b/kdeui/tests/background_1.png
new file mode 100644
index 000000000..5723d3a46
--- /dev/null
+++ b/kdeui/tests/background_1.png
Binary files differ
diff --git a/kdeui/tests/go.png b/kdeui/tests/go.png
new file mode 100644
index 000000000..8b9eacceb
--- /dev/null
+++ b/kdeui/tests/go.png
Binary files differ
diff --git a/kdeui/tests/itemcontainertest.cpp b/kdeui/tests/itemcontainertest.cpp
new file mode 100644
index 000000000..7ad145c9e
--- /dev/null
+++ b/kdeui/tests/itemcontainertest.cpp
@@ -0,0 +1,225 @@
+/*
+* Tests the item container widgets KIconView, KListView, KListBox
+*
+* Copyright (c) 2000 by Michael Reiher <michael.reiher@gmx.de>
+*
+* License: GPL, version 2
+* Version: $Id:
+*
+*/
+
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qhbox.h>
+#include <qbuttongroup.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+#include <kapplication.h>
+#include <kglobal.h>
+#include <kconfig.h>
+#include <kiconview.h>
+#include <klistview.h>
+#include <klistbox.h>
+
+#include "itemcontainertest.h"
+
+static const char * item_xpm[] = {
+"22 22 3 1",
+" c None",
+". c #000000",
+"+ c #FF0000",
+" ...... ",
+" ....++++.... ",
+" ..++++..++++.. ",
+" ..++++++++++++.. ",
+" ..++++++..++++++.. ",
+" ..++++++++++++++++.. ",
+" .++++++++..++++++++. ",
+" .++++++++++++++++++. ",
+"..++++++++..++++++++..",
+".++++++++++++++++++++.",
+".+.+.+.+.+..+.+.+.+.+.",
+".+.+.+.+.+..+.+.+.+.+.",
+".++++++++++++++++++++.",
+"..++++++++..++++++++..",
+" .++++++++++++++++++. ",
+" .++++++++..++++++++. ",
+" ..++++++++++++++++.. ",
+" ..++++++..++++++.. ",
+" ..++++++++++++.. ",
+" ..++++..++++.. ",
+" ....++++.... ",
+" ...... "};
+
+
+KApplication *app;
+
+TopLevel::TopLevel(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ setCaption("Item container test application");
+
+ QHBoxLayout* hBox = new QHBoxLayout( this );
+ QVBoxLayout* vBox = new QVBoxLayout( hBox );
+ hBox->addSpacing( 5 );
+
+ //Selection mode selection
+ m_pbgMode = new QButtonGroup( 1, Qt::Horizontal, "Selection Mode", this);
+ m_pbgMode->insert(new QRadioButton("NoSlection", m_pbgMode), TopLevel::NoSelection );
+ m_pbgMode->insert(new QRadioButton("Single", m_pbgMode), TopLevel::Single );
+ m_pbgMode->insert(new QRadioButton("Multi", m_pbgMode), TopLevel::Multi );
+ m_pbgMode->insert(new QRadioButton("Extended", m_pbgMode), TopLevel::Extended );
+ m_pbgMode->setExclusive( true );
+ vBox->addWidget( m_pbgMode );
+
+ connect( m_pbgMode, SIGNAL( clicked( int ) ),
+ this, SLOT( slotSwitchMode( int ) ) );
+
+ //Signal labels
+ QGroupBox* gbWiget = new QGroupBox( 1, Qt::Horizontal, "Widget", this);
+ m_plblWidget = new QLabel( gbWiget );
+ vBox->addWidget( gbWiget );
+ QGroupBox* gbSignal = new QGroupBox( 1, Qt::Horizontal, "emitted Signal", this);
+ m_plblSignal = new QLabel( gbSignal );
+ vBox->addWidget( gbSignal );
+ QGroupBox* gbItem = new QGroupBox( 1, Qt::Horizontal, "on Item", this);
+ m_plblItem = new QLabel( gbItem );
+ vBox->addWidget( gbItem );
+
+ QButtonGroup* bgListView = new QButtonGroup( 1, Qt::Horizontal, "KListView", this);
+ QCheckBox* cbListView = new QCheckBox("Single Column", bgListView);
+ vBox->addWidget( bgListView );
+ connect( cbListView, SIGNAL( toggled( bool ) ),
+ this, SLOT( slotToggleSingleColumn( bool ) ) );
+
+ KGlobal::config()->reparseConfiguration();
+
+ //Create IconView
+ QGroupBox* gbIconView = new QGroupBox( 1, Qt::Horizontal, "KIconView", this);
+ m_pIconView = new KIconView( gbIconView );
+ hBox->addWidget( gbIconView );
+ hBox->addSpacing( 5 );
+ connect( m_pIconView, SIGNAL( executed( QIconViewItem* ) ),
+ this, SLOT( slotIconViewExec( QIconViewItem* ) ) );
+
+ //Create ListView
+ QGroupBox* gbListView = new QGroupBox( 1, Qt::Horizontal, "KListView", this);
+ m_pListView = new KListView( gbListView );
+ m_pListView->addColumn("Item");
+ m_pListView->addColumn("Text");
+ hBox->addWidget( gbListView );
+ hBox->addSpacing( 5 );
+ connect( m_pListView, SIGNAL( executed( QListViewItem* ) ),
+ this, SLOT( slotListViewExec( QListViewItem* ) ) );
+
+ //Create ListBox
+ QGroupBox* gbListBox = new QGroupBox( 1, Qt::Horizontal, "KListBox", this);
+ m_pListBox = new KListBox( gbListBox );
+ hBox->addWidget( gbListBox );
+ connect( m_pListBox, SIGNAL( executed( QListBoxItem* ) ),
+ this, SLOT( slotListBoxExec( QListBoxItem* ) ) );
+
+ //Initialize buttons
+ cbListView->setChecked( !m_pListView->allColumnsShowFocus() );
+ m_pbgMode->setButton( TopLevel::Extended );
+ slotSwitchMode( TopLevel::Extended );
+
+ //Fill container widgets
+ for( int i = 0; i < 10; i++ ) {
+ new QIconViewItem( m_pIconView, QString("Item%1").arg(i), QPixmap(item_xpm) );
+
+ QListViewItem* lv = new QListViewItem( m_pListView, QString("Item%1").arg(i), QString("Text%1").arg(i) );
+ lv->setPixmap( 0, QPixmap(item_xpm));
+ lv->setPixmap( 1, QPixmap(item_xpm));
+
+ new QListBoxPixmap( m_pListBox, QPixmap(item_xpm), QString("Item%1").arg(i));
+ }
+
+ connect( m_pIconView, SIGNAL( clicked( QIconViewItem* ) ),
+ this, SLOT( slotClicked( QIconViewItem* ) ) );
+ connect( m_pIconView, SIGNAL( doubleClicked( QIconViewItem* ) ),
+ this, SLOT( slotDoubleClicked( QIconViewItem* ) ) );
+}
+
+void TopLevel::slotSwitchMode( int id )
+{
+ m_pIconView->clearSelection();
+ m_pListView->clearSelection();
+ m_pListBox->clearSelection();
+
+ switch( id ) {
+ case TopLevel::NoSelection:
+ m_pIconView->setSelectionMode( KIconView::NoSelection );
+ m_pListView->setSelectionMode( QListView::NoSelection );
+ m_pListBox->setSelectionMode( KListBox::NoSelection );
+ break;
+ case TopLevel::Single:
+ m_pIconView->setSelectionMode( KIconView::Single );
+ m_pListView->setSelectionMode( QListView::Single );
+ m_pListBox->setSelectionMode( KListBox::Single );
+ break;
+ case TopLevel::Multi:
+ m_pIconView->setSelectionMode( KIconView::Multi );
+ m_pListView->setSelectionMode( QListView::Multi );
+ m_pListBox->setSelectionMode( KListBox::Multi );
+ break;
+ case TopLevel::Extended:
+ m_pIconView->setSelectionMode( KIconView::Extended );
+ m_pListView->setSelectionMode( QListView::Extended );
+ m_pListBox->setSelectionMode( KListBox::Extended );
+ break;
+ default:
+ Q_ASSERT(0);
+ }
+}
+
+void TopLevel::slotIconViewExec( QIconViewItem* item )
+{
+ m_plblWidget->setText("KIconView");
+ m_plblSignal->setText("executed");
+ if( item )
+ m_plblItem->setText( item->text() );
+ else
+ m_plblItem->setText("Viewport");
+}
+
+void TopLevel::slotListViewExec( QListViewItem* item )
+{
+ m_plblWidget->setText("KListView");
+ m_plblSignal->setText("executed");
+ if( item )
+ m_plblItem->setText( item->text(0) );
+ else
+ m_plblItem->setText("Viewport");
+}
+
+void TopLevel::slotListBoxExec( QListBoxItem* item )
+{
+ m_plblWidget->setText("KListBox");
+ m_plblSignal->setText("executed");
+ if( item )
+ m_plblItem->setText( item->text() );
+ else
+ m_plblItem->setText("Viewport");
+}
+
+void TopLevel::slotToggleSingleColumn( bool b )
+{
+ m_pListView->setAllColumnsShowFocus( !b );
+}
+
+int main( int argc, char ** argv )
+{
+ app = new KApplication ( argc, argv, "ItemContainerTest" );
+
+ TopLevel *toplevel = new TopLevel(0, "itemcontainertest");
+
+ toplevel->show();
+ toplevel->resize( 600, 300 );
+ app->setMainWidget(toplevel);
+ app->exec();
+}
+
+#include "itemcontainertest.moc"
diff --git a/kdeui/tests/itemcontainertest.h b/kdeui/tests/itemcontainertest.h
new file mode 100644
index 000000000..c6091f5e5
--- /dev/null
+++ b/kdeui/tests/itemcontainertest.h
@@ -0,0 +1,45 @@
+#ifndef _ITEMCONTAINERTEST_H
+#define _ITEMCONTAINERTEST_H
+
+#include <qwidget.h>
+
+class KIconView;
+class KListView;
+class KListBox;
+class QButtonGroup;
+class QLabel;
+
+class TopLevel : public QWidget
+{
+ Q_OBJECT
+public:
+
+ TopLevel( QWidget *parent=0, const char *name=0 );
+
+ enum ViewID { IconView, ListView, ListBox };
+ enum ModeID { NoSelection, Single, Multi, Extended };
+
+public slots:
+ //void slotSwitchView( int id );
+ void slotSwitchMode( int id );
+
+ void slotIconViewExec( QIconViewItem* item );
+ void slotListViewExec( QListViewItem* item );
+ void slotListBoxExec( QListBoxItem* item );
+ void slotToggleSingleColumn( bool b );
+
+ void slotClicked( QIconViewItem* ) { qDebug("CLICK");}
+ void slotDoubleClicked( QIconViewItem* ) { qDebug("DOUBLE CLICK");}
+protected:
+ KIconView* m_pIconView;
+ KListView* m_pListView;
+ KListBox* m_pListBox;
+
+ QButtonGroup* m_pbgView;
+ QButtonGroup* m_pbgMode;
+ QLabel* m_plblWidget;
+ QLabel* m_plblSignal;
+ QLabel* m_plblItem;
+};
+
+#endif
diff --git a/kdeui/tests/kaboutdialogtest.cpp b/kdeui/tests/kaboutdialogtest.cpp
new file mode 100644
index 000000000..89d25d531
--- /dev/null
+++ b/kdeui/tests/kaboutdialogtest.cpp
@@ -0,0 +1,72 @@
+/* -*- C++ -*-
+ * This file shows an example for the KDE about dialog.
+ *
+ * copyright: (C) Mirko Boehm, 1999
+ * license: GNU Public License, Version 2
+ * mail to: Mirko Boehm <mirko@kde.org>
+ * requires: recent C++-compiler, at least Qt 1.4
+ * $Revision$
+ */
+
+#include "kaboutdialog.h"
+// #include <kimgio.h>
+#include <qimage.h>
+#include <kapplication.h>
+#include <klocale.h>
+
+int main(int argc, char** argv)
+{
+ (void)new KApplication(argc, argv, "KAboutDialogTest");
+ QImage logo;
+ QImage bg;
+ QPixmap pix;
+ KAboutDialog about;
+ // -----
+ // kimgioRegister();
+ if(logo.load("RayTracedGear.png"))
+ {
+ pix=logo;
+ about.setLogo(pix);
+ } else {
+ qDebug("main: No logo loaded.");
+ }
+ if(bg.load("background_1.png"))
+ {
+ pix=bg;
+ about.setBackgroundTile(&pix);
+ about.showTile( true );
+ about.enableLinkedHelp( true );
+
+ //about.showBaseFrameTile(true);
+ } else {
+ qDebug("main: No tile loaded.");
+ }
+// about.setButtonOKText
+// ("Cl&ose", "Close this dialog.",
+// "<b>Close</b> the dialog<br>"
+// "<i>(there are no settings to save).</i>");
+ about.setCaption("KAboutDialog example");
+ about.setVersion("KAboutDialog, Draft Study");
+ about.setHelp("kdehelp/intro.html", "intro");
+ // ----- set the application author:
+ about.setAuthor
+ ("Mirko Boehm", "mirko@kde.org", "", "Initial developer.");
+ // ----- set the application maintainer:
+ about.setMaintainer("Any One", // name
+ "anyone@kde.org", // email address
+ "http://www.anyhere.com", // URL
+ "Current maintainer."); // description
+ // ----- add some contributors:
+ about.addContributor("Some One", "someone@kde.org", "http://www.somehere.com",
+ "Making coffee");
+ about.addContributor("Another One",
+ "anotherone@kde.org",
+ "http://www.blablax.com",
+ "Pizza donator");
+ // ----- contents of the dialog have changed, adapt sizes:
+ about.adjust();
+ about.exec();
+ // -----
+ return 0;
+}
+
diff --git a/kdeui/tests/kaccelgentest.cpp b/kdeui/tests/kaccelgentest.cpp
new file mode 100644
index 000000000..d619bdfba
--- /dev/null
+++ b/kdeui/tests/kaccelgentest.cpp
@@ -0,0 +1,51 @@
+#include "kaccelgen.h"
+
+#include <qstringlist.h>
+
+#include <iostream>
+
+using std::cout;
+using std::endl;
+
+void check( const QString &what, const QStringList &expected, const QStringList &received )
+{
+ cout << "Testing " << what.latin1() << ": ";
+ if ( expected == received ) {
+ cout << "ok" << endl;
+ } else {
+ cout << "ERROR!" << endl;
+ cout << "Expected: " << expected.join( "," ).latin1() << endl;
+ cout << "Received: " << received.join( "," ).latin1() << endl;
+ }
+}
+
+int main()
+{
+ QStringList input;
+ input << "foo" << "bar item" << "&baz" << "bif" << "boz" << "boz 2"
+ << "yoyo && dyne";
+
+ QStringList expected;
+ expected << "&foo" << "bar &item" << "&baz" << "bif" << "b&oz" << "boz &2"
+ << "&yoyo && dyne";
+
+ QStringList output;
+ KAccelGen::generate( input, output );
+ check( "QStringList value generation", expected, output );
+
+ QMap<QString,QString> map;
+ for (QStringList::ConstIterator it = input.begin(); it != input.end(); ++it) {
+ map.insert(*it, *it);
+ }
+ input.sort();
+ expected.clear();
+ KAccelGen::generate( input, expected );
+
+ output.clear();
+ KAccelGen::generateFromValues( map, output );
+ check( "map value generation", expected, output );
+
+ output.clear();
+ KAccelGen::generateFromKeys( map, output );
+ check( "map key generation", expected, output );
+}
diff --git a/kdeui/tests/kactiontest.cpp b/kdeui/tests/kactiontest.cpp
new file mode 100644
index 000000000..60fa334ee
--- /dev/null
+++ b/kdeui/tests/kactiontest.cpp
@@ -0,0 +1,38 @@
+
+#include <qguardedptr.h>
+
+#include <kapplication.h>
+#include <kaction.h>
+
+#include <assert.h>
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "kactiontest" );
+
+ KActionCollection coll( static_cast<QObject *>( 0 ) );
+
+ QGuardedPtr<KAction> action1 = new KRadioAction("test",0, &coll);
+ QGuardedPtr<KAction> action2 = new KRadioAction("test",0, &coll);
+ QGuardedPtr<KAction> action3 = new KRadioAction("test",0, &coll);
+ QGuardedPtr<KAction> action4 = new KRadioAction("test",0, &coll);
+ QGuardedPtr<KAction> action5 = new KRadioAction("test",0, &coll);
+ QGuardedPtr<KAction> action6 = new KRadioAction("test",0, &coll);
+ QGuardedPtr<KAction> action7 = new KRadioAction("test",0, &coll);
+
+ coll.clear();
+ assert( coll.isEmpty() );
+
+ assert( action1.isNull() );
+ assert( action2.isNull() );
+ assert( action3.isNull() );
+ assert( action4.isNull() );
+ assert( action5.isNull() );
+ assert( action6.isNull() );
+ assert( action7.isNull() );
+
+ return 0;
+}
+
+/* vim: et sw=4 ts=4
+ */
diff --git a/kdeui/tests/kalphaicontest.h b/kdeui/tests/kalphaicontest.h
new file mode 100644
index 000000000..66d26e6f3
--- /dev/null
+++ b/kdeui/tests/kalphaicontest.h
@@ -0,0 +1,24 @@
+#include <kdebug.h>
+#include <qwidget.h>
+#include <qimage.h>
+#include <qpixmap.h>
+#include <kimageeffect.h>
+#include <kalphapainter.h>
+
+class KAlphaTest : public QWidget
+{
+ public:
+ KAlphaTest();
+ protected:
+ void paintEvent(QPaintEvent *);
+ private:
+ QImage m_image;
+ QPixmap m_pixmap;
+ QImage m_bg;
+
+ public:
+ static bool m_useDblBuffer;
+ static bool m_usePixmap;
+ static bool m_correctOverlapping;
+};
+
diff --git a/kdeui/tests/kblendtest.cpp b/kdeui/tests/kblendtest.cpp
new file mode 100644
index 000000000..f12d65b2b
--- /dev/null
+++ b/kdeui/tests/kblendtest.cpp
@@ -0,0 +1,98 @@
+#include "kblendtest.h"
+#include <kapplication.h>
+#include <kimageeffect.h>
+#include <qpainter.h>
+#include <qdatetime.h>
+#include <qstring.h>
+
+int cols = 3, rows = 3; // how many
+
+KBlendWidget::KBlendWidget(QWidget *parent, const char *name)
+ :QWidget(parent, name)
+{
+
+ bgnd = qRgb(255, 255, 255);
+
+ image = QImage("testimage.png");
+
+ resize(image.width()*2+60, image.height()*3+80);
+ setBackgroundColor(bgnd);
+}
+
+void KBlendWidget::paintEvent(QPaintEvent */*ev*/)
+{
+ QTime time;
+ int it, ft;
+ QString say;
+
+ image = QImage("testimage.png");
+
+ QPainter p(this);
+ p.setPen(Qt::black);
+
+ // you see here use of anti_dir param (blend from down to up, here)
+ time.start();
+ it = time.elapsed();
+ KImageEffect::blend(image, 0.2, bgnd, KImageEffect::VerticalGradient,true);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Vertical";
+ p.drawImage(20, 20, image);
+ p.drawText(5 , 15, say);
+
+ image = QImage("testimage.png");
+
+ // here a negative initial intensity is used (1/2 of image is unaffected)
+ it = time.elapsed();
+ KImageEffect::blend(image, -0.5, bgnd, KImageEffect::HorizontalGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Horizontal";
+ p.drawImage(40+image.width(), 20, image);
+ p.drawText(15+image.width() , 15, say);
+
+ image = QImage("testimage.png");
+
+ it = time.elapsed();
+ KImageEffect::blend(image, 0., bgnd, KImageEffect::DiagonalGradient,true);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Diagonal";
+ p.drawImage(20, 40+image.height(), image);
+ p.drawText(5 , 35+image.height(), say);
+
+ image = QImage("testimage.png");
+
+ it = time.elapsed();
+ KImageEffect::blend(image, 0.1, bgnd, KImageEffect::CrossDiagonalGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, CrossDiagonal";
+ p.drawImage(40+image.width(), 40+image.height(), image);
+ p.drawText(25+image.width() , 35 + image.height(), say);
+
+ image = QImage("testimage.png");
+
+ it = time.elapsed();
+ KImageEffect::blend(image, -0.6, bgnd, KImageEffect::RectangleGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Rectangle";
+ p.drawImage(20, 60+2*image.height(), image);
+ p.drawText(5 , 55+2*image.height(), say);
+
+ image = QImage("testimage.png");
+
+ it = time.elapsed();
+ KImageEffect::blend(image, 0.2, bgnd, KImageEffect::EllipticGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Elliptic";
+ p.drawImage(40+image.width(), 60+2*image.height(), image);
+ p.drawText(25+image.width(), 55+2*image.height(), say);
+ p.end();
+}
+
+int main(int argc, char **argv)
+{
+ KApplication app(argc, argv, "KBlendTest");
+ KBlendWidget w;
+ app.setMainWidget(&w);
+ w.show();
+ return(app.exec());
+}
+
diff --git a/kdeui/tests/kblendtest.h b/kdeui/tests/kblendtest.h
new file mode 100644
index 000000000..800f2d562
--- /dev/null
+++ b/kdeui/tests/kblendtest.h
@@ -0,0 +1,24 @@
+//
+// Simple little hack to show off blending effects.
+//
+// (C) KDE Artistic Cristian Tibirna <tibirna@kde.org>
+//
+
+#ifndef __KBLEND_TEST_H
+#define __KBLEND_TEST_H
+
+#include <qwidget.h>
+#include <qimage.h>
+
+class KBlendWidget : public QWidget
+{
+public:
+ KBlendWidget(QWidget *parent=0, const char *name=0);
+protected:
+ void paintEvent(QPaintEvent *ev);
+private:
+ QImage image, original;
+ QColor bgnd;
+};
+
+#endif
diff --git a/kdeui/tests/kbuttonboxtest.cpp b/kdeui/tests/kbuttonboxtest.cpp
new file mode 100644
index 000000000..d9b070bc0
--- /dev/null
+++ b/kdeui/tests/kbuttonboxtest.cpp
@@ -0,0 +1,205 @@
+/* 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#include <kapplication.h>
+#include "kbuttonbox.h"
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qdialog.h>
+#include <qpushbutton.h>
+
+int main(int argc, char **argv) {
+ KApplication a(argc, argv, "dummy");
+
+ // example 1
+ {
+ QDialog *w = new QDialog(0, "A common dialog", true);
+ w->setCaption("Example 1");
+ QVBoxLayout *tl = new QVBoxLayout(w, 5);
+ QLabel *l = new QLabel("A very common dialog\n\n"\
+ "OK and Cancel are left aligned, Help\n"\
+ "is right aligned. Try resizing\n"\
+ "the window!\n"
+ "Press OK or Cancel when done"
+ , w);
+ l->setAlignment(Qt::AlignVCenter|Qt::AlignLeft|Qt::WordBreak);
+ l->setMinimumSize(l->sizeHint());
+ tl->addWidget(l,1);
+ KButtonBox *bbox = new KButtonBox(w);
+ QPushButton *b = bbox->addButton("OK");
+ b->setDefault(true);
+ w->connect(b, SIGNAL(clicked()),
+ w, SLOT(accept()));
+ w->connect(bbox->addButton("Cancel"), SIGNAL(clicked()),
+ w, SLOT(accept()));
+
+ bbox->addStretch(1);
+ bbox->addButton("Help");
+ bbox->layout();
+ tl->addWidget(bbox,0);
+ tl->activate();
+ w->exec();
+ delete w;
+ }
+
+ // example 2
+ {
+ QDialog *w = new QDialog(0, "Right aligned buttons", true);
+ w->setCaption("Example 2");
+ QVBoxLayout *tl = new QVBoxLayout(w, 5);
+ QLabel *l = new QLabel("Another common dialog\n\n"\
+ "OK and Cancel are right aligned\n"\
+ "Try resizing the window!", w);
+ l->setAlignment(Qt::AlignVCenter|Qt::AlignLeft|Qt::WordBreak);
+ l->setMinimumSize(l->sizeHint());
+ tl->addWidget(l,1);
+ KButtonBox *bbox = new KButtonBox(w);
+ bbox->addStretch(1);
+ QPushButton *b = bbox->addButton("OK");
+ b->setDefault(true);
+ w->connect(b, SIGNAL(clicked()),
+ w, SLOT(accept()));
+ w->connect(bbox->addButton("Cancel"), SIGNAL(clicked()),
+ w, SLOT(accept()));
+ bbox->layout();
+ tl->addWidget(bbox,0);
+ tl->activate();
+ w->exec();
+ delete w;
+ }
+
+ // example 3
+ {
+ QDialog *w = new QDialog(0, "Middle aligned buttons", true);
+ w->setCaption("Example 3");
+ QVBoxLayout *tl = new QVBoxLayout(w, 5);
+ QLabel *l = new QLabel("Another common dialog\n\n"\
+ "OK and Cancel are middle aligned\n"\
+ "Try resizing the window!", w);
+ l->setAlignment(Qt::AlignVCenter|Qt::AlignLeft|Qt::WordBreak);
+ l->setMinimumSize(l->sizeHint());
+ tl->addWidget(l,1);
+ KButtonBox *bbox = new KButtonBox(w);
+ bbox->addStretch(1);
+ QPushButton *b = bbox->addButton("OK");
+ b->setDefault(true);
+ w->connect(b, SIGNAL(clicked()),
+ w, SLOT(accept()));
+ w->connect(bbox->addButton("Cancel"), SIGNAL(clicked()),
+ w, SLOT(accept()));
+ bbox->addStretch(1);
+ bbox->layout();
+ tl->addWidget(bbox,0);
+ tl->activate();
+ w->exec();
+ delete w;
+ }
+
+ // example 4
+ {
+ QDialog *w = new QDialog(0, "Bad example", true);
+ w->setCaption("Example 4");
+ QVBoxLayout *tl = new QVBoxLayout(w, 5);
+ QLabel *l = new QLabel("A very bad example\n\n"\
+ "Sometimes it's a bad idea to take\n"
+ "the maximum width for all buttons\n"
+ "since it will look ugly -- "
+ "anyway, it works", w);
+ l->setAlignment(Qt::AlignVCenter|Qt::AlignLeft|Qt::WordBreak);
+ l->setMinimumSize(l->sizeHint());
+ tl->addWidget(l,1);
+ KButtonBox *bbox = new KButtonBox(w);
+ bbox->addStretch(1);
+ QPushButton *b = bbox->addButton("OK");
+ b->setDefault(true);
+ w->connect(b, SIGNAL(clicked()),
+ w, SLOT(accept()));
+ w->connect(bbox->addButton("Cancel"), SIGNAL(clicked()),
+ w, SLOT(accept()));
+
+ bbox->addButton("Push me and I give you a banana");
+ bbox->addStretch(1);
+ bbox->layout();
+ tl->addWidget(bbox,0);
+ tl->activate();
+ w->exec();
+ delete w;
+ }
+
+ // example 5
+ {
+ QDialog *w = new QDialog(0, "Bad example", true);
+ w->setCaption("Example 5");
+ QVBoxLayout *tl = new QVBoxLayout(w, 5);
+ QLabel *l = new QLabel("A better solution for the bad example\n\n"\
+ "Use \"addButton(\"Push me and I give"
+ "you a banana\", true);\" to\n"
+ "prevent this strange effect as seen\n"
+ "the former example!"
+ ,w);
+ l->setAlignment(Qt::AlignVCenter|Qt::AlignLeft|Qt::WordBreak);
+ l->setMinimumSize(l->sizeHint());
+ tl->addWidget(l,1);
+ KButtonBox *bbox = new KButtonBox(w);
+ bbox->addStretch(1);
+ QPushButton *b = bbox->addButton("OK");
+ b->setDefault(true);
+ w->connect(b, SIGNAL(clicked()),
+ w, SLOT(accept()));
+ w->connect(bbox->addButton("Cancel"), SIGNAL(clicked()),
+ w, SLOT(accept()));
+
+ bbox->addButton("Push me and I give you a banana", true);
+ bbox->addStretch(1);
+ bbox->layout();
+ tl->addWidget(bbox,0);
+ tl->activate();
+ w->exec();
+ delete w;
+ }
+
+ // example 6
+ {
+ QDialog *w = new QDialog(0, "Vertical", true);
+ w->setCaption("Example 6 (last)");
+ QHBoxLayout *tl = new QHBoxLayout(w, 5);
+ QLabel *l = new QLabel("Did I mention that it's possible\n"
+ "to make vertically aligned buttons\n"
+ "too?"
+ ,w);
+ l->setAlignment(Qt::AlignVCenter|Qt::AlignLeft|Qt::WordBreak);
+ l->setMinimumSize(l->sizeHint());
+ tl->addWidget(l,1);
+ KButtonBox *bbox = new KButtonBox(w, KButtonBox::Vertical);
+ QPushButton *b = bbox->addButton("OK");
+ b->setDefault(true);
+ w->connect(b, SIGNAL(clicked()),
+ w, SLOT(accept()));
+ w->connect(bbox->addButton("Cancel"), SIGNAL(clicked()),
+ w, SLOT(accept()));
+
+ bbox->addStretch(1);
+ bbox->layout();
+ tl->addWidget(bbox,0);
+ tl->activate();
+ w->exec();
+ delete w;
+ }
+
+ return 0;
+}
diff --git a/kdeui/tests/kcharselecttest.cpp b/kdeui/tests/kcharselecttest.cpp
new file mode 100644
index 000000000..facd17bca
--- /dev/null
+++ b/kdeui/tests/kcharselecttest.cpp
@@ -0,0 +1,16 @@
+#include <kapplication.h>
+#include <klocale.h>
+#include "kcharselect.h"
+
+int main (int argc,char **argv)
+{
+ KApplication app( argc, argv, "kcharselecttest" );
+
+ KCharSelect selector( 0, "char selector" );
+ selector.resize( selector.sizeHint() );
+ selector.show();
+ selector.setCaption( "KCharSelect Test" );
+
+ app.setMainWidget( &selector );
+ return app.exec();
+}
diff --git a/kdeui/tests/kcolordlgtest.cpp b/kdeui/tests/kcolordlgtest.cpp
new file mode 100644
index 000000000..b5ba68393
--- /dev/null
+++ b/kdeui/tests/kcolordlgtest.cpp
@@ -0,0 +1,41 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 1997 Martin Jones (mjones@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <kapplication.h>
+#include "kcolordialog.h"
+#include <kconfig.h>
+#include <klocale.h>
+
+int main( int argc, char *argv[] )
+{
+ QColor color;
+
+ KLocale::setMainCatalogue("kdelibs");
+ QApplication::setColorMode( QApplication::CustomColors );
+ KApplication a( argc, argv, "KColorDialogTest" );
+ KConfig aConfig;
+ aConfig.setGroup( "KColorDialog-test" );
+
+ color = aConfig.readColorEntry( "Chosen" );
+ int nRet = KColorDialog::getColor( color, Qt::red /*testing default color*/ );
+ aConfig.writeEntry( "Chosen", color );
+
+ return nRet;
+}
+
diff --git a/kdeui/tests/kcolortest.cpp b/kdeui/tests/kcolortest.cpp
new file mode 100644
index 000000000..c4dd5892b
--- /dev/null
+++ b/kdeui/tests/kcolortest.cpp
@@ -0,0 +1,169 @@
+
+#include "kcolortest.h"
+#include <kapplication.h>
+#include <kimageeffect.h>
+#include <stdio.h>
+#include <qdatetime.h>
+
+bool fullscreen = false, oldway = false, intvsfade = false;
+int max = 20; // how many steps
+
+KColorWidget::KColorWidget(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+
+ if (fullscreen || intvsfade) {
+ QPixmap shot = QPixmap::grabWindow(QApplication::desktop()->winId());
+ original = shot.convertToImage();
+ }
+ else
+ original = QImage("testimage.png");
+ resize(original.width(), original.height());
+}
+
+void KColorWidget::paintEvent(QPaintEvent *)
+{
+ if(!pixmap.isNull())
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+}
+
+void KColorWidget::doIntensityLoop()
+{
+ int count;
+
+ int start, stop;
+ QTime t;
+
+ t.start();
+
+ image = original; image.detach();
+
+ if (fullscreen){
+ start = t.elapsed();
+ for(count=0; count < max; ++count){
+ if (!oldway)
+ KImageEffect::intensity(image, -1./max);
+ else {
+ uint *qptr=(uint *)image.bits();
+ QRgb qrgb;
+ int size=pixmap.width()*pixmap.height();
+ for (int i=0;i<size; i++, qptr++)
+ {
+ qrgb=*(QRgb *)qptr;
+ *qptr=qRgb((int)(qRed(qrgb)*1./max),
+ (int)(qGreen(qrgb)*1./max),
+ (int)(qBlue(qrgb)*1./max));
+ }
+ }
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+ stop = t.elapsed();
+ qDebug ("Total fullscreen %s dim time for %d steps : %f s",
+ oldway?"(antonio)":"(intensity)", count, (stop - start)*1e-3);
+
+ if (intvsfade) {
+ image = original; image.detach();
+ start = t.elapsed();
+ for(count=0; count < max; ++count){
+ KImageEffect::fade(image, 1./max, black);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+ }
+ stop = t.elapsed();
+ qDebug ("Total fullscreen (fade) dim time for %d steps : %f s",
+ count, (stop - start)*1e-3);
+
+ }
+
+ else {
+ image = original; image.detach();
+ qDebug("Intensity test");
+ for(count=0; count < max; ++count){
+ KImageEffect::intensity(image, 1./max);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+
+ for(count=0; count < max; ++count){
+ KImageEffect::intensity(image, -1./max);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+
+ image = original; image.detach();
+ qDebug("Red channel intensity test");
+ for(count=0; count < max; ++count){
+ KImageEffect::channelIntensity(image, -1./max, KImageEffect::Red);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+ for(count=0; count < max; ++count){
+ KImageEffect::channelIntensity(image, 1./max, KImageEffect::Red);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+
+ image = original; image.detach();
+ qDebug("Green channel intensity test");
+ for(count=0; count < max; ++count){
+ KImageEffect::channelIntensity(image, -1./max, KImageEffect::Green);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+ for(count=0; count < max; ++count){
+ KImageEffect::channelIntensity(image, 1./max, KImageEffect::Green);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+
+ image = original; image.detach();
+ qDebug("Blue channel intensity test");
+ for(count=0; count < max; ++count){
+ KImageEffect::channelIntensity(image, -1./max, KImageEffect::Blue);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+ for(count=0; count < max; ++count){
+ KImageEffect::channelIntensity(image, 1./max, KImageEffect::Blue);
+ pixmap.convertFromImage(image);
+ bitBlt(this, 0, 0, &pixmap, 0, 0, pixmap.width(), pixmap.height(),
+ Qt::CopyROP, true);
+ }
+ }
+}
+
+int main(int argc, char **argv)
+{
+ if (argc > 1) {
+ if (!strcmp(argv[1], "fullscreen"))
+ {
+ fullscreen = true;
+ if (!strcmp(argv[2], "old_way"))
+ oldway = true;
+ }
+ else if (!strcmp(argv[1], "int_vs_fade")) {
+ intvsfade = fullscreen = true;
+ oldway = false;
+ }
+ else
+ printf("Usage: %s [int_vs_fade | fullscreen [old_way]]\n ", argv[0]);
+ }
+ KApplication *app = new KApplication(argc, argv, "KColorTest");
+ KColorWidget w;
+ app->setMainWidget(&w);
+ w.show();
+ w.doIntensityLoop();
+ return(app->exec());
+}
diff --git a/kdeui/tests/kcolortest.h b/kdeui/tests/kcolortest.h
new file mode 100644
index 000000000..52cce12cc
--- /dev/null
+++ b/kdeui/tests/kcolortest.h
@@ -0,0 +1,21 @@
+#ifndef __KCOLORTEST_H
+#define __KCOLORTEST_H
+
+#include <qwidget.h>
+#include <qimage.h>
+#include <kpixmap.h>
+
+class KColorWidget : public QWidget
+{
+public:
+ KColorWidget(QWidget *parent=0, const char *name=0);
+ void doIntensityLoop();
+protected:
+ void paintEvent(QPaintEvent *ev);
+private:
+ QImage image, original;
+ KPixmap pixmap;
+
+};
+
+#endif
diff --git a/kdeui/tests/kcomboboxtest.cpp b/kdeui/tests/kcomboboxtest.cpp
new file mode 100644
index 000000000..2eb1f73e0
--- /dev/null
+++ b/kdeui/tests/kcomboboxtest.cpp
@@ -0,0 +1,227 @@
+#define protected public // for delegate()
+#include <kcombobox.h>
+#undef protected
+
+#include "kcomboboxtest.h"
+
+#include <assert.h>
+
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <klocale.h>
+#include <kiconloader.h>
+#include <ksimpleconfig.h>
+
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qpixmap.h>
+#include <qlabel.h>
+#include <qhbox.h>
+#include <qtimer.h>
+
+
+KComboBoxTest::KComboBoxTest(QWidget* widget, const char* name )
+ :QWidget(widget, name)
+{
+ QVBoxLayout *vbox = new QVBoxLayout (this, KDialog::marginHint(), KDialog::spacingHint());
+
+ // Test for KCombo's KLineEdit destruction
+ KComboBox *testCombo = new KComboBox( true, this ); // rw, with KLineEdit
+ testCombo->setEditable( false ); // destroys our KLineEdit
+ assert( testCombo->delegate() == 0L );
+ delete testCombo; // not needed anymore
+
+ // Qt combobox
+ QHBox* hbox = new QHBox(this);
+ hbox->setSpacing (KDialog::spacingHint());
+ QLabel* lbl = new QLabel("&QCombobox:", hbox);
+ lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
+
+ m_qc = new QComboBox(hbox, "QtReadOnlyCombo" );
+ lbl->setBuddy (m_qc);
+ QObject::connect (m_qc, SIGNAL(activated(int)), SLOT(slotActivated(int)));
+ QObject::connect (m_qc, SIGNAL(activated(const QString&)), SLOT (slotActivated(const QString&)));
+ vbox->addWidget (hbox);
+
+ // Read-only combobox
+ hbox = new QHBox(this);
+ hbox->setSpacing (KDialog::spacingHint());
+ lbl = new QLabel("&Read-Only Combo:", hbox);
+ lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
+
+ m_ro = new KComboBox(hbox, "ReadOnlyCombo" );
+ lbl->setBuddy (m_ro);
+ m_ro->setCompletionMode( KGlobalSettings::CompletionAuto );
+ QObject::connect (m_ro, SIGNAL(activated(int)), SLOT(slotActivated(int)));
+ QObject::connect (m_ro, SIGNAL(activated(const QString&)), SLOT (slotActivated(const QString&)));
+ vbox->addWidget (hbox);
+
+ // Read-write combobox
+ hbox = new QHBox(this);
+ hbox->setSpacing (KDialog::spacingHint());
+ lbl = new QLabel("&Editable Combo:", hbox);
+ lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
+
+ m_rw = new KComboBox( true, hbox, "ReadWriteCombo" );
+ lbl->setBuddy (m_rw);
+ m_rw->setDuplicatesEnabled( true );
+ m_rw->setInsertionPolicy( QComboBox::NoInsertion );
+ m_rw->setTrapReturnKey( true );
+ QObject::connect (m_rw, SIGNAL(activated(int)), SLOT(slotActivated(int)));
+ QObject::connect (m_rw, SIGNAL(activated(const QString&)), SLOT(slotActivated(const QString&)));
+ QObject::connect (m_rw, SIGNAL(returnPressed()), SLOT(slotReturnPressed()));
+ QObject::connect (m_rw, SIGNAL(returnPressed(const QString&)), SLOT(slotReturnPressed(const QString&)));
+ vbox->addWidget (hbox);
+
+ // History combobox...
+ hbox = new QHBox(this);
+ hbox->setSpacing (KDialog::spacingHint());
+ lbl = new QLabel("&History Combo:", hbox);
+ lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
+
+ m_hc = new KHistoryCombo( true, hbox, "HistoryCombo" );
+ lbl->setBuddy (m_hc);
+ m_hc->setDuplicatesEnabled( true );
+ m_hc->setInsertionPolicy( QComboBox::NoInsertion );
+ QObject::connect (m_hc, SIGNAL(activated(int)), SLOT(slotActivated(int)));
+ QObject::connect (m_hc, SIGNAL(activated(const QString&)), SLOT(slotActivated(const QString&)));
+ QObject::connect (m_hc, SIGNAL(returnPressed()), SLOT(slotReturnPressed()));
+ vbox->addWidget (hbox);
+ m_hc->setTrapReturnKey(true);
+
+ // Read-write combobox that is a replica of code in konqueror...
+ hbox = new QHBox(this);
+ hbox->setSpacing (KDialog::spacingHint());
+ lbl = new QLabel( "&Konq's Combo:", hbox);
+ lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred);
+
+ m_konqc = new KComboBox( true, hbox, "KonqyCombo" );
+ lbl->setBuddy (m_konqc);
+ m_konqc->setMaxCount( 10 );
+ QObject::connect (m_konqc, SIGNAL(activated(int)), SLOT(slotActivated(int)));
+ QObject::connect (m_konqc, SIGNAL(activated(const QString&)), SLOT (slotActivated(const QString&)));
+ QObject::connect (m_konqc, SIGNAL(returnPressed()), SLOT(slotReturnPressed()));
+ vbox->addWidget (hbox);
+
+ // Create an exit button
+ hbox = new QHBox (this);
+ m_btnExit = new QPushButton( "E&xit", hbox );
+ QObject::connect( m_btnExit, SIGNAL(clicked()), SLOT(quitApp()) );
+
+ // Create a disable button...
+ m_btnEnable = new QPushButton( "Disa&ble", hbox );
+ QObject::connect (m_btnEnable, SIGNAL(clicked()), SLOT(slotDisable()));
+
+ vbox->addWidget (hbox);
+
+ // Popuplate the select-only list box
+ QStringList list;
+ list << "Stone" << "Tree" << "Peables" << "Ocean" << "Sand" << "Chips"
+ << "Computer" << "Mankind";
+ list.sort();
+
+ // Setup the qcombobox
+ m_qc->insertStringList (list);
+
+ // Setup read-only combo
+ m_ro->insertStringList( list );
+ m_ro->completionObject()->setItems( list );
+
+ // Setup read-write combo
+ m_rw->insertStringList( list );
+ m_rw->completionObject()->setItems( list );
+
+ // Setup read-write combo
+ m_hc->insertStringList( list );
+ m_hc->completionObject()->setItems( list );
+
+ // Setup konq's combobox
+ KSimpleConfig historyConfig( "konq_history" );
+ historyConfig.setGroup( "Location Bar" );
+ KCompletion * s_pCompletion = new KCompletion;
+ s_pCompletion->setOrder( KCompletion::Weighted );
+ s_pCompletion->setItems( historyConfig.readListEntry( "ComboContents" ) );
+ s_pCompletion->setCompletionMode( KGlobalSettings::completionMode() );
+ m_konqc->setCompletionObject( s_pCompletion );
+
+ QPixmap pix = SmallIcon("www");
+ m_konqc->insertItem( pix, "http://www.kde.org" );
+ m_konqc->setCurrentItem( m_konqc->count()-1 );
+
+ m_timer = new QTimer (this);
+ connect (m_timer, SIGNAL (timeout()), SLOT (slotTimeout()));
+}
+
+KComboBoxTest::~KComboBoxTest()
+{
+ if (m_timer)
+ {
+ delete m_timer;
+ m_timer = 0;
+ }
+}
+
+void KComboBoxTest::slotDisable ()
+{
+ if (m_timer->isActive())
+ return;
+
+ m_btnEnable->setEnabled (!m_btnEnable->isEnabled());
+
+ m_timer->start (5000, true);
+}
+
+void KComboBoxTest::slotTimeout ()
+{
+ bool enabled = m_ro->isEnabled();
+
+ if (enabled)
+ m_btnEnable->setText ("Ena&ble");
+ else
+ m_btnEnable->setText ("Disa&ble");
+
+ m_qc->setEnabled (!enabled);
+ m_ro->setEnabled (!enabled);
+ m_rw->setEnabled (!enabled);
+ m_hc->setEnabled (!enabled);
+ m_konqc->setEnabled (!enabled);
+
+ m_btnEnable->setEnabled (!m_btnEnable->isEnabled());
+}
+
+void KComboBoxTest::slotActivated( int index )
+{
+ kdDebug() << "Activated Combo: " << sender()->name() << ", index:" << index << endl;
+}
+
+void KComboBoxTest::slotActivated (const QString& item)
+{
+ kdDebug() << "Activated Combo: " << sender()->name() << ", item: " << item << endl;
+}
+
+void KComboBoxTest::slotReturnPressed ()
+{
+ kdDebug() << "Return Pressed: " << sender()->name() << endl;
+}
+
+void KComboBoxTest::slotReturnPressed(const QString& item)
+{
+ kdDebug() << "Return Pressed, value = " << item << endl;
+}
+
+void KComboBoxTest::quitApp()
+{
+ kapp->closeAllWindows();
+}
+
+int main ( int argc, char **argv)
+{
+ KApplication a(argc, argv, "kcomboboxtest");
+ KComboBoxTest* t= new KComboBoxTest;
+ a.setMainWidget (t);
+ t->show ();
+ return a.exec();
+}
+
+#include "kcomboboxtest.moc"
diff --git a/kdeui/tests/kcomboboxtest.h b/kdeui/tests/kcomboboxtest.h
new file mode 100644
index 000000000..8c2a463b6
--- /dev/null
+++ b/kdeui/tests/kcomboboxtest.h
@@ -0,0 +1,44 @@
+#ifndef _KCOMBOBOXTEST_H
+#define _KCOMBOBOXTEST_H
+
+#include <qwidget.h>
+
+class QTimer;
+class QComboBox;
+class QPushButton;
+
+class KComboBox;
+
+class KComboBoxTest : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KComboBoxTest ( QWidget *parent=0, const char *name=0 );
+ ~KComboBoxTest();
+
+private slots:
+ void quitApp();
+ void slotTimeout();
+ void slotDisable();
+ void slotReturnPressed();
+ void slotReturnPressed(const QString&);
+ void slotActivated( int );
+ void slotActivated( const QString& );
+
+protected:
+ QComboBox* m_qc;
+
+ KComboBox* m_ro;
+ KComboBox* m_rw;
+ KComboBox* m_hc;
+ KComboBox* m_konqc;
+
+
+ QPushButton* m_btnExit;
+ QPushButton* m_btnEnable;
+
+ QTimer* m_timer;
+};
+
+#endif
diff --git a/kdeui/tests/kcompletiontest.cpp b/kdeui/tests/kcompletiontest.cpp
new file mode 100644
index 000000000..e04fdfc22
--- /dev/null
+++ b/kdeui/tests/kcompletiontest.cpp
@@ -0,0 +1,198 @@
+#include <klocale.h>
+/****************************************************************************
+** Form implementation generated from reading ui file './kcompletiontest.ui'
+**
+** Created: Wed Nov 15 20:15:10 2000
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#include "kcompletiontest.h"
+
+#include <qgroupbox.h>
+#include <qlabel.h>
+#include <qlistbox.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include <kapplication.h>
+#include <klineedit.h>
+#include <kcombobox.h>
+/*
+ * Constructs a Form1 which is a child of 'parent', with the
+ * name 'name' and widget flags set to 'f'
+ */
+Form1::Form1( QWidget* parent, const char* name )
+ : QWidget( parent, name, WDestructiveClose )
+{
+ if ( !name )
+ setName( "Form1" );
+ resize( 559, 465 );
+ setCaption( "Form1" );
+ Form1Layout = new QVBoxLayout( this );
+ Form1Layout->setSpacing( 6 );
+ Form1Layout->setMargin( 11 );
+
+ GroupBox1 = new QGroupBox( this, "GroupBox1" );
+ GroupBox1->setTitle( "Completion Test" );
+ GroupBox1->setColumnLayout(0, Qt::Vertical );
+ GroupBox1->layout()->setSpacing( 0 );
+ GroupBox1->layout()->setMargin( 0 );
+ GroupBox1Layout = new QVBoxLayout( GroupBox1->layout() );
+ GroupBox1Layout->setAlignment( Qt::AlignTop );
+ GroupBox1Layout->setSpacing( 6 );
+ GroupBox1Layout->setMargin( 11 );
+
+ Layout9 = new QVBoxLayout;
+ Layout9->setSpacing( 6 );
+ Layout9->setMargin( 0 );
+
+ Layout1 = new QHBoxLayout;
+ Layout1->setSpacing( 6 );
+ Layout1->setMargin( 0 );
+
+ TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
+ TextLabel1->setText( "Completion" );
+ Layout1->addWidget( TextLabel1 );
+
+ edit = new KLineEdit( GroupBox1, "edit" );
+ Layout1->addWidget( edit );
+ Layout9->addLayout( Layout1 );
+ edit->completionObject()->setItems( defaultItems() );
+ edit->completionObject()->setIgnoreCase( true );
+ edit->setFocus();
+ QToolTip::add( edit, "right-click to change completion mode" );
+
+ Layout2 = new QHBoxLayout;
+ Layout2->setSpacing( 6 );
+ Layout2->setMargin( 0 );
+
+ combo = new KHistoryCombo( GroupBox1, "history combo" );
+ combo->setCompletionObject( edit->completionObject() );
+ // combo->setMaxCount( 5 );
+ combo->setHistoryItems( defaultItems(), true );
+ connect( combo, SIGNAL( activated( const QString& )),
+ combo, SLOT( addToHistory( const QString& )));
+ QToolTip::add( combo, "KHistoryCombo" );
+ Layout2->addWidget( combo );
+
+ LineEdit1 = new KLineEdit( GroupBox1, "LineEdit1" );
+ Layout2->addWidget( LineEdit1 );
+
+ PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
+ PushButton1->setText( "Add" );
+ connect( PushButton1, SIGNAL( clicked() ), SLOT( slotAdd() ));
+ Layout2->addWidget( PushButton1 );
+ Layout9->addLayout( Layout2 );
+
+ Layout3 = new QHBoxLayout;
+ Layout3->setSpacing( 6 );
+ Layout3->setMargin( 0 );
+ QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+ Layout3->addItem( spacer );
+
+ PushButton1_4 = new QPushButton( GroupBox1, "PushButton1_4" );
+ PushButton1_4->setText( "Remove" );
+ connect( PushButton1_4, SIGNAL( clicked() ), SLOT( slotRemove() ));
+ Layout3->addWidget( PushButton1_4 );
+ Layout9->addLayout( Layout3 );
+
+ Layout8 = new QHBoxLayout;
+ Layout8->setSpacing( 6 );
+ Layout8->setMargin( 0 );
+
+ ListBox1 = new QListBox( GroupBox1, "ListBox1" );
+ Layout8->addWidget( ListBox1 );
+ connect( ListBox1, SIGNAL( highlighted( const QString& )),
+ SLOT( slotHighlighted( const QString& )));
+ QToolTip::add( ListBox1, "Contains the contents of the completion object.\n:x is the weighting, i.e. how often an item has been inserted");
+
+ Layout7 = new QVBoxLayout;
+ Layout7->setSpacing( 6 );
+ Layout7->setMargin( 0 );
+
+ PushButton1_3 = new QPushButton( GroupBox1, "PushButton1_3" );
+ PushButton1_3->setText( "Completion items" );
+ connect( PushButton1_3, SIGNAL( clicked() ), SLOT( slotList() ));
+ Layout7->addWidget( PushButton1_3 );
+
+ PushButton1_2 = new QPushButton( GroupBox1, "PushButton1_2" );
+ PushButton1_2->setText( "Clear" );
+ connect( PushButton1_2, SIGNAL( clicked() ),
+ edit->completionObject(), SLOT( clear() ));
+ Layout7->addWidget( PushButton1_2 );
+ Layout8->addLayout( Layout7 );
+ Layout9->addLayout( Layout8 );
+ GroupBox1Layout->addLayout( Layout9 );
+ Form1Layout->addWidget( GroupBox1 );
+
+ slotList();
+}
+
+/*
+ * Destroys the object and frees any allocated resources
+ */
+Form1::~Form1()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
+
+void Form1::slotAdd()
+{
+ qDebug("** adding: %s", LineEdit1->text().latin1() );
+ edit->completionObject()->addItem( LineEdit1->text() );
+
+ QStringList matches = edit->completionObject()->allMatches("S");
+ QStringList::ConstIterator it = matches.begin();
+ for ( ; it != matches.end(); ++it )
+ qDebug("-- %s", (*it).latin1());
+}
+
+void Form1::slotRemove()
+{
+ edit->completionObject()->removeItem( LineEdit1->text() );
+}
+
+void Form1::slotList()
+{
+ ListBox1->clear();
+ QStringList items = edit->completionObject()->items();
+ ListBox1->insertStringList( items );
+}
+
+void Form1::slotHighlighted( const QString& text )
+{
+ // remove any "weighting"
+ int index = text.findRev( ':' );
+ if ( index > 0 )
+ LineEdit1->setText( text.left( index ) );
+ else
+ LineEdit1->setText( text );
+}
+
+
+QStringList Form1::defaultItems() const
+{
+ QStringList items;
+ items << "Super" << "Sushi" << "Samson" << "Sucks" << "Sumo" << "Schumi";
+ items << "Slashdot" << "sUpEr" << "SUshi" << "sUshi" << "sUShi";
+ items << "sushI" << "SushI";
+ return items;
+}
+
+
+int main(int argc, char **argv )
+{
+ KApplication app( argc, argv, "kcompletiontest" );
+
+ Form1 *form = new Form1();
+ form->show();
+
+ return app.exec();
+}
+
+
+#include "kcompletiontest.moc"
diff --git a/kdeui/tests/kcompletiontest.h b/kdeui/tests/kcompletiontest.h
new file mode 100644
index 000000000..e2f5a2bee
--- /dev/null
+++ b/kdeui/tests/kcompletiontest.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+** Form interface generated from reading ui file './kcompletiontest.ui'
+**
+** Created: Wed Nov 15 20:12:56 2000
+** by: The User Interface Compiler (uic)
+**
+** WARNING! All changes made in this file will be lost!
+****************************************************************************/
+#ifndef FORM1_H
+#define FORM1_H
+
+#include <qstringlist.h>
+#include <qvariant.h>
+#include <qwidget.h>
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QGroupBox;
+class QLabel;
+class QListBox;
+class QListBoxItem;
+class QPushButton;
+
+class KHistoryCombo;
+class KLineEdit;
+
+
+class Form1 : public QWidget
+{
+ Q_OBJECT
+
+public:
+ Form1( QWidget* parent = 0, const char* name = 0 );
+ ~Form1();
+
+ QGroupBox* GroupBox1;
+ QLabel* TextLabel1;
+ KLineEdit* LineEdit1;
+ QPushButton* PushButton1;
+ QPushButton* PushButton1_4;
+ QListBox* ListBox1;
+ QPushButton* PushButton1_3;
+ QPushButton* PushButton1_2;
+
+ KLineEdit* edit;
+ KHistoryCombo *combo;
+
+protected slots:
+ void slotList();
+ void slotAdd();
+ void slotRemove();
+ void slotHighlighted( const QString& );
+
+protected:
+ QStringList defaultItems() const;
+
+ QVBoxLayout* Form1Layout;
+ QVBoxLayout* GroupBox1Layout;
+ QVBoxLayout* Layout9;
+ QHBoxLayout* Layout1;
+ QHBoxLayout* Layout2;
+ QHBoxLayout* Layout3;
+ QHBoxLayout* Layout8;
+ QVBoxLayout* Layout7;
+};
+
+#endif // FORM1_H
diff --git a/kdeui/tests/kdatepicktest.cpp b/kdeui/tests/kdatepicktest.cpp
new file mode 100644
index 000000000..eeef5945f
--- /dev/null
+++ b/kdeui/tests/kdatepicktest.cpp
@@ -0,0 +1,16 @@
+#include "kdatepicker.h"
+#include <qlineedit.h>
+#include <kapplication.h>
+#include <klocale.h>
+
+int main(int argc, char** argv)
+{
+ KLocale::setMainCatalogue("kdelibs");
+ KApplication app(argc, argv, "KDatePickertest");
+ KDatePicker picker;
+ app.setMainWidget(&picker);
+ picker.show();
+ // picker.setEnabled(false);
+ return app.exec();
+}
+
diff --git a/kdeui/tests/kdatetimewidgettest.cpp b/kdeui/tests/kdatetimewidgettest.cpp
new file mode 100644
index 000000000..fd3680be0
--- /dev/null
+++ b/kdeui/tests/kdatetimewidgettest.cpp
@@ -0,0 +1,14 @@
+#include "kdatetimewidget.h"
+#include <kapplication.h>
+#include <klocale.h>
+
+int main(int argc, char** argv)
+{
+ KLocale::setMainCatalogue("kdelibs");
+ KApplication app(argc, argv, "KDateTimeWidgettest");
+ KDateTimeWidget dateTimeWidget;
+ app.setMainWidget(&dateTimeWidget);
+ dateTimeWidget.show();
+ // dateTimeWidget.setEnabled(false);
+ return app.exec();
+}
diff --git a/kdeui/tests/kdatewidgettest.cpp b/kdeui/tests/kdatewidgettest.cpp
new file mode 100644
index 000000000..d58037960
--- /dev/null
+++ b/kdeui/tests/kdatewidgettest.cpp
@@ -0,0 +1,16 @@
+#include "kdatewidget.h"
+#include <qlineedit.h>
+#include <kapplication.h>
+#include <klocale.h>
+
+int main(int argc, char** argv)
+{
+ KLocale::setMainCatalogue("kdelibs");
+ KApplication app(argc, argv, "KDateWidgettest");
+ KDateWidget dateWidget;
+ app.setMainWidget(&dateWidget);
+ dateWidget.show();
+ // dateWidget.setEnabled(false);
+ return app.exec();
+}
+
diff --git a/kdeui/tests/kdesattest.cpp b/kdeui/tests/kdesattest.cpp
new file mode 100644
index 000000000..803e2e0ee
--- /dev/null
+++ b/kdeui/tests/kdesattest.cpp
@@ -0,0 +1,65 @@
+#include "kdesattest.h"
+#include <kapplication.h>
+#include <kimageeffect.h>
+#include <qpainter.h>
+#include <qdatetime.h>
+#include <qstring.h>
+
+int cols = 3, rows = 3; // how many
+
+KDesatWidget::KDesatWidget(QWidget *parent, const char *name)
+ :QWidget(parent, name)
+{
+
+ image = QImage("testimage.png");
+ slide = new KDoubleNumInput(700, this, "desat");
+ slide->setRange(0, 1, 0.001);
+ slide->setLabel("Desaturate: ", AlignVCenter | AlignLeft);
+ connect(slide,SIGNAL(valueChanged(double)), this, SLOT(change(double)));
+
+ resize(image.width()*2, image.height() + slide->height());
+ slide->setGeometry(0, image.height(), image.width()*2, slide->height());
+}
+
+void KDesatWidget::change(double) {
+ desat_value = slide->value();
+ repaint(false);
+}
+
+void KDesatWidget::paintEvent(QPaintEvent */*ev*/)
+{
+ QTime time;
+ int it, ft;
+ QString say;
+
+ QPainter p(this);
+ p.setPen(Qt::black);
+
+ // original image
+ time.start();
+ it = time.elapsed();
+ image = QImage("testimage.png");
+ p.drawImage(0, 0, image);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Vertical";
+ p.drawText(5 , 15, say);
+
+ // desaturated image
+ it = time.elapsed();
+ image = KImageEffect::desaturate(image, desat_value);
+ p.drawImage(image.width(), 0, image);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Horizontal";
+ p.drawText(15+image.width() , 15, say);
+}
+
+int main(int argc, char **argv)
+{
+ KApplication *app = new KApplication(argc, argv, "KDesatTest");
+ KDesatWidget w;
+ app->setMainWidget(&w);
+ w.show();
+ return(app->exec());
+}
+
+#include "kdesattest.moc"
diff --git a/kdeui/tests/kdesattest.h b/kdeui/tests/kdesattest.h
new file mode 100644
index 000000000..71a51c0be
--- /dev/null
+++ b/kdeui/tests/kdesattest.h
@@ -0,0 +1,31 @@
+//
+// Simple little hack to show off blending effects.
+//
+// (C) KDE Artistic Cristian Tibirna <tibirna@kde.org>
+//
+
+#ifndef __KBLEND_TEST_H
+#define __KBLEND_TEST_H
+
+#include <qwidget.h>
+#include <qimage.h>
+#include <knuminput.h>
+
+class KDesatWidget : public QWidget
+{
+Q_OBJECT
+public:
+ KDesatWidget(QWidget *parent=0, const char *name=0);
+
+public slots:
+ void change(double);
+
+protected:
+ void paintEvent(QPaintEvent *ev);
+private:
+ float desat_value;
+ QImage image;
+ KDoubleNumInput *slide;
+};
+
+#endif
diff --git a/kdeui/tests/kdialogbasetest.cpp b/kdeui/tests/kdialogbasetest.cpp
new file mode 100644
index 000000000..998e10d02
--- /dev/null
+++ b/kdeui/tests/kdialogbasetest.cpp
@@ -0,0 +1,77 @@
+#include <kapplication.h>
+#include <kdialogbase.h>
+
+#include <qstring.h>
+#include <qtextview.h>
+
+int main(int argc, char** argv)
+{
+ KApplication app(argc, argv, "DialogBaseTest");
+ // -----
+ QString text= // the explanation shown by the example dialog
+ "<center><h1>DialogBase Example</h1></center><hr><br>"
+ "This example shows the usage of the <i>DialogBase</i> class. "
+ "<i>DialogBase</i> is the KDE user interface class used to create "
+ "dialogs with unique layout without having to define an own dialog "
+ "style for your application. <br>"
+ "It provides three standard buttons (<b>OK</b>, <b>Apply</b>, and "
+ "<b>Cancel</b>) that are needed in most dialogs. Each one may be "
+ "hidden, enabled or disabled, and tooltips and quickhelp texts might be"
+ " added. And you do not need to bother about geometry management, this "
+ "is all done automatically.<br>"
+ "To polish your user interface even further, you might want to add "
+ "textures to the inner and the outer frame of the dialog (the frame is "
+ "created by the dialog object). This is done "
+ "using the <tt>setMainFrameTile</tt> and the <tt>setBaseFrameTile</tt> "
+ "methods. These tiles are added application-wide, so each dialog "
+ "of you application uses the same tiles. This is a tribute to a "
+ "comprehensable user interface.<br>"
+ "The class supports the creation of dialogs without being forced "
+ "to derive an own class for it, but you may derive your own class "
+ "for a better code structure.<br>"
+ "If you wrote a help chapter explaining what your dialog does, you "
+ "should add a link to it to the dialog using <tt>setHelp</tt>. You do "
+ "not have to take care about launching the help viewer, just set the "
+ "help file and topic and of course copy it to your documentation "
+ "directory during the program installation.";
+ /* Create the dialog object. DialogBase is derived from QDialog, but
+ you do not need to derive it to create a nice-looking dialog. Mostly,
+ you already have a widget class representing the core of your dialog,
+ and you only need to add a frame around it and the default buttons.
+
+ If you want to derive it, you still can, moving all code shown here
+ inside of your new class. */
+ KDialogBase dialog;
+ /* Set a help chapter. If you do not set one, the link is not shown, and the
+ upper part of the frame shrinks as much as possible. The help window "
+ "will of course only pop up if you correctly installed kdebase. */
+ // I disabled it, as khcclient did not run for me.
+ // dialog.setHelp("kdehelp/intro.html", "", "");
+ /* This QTextView is intended to be the main widget of our dialog. The
+ main widget is placed inside the dialogs frame, with the buttons below
+ it. You do not have to take care about the size handling, but it is a
+ good idea to set the main wigdets minimum size, since the sizes Qt and
+ the DialogBase class guess are sometimes ugly.
+
+ It is important that your main widget is created with the dialog object
+ as its parent! */
+ QTextView view(text, QString::null, &dialog);
+ //view.setMinimumSize(400, view.heightForWidth(400)+20);
+ view.setMinimumSize( 250, 300 );
+ dialog.setMainWidget(&view);
+ /* After finishing the setup of your main widget, the dialog needs to be
+ adjusted. It is not done automatically, since the layout of the main
+ widget may change before the dialog is shown. Additionally, setting a
+ help chapter may cause a need for adjustment since it modifies the height
+ of the upper frame. */
+ dialog.resize(dialog.minimumSize());
+ /* The dialog object is used just as any other QDialog: */
+ if(dialog.exec())
+ {
+ qDebug("Accepted.");
+ } else {
+ qDebug("Rejected.");
+ }
+ return 0;
+}
+
diff --git a/kdeui/tests/kdocktest.cpp b/kdeui/tests/kdocktest.cpp
new file mode 100644
index 000000000..c6df63ddb
--- /dev/null
+++ b/kdeui/tests/kdocktest.cpp
@@ -0,0 +1,65 @@
+#include "kdocktest.h"
+
+#include <kapplication.h>
+#include <kiconloader.h>
+
+#include <qwidget.h>
+#include <qstring.h>
+
+DockTest::DockTest( QWidget* parent )
+ : KDockArea( parent )
+{
+ m_blueDock = createDockWidget( "Blue Widget", SmallIcon("mail") );
+ //m_blueDock->setDetachable( false );
+ m_blueDock->setEnableDocking( KDockWidget::DockFullSite );
+ KDockWidgetHeader *header = new KDockWidgetHeader( m_blueDock, "Blue Header" );
+ header->forceCloseButtonHidden();
+ m_blueDock->setHeader( header );
+ m_blueDock->setCaption( "Blue" );
+ m_blueDock->setGeometry( 50, 50, 100, 100 );
+ QWidget *l = new QWidget( m_blueDock );
+ l->setBackgroundColor( Qt::blue );
+ l->setMinimumSize( 100,100 );
+ m_blueDock->setWidget( l );
+
+ setMainDockWidget( m_blueDock );
+
+ m_redDock = createDockWidget( "Red Widget", SmallIcon("news") );
+ m_redDock->setEnableDocking( KDockWidget::DockFullSite );
+ //m_redDock->setDetachable( false );
+ header = new KDockWidgetHeader( m_redDock, "Red kHeader" );
+ m_redDock->setHeader( header );
+ m_redDock->setCaption( "Red" );
+ m_redDock->setGeometry( 50, 50, 100, 100 );
+ l = new QWidget( m_redDock );
+ l->setBackgroundColor( Qt::red );
+ l->setMinimumSize( 100,100 );
+ m_redDock->setWidget( l );
+ m_redDock->manualDock( m_blueDock, KDockWidget::DockLeft, 3000 );
+
+ m_yellowDock = createDockWidget( "Yellow Widget", SmallIcon("web") );
+ m_yellowDock->setEnableDocking( KDockWidget::DockFullSite );
+ //m_yellowDock->setDetachable( false );
+// header = new KDockWidgetHeader( m_yellowDock, "Yellow Header" );
+ // m_yellowDock->setHeader( header );
+ m_yellowDock->setCaption( "Yellow" );
+ m_yellowDock->setGeometry( 50, 50, 100, 100 );
+ l = new QWidget( m_yellowDock );
+ l->setBackgroundColor( Qt::yellow );
+ l->setMinimumSize( 100,100 );
+ m_yellowDock->setWidget( l );
+ m_yellowDock->manualDock( m_blueDock, KDockWidget::DockTop, 5000 );
+}
+
+int
+main( int argc, char** argv )
+{
+ KApplication a( argc,argv, "docktest" );
+ DockTest* ap = new DockTest();
+ ap->setCaption("DockWidget demo");
+ a.setMainWidget( ap );
+ ap->show();
+ return a.exec();
+}
+
+#include "kdocktest.moc"
diff --git a/kdeui/tests/kdocktest.h b/kdeui/tests/kdocktest.h
new file mode 100644
index 000000000..906e3bd22
--- /dev/null
+++ b/kdeui/tests/kdocktest.h
@@ -0,0 +1,19 @@
+#ifndef KDOCKTEST_H
+#define KDOCKTEST_H
+
+#include <kdockwidget.h>
+
+class QWidget;
+class DockTest : public KDockArea
+{
+ Q_OBJECT
+public:
+ DockTest( QWidget* parent=0 );
+
+private:
+ KDockWidget* m_blueDock;
+ KDockWidget* m_redDock;
+ KDockWidget* m_yellowDock;
+};
+
+#endif
diff --git a/kdeui/tests/kdockwidgetdemo.cpp b/kdeui/tests/kdockwidgetdemo.cpp
new file mode 100644
index 000000000..e0ff60897
--- /dev/null
+++ b/kdeui/tests/kdockwidgetdemo.cpp
@@ -0,0 +1,796 @@
+#include "kdockwidgetdemo.h"
+
+#include <qheader.h>
+#include <qtoolbutton.h>
+#include <qtooltip.h>
+#include <qtextview.h>
+#include <qfileinfo.h>
+#include <qfile.h>
+#include <qtextstream.h>
+#include <qhbox.h>
+#include <qlabel.h>
+#include <qmultilineedit.h>
+#include <qevent.h>
+#include <qpopupmenu.h>
+#include <qpushbutton.h>
+#include <qpoint.h>
+#include <qmessagebox.h>
+#include <qmime.h>
+#include <qstrlist.h>
+#include <qpainter.h>
+
+#include <kconfig.h>
+#include <kapplication.h>
+//#include <kimgio.h>
+#include <stdlib.h>
+
+static const char *dir_tree_xpm[] = {
+"16 16 8 1",
+" c Gray0",
+". c #000080",
+"X c Cyan",
+"o c #808000",
+"O c Yellow",
+"+ c #808080",
+"@ c None",
+"# c #c1c1c1",
+"@@@@@@@@@@@@@@@@",
+"@@@+++++@@@@@@@@",
+"@@+@O@O@+@@@@@@@",
+"@+@O@O@O@++++++@",
+"@+@@@@@@@@@@@@o ",
+"@+@O@++ +O@O@Oo ",
+"@+@@+@X@ +O@O@o ",
+"@+@+@X@X@ +O@Oo ",
+"@+@+X@X@X o@O@o ",
+"@+@+@X@X@ oO@Oo ",
+"@+@@+@X@ +ooO@o ",
+"@+@O@+ +@..oOo ",
+"@+ooooooo.X..oo ",
+"@@ .X.. @",
+"@@@@@@@@@@@.X.. ",
+"@@@@@@@@@@@@.X. "
+};
+
+static const char *preview_xpm[] = {
+"16 16 6 1",
+" c Gray0",
+". c #000080",
+"X c Yellow",
+"o c #808080",
+"O c None",
+"+ c Gray100",
+"OOOOOOOOOOOOOOOO",
+"OOo oOOOOOOO",
+"Oo oooo OOOOOO",
+"O OOOOoo oOOOOO",
+"O OOOO++oo OOOOO",
+"O OOOO++Oo OOOOO",
+"O O+OOOOOo OOOOO",
+"O OO+OOOOo OOOOO",
+"OooOO+OOo OOOOO",
+"OO oOOOo + OOOO",
+"OOOo .X+ OOO",
+"OOOOOOOOO .X+ OO",
+"OOOOOOOOOO .X+ O",
+"OOOOOOOOOOO .X O",
+"OOOOOOOOOOOO OO",
+"OOOOOOOOOOOOOOOO"
+};
+
+SFileDialog::SFileDialog( QString initially, const QStringList& filter, const char* name )
+:QDialog(0L,name,true)
+{
+ KConfig* config = kapp->config();
+ config->setGroup( QString::fromLatin1("SFileDialogData:") + name );
+ if ( initially.isNull() ){
+ initially = config->readPathEntry( "InitiallyDir", QDir::currentDirPath() );
+ }
+
+ QStringList bookmark;
+ bookmark = config->readListEntry( "Bookmarks" );
+
+ dockManager = new KDockManager(this);
+
+ d_dirView = new KDockWidget( dockManager, "Dock_DirView", QPixmap(dir_tree_xpm) );
+ d_dirView->setCaption("Tree");
+
+ dirView = new DirectoryView( d_dirView, 0 );
+ dirView->addColumn( "" );
+ dirView->header()->hide();
+ d_dirView->setWidget( dirView );
+
+ Directory* root = new Directory( dirView, "/" );
+ root->setOpen(true);
+
+ d_preview = new KDockWidget( dockManager, "Dock_Preview", QPixmap(preview_xpm) );
+ d_preview->setCaption("Preview");
+ preview = new Preview( d_preview );
+ d_preview->setWidget( preview );
+
+ d_fd = new KDockWidget( dockManager, "Dock_QFileDialog", QPixmap(), this );
+ fd = new CustomFileDialog( d_fd );
+ fd->setDir( initially );
+ fd->setFilters( filter );
+ fd->setBookmark( bookmark );
+ fd->reparent(d_fd, QPoint(0,0));
+ d_fd->setWidget( fd );
+
+ connect( dirView, SIGNAL( folderSelected( const QString & ) ), fd, SLOT( setDir2( const QString & ) ) );
+ connect( fd, SIGNAL( dirEntered( const QString & ) ), dirView, SLOT( setDir( const QString & ) ) );
+
+ d_fd->setDockSite( KDockWidget::DockTop|KDockWidget::DockLeft|KDockWidget::DockRight|KDockWidget::DockBottom );
+ d_fd->setEnableDocking(KDockWidget::DockNone);
+
+ d_dirView->setEnableDocking(KDockWidget::DockTop|KDockWidget::DockLeft|KDockWidget::DockRight|KDockWidget::DockBottom|KDockWidget::DockCenter);
+ d_preview->setEnableDocking(KDockWidget::DockTop|KDockWidget::DockLeft|KDockWidget::DockRight|KDockWidget::DockBottom|KDockWidget::DockCenter);
+
+ d_dirView->manualDock( d_fd, KDockWidget::DockLeft, 20 );
+ d_preview->manualDock( d_fd, KDockWidget::DockBottom, 70 );
+
+ connect(fd, SIGNAL(fileHighlighted(const QString&)), preview, SLOT(showPreview(const QString&)));
+ connect(fd, SIGNAL(signalDone(int)), this, SLOT(done(int)));
+
+ connect(fd, SIGNAL(dirEntered(const QString&)), this, SLOT(changeDir(const QString&)));
+ connect(dirView, SIGNAL(folderSelected(const QString&)), this, SLOT(changeDir(const QString&)));
+
+ b_tree = new QToolButton( fd );
+ QToolTip::add( b_tree, "Show/Hide Tree" );
+ b_tree->setPixmap( QPixmap( dir_tree_xpm ) );
+ connect( b_tree, SIGNAL(clicked()), d_dirView, SLOT(changeHideShowState()) );
+ b_tree->setToggleButton(true);
+ b_tree->setOn(true);
+ fd->addToolButton( b_tree, true );
+
+ b_preview = new QToolButton( fd );
+ QToolTip::add( b_preview, "Show/Hide Preview" );
+ b_preview->setPixmap( QPixmap( preview_xpm ) );
+ connect( b_preview, SIGNAL(clicked()), d_preview, SLOT(changeHideShowState()) );
+ b_preview->setToggleButton(true);
+ b_preview->setOn(true);
+ fd->addToolButton( b_preview );
+
+ connect( dockManager, SIGNAL(change()), this, SLOT(dockChange()));
+ connect( dockManager, SIGNAL(setDockDefaultPos(KDockWidget*)), this, SLOT(setDockDefaultPos(KDockWidget*)));
+ setCaption("Open File");
+ resize(550,450);
+ qDebug("read config");
+ dockManager->readConfig( 0L , name );
+}
+
+void SFileDialog::dockChange()
+{
+ b_preview->setOn( d_preview->isVisibleToTLW() );
+ b_tree->setOn( d_dirView->isVisibleToTLW() );
+}
+
+SFileDialog::~SFileDialog()
+{
+ KConfig* config = kapp->config();
+ config->setGroup( QString("SFileDialogData:") + name() );
+ config->writeEntry( "Bookmarks", fd->getBookmark() );
+
+ qDebug("write config");
+ dockManager->writeConfig( 0L , name() );
+}
+
+void SFileDialog::setDockDefaultPos( KDockWidget* d )
+{
+ if ( d == d_dirView ){
+ d_dirView->manualDock( d_fd, KDockWidget::DockLeft, 20 );
+ }
+
+ if ( d == d_preview ){
+ d_preview->manualDock( d_fd, KDockWidget::DockBottom, 70 );
+ }
+}
+
+void SFileDialog::changeDir( const QString& f )
+{
+ if ( !f.isEmpty() ){
+ KConfig* config = kapp->config();
+ config->setGroup( QString("SFileDialogData:") + name() );
+ config->writePathEntry( "InitiallyDir", f );
+ }
+}
+
+QString SFileDialog::getOpenFileName( QString initially,
+ const QStringList& filter,
+ const QString caption, const char* name )
+{
+ SFileDialog* fd = new SFileDialog( initially, filter, name );
+ if ( !caption.isNull() ) fd->setCaption( caption );
+ QString result = ( fd->exec() == QDialog::Accepted ) ? fd->fd->selectedFile():QString::null;
+ delete fd;
+
+ return result;
+}
+
+QStringList SFileDialog::getOpenFileNames( QString initially,
+ const QStringList& filter,
+ const QString caption, const char* name )
+{
+ SFileDialog* fd = new SFileDialog( initially, filter, name );
+ if ( !caption.isNull() ) fd->setCaption( caption );
+
+ fd->fd->setMode( QFileDialog::ExistingFiles );
+ fd->d_preview->undock();
+ fd->b_preview->hide();
+
+ fd->exec();
+ QStringList result = fd->fd->selectedFiles();
+ delete fd;
+
+ return result;
+}
+
+void SFileDialog::showEvent( QShowEvent *e )
+{
+ QDialog::showEvent( e );
+ dirView->setDir( fd->dirPath() );
+}
+
+/******************************************************************************************************/
+PixmapView::PixmapView( QWidget *parent )
+:QScrollView( parent )
+{
+// kimgioRegister();
+ viewport()->setBackgroundMode( PaletteBase );
+}
+
+void PixmapView::setPixmap( const QPixmap &pix )
+{
+ pixmap = pix;
+ resizeContents( pixmap.size().width(), pixmap.size().height() );
+ viewport()->repaint( true );
+}
+
+void PixmapView::drawContents( QPainter *p, int, int, int, int )
+{
+ p->drawPixmap( 0, 0, pixmap );
+}
+
+Preview::Preview( QWidget *parent )
+:QWidgetStack( parent )
+{
+ normalText = new QMultiLineEdit( this );
+ normalText->setReadOnly( true );
+ html = new QTextView( this );
+ pixmap = new PixmapView( this );
+ raiseWidget( normalText );
+}
+
+void Preview::showPreview( const QString &str )
+{
+ QUrl u(str);
+ if ( u.isLocalFile() ){
+ QString path = u.path();
+ QFileInfo fi( path );
+ if ( fi.isFile() && (int)fi.size() > 400 * 1024 ) {
+ normalText->setText( tr( "The File\n%1\nis too large, so I don't show it!" ).arg( path ) );
+ raiseWidget( normalText );
+ return;
+ }
+
+ QPixmap pix( path );
+ if ( pix.isNull() ) {
+ if ( fi.isFile() ) {
+ QFile f( path );
+ if ( f.open( IO_ReadOnly ) ) {
+ QTextStream ts( &f );
+ QString text = ts.read();
+ f.close();
+ if ( fi.extension().lower().contains( "htm" ) ) {
+ QString url = html->mimeSourceFactory()->makeAbsolute( path, html->context() );
+ html->setText( text, url );
+ raiseWidget( html );
+ return;
+ } else {
+ normalText->setText( text );
+ raiseWidget( normalText );
+ return;
+ }
+ }
+ }
+ normalText->setText( QString::null );
+ raiseWidget( normalText );
+ } else {
+ pixmap->setPixmap( pix );
+ raiseWidget( pixmap );
+ }
+ } else {
+ normalText->setText( "I only show local files!" );
+ raiseWidget( normalText );
+ }
+}
+
+// ****************************************************************************************************
+static const char* homepage_xpm[] = {
+"24 24 9 1",
+" c #262660",
+". c #383666",
+"X c #62639c",
+"o c #7e86a5",
+"O c #a6a7dd",
+"+ c #bbbaed",
+"@ c #c4c4f2",
+"# c #f8f9f9",
+"$ c None",
+"$$$$$$$$$$$$$$$$$$$$$$$$",
+"$$$$$$$$$$$$$$$$$$$$$$$$",
+"$$$$$$$$$$$$$$$$o.X$$$$$",
+"$$$$$$$$$$oOOOO$O.X$$$$$",
+"$$$$$$$$$$oXXXX+O.X$$$$$",
+"$$$$$$$$$X#XXXXXO.X$$$$$",
+"$$$$$$$$X #XXXXO.X$$$$$",
+"$$$$$$$X XO #XXXO.X$$$$$",
+"$$$$$$X XOOO #XXX.XX$$$$",
+"$$$$$X XOOOOO #XXXXXX$$$",
+"$$$$X XOOOOOOO #XXXXXX$$",
+"$$$X XOOOOOOOOO #XXXXXX$",
+"$$X XOOOOOOOOOOO #.....$",
+"$$$$$OOOOXXXXOOOOX...$$$",
+"$$$$$OOOOXXXXOOOOX...$$$",
+"$$$$$OOOOXXXXOOOOX..o$$$",
+"$$$$$OOOOXXXXOOOOX.oo$$$",
+"$$$$$OOOOXXXXOOOOXXoo$$$",
+"$$$$$OOOOXXXXOOOOXooo$$$",
+"$$$ooOOOOXXXXOOOOXoooo$$",
+"$ooooXXXXXXXXXXXXXooooo$",
+"$ooooooooooooooooooooooo",
+"$$$$$$$$$$$$$$$$$$$$$$$$",
+"$$$$$$$$$$$$$$$$$$$$$$$$"
+};
+
+static const char* folder_trash[] = {
+"16 16 10 1",
+" c Gray0",
+". c #222222",
+"X c #333366",
+"o c #6666cc",
+"O c Magenta",
+"+ c #808080",
+"@ c #9999ff",
+"# c #c0c0c0",
+"$ c Gray100",
+"% c None",
+"%%%%%%oo%%%%%%%%",
+"%%%%%o$$o%%%%%%%",
+"%%%%o$$$$o%%%%%%",
+"%%%o$+$+$$o o%%%",
+"%%oo$$+$+$$o .%%",
+"%%.oo$$+$+$$o.%%",
+"%% Xoo$$+$$o +%%",
+"%%o Xoo$$oo o%%",
+"%%%X.XX +X%%%",
+"%%%o@X+X#X+X+%%%",
+"%%%+.$X#X+X %%%%",
+"%%%%.o$o#X+X%%%%",
+"%%%%.X@$X+ +%%%%",
+"%%%%+Xo.#. %%%%%",
+"%%%%%.Xo. o%%%%%",
+"%%%%%+. %%%%%%"
+};
+
+static const char* globalbookmark_xpm[]={
+"12 16 3 1",
+". c None",
+"a c #000000",
+"# c #008080",
+"............",
+"............",
+"........##..",
+".......#####",
+"......#####a",
+".....#####a.",
+"....#####a..",
+"...#####a...",
+"..#####a....",
+".#####a.....",
+"aaa##a......",
+"...#a.......",
+"...a........",
+"............",
+"............",
+"............"};
+
+CustomFileDialog::CustomFileDialog( QWidget* parent )
+: QFileDialog( parent, 0, false )
+{
+ QToolButton *p = new QToolButton( this );
+
+ p->setPixmap( QPixmap( globalbookmark_xpm ) );
+ QToolTip::add( p, tr( "Bookmarks" ) );
+
+ bookmarkMenu = new QPopupMenu( this );
+ connect( bookmarkMenu, SIGNAL( activated( int ) ), this, SLOT( bookmarkChosen( int ) ) );
+ addId = bookmarkMenu->insertItem( "Add bookmark" );
+ clearId = bookmarkMenu->insertItem( QPixmap(folder_trash), "Clear bookmarks" );
+ bookmarkMenu->insertSeparator();
+
+ p->setPopup( bookmarkMenu );
+ p->setPopupDelay(0);
+ addToolButton( p, true );
+
+ QToolButton *b = new QToolButton( this );
+ QToolTip::add( b, tr( "Go Home!" ) );
+
+ b->setPixmap( QPixmap( homepage_xpm ) );
+ connect( b, SIGNAL( clicked() ), this, SLOT( goHome() ) );
+
+ addToolButton( b );
+}
+
+
+void CustomFileDialog::setBookmark( QStringList &s )
+{
+ QStringList::Iterator it = s.begin();
+ for ( ; it != s.end(); ++it ){
+ bookmarkList << (*it);
+
+ const char* book_pix[]={
+ "12 16 3 1",
+ ". c None",
+ "a c #000000",
+ "# c #008080",
+ "............",
+ "............",
+ "........##..",
+ ".......#####",
+ "......#####a",
+ ".....#####a.",
+ "....#####a..",
+ "...#####a...",
+ "..#####a....",
+ ".#####a.....",
+ "aaa##a......",
+ "...#a.......",
+ "...a........",
+ "............",
+ "............",
+ "............"};
+ bookmarkMenu->insertItem( QIconSet( book_pix ), (*it) );
+ }
+}
+
+CustomFileDialog::~CustomFileDialog()
+{
+}
+
+void CustomFileDialog::setDir2( const QString &s )
+{
+ blockSignals( true );
+ setDir( s );
+ blockSignals( false );
+}
+
+void CustomFileDialog::bookmarkChosen( int i )
+{
+ if ( i == clearId ){
+ bookmarkList.clear();
+ bookmarkMenu->clear();
+ addId = bookmarkMenu->insertItem( "Add bookmark" );
+ clearId = bookmarkMenu->insertItem( "Clear bookmarks" );
+ bookmarkMenu->insertSeparator();
+ return;
+ }
+
+ if ( i == addId ){
+ bookmarkList << dirPath();
+
+ const char* book_pix[]={
+ "12 16 3 1",
+ ". c None",
+ "a c #000000",
+ "# c #008080",
+ "............",
+ "............",
+ "........##..",
+ ".......#####",
+ "......#####a",
+ ".....#####a.",
+ "....#####a..",
+ "...#####a...",
+ "..#####a....",
+ ".#####a.....",
+ "aaa##a......",
+ "...#a.......",
+ "...a........",
+ "............",
+ "............",
+ "............"};
+ bookmarkMenu->insertItem( QIconSet( book_pix ), dirPath() );
+ return;
+ }
+
+ setDir( bookmarkMenu->text( i ) );
+}
+
+void CustomFileDialog::goHome()
+{
+ if ( getenv( "HOME" ) )
+ setDir( getenv( "HOME" ) );
+ else
+ setDir( "/" );
+}
+
+void CustomFileDialog::done( int i )
+{
+ emit signalDone(i);
+}
+/******************************************************************************************************/
+static const char* folder_closed_xpm[] = {
+"16 16 9 1",
+" c Gray0",
+". c #222222",
+"X c #6666cc",
+"o c #9999ff",
+"O c #c0c0c0",
+"+ c #ccccff",
+"@ c #ffffcc",
+"# c Gray100",
+"$ c None",
+"$$$$$$$$$$$$$$$$",
+"$$$$$$$$$$$$$$$$",
+"$$$$$$$$$$$$$$$$",
+"$$$$$$$$$$$$$$$$",
+"$$XXXXo$$$$$$$$$",
+"$X#++o@XXXXXX$$$",
+"X#+++++++++++o$$",
+"X#o+o+o+o+o+oX$$",
+"X#+o+o+o+o+o+X $",
+"X#o+o+o+o+o+oX $",
+"X#+o+o+o+o+o+X $",
+"X#o+o+o+o+o+oX $",
+"X#+o+o+o+o+o+X $",
+"X+o+o+o+o+o+oX $",
+"XXXXXXXXXXXXXX $",
+"$ .. $"
+};
+
+static const char* folder_open_xpm[] = {
+"16 16 10 1",
+" c Gray0",
+". c #222222",
+"X c #6666cc",
+"o c Magenta",
+"O c #9999ff",
+"+ c #c0c0c0",
+"@ c #ccccff",
+"# c #ffffcc",
+"$ c Gray100",
+"% c None",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%",
+"%%%%%%%%%%%%%%%%",
+"%%XXXX%%%%%%%%%%",
+"%X$$$XXXXXXXXX%%",
+"%X$O+#######.OX%",
+"%X$+#######.O@X%",
+"%O$#######.O@OX ",
+"XXXXXXXXXX.XO@X ",
+"X$$$$$$$$$+ @OX ",
+"%XO+O+O+O+O+ @X ",
+"%X+O+O+O+O+O. X ",
+"%%X+O+O+O+O+O. ",
+"%%XXXXXXXXXXXXX ",
+"%%% "
+};
+
+static const char* folder_locked_xpm[] = {
+"16 16 8 1",
+" c Gray0",
+". c #333366",
+"X c #6666cc",
+"o c Magenta",
+"O c #9999ff",
+"+ c #c0c0c0",
+"@ c Gray100",
+"# c None",
+"###O.O##########",
+"###...##########",
+"###O.O##########",
+"##.#X#.#OX######",
+"#...X...@@X#####",
+"#.......OOOOOOX#",
+"#.......@@@@@@X#",
+"#@@@@@@@O+O+O+X ",
+"#O@O+O+O+O+O+OX ",
+"#O@+O+O+O+O+O+X ",
+"#O@O+O+O+O+O+OX ",
+"#O@+O+O+O+O+O+X ",
+"#O@O+O+O+O+O+OX ",
+"#OXXXXXXXXXXXXX ",
+"## ",
+"################"
+};
+
+Directory::Directory( Directory * parent, const QString& filename )
+:QListViewItem( parent ), f(filename)
+{
+ p = parent;
+ readable = QDir( fullName() ).isReadable();
+
+ if ( !readable )
+ setPixmap( 0, QPixmap( folder_locked_xpm ) );
+ else
+ setPixmap( 0, QPixmap( folder_closed_xpm ) );
+}
+
+
+Directory::Directory( QListView * parent, const QString& filename )
+:QListViewItem( parent ), f(filename)
+{
+ p = 0;
+ readable = QDir( fullName() ).isReadable();
+}
+
+
+void Directory::setOpen( bool o )
+{
+ if ( o )
+ setPixmap( 0, QPixmap( folder_open_xpm ) );
+ else
+ setPixmap( 0, QPixmap( folder_closed_xpm ) );
+
+ if ( o && !childCount() ){
+ QString s( fullName() );
+ QDir thisDir( s );
+ if ( !thisDir.isReadable() ) {
+ readable = false;
+ setExpandable( false );
+ return;
+ }
+
+ listView()->setUpdatesEnabled( false );
+ const QFileInfoList * files = thisDir.entryInfoList();
+ if ( files ){
+ QFileInfoListIterator it( *files );
+ QFileInfo * f;
+ while( (f=it.current()) != 0 ){
+ ++it;
+ if ( f->fileName() != "." && f->fileName() != ".." && f->isDir() )
+ (void)new Directory( this, f->fileName() );
+ }
+ }
+ listView()->setUpdatesEnabled( true );
+ }
+ QListViewItem::setOpen( o );
+}
+
+
+void Directory::setup()
+{
+ setExpandable( true );
+ QListViewItem::setup();
+}
+
+
+QString Directory::fullName()
+{
+ QString s;
+ if ( p ) {
+ s = p->fullName();
+ s.append( f.name() );
+ s.append( "/" );
+ } else {
+ s = f.name();
+ }
+ return s;
+}
+
+
+QString Directory::text( int column ) const
+{
+ if ( column == 0 )
+ return f.name();
+ else
+ if ( readable )
+ return "Directory";
+ else
+ return "Unreadable Directory";
+}
+
+DirectoryView::DirectoryView( QWidget *parent, const char *name )
+:QListView( parent, name )
+{
+ connect( this, SIGNAL( clicked( QListViewItem * ) ),
+ this, SLOT( slotFolderSelected( QListViewItem * ) ) );
+ connect( this, SIGNAL( doubleClicked( QListViewItem * ) ),
+ this, SLOT( slotFolderSelected( QListViewItem * ) ) );
+ connect( this, SIGNAL( returnPressed( QListViewItem * ) ),
+ this, SLOT( slotFolderSelected( QListViewItem * ) ) );
+
+ setAcceptDrops( true );
+ viewport()->setAcceptDrops( true );
+}
+
+void DirectoryView::setOpen( QListViewItem* i, bool b )
+{
+ QListView::setOpen(i,b);
+ setCurrentItem(i);
+ slotFolderSelected(i);
+}
+
+void DirectoryView::slotFolderSelected( QListViewItem *i )
+{
+ if ( !i ) return;
+
+ Directory *dir = (Directory*)i;
+ emit folderSelected( dir->fullName() );
+}
+
+QString DirectoryView::fullPath(QListViewItem* item)
+{
+ QString fullpath = item->text(0);
+ while ( (item=item->parent()) ) {
+ if ( item->parent() )
+ fullpath = item->text(0) + "/" + fullpath;
+ else
+ fullpath = item->text(0) + fullpath;
+ }
+ return fullpath;
+}
+
+void DirectoryView::setDir( const QString &s )
+{
+ QListViewItemIterator it( this );
+ ++it;
+ for ( ; it.current(); ++it ) {
+ it.current()->setOpen( false );
+ }
+
+ QStringList lst( QStringList::split( "/", s ) );
+ QListViewItem *item = firstChild();
+ QStringList::Iterator it2 = lst.begin();
+ for ( ; it2 != lst.end(); ++it2 ) {
+ while ( item ) {
+ if ( item->text( 0 ) == *it2 ) {
+ item->setOpen( true );
+ break;
+ }
+ item = item->itemBelow();
+ }
+ }
+
+ if ( item ){
+ setSelected( item, true );
+ setCurrentItem( item );
+ }
+}
+
+QString DirectoryView::selectedDir()
+{
+ Directory *dir = (Directory*)currentItem();
+ return dir->fullName();
+}
+/**********************************************************************************************/
+
+int main(int argc, char* argv[]) {
+ KApplication app(argc,argv,"kdockwidgetdemo");
+
+#if 0
+ SFileDialog* openfile = new SFileDialog();
+ openfile->exec();
+ qDebug( openfile->fileName() );
+#endif
+
+#if 0
+ qDebug ( SFileDialog::getOpenFileName( QString::null, QString::fromLatin1("All (*)"),
+ QString::fromLatin1("DockWidget Demo"), "dialog1" ) );
+#endif
+
+#if 1
+ QStringList s = SFileDialog::getOpenFileNames( QString::null, QString::fromLatin1("All (*)"),
+ QString::fromLatin1("DockWidget Demo"), "dialog1" );
+ QStringList::Iterator it = s.begin();
+ for ( ; it != s.end(); ++it ){
+ qDebug( "%s", (*it).local8Bit().data() );
+ }
+#endif
+ return 0;
+}
+
+#include "kdockwidgetdemo.moc"
+
diff --git a/kdeui/tests/kdockwidgetdemo.h b/kdeui/tests/kdockwidgetdemo.h
new file mode 100644
index 000000000..e81162eb0
--- /dev/null
+++ b/kdeui/tests/kdockwidgetdemo.h
@@ -0,0 +1,164 @@
+#ifndef KDOCKWIDGETDEMO_H
+#define KDOCKWIDGETDEMO_H
+
+#include <kdockwidget.h>
+
+#include <qdialog.h>
+#include <qlistview.h>
+#include <qstring.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+#include <qtimer.h>
+#include <qscrollview.h>
+#include <qfiledialog.h>
+#include <qwidgetstack.h>
+#include <qvbox.h>
+#include <qurl.h>
+#include <qpixmap.h>
+
+class QMultiLineEdit;
+class QTextView;
+class QToolButton;
+class QSpinBox;
+class QShowEvent;
+class QPopupMenu;
+
+class DirectoryView;
+class CustomFileDialog;
+class Preview;
+class DirectoryView;
+
+class SFileDialog : public QDialog
+{Q_OBJECT
+
+public:
+ SFileDialog( QString initially = QString::null,
+ const QStringList& filter = "All Files ( * )", const char* name = 0 );
+ ~SFileDialog();
+
+ static QString getOpenFileName( QString initially = QString::null,
+ const QStringList& filter = "All Files ( * )",
+ const QString caption = QString::null, const char* name = 0 );
+
+ static QStringList getOpenFileNames( QString initially = QString::null,
+ const QStringList& filter = "All Files ( * )",
+ const QString caption = QString::null, const char* name = 0 );
+
+
+protected:
+ void showEvent( QShowEvent *e );
+
+protected slots:
+ void dockChange();
+ void setDockDefaultPos( KDockWidget* );
+ void changeDir( const QString& );
+
+private:
+ DirectoryView* dirView;
+ CustomFileDialog* fd;
+ Preview* preview;
+
+ KDockManager* dockManager;
+ KDockWidget* d_dirView;
+ KDockWidget* d_preview;
+ KDockWidget* d_fd;
+
+ QToolButton *b_tree;
+ QToolButton *b_preview;
+};
+/******************************************************************************************************/
+class Directory : public QListViewItem
+{
+public:
+ Directory( QListView * parent, const QString& filename );
+ Directory( Directory * parent, const QString& filename );
+
+ QString text( int column ) const;
+
+ QString fullName();
+
+ void setOpen( bool );
+ void setup();
+
+private:
+ QFile f;
+ Directory * p;
+ bool readable;
+};
+
+class DirectoryView : public QListView
+{Q_OBJECT
+public:
+ DirectoryView( QWidget *parent = 0, const char *name = 0 );
+ virtual void setOpen ( QListViewItem *, bool );
+
+ QString selectedDir();
+
+public slots:
+ void setDir( const QString & );
+
+signals:
+ void folderSelected( const QString & );
+
+protected slots:
+ void slotFolderSelected( QListViewItem * );
+
+private:
+ QString fullPath(QListViewItem* item);
+};
+/******************************************************************************************************/
+class PixmapView : public QScrollView
+{Q_OBJECT
+public:
+ PixmapView( QWidget *parent );
+ void setPixmap( const QPixmap &pix );
+ void drawContents( QPainter *p, int, int, int, int );
+
+private:
+ QPixmap pixmap;
+};
+
+class Preview : public QWidgetStack
+{Q_OBJECT
+public:
+ Preview( QWidget *parent );
+
+public slots:
+ void showPreview( const QString& );
+
+private:
+ QMultiLineEdit *normalText;
+ QTextView *html;
+ PixmapView *pixmap;
+};
+
+class CustomFileDialog : public QFileDialog
+{Q_OBJECT
+public:
+ CustomFileDialog( QWidget* parent );
+ ~CustomFileDialog();
+
+ void addToolButton( QButton * b, bool separator = false ){ QFileDialog::addToolButton(b,separator); }
+ void setBookmark( QStringList& );
+ QStringList getBookmark(){ return bookmarkList; }
+
+public slots:
+ void setDir2( const QString & );
+
+signals:
+ void signalDone( int );
+
+protected slots:
+ void bookmarkChosen( int i );
+ void goHome();
+ virtual void done( int );
+
+private:
+ QPopupMenu *bookmarkMenu;
+ QStringList bookmarkList;
+ int addId, clearId;
+};
+
+#endif
+
+
diff --git a/kdeui/tests/kdockwidgettest.cpp b/kdeui/tests/kdockwidgettest.cpp
new file mode 100644
index 000000000..bf1fb272d
--- /dev/null
+++ b/kdeui/tests/kdockwidgettest.cpp
@@ -0,0 +1,255 @@
+/***************************************************************************
+ copyright : (C) 1999 by Judin Max
+ email : novaprint@mtu-net.ru
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "kdockwidgettest.h"
+
+#include <qpushbutton.h>
+#include <kapplication.h>
+#include <kiconloader.h>
+#include <kstatusbar.h>
+#include <kmenubar.h>
+#include <ktoolbar.h>
+#include <qvbox.h>
+
+static const char*folder[]={
+"16 16 9 1",
+"g c #808080",
+"b c #ffa858",
+"e c #c0c0c0",
+"# c #000000",
+"c c #ffdca8",
+". c None",
+"a c #585858",
+"f c #a0a0a4",
+"d c #ffffff",
+"..#a#...........",
+".#abc##.........",
+".#daabc#####....",
+".#ddeaabcccb#...",
+".#dedeeabccca...",
+".#edeeeeaaaab#..",
+".#deeeeeeefe#ba.",
+".#eeeeeeefef#ba.",
+".#eeeeeefeff#ba.",
+".#eeeeefefff#ba.",
+".##geefeffff#ba.",
+"...##gefffff#ba.",
+".....##fffff#ba.",
+".......##fff#b##",
+".........##f#b##",
+"...........####."};
+
+
+DockApplication::DockApplication( const char* name )
+: KDockMainWindow( 0L, name )
+{
+ QPixmap p(folder);
+
+ initMenuBar();
+ initToolBars();
+ initStatusBar();
+
+ /*****************************************************/
+ dock = createDockWidget( "Green Widget", p );
+ dock->setCaption("Green");
+ dock->setGeometry(50, 50, 100, 100);
+ l = new QWidget(dock);
+ l->setBackgroundColor(green);
+ l->setMinimumSize(100,100);
+ dock->setWidget(l);
+ /*****************************************************/
+ dock1 = createDockWidget( "Blue Widget", p );
+ dock1->setCaption("Blue");
+ dock1->setGeometry( 150, 150, 100, 100);
+ setView( dock1 );
+ setMainDockWidget( dock1 );
+
+ mainW = new QWidget( dock1, "createdOnBlueDock" );
+ mainW->setBackgroundColor(blue);
+ mainW->setMinimumSize(300,150);
+ dock1->setWidget( mainW );
+ /*****************************************************/
+
+ KDockWidget* dock2 = createDockWidget( "Yellow Widget", p );
+ dock2->setGeometry(300, 300, 100, 100);
+ dock2->setCaption("Yellow");
+
+ /* test set new header widget...*/
+// dock2->setHeader( new KDockWidgetHeader(dock2) );
+
+ QWidget* l2 = new QWidget(dock2);
+ l2->setBackgroundColor(yellow);
+ dock2->setWidget( l2 );
+ /*****************************************************/
+
+ /*****************************************************/
+ dock5 = createDockWidget( "Container Widget", p );
+ dock5->setCaption("Container");
+ dock5->setGeometry(50, 50, 100, 100);
+ l = new CTW(dock5);
+ l->setBackgroundColor(white);
+ l->setMinimumSize(100,100);
+ dock5->setWidget(l);
+ if (l->qt_cast("KDockContainer")) qDebug("KDockContainer created for dock 5");
+ /*****************************************************/
+
+ /*****************************************************/
+ dock6 = createDockWidget( "Container Widget2", p );
+ dock6->setCaption("Container2");
+ dock6->setGeometry(50, 50, 100, 100);
+ l = new CTW(dock6);
+ l->setBackgroundColor(white);
+ l->setMinimumSize(100,100);
+ dock6->setWidget(l);
+ if (l->qt_cast("KDockContainer")) qDebug("KDockContainer created for dock 6");
+ /*****************************************************/
+
+
+
+ QPushButton* b1 = new QPushButton(mainW);
+ b1->setGeometry(10, 10, 250, 25);
+ b1->setText("write dock config");
+ connect(b1, SIGNAL(clicked()), SLOT(wConfig()));
+
+ QPushButton* b2 = new QPushButton(mainW);
+ b2->setGeometry(10, 35, 250, 25);
+ b2->setText("read dock config");
+ connect(b2, SIGNAL(clicked()), SLOT(rConfig()));
+
+ m_bname = new QPushButton(mainW);
+ m_bname->setGeometry(10, 60, 250, 25);
+ m_bname->setEnabled( false );
+
+ QPushButton *b3 = new QPushButton(mainW);
+ b3->setGeometry(10,95,250,25);
+ b3->setText("change the icon of the green widget");
+ connect(b3,SIGNAL(clicked()), SLOT(gSetPix1()));
+
+ QPushButton *b4 = new QPushButton(mainW);
+ b4->setGeometry(10,130,250,25);
+ b4->setText("remove icon ");
+ connect(b4,SIGNAL(clicked()), SLOT(gSetPix2()));
+
+ setGeometry(200, 100, 500, 300);
+
+ qDebug("load config");
+ readDockConfig();
+
+ updateButton();
+}
+
+DockApplication::~DockApplication()
+{
+ qDebug("Close & store config");
+ writeDockConfig();
+}
+
+void DockApplication::rConfig()
+{
+ readDockConfig();
+}
+
+void DockApplication::wConfig()
+{
+ writeDockConfig();
+}
+
+void DockApplication::initMenuBar()
+{
+ QPixmap p(folder);
+ QPopupMenu *file_menu = new QPopupMenu();
+
+ file_menu->insertItem(p, "Change Green Widget Caption", this, SLOT(cap()) );
+ file_menu->insertSeparator();
+ file_menu->insertItem(p, "Set Green Widget as MainDockWidget", this, SLOT(greenMain()) );
+ file_menu->insertItem(p, "Set Blue Widget as MainDockWidget", this, SLOT(blueMain()) );
+ file_menu->insertItem(p, "Set NULL as MainDockWidget", this, SLOT(nullMain()) );
+
+ KMenuBar* menu_bar = menuBar();
+ menu_bar->insertItem( "&Test", file_menu );
+ menu_bar->insertItem( "&Docking Windows", dockHideShowMenu() );
+}
+
+void DockApplication::initToolBars()
+{
+ QPixmap p(folder);
+ KToolBar* tool_bar_0 = toolBar(0);
+ tool_bar_0->setFullSize(false);
+ tool_bar_0->insertButton( p, 1 );
+ tool_bar_0->insertButton(p, 2 );
+ tool_bar_0->setFullSize( true );
+}
+
+void DockApplication::initStatusBar()
+{
+ KStatusBar* status_bar = statusBar();
+ status_bar->insertItem("Welcome to KDockWidget test...", 1);
+}
+
+void DockApplication::cap()
+{
+ if ( dock->caption() != "Test Caption1" )
+ dock->setCaption("Test Caption1");
+ else
+ dock->setCaption("Another Caption");
+}
+
+void DockApplication::greenMain()
+{
+ setMainDockWidget( dock );
+ updateButton();
+}
+
+void DockApplication::blueMain()
+{
+ setMainDockWidget( dock1 );
+ updateButton();
+}
+
+void DockApplication::nullMain()
+{
+ setMainDockWidget( 0L );
+ updateButton();
+}
+
+void DockApplication::updateButton()
+{
+ if ( getMainDockWidget() )
+ m_bname->setText(QString("MainDockWidget is %1").arg(getMainDockWidget()->name()));
+ else
+ m_bname->setText("MainDockWidget is NULL");
+}
+
+void DockApplication::gSetPix1() {
+ dock->setPixmap(SmallIcon("agent"));
+
+}
+
+void DockApplication::gSetPix2() {
+ dock->setPixmap();
+
+}
+
+int main(int argc, char* argv[]) {
+ KApplication a(argc,argv, "kdockdemoapp1");
+ DockApplication* ap = new DockApplication("DockWidget demo");
+ ap->setCaption("DockWidget demo");
+ a.setMainWidget(ap);
+ ap->show();
+ return a.exec();
+}
+
+
+#include "kdockwidgettest.moc"
+
diff --git a/kdeui/tests/kdockwidgettest.h b/kdeui/tests/kdockwidgettest.h
new file mode 100644
index 000000000..70d75877c
--- /dev/null
+++ b/kdeui/tests/kdockwidgettest.h
@@ -0,0 +1,72 @@
+/***************************************************************************
+ copyright : (C) 1999 by Judin Max
+ email : novaprint@mtu-net.ru
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KDOCKWIDGETTEST_H
+#define KDOCKWIDGETTEST_H
+
+#include <kdockwidget.h>
+#include <kdockwidget_p.h>
+#include <qtabwidget.h>
+#include <qlabel.h>
+class QPushButton;
+
+class DockApplication : public KDockMainWindow
+{Q_OBJECT
+public:
+ DockApplication( const char* name );
+ ~DockApplication();
+
+public slots:
+ void rConfig();
+ void wConfig();
+ void cap();
+ void greenMain();
+ void blueMain();
+ void nullMain();
+ void gSetPix1();
+ void gSetPix2();
+
+protected:
+ void initMenuBar();
+ void initToolBars();
+ void initStatusBar();
+
+private:
+ void updateButton();
+ KDockWidget* dock;
+ KDockWidget* dock1;
+ KDockWidget* dock4;
+ KDockWidget* dock5;
+ KDockWidget* dock6;
+
+ QWidget* mainW;
+ QWidget* l;
+ QPushButton* m_bname;
+};
+
+class CTW:public QTabWidget,public KDockContainer
+{
+ Q_OBJECT
+public:
+ CTW(QWidget *parent):QTabWidget(parent,"MyDockContainer"),KDockContainer(){insertTab(new QLabel("BLAH",this),"BLUP");}
+ virtual ~CTW(){;}
+ KDockWidget *parentDockWidget(){return ((KDockWidget*)parent());}
+ void insertWidget (KDockWidget *w, QPixmap, const QString &, int &){qDebug("widget inserted"); insertTab(w,"NO");}
+ void setToolTip (KDockWidget *, QString &){qDebug("Tooltip set");}
+};
+
+
+#endif
+
+
diff --git a/kdeui/tests/kdualcolortest.cpp b/kdeui/tests/kdualcolortest.cpp
new file mode 100644
index 000000000..9022634f1
--- /dev/null
+++ b/kdeui/tests/kdualcolortest.cpp
@@ -0,0 +1,63 @@
+#include "kdualcolortest.h"
+#include <kdualcolorbutton.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <qlayout.h>
+#include <qpalette.h>
+
+KDualColorWidget::KDualColorWidget(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ lbl = new QLabel("Testing, testing, 1, 2, 3...", this);
+ KDualColorButton *colorBtn =
+ new KDualColorButton(lbl->colorGroup().text(),
+ lbl->colorGroup().background(), this);
+ connect(colorBtn, SIGNAL(fgChanged(const QColor &)),
+ SLOT(slotFgChanged(const QColor &)));
+ connect(colorBtn, SIGNAL(bgChanged(const QColor &)),
+ SLOT(slotBgChanged(const QColor &)));
+ connect(colorBtn, SIGNAL(currentChanged(KDualColorButton::DualColor)),
+ SLOT(slotCurrentChanged(KDualColorButton::DualColor)));
+
+ QHBoxLayout *layout = new QHBoxLayout(this, 5);
+ layout->addWidget(colorBtn, 0);
+ layout->addWidget(lbl, 1);
+ layout->activate();
+ resize(sizeHint());
+}
+
+void KDualColorWidget::slotFgChanged(const QColor &c)
+{
+ QPalette p = lbl->palette();
+ p.setColor(QColorGroup::Text, c);
+ lbl->setPalette(p);
+}
+
+void KDualColorWidget::slotBgChanged(const QColor &c)
+{
+ QPalette p = lbl->palette();
+ QBrush b(c, SolidPattern);
+ p.setBrush(QColorGroup::Background, b);
+ setPalette(p);
+}
+
+void KDualColorWidget::slotCurrentChanged(KDualColorButton::DualColor current)
+{
+ if(current == KDualColorButton::Foreground)
+ qDebug("Foreground Button Selected.");
+ else
+ qDebug("Background Button Selected.");
+}
+
+int main(int argc, char **argv)
+{
+ KApplication *app = new KApplication(argc, argv, "KDualColorTest");
+ KDualColorWidget w;
+ app->setMainWidget(&w);
+ w.show();
+ return(app->exec());
+}
+
+#include "kdualcolortest.moc"
+
+
diff --git a/kdeui/tests/kdualcolortest.h b/kdeui/tests/kdualcolortest.h
new file mode 100644
index 000000000..6a0c49452
--- /dev/null
+++ b/kdeui/tests/kdualcolortest.h
@@ -0,0 +1,20 @@
+#ifndef __KDUALCOLORTEST_H
+#define __KDUALCOLORTEST_H
+
+#include <qlabel.h>
+#include <kdualcolorbutton.h>
+
+class KDualColorWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ KDualColorWidget(QWidget *parent=0, const char *name=0);
+protected slots:
+ void slotFgChanged(const QColor &c);
+ void slotBgChanged(const QColor &c);
+ void slotCurrentChanged(KDualColorButton::DualColor current);
+protected:
+ QLabel *lbl;
+};
+
+#endif
diff --git a/kdeui/tests/keditlistboxtest.cpp b/kdeui/tests/keditlistboxtest.cpp
new file mode 100644
index 000000000..0cbbece8a
--- /dev/null
+++ b/kdeui/tests/keditlistboxtest.cpp
@@ -0,0 +1,21 @@
+#include <kapplication.h>
+#include <keditlistbox.h>
+#include <kcombobox.h>
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "keditlistboxtest" );
+
+ KEditListBox::CustomEditor editor( new KComboBox( true, 0L, "test" ) );
+ KEditListBox *box = new KEditListBox( QString::fromLatin1("KEditListBox"),
+ editor );
+
+ box->insertItem( QString::fromLatin1("Test") );
+ box->insertItem( QString::fromLatin1("for") );
+ box->insertItem( QString::fromLatin1("this") );
+ box->insertItem( QString::fromLatin1("KEditListBox") );
+ box->insertItem( QString::fromLatin1("Widget") );
+ box->show();
+
+ return app.exec();
+}
diff --git a/kdeui/tests/kedittest.cpp b/kdeui/tests/kedittest.cpp
new file mode 100644
index 000000000..271923e18
--- /dev/null
+++ b/kdeui/tests/kedittest.cpp
@@ -0,0 +1,14 @@
+#include <kapplication.h>
+#include <keditcl.h>
+#include <qpopupmenu.h>
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "kedittest" );
+ KEdit *edit = new KEdit( 0L );
+ QPopupMenu *pop = new QPopupMenu( 0L );
+ pop->insertItem( "Popupmenu item" );
+ edit->installRBPopup( pop );
+ edit->show();
+ return app.exec();
+}
diff --git a/kdeui/tests/kfontdialogtest.cpp b/kdeui/tests/kfontdialogtest.cpp
new file mode 100644
index 000000000..f1aa74804
--- /dev/null
+++ b/kdeui/tests/kfontdialogtest.cpp
@@ -0,0 +1,51 @@
+/*
+ $Id$
+
+ Requires the Qt widget libraries, available at no cost at
+ http://www.troll.no
+
+ Copyright (C) 1996 Bernd Johannes Wuebben
+ wuebben@math.cornell.edu
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU 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 General Public License for more details.
+
+ 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+*/
+
+
+#include <kapplication.h>
+#include "kfontdialog.h"
+#include <kconfig.h>
+
+
+ int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "KFontDialogTest" );
+
+ KConfig aConfig;
+ aConfig.setGroup( "KFontDialog-test" );
+
+ app.setFont(QFont("Helvetica",12));
+
+ // QFont font = QFont("Times",18,QFont::Bold);
+
+ QFont font = aConfig.readFontEntry( "Chosen" );
+ int nRet = KFontDialog::getFont(font);
+ int flags;
+ nRet = KFontDialog::getFontDiff(font, flags);
+ aConfig.writeEntry( "Chosen", font, true );
+
+ aConfig.sync();
+ return nRet;
+}
diff --git a/kdeui/tests/kgradienttest.cpp b/kdeui/tests/kgradienttest.cpp
new file mode 100644
index 000000000..9fad0bb46
--- /dev/null
+++ b/kdeui/tests/kgradienttest.cpp
@@ -0,0 +1,108 @@
+#include "kgradienttest.h"
+#include <kapplication.h>
+#include <kpixmapeffect.h>
+#include <qpainter.h>
+#include <qdatetime.h>
+#include <qstring.h>
+
+int cols = 3, rows = 3; // how many
+
+void KGradientWidget::paintEvent(QPaintEvent */*ev*/)
+{
+ QTime time;
+ int it, ft;
+ QString say;
+
+ QColor ca = Qt::black, cb = Qt::blue;
+
+ int x = 0, y = 0;
+
+ pix.resize(width()/cols, height()/rows);
+ QPainter p(this);
+ p.setPen(Qt::white);
+
+ // draw once, so that the benchmarking be fair :-)
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::VerticalGradient);
+
+ // vertical
+ time.start();
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::VerticalGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Vertical";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5 + (x++)*width()/cols, 15+y*height()/rows, say); // augment x
+
+ // horizontal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::HorizontalGradient);
+ ft = time.elapsed() ;
+ say.setNum( ft - it); say += " ms, Horizontal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // elliptic
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::EllipticGradient);
+ ft = time.elapsed() ;
+ say.setNum( ft - it); say += " ms, Elliptic";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ y++; // next row
+ x = 0; // reset the columns
+
+ // diagonal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::DiagonalGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Diagonal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // crossdiagonal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::CrossDiagonalGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, CrossDiagonal";
+ p.drawPixmap(width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ y++; // next row
+ x = 0; // reset the columns
+
+ // pyramidal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::PyramidGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Pyramid";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // pattern
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::RectangleGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Rectangle";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/rows, 15+y*height()/rows, say);
+
+ // crosspipe
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::PipeCrossGradient);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, PipeCross";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/rows, 15+y*height()/rows, say);
+}
+
+int main(int argc, char **argv)
+{
+ KApplication *app = new KApplication(argc, argv, "KGradientTest");
+ KGradientWidget w;
+ w.resize(250 * cols, 250 * rows);
+ app->setMainWidget(&w);
+ w.show();
+ return(app->exec());
+}
+
diff --git a/kdeui/tests/kgradienttest.h b/kdeui/tests/kgradienttest.h
new file mode 100644
index 000000000..09b17ffc7
--- /dev/null
+++ b/kdeui/tests/kgradienttest.h
@@ -0,0 +1,24 @@
+//
+// Simple little hack to show off new diagonal gradients.
+//
+// (C) KDE Artistic Daniel M. Duley <mosfet@kde.org>
+//
+
+#ifndef __KGRADIENT_TEST_H
+#define __KGRADIENT_TEST_H
+
+#include <qwidget.h>
+#include <kpixmap.h>
+
+class KGradientWidget : public QWidget
+{
+public:
+ KGradientWidget(QWidget *parent=0, const char *name=0)
+ : QWidget(parent, name){;}
+protected:
+ void paintEvent(QPaintEvent *ev);
+private:
+ KPixmap pix;
+};
+
+#endif
diff --git a/kdeui/tests/khashtest.cpp b/kdeui/tests/khashtest.cpp
new file mode 100644
index 000000000..1065bef1a
--- /dev/null
+++ b/kdeui/tests/khashtest.cpp
@@ -0,0 +1,137 @@
+#include "khashtest.h"
+#include <kapplication.h>
+#include <kpixmapeffect.h>
+#include <kimageeffect.h>
+#include <qpainter.h>
+#include <qdatetime.h>
+#include <qstring.h>
+#include <qimage.h>
+
+int cols = 3, rows = 3; // how many
+
+void KHashWidget::paintEvent(QPaintEvent * /*ev*/)
+{
+ QTime time;
+ int it, ft;
+ QString say;
+
+ QColor cb = QColor(0,70,70), ca = QColor(80,200,200);
+
+ int x = 0, y = 0;
+
+ pix.resize(width()/cols, height()/rows);
+ QPainter p(this);
+ p.setPen(Qt::white);
+
+ // draw once, so that the benchmarking be fair :-)
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::VerticalGradient);
+
+ // vertical
+ time.start();
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::VerticalGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::NorthLite);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Vertical";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5 + (x++)*width()/cols, 15+y*height()/rows, say); // augment x
+
+ // horizontal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::HorizontalGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::SouthLite);
+ ft = time.elapsed() ;
+ say.setNum( ft - it); say += " ms, Horizontal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // elliptic
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::EllipticGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::NorthLite, 1);
+ ft = time.elapsed() ;
+ say.setNum( ft - it); say += " ms, Elliptic";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ y++; // next row
+ x = 0; // reset the columns
+
+ // diagonal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::DiagonalGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::EastLite);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Diagonal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // crossdiagonal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix,ca, cb, KPixmapEffect::CrossDiagonalGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::EastLite, 2);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, CrossDiagonal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+
+ QImage image = QImage("testimage.png");
+ it = time.elapsed();
+ KImageEffect::hash(image, KImageEffect::WestLite, 2);
+ ft = time.elapsed();
+ pix.resize(image.width(), image.height());
+ pix.convertFromImage(image);
+ pix.resize(width()/cols, height()/rows);
+ say.setNum( ft - it); say += " ms, CrossDiagonal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.setPen(Qt::blue);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+ p.setPen(Qt::white);
+
+
+ y++; // next row
+ x = 0; // reset the columns
+
+ // pyramidal
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::PyramidGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::WestLite);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Pyramid";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // rectangular
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::RectangleGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::NWLite);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, Rectangle";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/rows, 15+y*height()/rows, say);
+
+ // crosspipe
+ it = time.elapsed();
+ KPixmapEffect::gradient(pix, ca, cb, KPixmapEffect::PipeCrossGradient);
+ KPixmapEffect::hash(pix,KPixmapEffect::WestLite, 3);
+ ft = time.elapsed();
+ say.setNum( ft - it); say += " ms, PipeCross";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/rows, 15+y*height()/rows, say);
+
+}
+
+int main(int argc, char **argv)
+{
+
+ KApplication *app = new KApplication(argc, argv, "KHashTest");
+ KHashWidget w;
+ w.resize(250 * cols, 250 * rows);
+ app->setMainWidget(&w);
+ w.show();
+ return(app->exec());
+}
+
+#include <khashtest.moc>
diff --git a/kdeui/tests/khashtest.h b/kdeui/tests/khashtest.h
new file mode 100644
index 000000000..24a01c4f1
--- /dev/null
+++ b/kdeui/tests/khashtest.h
@@ -0,0 +1,26 @@
+//
+// Simple little hack to show off new diagonal gradients.
+//
+// (C) KDE Artistic Daniel M. Duley <mosfet@kde.org>
+//
+
+#ifndef __KHASH_TEST_H
+#define __KHASH_TEST_H
+
+#include <qwidget.h>
+#include <kpixmap.h>
+
+class KHashWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KHashWidget(QWidget *parent=0, const char *name=0)
+ : QWidget(parent, name){;}
+protected:
+ void paintEvent(QPaintEvent *ev);
+private:
+ KPixmap pix;
+};
+
+#endif
diff --git a/kdeui/tests/kinputdialogtest.cpp b/kdeui/tests/kinputdialogtest.cpp
new file mode 100644
index 000000000..3f9509a40
--- /dev/null
+++ b/kdeui/tests/kinputdialogtest.cpp
@@ -0,0 +1,67 @@
+/*
+ * Author: Nadeem Hasan <nhasan@kde.org>
+ * License: GPL V2
+ */
+
+#include <kapplication.h>
+#include <kinputdialog.h>
+#include <kdebug.h>
+
+#include <qstring.h>
+#include <qvalidator.h>
+
+int main( int argc, char *argv[] )
+{
+ KApplication app( argc, argv, "kinputdialogtest" );
+
+ bool ok;
+ QString svalue;
+ int ivalue;
+ double dvalue;
+
+ svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok );
+ kdDebug() << "value1: " << svalue << ", ok: " << ok << endl;
+
+ svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok, 0L, 0L,
+ &QRegExpValidator( QRegExp( "[0-9]{3}\\-[0-9]{3}\\-[0-9]{4}" ), 0L ) );
+ kdDebug() << "value2: " << svalue << ", ok: " << ok << endl;
+
+ svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok, 0L, 0L,
+ 0L, "900.900.900.900" );
+ kdDebug() << "value1: " << svalue << ", ok: " << ok << endl;
+
+ ivalue = KInputDialog::getInteger( "_caption", "_label:", 64, 0, 255,
+ 16, 16, &ok );
+ kdDebug() << "value3: " << ivalue << ", ok: " << ok << endl;
+
+ ivalue = KInputDialog::getInteger( "_caption", "_label:", 100, 0, 255,
+ 10, 10, &ok );
+ kdDebug() << "value4: " << ivalue << ", ok: " << ok << endl;
+
+ dvalue = KInputDialog::getDouble( "_caption", "_label:", 10, 0, 100, 0.1,
+ 2, &ok );
+ kdDebug() << "value5: " << dvalue << ", ok: " << ok << endl;
+
+ dvalue = KInputDialog::getDouble( "_caption", "_label:", 10, 0, 100, 2, &ok );
+ kdDebug() << "value6: " << dvalue << ", ok: " << ok << endl;
+
+ QStringList list, slvalue;
+ list << "Item 1" << "Item 2" << "Item 3" << "Item 4" << "Item 5";
+ svalue = KInputDialog::getItem( "_caption", "_label:", list, 1, false, &ok );
+ kdDebug() << "value7: " << svalue << ", ok: " << ok << endl;
+
+ svalue = KInputDialog::getItem( "_caption", "_label:", list, 1, true, &ok );
+ kdDebug() << "value8: " << svalue << ", ok: " << ok << endl;
+
+ QStringList select;
+ select << "Item 3";
+ list << "Item 6" << "Item 7" << "Item 8" << "Item 9" << "Item 10";
+ slvalue = KInputDialog::getItemList( "_caption", "_label:", list, select,
+ false, &ok );
+ kdDebug() << "value9: " << slvalue << ", ok: " << ok << endl;
+
+ select << "Item 5";
+ slvalue = KInputDialog::getItemList( "_caption", "_label:", list, select,
+ true, &ok );
+ kdDebug() << "value10: " << slvalue << ", ok: " << ok << endl;
+}
diff --git a/kdeui/tests/kjanuswidgettest.cpp b/kdeui/tests/kjanuswidgettest.cpp
new file mode 100644
index 000000000..5788f3638
--- /dev/null
+++ b/kdeui/tests/kjanuswidgettest.cpp
@@ -0,0 +1,25 @@
+#include <kapplication.h>
+#include <kjanuswidget.h>
+
+#include <qstring.h>
+#include <qcheckbox.h>
+#include <qvbox.h>
+
+int main(int argc, char** argv)
+{
+ KApplication app(argc, argv, "JanusWidgetTest");
+ // -----
+ KJanusWidget* janus = new KJanusWidget( 0, 0, KJanusWidget::IconList );
+
+ QVBox* page1 = janus->addVBoxPage( QString( "Page1" ) ); // use i18n in real apps
+ QCheckBox* cb1 = new QCheckBox( "a", page1 );
+
+ QVBox* page2 = janus->addVBoxPage( QString( "Page2" ) );
+ QCheckBox* cb2 = new QCheckBox( "a", page2 );
+
+ janus->show();
+ QObject::connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
+
+ return app.exec();
+}
+
diff --git a/kdeui/tests/kledtest.cpp b/kdeui/tests/kledtest.cpp
new file mode 100644
index 000000000..8fc082420
--- /dev/null
+++ b/kdeui/tests/kledtest.cpp
@@ -0,0 +1,160 @@
+#include <kapplication.h>
+#include <qwidget.h>
+#include <qtimer.h>
+#include <stdlib.h>
+#include "kled.h"
+#include "kledtest.h"
+
+
+
+KLedTest::KLedTest(QWidget* parent)
+ : QWidget(parent, 0),
+ LedWidth(16),
+ LedHeight(10),
+ Grid(3),
+ ledcolor(0),
+ red(QColor("red")),
+ blue(QColor("blue")),
+ green(QColor("green")),
+ yellow(QColor("yellow")),
+ kled_round(true) // Switch HERE between rectangle and circular leds
+{
+ if (kled_round) {
+ //KLed l(KLed::red, &qw); // create lamp
+ //KLed l(KLed::blue, &qw); // create lamp
+ l = new KLed(Qt::green, this); // create lamp
+ //KLed l(KLed::yellow, &qw); // create lamp
+ //KLed l(KLed::orange, &qw); // create lamp
+
+
+ l->resize(16,30);
+ //l.setLook(KLed::flat);
+ l->setShape(KLed::Circular);
+ //l->setShape(KLed::Rectangular);
+
+ //l->setLook(KLed::Flat);
+ //l->setLook(KLed::Flat);
+ //l->setLook(KLed::Flat);
+
+ l->move(5,5);
+ // ktmp tmpobj(l);
+
+ t_toggle.start(1000, false);
+ t_color.start(3500, false);
+ t_look.start(3500, false);
+ QObject::connect(&t_toggle, SIGNAL(timeout()), l, SLOT(toggle()));
+ QObject::connect(&t_color, SIGNAL(timeout()), this, SLOT(nextColor()));
+ QObject::connect(&t_look, SIGNAL(timeout()), this, SLOT(nextLook()));
+ l->show();
+ resize(240,140);
+ }
+ else {
+ y=Grid; index=0;
+ for( int shape=0; (int)shape<2; shape=(KLed::Shape)(shape+1)) {
+ x=Grid;
+ for( int look=0; (int)look<3; look=(KLed::Look)(look+1)) {
+ for(state=KLed::Off; (int)state<2; state=(KLed::State)(state+1))
+ {
+ leds[index]=new KLed(Qt::yellow, state,
+ (KLed::Look)(look+1),
+ (KLed::Shape)(shape+1), this);
+ leds[index]->setGeometry(x, y, LedWidth, LedHeight);
+ ++index;
+ x+=Grid+LedWidth;
+ }
+ }
+ y+=Grid+LedHeight;
+ }
+ setFixedSize(x+Grid, y+Grid);
+ connect(&timer, SIGNAL(timeout()), SLOT(timeout()));
+ timer.start(500);
+ }
+}
+
+
+KLedTest::~KLedTest()
+{
+ if (kled_round) {
+ delete l;
+ }
+}
+
+
+void
+KLedTest::nextColor() {
+
+ ledcolor++;
+ ledcolor%=4;
+
+ switch(ledcolor) {
+ default:
+ case 0: l->setColor(green); break;
+ case 1: l->setColor(blue); break;
+ case 2: l->setColor(red); break;
+ case 3: l->setColor(yellow); break;
+ }
+}
+
+
+void
+KLedTest::nextLook() {
+ register int tmp;
+ if (kled_round) {
+ tmp = (static_cast<int>(ledlook) +1 ) % 3 ;
+ }
+ else {
+ tmp = (static_cast<int>(ledlook) + 1) % 3;
+ }
+ ledlook = static_cast<KLed::Look>(tmp);
+ l->setLook(ledlook);
+ //qDebug("painting look %i", ledlook);
+ //l->repaint();
+}
+
+
+void
+KLedTest::timeout()
+{
+ const int NoOfLeds=sizeof(leds)/sizeof(leds[0]);
+ int count;
+ // -----
+ for(count=0; count<NoOfLeds; ++count)
+ {
+ if(leds[count]->state()==KLed::Off)
+ {
+ leds[count]->setState(KLed::On);
+ } else {
+ leds[count]->setState(KLed::Off);
+ }
+ }
+}
+
+
+/*#include <stdio.h>*/
+
+int main( int argc, char **argv )
+{
+ KApplication a( argc, argv, "KLedTest" );
+ KLedTest widget;
+ // -----
+ /*
+ if (argc>1) { // look out for round or circular led command
+ if (strncmp(argv[1],"-c",2)) {
+ // paint circular
+ printf("painting circular led\n");
+ widget.kled_round = true;
+ }
+ else if (strncmp(argv[1],"-r",2)) {
+ // paint rectangle
+ printf("painting rectangular led\n");
+ widget.kled_round = false;
+ }
+ }
+ */
+ a.setMainWidget(&widget);
+ widget.show();
+ return a.exec(); // go
+}
+
+#include "kledtest.moc"
+
diff --git a/kdeui/tests/kledtest.h b/kdeui/tests/kledtest.h
new file mode 100644
index 000000000..ad9ad3ffb
--- /dev/null
+++ b/kdeui/tests/kledtest.h
@@ -0,0 +1,56 @@
+#ifndef kledtest_h
+#define kledtest_h
+
+#include <qwidget.h>
+#include <qtimer.h>
+#include <stdlib.h>
+#include <kled.h>
+
+class KLedTest : public QWidget
+{
+ Q_OBJECT
+protected:
+ QTimer timer;
+ KLed *leds[/*KLed::NoOfShapes*/2* /*KLed::NoOfLooks*/3* /*KLed::NoOfStates*/2];
+ const int LedWidth;
+ const int LedHeight;
+ const int Grid;
+ KLed::Shape shape;
+ KLed::Look look;
+ KLed::State state;
+ int x, y, index;
+
+
+ QTimer t_toggle, t_color, t_look;
+ //KLed *l; // create lamp
+ //KLed *l; // create lamp
+ KLed *l; // create lamp
+ //KLed *l; // create lamp
+ //KLed *l; // create lamp
+ int ledcolor;
+ KLed::Look ledlook;
+
+ const QColor red;
+ const QColor blue;
+ const QColor green;
+ const QColor yellow;
+
+public:
+
+ KLedTest(QWidget* parent=0);
+ ~KLedTest();
+
+ bool kled_round;
+
+
+public slots:
+ void timeout();
+
+ void nextColor();
+ void nextLook();
+
+
+};
+
+#endif
+
diff --git a/kdeui/tests/klineeditdlgtest.cpp b/kdeui/tests/klineeditdlgtest.cpp
new file mode 100644
index 000000000..2c9dc5248
--- /dev/null
+++ b/kdeui/tests/klineeditdlgtest.cpp
@@ -0,0 +1,19 @@
+#include <kapplication.h>
+#include <klineeditdlg.h>
+
+#include <qstring.h>
+#include <qtextview.h>
+
+int main(int argc, char** argv)
+{
+ KApplication app(argc, argv, "klineedittest");
+ KLineEditDlg dialog( "_text", "_value", 0L );
+ if(dialog.exec())
+ {
+ qDebug("Accepted.");
+ } else {
+ qDebug("Rejected.");
+ }
+ return 0;
+}
+
diff --git a/kdeui/tests/klineedittest.cpp b/kdeui/tests/klineedittest.cpp
new file mode 100644
index 000000000..2b40163a1
--- /dev/null
+++ b/kdeui/tests/klineedittest.cpp
@@ -0,0 +1,137 @@
+#include <qstring.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qhbox.h>
+#include <qtimer.h>
+
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+#include <kapplication.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <klocale.h>
+#include <klineedit.h>
+#include <kglobalsettings.h>
+#include <kcompletionbox.h>
+
+#include "klineedittest.h"
+
+KLineEditTest::KLineEditTest (QWidget* widget, const char* name )
+ :QWidget( widget, name )
+{
+ QVBoxLayout* layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
+
+ QStringList list;
+ list << "Tree" << "Suuupa" << "Stroustrup" << "Stone" << "Slick"
+ << "Slashdot" << "Send" << "Peables" << "Mankind" << "Ocean"
+ << "Chips" << "Computer" << "Sandworm" << "Sandstorm" << "Chops";
+ list.sort();
+
+ m_lineedit = new KLineEdit( this, "klineedittest" );
+ m_lineedit->completionObject()->setItems( list );
+ m_lineedit->setFixedSize(500,30);
+ m_lineedit->setEnableSqueezedText( true );
+ connect( m_lineedit, SIGNAL( returnPressed() ), SLOT( slotReturnPressed() ) );
+ connect( m_lineedit, SIGNAL( returnPressed(const QString&) ),
+ SLOT( slotReturnPressed(const QString&) ) );
+
+ QHBox *hbox = new QHBox (this);
+ m_btnExit = new QPushButton( "E&xit", hbox );
+ m_btnExit->setFixedSize(100,30);
+ connect( m_btnExit, SIGNAL( clicked() ), SLOT( quitApp() ) );
+
+ m_btnReadOnly = new QPushButton( "&Read Only", hbox );
+ m_btnReadOnly->setToggleButton (true);
+ m_btnReadOnly->setFixedSize(100,30);
+ connect( m_btnReadOnly, SIGNAL( toggled(bool) ), SLOT( slotReadOnly(bool) ) );
+
+ m_btnEnable = new QPushButton( "Dis&able", hbox );
+ m_btnEnable->setToggleButton (true);
+ m_btnEnable->setFixedSize(100,30);
+ connect( m_btnEnable, SIGNAL( toggled(bool) ), SLOT( slotEnable(bool) ) );
+
+ m_btnHide = new QPushButton( "Hi&de", hbox );
+ m_btnHide->setFixedSize(100,30);
+ connect( m_btnHide, SIGNAL( clicked() ), SLOT( slotHide() ) );
+
+ layout->addWidget( m_lineedit );
+ layout->addWidget( hbox );
+ setCaption( "KLineEdit Unit Test" );
+}
+
+KLineEditTest::~KLineEditTest()
+{
+}
+
+void KLineEditTest::quitApp()
+{
+ kapp->closeAllWindows();
+}
+
+void KLineEditTest::show()
+{
+ if (m_lineedit->isHidden())
+ m_lineedit->show();
+
+ m_btnHide->setEnabled( true );
+
+ QWidget::show();
+}
+
+void KLineEditTest::slotReturnPressed()
+{
+ kdDebug() << "Return pressed" << endl;
+}
+
+void KLineEditTest::slotReturnPressed( const QString& text )
+{
+ kdDebug() << "Return pressed: " << text << endl;
+}
+
+void KLineEditTest::resultOutput( const QString& text )
+{
+ kdDebug() << "KlineEditTest Debug: " << text << endl;
+}
+
+void KLineEditTest::slotReadOnly( bool ro )
+{
+ m_lineedit->setReadOnly (ro);
+ QString text = (ro) ? "&Read Write" : "&Read Only";
+ m_btnReadOnly->setText (text);
+}
+
+void KLineEditTest::slotEnable (bool enable)
+{
+ m_lineedit->setEnabled (!enable);
+ QString text = (enable) ? "En&able":"Dis&able";
+ m_btnEnable->setText (text);
+}
+
+void KLineEditTest::slotHide()
+{
+ m_lineedit->hide();
+ m_btnHide->setEnabled( false );
+ m_lineedit->setText( "My dog ate the homework, whaaaaaaaaaaaaaaaaaaaaaaa"
+ "aaaaaaaaaaaaaaaaaaaaaaaaa! I want my mommy!" );
+ QTimer::singleShot( 1000, this, SLOT(show()) );
+}
+
+int main ( int argc, char **argv)
+{
+ KAboutData aboutData( "klineedittest", "klineedittest", "1.0" );
+ KCmdLineArgs::init(argc, argv, &aboutData);
+ KApplication::addCmdLineOptions();
+
+ KApplication a;
+ KLineEditTest *t = new KLineEditTest();
+ //t->lineEdit()->setTrapReturnKey( true );
+ //t->lineEdit()->completionBox()->setTabHandling( false );
+ t->lineEdit()->setEnableSqueezedText( true );
+ t->lineEdit()->setText ("This is a really really really really really really "
+ "really really long line because I am a talkative fool!");
+ a.setMainWidget(t);
+ t->show();
+ return a.exec();
+}
+
+#include "klineedittest.moc"
diff --git a/kdeui/tests/klineedittest.h b/kdeui/tests/klineedittest.h
new file mode 100644
index 000000000..e3b87c30e
--- /dev/null
+++ b/kdeui/tests/klineedittest.h
@@ -0,0 +1,41 @@
+#ifndef _KLINEEDITTEST_H
+#define _KLINEEDITTEST_H
+
+#include <qwidget.h>
+#include <qguardedptr.h>
+
+class QString;
+class QPushButton;
+
+class KLineEdit;
+
+class KLineEditTest : public QWidget
+{
+ Q_OBJECT
+
+public:
+ KLineEditTest( QWidget *parent=0, const char *name=0 );
+ ~KLineEditTest();
+ KLineEdit* lineEdit() const { return m_lineedit; }
+
+public slots:
+ virtual void show ();
+
+private slots:
+ void quitApp();
+ void slotHide();
+ void slotEnable( bool );
+ void slotReadOnly( bool );
+ void slotReturnPressed();
+ void resultOutput( const QString& );
+ void slotReturnPressed( const QString& );
+
+protected:
+ QGuardedPtr<KLineEdit> m_lineedit;
+ QPushButton* m_btnExit;
+ QPushButton* m_btnReadOnly;
+ QPushButton* m_btnEnable;
+ QPushButton* m_btnHide;
+};
+
+#endif
diff --git a/kdeui/tests/klistviewtest.cpp b/kdeui/tests/klistviewtest.cpp
new file mode 100644
index 000000000..75c01e439
--- /dev/null
+++ b/kdeui/tests/klistviewtest.cpp
@@ -0,0 +1,39 @@
+#include <klistview.h>
+#include <kapplication.h>
+#include <kdialogbase.h>
+#include <qvbox.h>
+
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "klistviewtest" );
+ KDialogBase dialog;
+ KListView *view = new KListView( dialog.makeVBoxMainWidget() );
+ view->setSelectionModeExt( KListView::FileManager );
+ view->setDragEnabled( true );
+ view->setItemsMovable( false );
+ view->setAcceptDrops( true );
+ view->addColumn("Column 1");
+ view->addColumn("Column 2");
+ view->addColumn("Column 3");
+
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 1");
+ new KListViewItem( view, "Item 2", "Some more", "Hi Mom :)" );
+
+ view->restoreLayout( KGlobal::config(), "ListView" );
+
+ new KListViewItem( view, "Item 3" );
+
+ dialog.exec();
+ view->saveLayout( KGlobal::config(), "ListView" );
+
+ return 0;
+}
diff --git a/kdeui/tests/kmainwindowrestoretest.cpp b/kdeui/tests/kmainwindowrestoretest.cpp
new file mode 100644
index 000000000..35198a6c2
--- /dev/null
+++ b/kdeui/tests/kmainwindowrestoretest.cpp
@@ -0,0 +1,41 @@
+
+#include "kmainwindowrestoretest.h"
+
+#include <kapplication.h>
+
+#include <qlabel.h>
+
+#define MAKE_WINDOW( kind, title ) do { \
+ MainWin##kind * m = new MainWin##kind; \
+ m->setCaption( title ); \
+ m->setCentralWidget( new QLabel( title, m ) ); \
+ m->show(); \
+} while ( false )
+
+int main( int argc, char * argv[] ) {
+
+ KApplication app( argc, argv, "kmainwindowrestoretest" );
+
+ if ( kapp->isRestored() ) {
+ kRestoreMainWindows< MainWin1, MainWin2, MainWin3 >();
+ kRestoreMainWindows< MainWin4, MainWin5 >();
+ RESTORE(MainWin6);
+ //kRestoreMainWindows< MainWin6 >(); // should be equivalent to RESTORE()
+ } else {
+ MAKE_WINDOW( 1, "First 1" );
+ MAKE_WINDOW( 1, "Second 1" );
+ MAKE_WINDOW( 2, "Only 2" );
+ MAKE_WINDOW( 3, "First 3" );
+ MAKE_WINDOW( 4, "First 4" );
+ MAKE_WINDOW( 4, "Second 4" );
+ MAKE_WINDOW( 3, "Second 3" );
+ MAKE_WINDOW( 4, "Third 4" );
+ MAKE_WINDOW( 5, "First 5" );
+ MAKE_WINDOW( 5, "Second 5" );
+ MAKE_WINDOW( 1, "Only 6" );
+ }
+
+ return app.exec();
+}
+
+#include "kmainwindowrestoretest.moc"
diff --git a/kdeui/tests/kmainwindowrestoretest.h b/kdeui/tests/kmainwindowrestoretest.h
new file mode 100644
index 000000000..7bd535f74
--- /dev/null
+++ b/kdeui/tests/kmainwindowrestoretest.h
@@ -0,0 +1,48 @@
+#ifndef _KDEUI_TESTS_KMAINWINDOWRESTORETEST_H_
+#define _KDEUI_TESTS_KMAINWINDOWRESTORETEST_H_
+
+#include <kmainwindow.h>
+
+class MainWin1 : public KMainWindow {
+ Q_OBJECT
+public:
+ MainWin1() : KMainWindow() {}
+ virtual ~MainWin1() {}
+};
+
+class MainWin2 : public KMainWindow {
+ Q_OBJECT
+public:
+ MainWin2() : KMainWindow() {}
+ virtual ~MainWin2() {}
+};
+
+class MainWin3 : public KMainWindow {
+ Q_OBJECT
+public:
+ MainWin3() : KMainWindow() {}
+ virtual ~MainWin3() {}
+};
+
+class MainWin4 : public KMainWindow {
+ Q_OBJECT
+public:
+ MainWin4() : KMainWindow() {}
+ virtual ~MainWin4() {}
+};
+
+class MainWin5 : public KMainWindow {
+ Q_OBJECT
+public:
+ MainWin5() : KMainWindow() {}
+ virtual ~MainWin5() {}
+};
+
+class MainWin6 : public KMainWindow {
+ Q_OBJECT
+public:
+ MainWin6() : KMainWindow() {}
+ virtual ~MainWin6() {}
+};
+
+#endif // _KDEUI_TESTS_KMAINWINDOWRESTORETEST_H_
diff --git a/kdeui/tests/kmainwindowtest.cpp b/kdeui/tests/kmainwindowtest.cpp
new file mode 100644
index 000000000..6ab8d33a0
--- /dev/null
+++ b/kdeui/tests/kmainwindowtest.cpp
@@ -0,0 +1,38 @@
+#include <qtimer.h>
+#include <qlabel.h>
+
+#include <kapplication.h>
+#include <kstatusbar.h>
+#include <kmenubar.h>
+
+#include "kmainwindowtest.h"
+
+MainWindow::MainWindow()
+{
+ QTimer::singleShot( 2*1000, this, SLOT( showMessage() ) );
+
+ setCentralWidget( new QLabel( "foo", this ) );
+
+ menuBar()->insertItem( "hi" );
+}
+
+void MainWindow::showMessage()
+{
+ statusBar()->show();
+ statusBar()->message( "test" );
+}
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "kmainwindowtest" );
+
+ MainWindow* mw = new MainWindow; // deletes itself when closed
+ mw->show();
+
+ return app.exec();
+}
+
+#include "kmainwindowtest.moc"
+
+/* vim: et sw=4 ts=4
+ */
diff --git a/kdeui/tests/kmainwindowtest.h b/kdeui/tests/kmainwindowtest.h
new file mode 100644
index 000000000..4fb426ac5
--- /dev/null
+++ b/kdeui/tests/kmainwindowtest.h
@@ -0,0 +1,18 @@
+#ifndef KMAINWINDOWTEST_H
+#define KMAINWINDOWTEST_H
+
+#include <kmainwindow.h>
+
+class MainWindow : public KMainWindow
+{
+ Q_OBJECT
+public:
+ MainWindow();
+
+private slots:
+ void showMessage();
+};
+
+#endif // KMAINWINDOWTEST_H
+/* vim: et sw=4 ts=4
+ */
diff --git a/kdeui/tests/kmessageboxtest.cpp b/kdeui/tests/kmessageboxtest.cpp
new file mode 100644
index 000000000..372bef16a
--- /dev/null
+++ b/kdeui/tests/kmessageboxtest.cpp
@@ -0,0 +1,242 @@
+#include "kmessagebox.h"
+
+#include <qdialog.h>
+#include <qlayout.h>
+
+#include <stdlib.h>
+
+#include <stdio.h>
+
+#include <kstatusbar.h>
+#include <kapplication.h>
+
+#include <kglobal.h>
+
+class ExampleWidget : public QLabel
+{
+public:
+ ExampleWidget( QWidget *parent = 0, const char *name = 0 );
+};
+
+ExampleWidget::ExampleWidget( QWidget *parent, const char *name )
+ : QLabel(parent, name )
+{
+ // Make the top-level layout; a vertical box to contain all widgets
+ // and sub-layouts.
+ QSize sh;
+ setText("<p>Hello.</p>");
+ sh = sizeHint();
+ qWarning("SizeHint = %d x %d", sh.width(), sh.height());
+ setText("Hello.");
+ sh = sizeHint();
+ qWarning("SizeHint = %d x %d", sh.width(), sh.height());
+ setText("<p>Hello<br>World</p>");
+ sh = sizeHint();
+ qWarning("SizeHint = %d x %d", sh.width(), sh.height());
+// setText("Hello\nWorld");
+ sh = sizeHint();
+ qWarning("SizeHint = %d x %d", sh.width(), sh.height());
+ setMinimumSize(sizeHint());
+}
+
+
+class Foo: public QDialog
+{
+ public:
+ Foo() : QDialog(0, "foo", true) { resize(200,200); new QLabel("Hello World", this); show(); }
+};
+
+void showResult(int test, int i)
+{
+ printf("%d. returned %d ", test, i);
+ switch( i) {
+ case KMessageBox::Ok : printf("(%s)\n", "Ok"); break;
+ case KMessageBox::Cancel : printf("(%s)\n", "Cancel"); break;
+ case KMessageBox::Yes : printf("(%s)\n", "Yes"); break;
+ case KMessageBox::No : printf("(%s)\n", "No"); break;
+ case KMessageBox::Continue : printf("(%s)\n", "Continue"); break;
+ default: printf("(%s)\n", "ERROR!"); exit(1);
+ }
+}
+
+
+int main( int argc, char *argv[] )
+{
+ int i, test;
+ new KApplication( argc, argv, "MyApplication" );
+
+ ExampleWidget *w = new ExampleWidget();
+ w->show();
+ w->deleteLater();
+
+ QStringList list; list.append("Hello"); list.append("World");
+
+ for( test = 1; true; test++)
+ {
+ switch(test)
+ {
+case 1:
+ i = KMessageBox::warningContinueCancel(w,
+ "You are about to <Print>.\n"
+ "Are you sure?",
+ "Print", QString::fromLatin1("&Print"), "dontask", false);
+ i = KMessageBox::warningContinueCancel(0,
+ "You are about to <Print>.\n"
+ "Are you sure?",
+ "Print", QString::fromLatin1("&Print"), "dontask", KMessageBox::AllowLink);
+ i = KMessageBox::questionYesNo(0, "<p>Do you have a printer? thisisaverylongdkldhklghklghklashgkllasghkdlsghkldfghklsabla bla bbla bla. It also has <a href=http://www.kde.org>this URL</a>.</p>",
+ QString("Bla"), QString("Yes"), QString("No"), "bla", KMessageBox::AllowLink);
+ break;
+
+case 2:
+ i = KMessageBox::questionYesNo(0, "Do you have a printer?",
+ QString("Printer setup"), QString::null);
+ break;
+
+case 3:
+ i = KMessageBox::questionYesNo(0,
+ "Does your printer support color or only black and white?",
+ "Printer setup", QString::fromLatin1("&Color"), QString::fromLatin1("&Black & White"));
+ break;
+
+case 4:
+ i = KMessageBox::warningYesNo(0,
+ "KDVI could not locate the program 'dvipdfm' on your computer. That program is "
+ "absolutely needed by the export function. You can, however, convert "
+ "the DVI-file to PDF using the print function of KDVI, but that will often "
+ "produce files which print ok, but are of inferior quality if viewed in the "
+ "Acrobat Reader. It may be wise to upgrade to a more recent version of your "
+ "TeX distribution which includes the 'dvipdfm' program.\n"
+ "Hint to the perplexed system administrator: KDVI uses the shell's PATH variable "
+ "when looking for programs."
+ );
+ break;
+
+
+case 5:
+ i = KMessageBox::warningYesNo(0, "Your printer has been added.\n"
+ "Do you want to update your configuration?",
+ "Printer Setup");
+ break;
+
+case 6:
+ i = KMessageBox::warningContinueCancel(0,
+ "You are about to print.\n"
+ "Are you sure?",
+ "Print", QString::fromLatin1("&Print"));
+ break;
+case 7:
+ i = KMessageBox::warningContinueCancel(0,
+ "You are about to <Print>.\n"
+ "Are you sure?",
+ "Print", QString::fromLatin1("&Print"), "dontask", false);
+ break;
+
+case 8:
+ i = KMessageBox::warningYesNoCancel(0,
+ "Your document contains unsaved changes.\n"
+ "Do you want to save your changes?\n");
+ break;
+
+case 9:
+ i = KMessageBox::warningYesNoCancel(0,
+ "Your document contains unsaved changes.\n"
+ "Do you want to save your changes?\n",
+ QString::fromLatin1("Close"));
+ break;
+
+case 10:
+ i = KMessageBox::warningYesNoCancel(0,
+ "Your document contains unsaved changes.\n"
+ "Do you want to save or discard your changes?\n",
+ "Close", QString::fromLatin1("&Save"), QString::fromLatin1("&Discard") );
+ break;
+
+case 11:
+ i = KMessageBox::Ok;
+ KMessageBox::error(0, "Oops, Your harddisk is unreadable.");
+ break;
+
+case 12:
+ i = KMessageBox::Ok;
+ KMessageBox::error(0, "Oops, Your harddisk is unreadable." , "Uh ooh");
+ break;
+
+case 13:
+ i = KMessageBox::Ok;
+ KMessageBox::sorry(0, "Sorry, Your harddisk appears to be empty.");
+ break;
+
+case 14:
+ i = KMessageBox::Ok;
+ KMessageBox::sorry(0, "Sorry, Your harddisk appears to be empty.", "Oops");
+ break;
+
+case 15:
+ i = KMessageBox::Ok;
+ KMessageBox::information(0, "You can enable the menubar again "
+ "with the right mouse button menu.");
+ break;
+
+case 16:
+ i = KMessageBox::Ok;
+ KMessageBox::information(0, "You can enable the menubar again "
+ "with the right mouse button menu.", "Menubar Info");
+ break;
+
+case 17:
+ i = KMessageBox::Ok;
+ KMessageBox::information(0, "You can enable the menubar again\nwith the right mouse button menu.", QString::null, "Enable_Menubar");
+ break;
+
+case 18:
+ i = KMessageBox::Ok;
+ KMessageBox::enableAllMessages();
+ break;
+
+case 19:
+ i = KMessageBox::Ok;
+ KMessageBox::information(0, "Return of the annoying popup message.", QString::null, "Enable_Menubar");
+ break;
+case 20:
+ {
+ QStringList strlist;
+ strlist << "/dev/hda" << "/etc/inittab" << "/usr/somefile" << "/some/really/"
+ "long/file/name/which/is/in/a/really/deep/directory/in/a/really/large/"
+ "hard/disk/of/your/system" << "/and/another/one" ;
+ i = KMessageBox::questionYesNoList(0, "Do you want to delete the following files ?",strlist);
+ }
+ break;
+case 21:
+ {
+ QStringList strlist;
+ printf("Filling StringList...\n");
+ for (int j=1;j<=6000;j++) strlist.append(QString("/tmp/tmp.%1").arg(j));
+ printf("Completed...\n");
+ i = KMessageBox::questionYesNoList(0, "Do you want to delete the following files ?",strlist);
+ }
+ break;
+
+case 22:
+ i = KMessageBox::Ok;
+ KMessageBox::informationList(0, "The following words have been found:",list);
+ break;
+
+case 23:
+ i = KMessageBox::Ok;
+ KMessageBox::informationList(0, "The following words have been found:", list, "Search Words");
+ break;
+
+case 24:
+ i = KMessageBox::Ok;
+ KMessageBox::informationList(0, "The follwoing words have been found:", list, QString::null, "Search_Words");
+ break;
+
+default:
+ return 0;
+ } // Switch
+
+ showResult(test, i);
+ } // Test
+}
+
diff --git a/kdeui/tests/knuminputtest.cpp b/kdeui/tests/knuminputtest.cpp
new file mode 100644
index 000000000..b3d8e9067
--- /dev/null
+++ b/kdeui/tests/knuminputtest.cpp
@@ -0,0 +1,145 @@
+/*
+* Tests the KNumInput Widget class
+*
+* Copyright (c) 1999 by Dirk A. Mueller <dmuell@gmx.net>
+*
+* License: GPL, version 2
+* Version: $Id:
+*
+*/
+
+#include <qlayout.h>
+#include <qvgroupbox.h>
+
+#include <kapplication.h>
+#include <knuminput.h>
+
+#include "knuminputtest.h"
+
+KApplication *a;
+
+#include <kdebug.h>
+void TopLevel::slotPrint( int n ) {
+ kdDebug() << "slotPrint( " << n << " )" << endl;
+}
+void TopLevel::slotPrint( double n ) {
+ kdDebug() << "slotPrint( " << n << " )" << endl;
+}
+
+#define conn(x,y) connect( x, SIGNAL(valueChanged(y)), SLOT(slotPrint(y)))
+TopLevel::TopLevel(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ setCaption("KNumInput test application");
+
+ QBoxLayout* l = new QHBoxLayout(this, 10);
+
+ QGroupBox* b1 = new QVGroupBox("KIntNumInput", this);
+
+ i1 = new KIntNumInput(42, b1, 10, "perc_no_slider");
+ i1->setLabel("percent of usage (no slider)");
+ i1->setRange(0, 100, 5, false);
+ conn(i1,int);
+
+ i2 = new KIntNumInput(i1, 42, b1);
+ i2->setLabel("percentage of usage (with slider)");
+ i2->setRange(0, 100, 5);
+ i2->setSuffix(" %");
+ conn(i2,int);
+
+ i3 = new KIntNumInput(i2, 0xAF, b1, 16);
+ i3->setLabel("Hex byte (no slider)");
+ i3->setRange(0, 255, 1, false);
+ i3->setSuffix(" (hex)");
+ conn(i3,int);
+
+ i4 = new KIntNumInput(i3, 0xfe, b1, 16);
+ i4->setLabel("Hex byte (with slider)");
+ i4->setRange(0, 255, 1);
+ conn(i4,int);
+
+ i5 = new KIntNumInput(i4, 10, b1, 10);
+ i5->setLabel("Width (keeps aspect ratio):");
+ i5->setRange(0, 200, 1, false);
+ i5->setReferencePoint( 5 );
+
+ i6 = new KIntNumInput(i5, 20, b1, 10);
+ i6->setLabel("Height (should be 2xWidth):");
+ i6->setRange(0, 200, 1, false);
+ i6->setReferencePoint( 10 );
+ connect( i5, SIGNAL(relativeValueChanged(double)),
+ i6, SLOT(setRelativeValue(double)) );
+ connect( i6, SIGNAL(relativeValueChanged(double)),
+ i5, SLOT(setRelativeValue(double)) );
+
+ i7 = new KIntNumInput(i6, 0, b1, 10);
+ i7->setLabel("math test:", AlignVCenter|AlignLeft );
+ i7->setRange( INT_MIN, INT_MAX, 1 );
+ conn(i7,int);
+
+ l->addWidget(b1);
+
+ QGroupBox* b2 = new QVGroupBox("KDoubleNumInput", this);
+
+ d1 = new KDoubleNumInput(4.0, b2, "perc_double_no_slider");
+ d1->setLabel("percent of usage (no slider)", AlignTop | AlignRight);
+ d1->setRange(0.0, 4000.0, 0.01, false);
+ //d1->setValue(1.00000000000000000001);
+ conn(d1,double);
+
+ d2 = new KDoubleNumInput(d1, 0.422, b2, "perc_double_with_slider");
+ d2->setLabel("percentage of usage (with slider)", AlignBottom | AlignLeft);
+ d2->setRange(0, 1.0, 0.005);
+ d2->setSuffix("%");
+ conn(d2,double);
+
+ d3 = new KDoubleNumInput(d2, 16.20, b2);
+ d3->setLabel("cash: ", AlignVCenter | AlignHCenter);
+ d3->setRange(0.10, 100, 0.1);
+ d3->setPrefix("p");
+ d3->setSuffix("$");
+ conn(d3,double);
+
+ d4 = new KDoubleNumInput(d3, INT_MAX/10000.0, b2);
+ d4->setPrecision(3);
+ d4->setRange(double(INT_MIN+1)/1000.0, double(INT_MAX)/1000.0, 1);
+ d4->setLabel("math test: ", AlignVCenter | AlignLeft);
+// d4->setFormat("%g");
+ conn(d4,double);
+
+ d5 = new KDoubleNumInput(d4, double(INT_MIN+1)/1e9, double(INT_MAX-1)/1e9,
+ 0.1, 0.001, 9, b2, "d5");
+ d5->setLabel("math test 2: ", AlignVCenter|AlignLeft);
+ conn(d5,double);
+
+ d6 = new KDoubleNumInput(d5, -10, 10, 0, 0.001, 3, b2, "d6");
+ d6->setLabel("aspect ratio test with a negative ratio:");
+ d6->setReferencePoint( 1 );
+
+ d7 = new KDoubleNumInput(d6, -30, 30, 0, 0.001, 3, b2, "d7");
+ d7->setReferencePoint( -3 );
+
+ connect( d6, SIGNAL(relativeValueChanged(double)),
+ d7, SLOT(setRelativeValue(double)) );
+ connect( d7, SIGNAL(relativeValueChanged(double)),
+ d6, SLOT(setRelativeValue(double)) );
+
+ l->addWidget(b2);
+}
+
+
+
+
+int main( int argc, char ** argv )
+{
+ a = new KApplication ( argc, argv, "KNuminputTest" );
+
+ TopLevel *toplevel = new TopLevel(0, "knuminputtest");
+
+ toplevel->show();
+ a->setMainWidget(toplevel);
+ a->exec();
+}
+
+#include "knuminputtest.moc"
+
diff --git a/kdeui/tests/knuminputtest.h b/kdeui/tests/knuminputtest.h
new file mode 100644
index 000000000..e4a979e48
--- /dev/null
+++ b/kdeui/tests/knuminputtest.h
@@ -0,0 +1,23 @@
+#ifndef _KNUMINPUTTEST_H
+#define _KNUMINPUTTEST_H
+
+#include <qwidget.h>
+
+class KIntNumInput;
+class KDoubleNumInput;
+
+class TopLevel : public QWidget
+{
+ Q_OBJECT
+public:
+
+ TopLevel( QWidget *parent=0, const char *name=0 );
+protected:
+ KIntNumInput* i1, *i2, *i3, *i4, *i5, *i6, *i7;
+ KDoubleNumInput* d1, *d2, *d3, *d4, *d5, *d6, *d7;
+protected slots:
+ void slotPrint( int );
+ void slotPrint( double );
+};
+
+#endif
diff --git a/kdeui/tests/kpalettetest.cpp b/kdeui/tests/kpalettetest.cpp
new file mode 100644
index 000000000..d75563ec5
--- /dev/null
+++ b/kdeui/tests/kpalettetest.cpp
@@ -0,0 +1,38 @@
+
+#include <kapplication.h>
+#include <qwidget.h>
+#include <qtimer.h>
+#include <stdlib.h>
+#include "kpalette.h"
+#include "kledtest.h"
+#include <stdio.h>
+
+#include <qstringlist.h>
+
+
+int main( int argc, char **argv )
+{
+ KApplication a( argc, argv, "KPalettetest" );
+
+ QStringList palettes = KPalette::getPaletteList();
+ for(QStringList::ConstIterator it = palettes.begin();
+ it != palettes.end(); it++)
+ {
+ printf("Palette = %s\n", (*it).ascii());
+
+ KPalette myPalette = KPalette(*it);
+
+ printf("Palette Name = \"%s\"\n", myPalette.name().ascii());
+ printf("Description:\n\"%s\"\n", myPalette.description().ascii());
+ printf("Nr of Colors = %d\n", myPalette.nrColors());
+ for(int i = 0; i < myPalette.nrColors(); i++)
+ {
+ int r,g,b;
+ myPalette.color(i).rgb(&r, &g, &b);
+ printf("#%d Name = \"%s\" #%02x%02x%02x\n",
+ i, myPalette.colorName(i).ascii(), r,g,b);
+ }
+ }
+}
+
+
diff --git a/kdeui/tests/kpanelmenutest.cpp b/kdeui/tests/kpanelmenutest.cpp
new file mode 100644
index 000000000..4ff13b89c
--- /dev/null
+++ b/kdeui/tests/kpanelmenutest.cpp
@@ -0,0 +1,72 @@
+#include "kpanelmenutest.h"
+#include <kapplication.h>
+#include <kstandarddirs.h>
+#include <dcopclient.h>
+
+TestWidget::TestWidget(QWidget *parent, const char *name)
+ : QLabel(parent, name)
+{
+ testMenu = new KPanelAppMenu(locate("mini", "x.png"), "Client Test", this,
+ "menu1");
+
+ subMenu = testMenu->insertMenu(locate("mini", "x.png"), "Submenu Test");
+ subMenu->insertItem(locate("mini", "bx2.png"), "First Entry", 100);
+ subMenu->insertItem(locate("mini", "bx2.png"), "Second Entry", 101);
+
+ KPanelAppMenu *ssub = subMenu->insertMenu(locate("mini", "x.png"), "One more");
+
+ connect(testMenu, SIGNAL(activated(int)), SLOT(slotMenuCalled(int)));
+ connect(subMenu, SIGNAL(activated(int)), SLOT(slotSubMenuCalled(int)));
+ init();
+
+ setText("We added \"Client Test\" to kicker. Click the K Menu to check.");
+ resize(sizeHint());
+}
+
+void TestWidget::init()
+{
+ testMenu->insertItem(locate("mini", "bx2.png"),
+ "Add another entry!", 1);
+ testMenu->insertItem("Attention, this will clear the menu", 2);
+}
+
+void TestWidget::slotMenuCalled(int id)
+{
+ switch ( id ) {
+ case 1:
+ setText("Selected \"Add another entry!\" ");
+ testMenu->insertItem("Another entry");
+ break;
+ case 2:
+ setText("Selected \"Attention, this will clear the menu\"");
+ testMenu->clear();
+ init();
+ break;
+ default:
+ setText("Selected \"Another entry...\"");
+ }
+}
+
+
+void TestWidget::slotSubMenuCalled(int id)
+{
+ QString msg("Called with id=%1");
+ setText(msg.arg(id));
+}
+
+
+int main(int argc, char **argv)
+{
+ KApplication *app = new KApplication(argc, argv, "menutest");
+
+ TestWidget w;
+ app->setMainWidget(&w);
+ w.show();
+
+ app->exec();
+}
+
+#include "kpanelmenutest.moc"
+
+
+
diff --git a/kdeui/tests/kpanelmenutest.h b/kdeui/tests/kpanelmenutest.h
new file mode 100644
index 000000000..0e0e4a728
--- /dev/null
+++ b/kdeui/tests/kpanelmenutest.h
@@ -0,0 +1,21 @@
+#ifndef __KPANELMENUTEST_H
+#define __KPANELMENUTEST_H
+
+#include <kpanelappmenu.h>
+#include <qlabel.h>
+
+class TestWidget : public QLabel
+{
+ Q_OBJECT
+public:
+ TestWidget(QWidget *parent=0, const char *name=0);
+ ~TestWidget(){delete testMenu;}
+public slots:
+ void slotMenuCalled(int id);
+ void slotSubMenuCalled(int id);
+private:
+ void init();
+ KPanelAppMenu *testMenu, *subMenu;
+};
+
+#endif
diff --git a/kdeui/tests/kpixmapregionselectordialogtest.cpp b/kdeui/tests/kpixmapregionselectordialogtest.cpp
new file mode 100644
index 000000000..7d57c4234
--- /dev/null
+++ b/kdeui/tests/kpixmapregionselectordialogtest.cpp
@@ -0,0 +1,33 @@
+#include "kpixmapregionselectordialog.h"
+#include <qpixmap.h>
+#include <qimage.h>
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <iostream>
+
+static const KCmdLineOptions options[] =
+{
+ { "+file", "The image file to open", 0 },
+ KCmdLineLastOption
+};
+
+int main(int argc, char**argv)
+{
+ KCmdLineArgs::init(argc, argv, "test", "test" ,"test" ,"1.0");
+ KCmdLineArgs::addCmdLineOptions( options );
+ KApplication app("test");
+
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ if (args->count()!=1)
+ {
+ std::cout << "Usage: kpixmapregionselectordialogtest <imageFile>" << std::endl;
+ return 1;
+ }
+
+ QImage image=
+ KPixmapRegionSelectorDialog::getSelectedImage(QPixmap(args->arg(0)),100,100);
+
+ image.save("output.png", "PNG");
+
+ return 0;
+}
diff --git a/kdeui/tests/kpopuptest.cpp b/kdeui/tests/kpopuptest.cpp
new file mode 100644
index 000000000..43e3c0958
--- /dev/null
+++ b/kdeui/tests/kpopuptest.cpp
@@ -0,0 +1,40 @@
+#include <kapplication.h>
+#include <qwidget.h>
+#include <qcursor.h>
+#include "kpopupmenu.h"
+
+class DemoWidget : public QWidget {
+private:
+ KPopupMenu *menu;
+
+void mousePressEvent(QMouseEvent *)
+{
+ menu->popup(QCursor::pos());
+}
+
+void paintEvent(QPaintEvent *)
+{
+ drawText(32, 32, "Press a Mouse Button!");
+}
+
+public:
+ DemoWidget() : QWidget()
+ {
+ menu = new KPopupMenu("Popup Menu:");
+ menu->insertItem("Item1");
+ menu->insertItem("Item2");
+ menu->insertSeparator();
+ menu->insertItem("Quit", qApp, SLOT(quit()));
+ }
+};
+
+int main(int argc, char **argv)
+{
+ KApplication app(argc, argv, "kpopupmenutest");
+ DemoWidget w;
+ app.setMainWidget(&w);
+ w.setFont(QFont("helvetica", 12, QFont::Bold), true);
+ w.show();
+ return app.exec();
+}
+
diff --git a/kdeui/tests/kprogresstest.cpp b/kdeui/tests/kprogresstest.cpp
new file mode 100644
index 000000000..d748fcb0f
--- /dev/null
+++ b/kdeui/tests/kprogresstest.cpp
@@ -0,0 +1,58 @@
+#include <kapplication.h>
+#include <qwidget.h>
+#include "kprogress.h"
+
+
+class MyWidget : public QWidget {
+public:
+ MyWidget() : QWidget()
+ {
+ setFixedSize(440, 80);
+ Progress = new KProgress(this);
+ Progress->resize(400, 40);
+ Progress->move(20, 20);
+ startTimer(50);
+ }
+
+private:
+ KProgress *Progress;
+
+ void timerEvent(QTimerEvent *);
+};
+
+void MyWidget::timerEvent(QTimerEvent *)
+{
+ static enum { fwd, back } direction = fwd;
+ //static KProgress::BarStyle style = KProgress::Solid;
+ if (direction == fwd)
+ {
+ if (Progress->value() == Progress->maxValue())
+ direction = back;
+ else
+ Progress->advance(1);
+ }
+ else
+ {
+ if (Progress->value() == 0 /*Progress->minValue()*/)
+ {
+ direction = fwd;
+ //style = (style == KProgress::Solid)? KProgress::Blocked : KProgress::Solid;
+ //Progress->setBarStyle(style);
+ }
+ else
+ Progress->advance(-1);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ KApplication app(argc, argv, "KProgressTest");
+ MyWidget w;
+
+ app.setMainWidget(&w);
+
+ w.show();
+
+ int ret = app.exec();
+ return ret;
+}
diff --git a/kdeui/tests/krulertest.cpp b/kdeui/tests/krulertest.cpp
new file mode 100644
index 000000000..1efe57643
--- /dev/null
+++ b/kdeui/tests/krulertest.cpp
@@ -0,0 +1,375 @@
+
+
+#include "krulertest.h"
+
+#include "kruler.h"
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qgroupbox.h>
+
+/*
+void
+MyCheckBox::mouseReleaseEvent(QMouseEvent *e )
+{
+ QButton::mouseReleaseEvent(e);
+ if ();
+}
+*/
+
+MouseWidget::MouseWidget( QWidget *parent, const char *name, WFlags f )
+ : QFrame(parent, name, f)
+{
+}
+
+void
+MouseWidget::mousePressEvent( QMouseEvent *e )
+{
+ mouseButtonDown = true;
+ emit newXPos(e->x());
+ emit newYPos(e->y());
+}
+
+void
+MouseWidget::mouseReleaseEvent( QMouseEvent * )
+{ mouseButtonDown = false; }
+
+void
+MouseWidget::mouseMoveEvent( QMouseEvent *e )
+{
+ if (mouseButtonDown) {
+ emit newXPos(e->x());
+ emit newYPos(e->y());
+ }
+}
+
+void
+MouseWidget::resizeEvent( QResizeEvent *r )
+{
+ emit newWidth(r->size().width());
+ emit newHeight(r->size().height());
+}
+
+
+KRulerTest::KRulerTest( const char *name )
+ : KMainWindow(0, name)
+{
+ mainframe = new QFrame(this);
+
+ layout = new QGridLayout(mainframe, 2, 2);
+
+ miniwidget = new QFrame(mainframe);
+ miniwidget->setFrameStyle(QFrame::WinPanel | QFrame::Raised);
+ bigwidget = new MouseWidget(mainframe);
+ bigwidget->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
+
+ // QRect bwrect = bigwidget->frameRect();
+ // qDebug("big rect: top%i left%i bottom%i right%i",
+ // bwrect.top(), bwrect.left(), bwrect.bottom(), bwrect.right());
+ hruler = new KRuler(Horizontal, mainframe);
+ // hruler->setRange( bwrect.left(), bwrect.right() );
+ hruler->setRange( 0, 1000 );
+ // hruler->setOffset( bwrect.left() - bigwidget->frameRect().left() );
+ hruler->setOffset( 0 );
+
+ vruler = new KRuler(Vertical, mainframe);
+ vruler->setFrameStyle(QFrame::WinPanel | QFrame::Sunken);
+ vruler->setOffset( 0 );
+ vruler->setRange( 0, 1000 );
+
+ connect( bigwidget, SIGNAL(newXPos(int)),
+ hruler, SLOT(slotNewValue(int)) );
+ connect( bigwidget, SIGNAL(newYPos(int)),
+ vruler, SLOT(slotNewValue(int)) );
+ connect( bigwidget, SIGNAL(newWidth(int)),
+ SLOT(slotNewWidth(int)) );
+ connect( bigwidget, SIGNAL(newHeight(int)),
+ SLOT(slotNewHeight(int)) );
+
+ layout->addWidget(miniwidget, 0, 0);
+ layout->addWidget(hruler, 0, 1);
+ layout->addWidget(vruler, 1, 0);
+ layout->addWidget(bigwidget, 1, 1);
+
+ mouse_message = new QLabel("Press and hold mouse button\nfor pointer movement", bigwidget);
+ mouse_message->adjustSize();
+ mouse_message->move(4,4);
+
+ showMarks = new QGroupBox("Show which marks ?", bigwidget);
+ showMarks->setFixedSize(140, 160);
+ showMarks->move(330,4);
+ showTM = new QCheckBox("show tiny marks", showMarks);
+ showTM->adjustSize();
+ showTM->move(5,15);
+ showTM->setChecked(true);
+ connect(showTM, SIGNAL(toggled(bool)), SLOT(slotSetTinyMarks(bool)) );
+ showLM = new QCheckBox("show little marks", showMarks);
+ showLM->adjustSize();
+ showLM->move(5,35);
+ showLM->setChecked(true);
+ connect(showLM, SIGNAL(toggled(bool)), SLOT(slotSetLittleMarks(bool)) );
+ showMM = new QCheckBox("show medium marks", showMarks);
+ showMM->adjustSize();
+ showMM->move(5,55);
+ showMM->setChecked(true);
+ connect(showMM, SIGNAL(toggled(bool)), SLOT(slotSetMediumMarks(bool)) );
+ showBM = new QCheckBox("show big marks", showMarks);
+ showBM->adjustSize();
+ showBM->move(5,75);
+ showBM->setChecked(true);
+ connect(showBM, SIGNAL(toggled(bool)), SLOT(slotSetBigMarks(bool)) );
+ showEM = new QCheckBox("show end marks", showMarks);
+ showEM->adjustSize();
+ showEM->move(5,95);
+ showEM->setChecked(true);
+ connect(showEM, SIGNAL(toggled(bool)), SLOT(slotSetEndMarks(bool)) );
+ showPT = new QCheckBox("show ruler pointer", showMarks);
+ showPT->adjustSize();
+ showPT->move(5,115);
+ showPT->setChecked(true);
+ connect(showPT, SIGNAL(toggled(bool)), SLOT(slotSetRulerPointer(bool)) );
+ fixLen = new QCheckBox("fix ruler length", showMarks);
+ fixLen->adjustSize();
+ fixLen->move(5,135);
+ fixLen->setChecked(true);
+ connect(fixLen, SIGNAL(toggled(bool)), SLOT(slotFixRulerLength(bool)) );
+ connect(fixLen, SIGNAL(toggled(bool)), SLOT(slotCheckLength(bool)) );
+
+ lineEdit = new QGroupBox("Value of begin/end", bigwidget);
+ lineEdit->setFixedSize(140, 80);
+ lineEdit->move(330,4+160);
+ beginMark = new KIntNumInput(0, lineEdit);
+ beginMark->setRange(-1000, 1000, 1, false);
+ beginMark->move(5, 15);
+ beginMark->setFixedSize(beginMark->sizeHint());
+ connect(beginMark, SIGNAL(valueChanged(int)),
+ hruler, SLOT(slotNewOffset(int)) );
+ connect(beginMark, SIGNAL(valueChanged(int)),
+ vruler, SLOT(slotNewOffset(int)) );
+ endMark = new KIntNumInput(0, lineEdit);
+ endMark->setRange(-1000, 1000, 1, false);
+ endMark->move(5, 35);
+ endMark->setFixedSize(endMark->sizeHint());
+ connect(endMark, SIGNAL(valueChanged(int)),
+ hruler, SLOT(slotEndOffset(int)) );
+ connect(endMark, SIGNAL(valueChanged(int)),
+ vruler, SLOT(slotEndOffset(int)) );
+ lengthInput = new KIntNumInput(0, lineEdit);
+ lengthInput->setRange(-1000, 1000, 1, false);
+ lengthInput->move(5, 55);
+ lengthInput->setFixedSize(lengthInput->sizeHint());
+ connect(lengthInput, SIGNAL(valueChanged(int)),
+ hruler, SLOT(slotEndOffset(int)) );
+ connect(lengthInput, SIGNAL(valueChanged(int)),
+ vruler, SLOT(slotEndOffset(int)) );
+
+
+ vertrot = new QGroupBox("Value of rotate translate for Vert.", bigwidget);
+ vertrot->setFixedSize(140, 80);
+ vertrot->move(330,4+160+80+4);
+ transX = new KDoubleNumInput(0.0, vertrot);
+ transX->setRange(-1000, 1000, 1, false);
+ transX->move(5, 15);
+ transX->setFixedSize(transX->sizeHint());
+ //transX->setLabel("transx", AlignLeft);
+ connect(transX, SIGNAL(valueChanged(double)),
+ SLOT(slotSetXTrans(double)) );
+ transY = new KDoubleNumInput(-12.0, vertrot);
+ transY->setRange(-1000, 1000, 1, false);
+ transY->move(5, 35);
+ transY->setFixedSize(transY->sizeHint());
+ //transY->setLabel("transy", AlignLeft);
+ connect(transY, SIGNAL(valueChanged(double)),
+ SLOT(slotSetYTrans(double)) );
+ rotV = new KDoubleNumInput(90.0, vertrot);
+ rotV->setRange(-1000, 1000, 1, false);
+ rotV->move(5, 55);
+ rotV->setFixedSize(rotV->sizeHint());
+ //rotV->setLabel("rot", AlignLeft);
+ connect(rotV, SIGNAL(valueChanged(double)),
+ SLOT(slotSetRotate(double)) );
+
+
+ metricstyle = new QButtonGroup("metric styles", bigwidget);
+ metricstyle->setFixedSize(100, 120);
+ metricstyle->move(330-110,4);
+ pixelmetric = new QRadioButton("pixel", metricstyle);
+ pixelmetric->adjustSize();
+ pixelmetric->move(5,15);
+ metricstyle->insert(pixelmetric, (int)KRuler::Pixel);
+ inchmetric = new QRadioButton("inch", metricstyle);
+ inchmetric->adjustSize();
+ inchmetric->move(5,35);
+ metricstyle->insert(inchmetric, (int)KRuler::Inch);
+ mmmetric = new QRadioButton("millimeter", metricstyle);
+ mmmetric->adjustSize();
+ mmmetric->move(5,55);
+ metricstyle->insert(mmmetric, (int)KRuler::Millimetres);
+ cmmetric = new QRadioButton("centimeter", metricstyle);
+ cmmetric->adjustSize();
+ cmmetric->move(5,75);
+ metricstyle->insert(cmmetric, (int)KRuler::Centimetres);
+ mmetric = new QRadioButton("meter", metricstyle);
+ mmetric->adjustSize();
+ mmetric->move(5,95);
+ metricstyle->insert(mmetric, (int)KRuler::Metres);
+ connect ( metricstyle, SIGNAL(clicked(int)), SLOT(slotSetMStyle(int)) );
+
+ setCentralWidget(mainframe);
+
+ slotUpdateShowMarks();
+}
+
+KRulerTest::~KRulerTest()
+{
+ delete layout;
+ delete hruler;
+ delete vruler;
+ delete miniwidget;
+ delete bigwidget;
+ delete mainframe;
+}
+
+void
+KRulerTest::slotNewWidth(int width)
+{
+ hruler->setMaxValue(width);
+}
+
+void
+KRulerTest::slotNewHeight(int height)
+{
+ vruler->setMaxValue(height);
+}
+
+void
+KRulerTest::slotSetTinyMarks(bool set)
+{
+ hruler->setShowTinyMarks(set);
+ vruler->setShowTinyMarks(set);
+}
+
+void
+KRulerTest::slotSetLittleMarks(bool set)
+{
+ hruler->setShowLittleMarks(set);
+ vruler->setShowLittleMarks(set);
+}
+
+void
+KRulerTest::slotSetMediumMarks(bool set)
+{
+ hruler->setShowMediumMarks(set);
+ vruler->setShowMediumMarks(set);
+}
+
+void
+KRulerTest::slotSetBigMarks(bool set)
+{
+ hruler->setShowBigMarks(set);
+ vruler->setShowBigMarks(set);
+}
+
+void
+KRulerTest::slotSetEndMarks(bool set)
+{
+ hruler->setShowEndMarks(set);
+ vruler->setShowEndMarks(set);
+}
+
+void
+KRulerTest::slotSetRulerPointer(bool set)
+{
+ hruler->setShowPointer(set);
+ vruler->setShowPointer(set);
+}
+
+void
+KRulerTest::slotSetRulerLength(int len)
+{
+ hruler->setLength(len);
+ vruler->setLength(len);
+}
+
+void
+KRulerTest::slotFixRulerLength(bool fix)
+{
+ hruler->setLengthFixed(fix);
+ vruler->setLengthFixed(fix);
+}
+
+void
+KRulerTest::slotSetMStyle(int style)
+{
+ hruler->setRulerMetricStyle((KRuler::MetricStyle)style);
+ vruler->setRulerMetricStyle((KRuler::MetricStyle)style);
+ slotUpdateShowMarks();
+}
+
+
+void
+KRulerTest::slotUpdateShowMarks()
+{
+ showTM->setChecked(hruler->showTinyMarks());
+ showLM->setChecked(hruler->showLittleMarks());
+ showMM->setChecked(hruler->showMediumMarks());
+ showBM->setChecked(hruler->showBigMarks());
+ showEM->setChecked(hruler->showEndMarks());
+}
+
+void
+KRulerTest::slotCheckLength(bool fixlen)
+{
+ beginMark->setValue(hruler->offset());
+ endMark->setValue(hruler->endOffset());
+ lengthInput->setValue(hruler->length());
+}
+
+void
+KRulerTest::slotSetRotate(double d)
+{
+#ifdef KRULER_ROTATE_TEST
+ vruler->rotate = d;
+ vruler->update();
+ //debug("rotate %.1f", d);
+#endif
+}
+
+void
+KRulerTest::slotSetXTrans(double d)
+{
+#ifdef KRULER_ROTATE_TEST
+ vruler->xtrans = d;
+ vruler->update();
+ //debug("trans x %.1f", d);
+#endif
+}
+
+void
+KRulerTest::slotSetYTrans(double d)
+{
+#ifdef KRULER_ROTATE_TEST
+ vruler->ytrans = d;
+ vruler->update();
+ //debug("trans y %.1f", d);
+#endif
+}
+
+
+/* --- MAIN -----------------------*/
+int main(int argc, char **argv)
+{
+ KApplication *testapp;
+ KRulerTest *window;
+
+ testapp = new KApplication(argc, argv,"krulertest");
+ testapp->setFont(QFont("Helvetica",12),true);
+
+ window = new KRulerTest("main");
+ testapp->setMainWidget(window);
+ window->setCaption("KRulerTest");
+ window->show();
+ return testapp->exec();
+}
+
+#include "krulertest.moc"
+
diff --git a/kdeui/tests/krulertest.h b/kdeui/tests/krulertest.h
new file mode 100644
index 000000000..ba9938deb
--- /dev/null
+++ b/kdeui/tests/krulertest.h
@@ -0,0 +1,91 @@
+/* -*- c++ -*- */
+
+#ifndef krulertest_h
+#define krulertest_h
+
+#include <kapplication.h>
+#include <kmainwindow.h>
+#include <qwidget.h>
+#include <qcheckbox.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <knuminput.h>
+
+class KRuler;
+class QWidget;
+class QFrame;
+class QGridLayout;
+class QCheckBox;
+class QGroupBox;
+
+
+class MouseWidget : public QFrame
+{
+Q_OBJECT
+public:
+MouseWidget( QWidget *parent=0, const char *name=0, WFlags f=0 );
+
+signals:
+ void newXPos(int);
+ void newYPos(int);
+ void newWidth(int);
+ void newHeight(int);
+
+protected:
+ virtual void mousePressEvent ( QMouseEvent * );
+ virtual void mouseReleaseEvent ( QMouseEvent * );
+ virtual void mouseMoveEvent ( QMouseEvent * );
+ virtual void resizeEvent ( QResizeEvent * );
+private:
+ bool mouseButtonDown;
+
+};
+
+
+class KRulerTest : public KMainWindow
+{
+Q_OBJECT
+public:
+KRulerTest( const char *name = 0L );
+~KRulerTest();
+
+private slots:
+ void slotNewWidth(int);
+ void slotNewHeight(int);
+
+ void slotSetTinyMarks(bool);
+ void slotSetLittleMarks(bool);
+ void slotSetMediumMarks(bool);
+ void slotSetBigMarks(bool);
+ void slotSetEndMarks(bool);
+ void slotSetRulerPointer(bool);
+
+ void slotSetRulerLength(int);
+ void slotFixRulerLength(bool);
+ void slotSetMStyle(int);
+ void slotUpdateShowMarks();
+ void slotCheckLength(bool);
+
+ void slotSetRotate(double);
+ void slotSetXTrans(double);
+ void slotSetYTrans(double);
+
+
+private:
+
+ KRuler *hruler, *vruler;
+ QGridLayout *layout;
+ QFrame *miniwidget, *bigwidget;
+ QFrame *mainframe;
+
+ QLabel *mouse_message;
+ QGroupBox *showMarks, *lineEdit, *vertrot;
+ QCheckBox *showTM, *showLM, *showMM, *showBM, *showEM, *showPT, *fixLen;
+ KIntNumInput *beginMark, *endMark, *lengthInput;
+ KDoubleNumInput *transX, *transY, *rotV;
+ QButtonGroup *metricstyle;
+ QRadioButton *pixelmetric, *inchmetric, *mmmetric, *cmmetric, *mmetric;
+
+};
+#endif
+
diff --git a/kdeui/tests/kseparatortest.cpp b/kdeui/tests/kseparatortest.cpp
new file mode 100644
index 000000000..2abd84448
--- /dev/null
+++ b/kdeui/tests/kseparatortest.cpp
@@ -0,0 +1,51 @@
+/*
+ * 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 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 General Public License for more details.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+
+#include <kapplication.h>
+#include <qlayout.h>
+#include <qwidget.h>
+
+#include "kseparator.h"
+
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+
+ QWidget *toplevel = new QWidget();
+
+ QBoxLayout *mainbox = new QBoxLayout(toplevel, QBoxLayout::TopToBottom, 10);
+
+ KSeparator *sep1 = new KSeparator( KSeparator::VLine, toplevel );
+ mainbox->addWidget(sep1);
+
+ KSeparator *sep2 = new KSeparator( KSeparator::HLine, toplevel );
+ mainbox->addWidget(sep2);
+
+ mainbox->activate();
+
+ app.setMainWidget(toplevel);
+ toplevel->show();
+ return app.exec();
+}
+
+
+
+
diff --git a/kdeui/tests/kspelltest.cpp b/kdeui/tests/kspelltest.cpp
new file mode 100644
index 000000000..4511edd6c
--- /dev/null
+++ b/kdeui/tests/kspelltest.cpp
@@ -0,0 +1,57 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 1997 David Sweet <dsweet@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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "kspell.h"
+#include <kapplication.h>
+#include <kdebug.h>
+
+#include <qstring.h>
+#include <qlabel.h>
+#include <qtextcodec.h>
+
+int main(int argc, char **argv)
+{
+ KApplication *app = new KApplication(argc, argv, "KSpellTest");
+
+ // test ASCII
+ //QString text( "I have noo idee of how to wride englisch or englisch" );
+
+ // test Latin-3 (need dictionary "esperanto" and "Latin3" in config)
+ //QCString ctext( "sed jen: e¶oþanø' æiu¼aýde; e¶uþunøo øiun fendredon - kaj dimanøon...");
+ //QTextCodec *codec = QTextCodec::codecForName("ISO 8859-3");
+
+ // test UTF-8 (need dictionary "esperanto" and "UTF-8" in config)
+ QCString ctext( "sed jen: e\304\245oÅanÄo ĉiuĵaÅ­de e\304\245uÅunÄo Äiun fendredon kaj dimanÄon");
+ QTextCodec *codec = QTextCodec::codecForName("UTF-8");
+
+ QString text = codec->toUnicode(ctext.data());
+
+ KSpell::modalCheck( text );
+
+ kdDebug() << "Returned " << text << endl;
+
+ return 0;
+
+}
+
+
+
+
+
+
+
diff --git a/kdeui/tests/ksqueezedtextlabeltest.cpp b/kdeui/tests/ksqueezedtextlabeltest.cpp
new file mode 100644
index 000000000..62f3c1a76
--- /dev/null
+++ b/kdeui/tests/ksqueezedtextlabeltest.cpp
@@ -0,0 +1,13 @@
+#include "ksqueezedtextlabel.h"
+#include <kapplication.h>
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "KSqueezedTextLabelTest" );
+
+ KSqueezedTextLabel l( "This is a rather long string", 0);
+ app.setMainWidget( &l );
+ l.show();
+
+ return app.exec();
+}
diff --git a/kdeui/tests/kstatusbartest.cpp b/kdeui/tests/kstatusbartest.cpp
new file mode 100644
index 000000000..80b92c446
--- /dev/null
+++ b/kdeui/tests/kstatusbartest.cpp
@@ -0,0 +1,121 @@
+#include <qpopupmenu.h>
+#include <qwidget.h>
+#include <qstring.h>
+#include <qmessagebox.h>
+#include <qmultilineedit.h>
+#include <qkeycode.h>
+#include <qpixmap.h>
+#include <qcursor.h>
+
+#include <stdlib.h>
+
+#include "kstatusbar.h"
+#include <kapplication.h>
+#include <kmainwindow.h>
+#include <kmenubar.h>
+#include "kstatusbartest.h"
+
+testWindow::testWindow (QWidget *, const char *name)
+ : KMainWindow (0, name)
+ {
+ // Setup Menus
+ menuBar = new KMenuBar (this);
+ fileMenu = new QPopupMenu;
+ menuBar->insertItem ("&File", fileMenu);
+ fileMenu->insertItem ("&Exit", KApplication::kApplication(),
+ SLOT( quit() ), ALT + Key_Q );
+ statusbar = new KStatusBar (this);
+ statusbar->insertItem("Zoom: XXXX", 0);
+ statusbar->insertItem("XXX", 1);
+ statusbar->insertItem("Line: XXXXX", 2);
+
+ statusbar->changeItem("Zoom: 100%", 0);
+ statusbar->changeItem("INS", 1);
+ insert = true;
+ statusbar->changeItem("Line: 13567", 2);
+
+ connect (statusbar, SIGNAL(pressed(int)), this, SLOT(slotPress(int)));
+ connect (statusbar, SIGNAL(released(int)), this, SLOT(slotClick(int)));
+
+ widget = new QMultiLineEdit (this);
+
+ setCentralWidget(widget);
+
+ setCaption( KApplication::kApplication()->caption() );
+
+ smenu = new QPopupMenu;
+
+ smenu->insertItem("50%");
+ smenu->insertItem("75%");
+ smenu->insertItem("100%");
+ smenu->insertItem("150%");
+ smenu->insertItem("200%");
+ smenu->insertItem("400%");
+ smenu->insertItem("oo%");
+
+ connect (smenu, SIGNAL(activated(int)), this, SLOT(slotMenu(int)));
+}
+
+void testWindow::slotClick(int id)
+{
+ switch (id)
+ {
+ case 0:
+ break;
+
+ case 1:
+ if (insert == true)
+ {
+ insert = false;
+ statusbar->changeItem("OVR", 1);
+ }
+ else
+ {
+ insert = true;
+ statusbar->changeItem("INS", 1);
+ }
+ break;
+
+ case 2:
+ QMessageBox::information(0, "Go to line", "Enter line number:", "where?");
+ statusbar->changeItem("16543", 2);
+ break;
+ }
+}
+
+void testWindow::slotPress(int id)
+{
+ if (id == 0)
+ smenu->popup(QCursor::pos()); // This popup should understand keys up and down
+}
+
+void testWindow::slotMenu(int id)
+{
+ QString s = "Zoom: ";
+ s.append (smenu->text(id));
+ statusbar->changeItem(s,0);
+}
+
+testWindow::~testWindow ()
+{
+ // I would delete toolbars here, but there are none
+ delete statusbar;
+}
+
+int main( int argc, char *argv[] )
+{
+ KApplication *myApp = new KApplication( argc, argv, "KStatusBarTest" );
+ testWindow *test = new testWindow;
+
+ myApp->setMainWidget(test);
+ test->show();
+ test->resize(test->width(), test->height()); // I really really really dunno why it doesn't show
+ int ret = myApp->exec();
+
+ delete test;
+
+ return ret;
+}
+
+#include "kstatusbartest.moc"
+
diff --git a/kdeui/tests/kstatusbartest.h b/kdeui/tests/kstatusbartest.h
new file mode 100644
index 000000000..ea59073b6
--- /dev/null
+++ b/kdeui/tests/kstatusbartest.h
@@ -0,0 +1,33 @@
+#ifndef test_kstatusbar_h
+#define test_kstatusbar_h
+
+#include <kmenubar.h>
+#include <qpopupmenu.h>
+#include <kstatusbar.h>
+#include <kmainwindow.h>
+
+class QMultiLineEdit;
+
+class testWindow : public KMainWindow
+{
+ Q_OBJECT
+
+public:
+ testWindow (QWidget *parent=0, const char *name=0);
+ ~testWindow ();
+
+public slots:
+ void slotPress(int i);
+ void slotClick(int i);
+ void slotMenu(int i);
+
+protected:
+ QPopupMenu *fileMenu;
+ QPopupMenu *smenu;
+ KMenuBar *menuBar;
+ KStatusBar *statusbar;
+ bool insert;
+ QMultiLineEdit *widget;
+};
+#endif
+
diff --git a/kdeui/tests/ksystemtraytest.cpp b/kdeui/tests/ksystemtraytest.cpp
new file mode 100644
index 000000000..746246132
--- /dev/null
+++ b/kdeui/tests/ksystemtraytest.cpp
@@ -0,0 +1,14 @@
+#include <ksystemtray.h>
+#include <kapplication.h>
+
+int main(int argc, char **argv)
+{
+ KApplication app( argc, argv, "ksystemtraytest" );
+ QLabel *l = new QLabel("System Tray Main Window", 0L);
+ KSystemTray *tray = new KSystemTray( l );
+ tray->setText("Test");
+ l->show();
+ tray->show();
+
+ return app.exec();
+}
diff --git a/kdeui/tests/ktabctltest.cpp b/kdeui/tests/ktabctltest.cpp
new file mode 100644
index 000000000..20b7246c1
--- /dev/null
+++ b/kdeui/tests/ktabctltest.cpp
@@ -0,0 +1,105 @@
+/*
+ *
+ */
+
+#include <kapplication.h>
+#include <qpushbutton.h>
+#include <qlabel.h>
+#include <qobject.h>
+#include <qlistbox.h>
+#include <qgroupbox.h>
+#include <qevent.h>
+#include <qcombobox.h>
+#include <qlineedit.h>
+#include <qradiobutton.h>
+#include <qcheckbox.h>
+#include <qtabdialog.h>
+#include <qtooltip.h>
+#include <qmessagebox.h>
+#include <qtabbar.h>
+#include <qpalette.h>
+#include <qmultilineedit.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "ktabctl.h"
+#include "ktabctltest.h"
+
+QFont default_font("Helvetica", 12);
+
+KApplication *a;
+
+TopLevel::TopLevel(QWidget *parent, const char *name)
+ : QWidget(parent, name)
+{
+ setCaption("KTabCtl test application");
+ setMinimumSize(300, 200);
+
+ /*
+ * add a tabctrl widget
+ */
+
+ test = new KTabCtl(this, "test");
+ connect(test, SIGNAL(tabSelected(int)), this, SLOT(tabChanged(int)));
+ QWidget *w = new QWidget(test, "_page1");
+ QPushButton *bt = new QPushButton("Click me to quit", w, "_bt1");
+ connect(bt, SIGNAL(clicked()), this, SLOT(okPressed()));
+ bt->adjustSize();
+ bt->move(20, 20);
+ test->addTab(w, "Seite 1");
+ pages[0] = w;
+ w = new QWidget(test, "_page2");
+ e = new QMultiLineEdit(w, "_editor");
+ e->setText("Write some usesless stuff here :-)");
+ w->resize(width(), height());
+ test->addTab(w, "Seite 2");
+ pages[1] = w;
+ w = new QWidget(test, "_page3");
+ bt = new QPushButton("This button does absolutely nothing", w, "_bt3");
+ bt->adjustSize();
+ bt->move(20, 20);
+ test->addTab(w, "Seite 3");
+ pages[2] = w;
+ test->resize(200, 200);
+ test->move(0, 0);
+ move(20, 20);
+ resize(400, 300);
+ adjustSize();
+}
+
+void TopLevel::resizeEvent( QResizeEvent * )
+{
+ test->resize(width(), height());
+ e->setGeometry(10, 10, pages[1]->width() - 20, pages[1]->height() - 20);
+}
+
+void TopLevel::tabChanged(int newpage)
+{
+ printf("tab number %d selected\n", newpage);
+ if(newpage == 1)
+ e->setFocus();
+}
+
+void TopLevel::okPressed()
+{
+ a->quit();
+}
+
+int main( int argc, char ** argv )
+{
+ a = new KApplication ( argc, argv, "KTabCtlTest" );
+
+ a->setFont(default_font);
+
+ TopLevel *toplevel = new TopLevel(0, "_ktabctl_test");
+
+ toplevel->show();
+ a->setMainWidget(toplevel);
+ a->exec();
+}
+
+#include "ktabctltest.moc"
+
diff --git a/kdeui/tests/ktabctltest.h b/kdeui/tests/ktabctltest.h
new file mode 100644
index 000000000..c010c993f
--- /dev/null
+++ b/kdeui/tests/ktabctltest.h
@@ -0,0 +1,30 @@
+/*
+ * $Id$
+ */
+
+#ifndef _KTABCTLTEST_H
+#define _KTABCTLTEST_H
+
+#include <qwidget.h>
+class KTabCtl;
+class QPushButton;
+class QMultiLineEdit;
+
+class TopLevel : public QWidget
+{
+ Q_OBJECT
+public:
+
+ TopLevel( QWidget *parent=0, const char *name=0 );
+protected:
+ void resizeEvent(QResizeEvent *);
+ KTabCtl *test;
+ QPushButton *ok, *cancel;
+ QMultiLineEdit *e;
+ QWidget *pages[3];
+public slots:
+ void okPressed();
+ void tabChanged(int);
+};
+
+#endif
diff --git a/kdeui/tests/ktabwidgettest.cpp b/kdeui/tests/ktabwidgettest.cpp
new file mode 100644
index 000000000..82db9109c
--- /dev/null
+++ b/kdeui/tests/ktabwidgettest.cpp
@@ -0,0 +1,366 @@
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qdragobject.h>
+
+#include <kapplication.h>
+#include <kcmdlineargs.h>
+#include <kinputdialog.h>
+#include <kdebug.h>
+
+#include "ktabwidgettest.h"
+
+Test::Test( QWidget* parent, const char *name )
+ :QVBox( parent, name ), mChange(0), mLeftWidget(0), mRightWidget(0),
+ mLeftPopup( false ), mRightPopup( false ), mTabbarContextPopup( false ), mContextPopup( false )
+
+{
+ resize( 600,300 );
+
+ mWidget = new KTabWidget( this );
+ mWidget->addTab( new QLabel( "Testlabel 1", mWidget ), "One" );
+ mWidget->addTab( new QLabel( "Testlabel 2", mWidget ), "Two" );
+ mWidget->addTab( new QWidget( mWidget), SmallIcon( "konsole" ), "Three" );
+ mWidget->addTab( new QWidget( mWidget), "Four" );
+ mWidget->setTabColor( mWidget->page(0), Qt::red );
+ mWidget->setTabColor( mWidget->page(1), Qt::blue );
+
+ connect( mWidget, SIGNAL( currentChanged( QWidget * ) ), SLOT( currentChanged( QWidget * ) ) );
+ connect( mWidget, SIGNAL( contextMenu( QWidget *, const QPoint & )), SLOT(contextMenu( QWidget *, const QPoint & )));
+ connect( mWidget, SIGNAL( contextMenu( const QPoint & )), SLOT(tabbarContextMenu( const QPoint & )));
+ connect( mWidget, SIGNAL( mouseDoubleClick( QWidget * )), SLOT(mouseDoubleClick( QWidget * )));
+ connect( mWidget, SIGNAL( mouseMiddleClick() ), SLOT(addTab() ));
+ connect( mWidget, SIGNAL( mouseMiddleClick( QWidget * )), SLOT(mouseMiddleClick( QWidget * )));
+ connect( mWidget, SIGNAL( closeRequest( QWidget * )), SLOT(mouseMiddleClick( QWidget * )));
+ connect( mWidget, SIGNAL( testCanDecode(const QDragMoveEvent *, bool & )), SLOT(testCanDecode(const QDragMoveEvent *, bool & )));
+ connect( mWidget, SIGNAL( receivedDropEvent( QDropEvent * )), SLOT(receivedDropEvent( QDropEvent * )));
+ connect( mWidget, SIGNAL( receivedDropEvent( QWidget *, QDropEvent * )), SLOT(receivedDropEvent( QWidget *, QDropEvent * )));
+ connect( mWidget, SIGNAL( initiateDrag( QWidget * )), SLOT(initiateDrag( QWidget * )));
+ connect( mWidget, SIGNAL( movedTab( int, int )), SLOT(movedTab( int, int )));
+ mWidget->setTabReorderingEnabled( true );
+
+ QWidget * grid = new QWidget(this);
+ QGridLayout * gridlayout = new QGridLayout( grid, 5, 2 );
+
+ QPushButton * addTab = new QPushButton( "Add Tab", grid );
+ gridlayout->addWidget( addTab, 0, 0 );
+ connect( addTab, SIGNAL( clicked() ), SLOT( addTab() ) );
+
+ QPushButton * removeTab = new QPushButton( "Remove Current Tab", grid );
+ gridlayout->addWidget( removeTab, 0, 1 );
+ connect( removeTab, SIGNAL( clicked() ), SLOT( removeCurrentTab() ) );
+
+ mLeftButton = new QCheckBox( "Show left button", grid );
+ gridlayout->addWidget( mLeftButton, 1, 0 );
+ connect( mLeftButton, SIGNAL( toggled(bool) ), SLOT( toggleLeftButton(bool) ) );
+ mLeftButton->setChecked(true);
+
+ QCheckBox * leftPopup = new QCheckBox( "Enable left popup", grid );
+ gridlayout->addWidget( leftPopup, 2, 0 );
+ connect( leftPopup, SIGNAL( toggled(bool) ), SLOT( toggleLeftPopup(bool) ) );
+ leftPopup->setChecked(true);
+
+ mRightButton = new QCheckBox( "Show right button", grid );
+ gridlayout->addWidget( mRightButton, 1, 1 );
+ connect( mRightButton, SIGNAL( toggled(bool) ), SLOT( toggleRightButton(bool) ) );
+ mRightButton->setChecked(true);
+
+ QCheckBox * rightPopup = new QCheckBox( "Enable right popup", grid );
+ gridlayout->addWidget( rightPopup, 2, 1 );
+ connect( rightPopup, SIGNAL( toggled(bool) ), SLOT( toggleRightPopup(bool) ) );
+ rightPopup->setChecked(true);
+
+ mTabsBottom = new QCheckBox( "Show tabs at bottom", grid );
+ gridlayout->addWidget( mTabsBottom, 3, 0 );
+ connect( mTabsBottom, SIGNAL( toggled(bool) ), SLOT( toggleTabPosition(bool) ) );
+
+ QCheckBox * tabshape = new QCheckBox( "Triangular tab shape", grid );
+ gridlayout->addWidget( tabshape, 3, 1 );
+ connect( tabshape, SIGNAL( toggled(bool) ), SLOT( toggleTabShape(bool) ) );
+
+ QCheckBox *tabClose = new QCheckBox( "Close button on icon hover", grid );
+ gridlayout->addWidget( tabClose, 4, 0 );
+ connect( tabClose, SIGNAL( toggled(bool) ), SLOT( toggleCloseButtons(bool) ) );
+ tabClose->setChecked(true);
+
+ QCheckBox * showlabels = new QCheckBox( "Show labels", grid );
+ gridlayout->addWidget( showlabels, 4, 1 );
+ connect( showlabels, SIGNAL( toggled(bool) ), this, SLOT( toggleLabels(bool) ) );
+}
+
+void Test::currentChanged(QWidget* w)
+{
+ mWidget->setTabColor( w, Qt::black );
+}
+
+void Test::addTab()
+{
+ mWidget->addTab( new QWidget( mWidget ), SmallIcon( "konsole" ), QString("Tab %1").arg( mWidget->count()+1 ) );
+}
+
+void Test::testCanDecode(const QDragMoveEvent *e, bool &accept /* result */)
+{
+ if ( QTextDrag::canDecode(e) ) // don't accept=false if it cannot be decoded!
+ accept = true;
+}
+
+void Test::receivedDropEvent( QDropEvent *e )
+{
+ QString dropText;
+ if (QTextDrag::decode(e, dropText)) {
+ mWidget->addTab( new QWidget( mWidget), dropText );
+ }
+}
+
+void Test::receivedDropEvent( QWidget *w, QDropEvent *e )
+{
+ QString dropText;
+ if (QTextDrag::decode(e, dropText)) {
+ mWidget->changeTab( w, dropText );
+ }
+}
+
+void Test::initiateDrag( QWidget *w )
+{
+ QDragObject *d = new QTextDrag( mWidget->label( mWidget->indexOf( w ) ), this );
+ d->dragCopy(); // do NOT delete d.
+}
+
+void Test::removeCurrentTab()
+{
+ if ( mWidget->count()==1 ) return;
+
+ mWidget->removePage( mWidget->currentPage() );
+}
+
+void Test::toggleLeftButton(bool state)
+{
+ if (state) {
+ if (!mLeftWidget) {
+ mLeftWidget = new QToolButton( mWidget );
+ connect( mLeftWidget, SIGNAL( clicked() ), SLOT( addTab() ) );
+ mLeftWidget->setIconSet( SmallIcon( "tab_new" ) );
+ mLeftWidget->setTextLabel("New");
+ mLeftWidget->setTextPosition(QToolButton::Right);
+ mLeftWidget->adjustSize();
+ //mLeftWidget->setGeometry( 0, 0, h, h );
+ mLeftWidget->setPopup(mLeftPopup);
+ mWidget->setCornerWidget( mLeftWidget, TopLeft );
+ }
+ mLeftWidget->show();
+ }
+ else
+ mLeftWidget->hide();
+}
+
+void Test::toggleLeftPopup(bool state)
+{
+ if (state) {
+ if (!mLeftPopup) {
+ mLeftPopup = new QPopupMenu(this);
+ mLeftPopup->insertItem(SmallIcon( "tab_new" ), "Empty Tab", 0);
+ mLeftPopup->insertItem(SmallIcon( "tab_new" ), "Empty Tab After First", 3);
+ mLeftPopup->insertSeparator();
+ mLeftPopup->insertItem(SmallIcon( "tab_new" ), "Button Tab", 1);
+ mLeftPopup->insertItem(SmallIcon( "tab_new" ), "Label Tab", 2);
+ connect(mLeftPopup, SIGNAL(activated(int)), SLOT(leftPopupActivated(int)));
+ }
+ mLeftWidget->setPopup(mLeftPopup);
+ }
+ else
+ mLeftWidget->setPopup(0);
+}
+
+void Test::leftPopupActivated(int item)
+{
+ switch (item) {
+ case 0: mWidget->addTab( new QWidget( mWidget), QString("Tab %1").arg( mWidget->count()+1 ) );
+ break;
+ case 1: mWidget->addTab( new QPushButton( "Testbutton", mWidget ), QString("Tab %1").arg( mWidget->count()+1 ) );
+ break;
+ case 2: mWidget->addTab( new QLabel( "Testlabel", mWidget ), QString("Tab %1").arg( mWidget->count()+1 ) );
+ break;
+ case 3: mWidget->insertTab( new QWidget( mWidget), QString("Tab %1").arg( mWidget->count()+1 ), 1 );
+ }
+}
+
+void Test::toggleRightButton(bool state)
+{
+if (state) {
+ if ( !mRightWidget) {
+ mRightWidget = new QToolButton( mWidget );
+ QObject::connect( mRightWidget, SIGNAL( clicked() ), SLOT( removeCurrentTab() ) );
+ mRightWidget->setIconSet( SmallIcon( "tab_remove" ) );
+ mRightWidget->setTextLabel("Close");
+ mRightWidget->setTextPosition(QToolButton::Right);
+ mRightWidget->adjustSize();
+ //mRightButton->setGeometry( 0, 0, h, h );
+ mRightWidget->setPopup(mRightPopup);
+ mWidget->setCornerWidget( mRightWidget, TopRight );
+ }
+ mRightWidget->show();
+ }
+ else
+ mRightWidget->hide();
+}
+
+void Test::toggleRightPopup(bool state)
+{
+ if (state) {
+ if (!mRightPopup) {
+ mRightPopup = new QPopupMenu(this);
+ mRightPopup->insertItem(SmallIcon( "tab_remove" ), "Current Tab", 1);
+ mRightPopup->insertSeparator();
+ mRightPopup->insertItem(SmallIcon( "tab_remove" ), "Most Left Tab", 0);
+ mRightPopup->insertItem(SmallIcon( "tab_remove" ), "Most Right Tab", 2);
+ connect(mRightPopup, SIGNAL(activated(int)), SLOT(rightPopupActivated(int)));
+ }
+ mRightWidget->setPopup(mRightPopup);
+ }
+ else
+ mRightWidget->setPopup(0);
+}
+
+void Test::rightPopupActivated(int item)
+{
+ switch (item) {
+ case 0: if ( mWidget->count() >1) {
+ mWidget->removePage( mWidget->page(0) );
+ }
+ break;
+ case 1: removeCurrentTab();
+ break;
+ case 2: int count = mWidget->count();
+ if (count>1) {
+ mWidget->removePage( mWidget->page(count-1) );
+ }
+ }
+}
+
+void Test::toggleTabPosition(bool state)
+{
+ mWidget->setTabPosition(state ? QTabWidget::Bottom : QTabWidget::Top);
+}
+
+void Test::toggleTabShape(bool state)
+{
+ mWidget->setTabShape(state ? QTabWidget::Triangular : QTabWidget::Rounded);
+}
+
+void Test::toggleCloseButtons(bool state)
+{
+ mWidget->setHoverCloseButton( state );
+}
+
+void Test::contextMenu(QWidget *w, const QPoint &p)
+{
+ if (mContextPopup)
+ delete mContextPopup;
+
+ mContextPopup = new QPopupMenu(this);
+ mContextPopup->insertItem( "Activate Tab", 4);
+ mContextPopup->insertSeparator();
+ mContextPopup->insertItem(SmallIcon( "konsole" ), "Set This Icon", 0);
+ mContextPopup->insertItem(SmallIcon( "konqueror" ), "Set This Icon", 1);
+ mContextPopup->insertSeparator();
+ mContextPopup->insertItem( mWidget->isTabEnabled(w) ? "Disable Tab" : "Enable Tab", 2);
+ mContextPopup->insertItem( mWidget->tabToolTip(w).isEmpty() ? "Set Tooltip" : "Remove Tooltip", 3);
+ connect(mContextPopup, SIGNAL(activated(int)), SLOT(contextMenuActivated(int)));
+
+ mContextWidget = w;
+ mContextPopup->popup(p);
+}
+
+void Test::contextMenuActivated(int item)
+{
+ switch (item) {
+ case 0: mWidget->changeTab( mContextWidget, SmallIcon( "konsole" ), mWidget->label( mWidget->indexOf( mContextWidget ) ) );
+ break;
+ case 1: mWidget->changeTab( mContextWidget, SmallIcon( "konqueror" ), mWidget->label( mWidget->indexOf( mContextWidget ) ) );
+ break;
+ case 2: mWidget->setTabEnabled( mContextWidget, !(mWidget->isTabEnabled(mContextWidget)) );
+ break;
+ case 3: if ( mWidget->tabToolTip(mContextWidget).isEmpty() )
+ mWidget->setTabToolTip( mContextWidget, "This is a tool tip.");
+ else
+ mWidget->removeTabToolTip( mContextWidget );
+ break;
+ case 4: mWidget->showPage( mContextWidget );
+ }
+ delete mContextPopup;
+ mContextPopup = 0;
+}
+
+void Test::tabbarContextMenu(const QPoint &p)
+{
+ if (mTabbarContextPopup)
+ delete mTabbarContextPopup;
+
+ mTabbarContextPopup = new QPopupMenu(this);
+ mTabbarContextPopup->insertItem(SmallIcon( "tab_new" ), mLeftWidget->isVisible() ? "Hide \"Add\" Button" : "Show \"Add\" Button", 0);
+ mTabbarContextPopup->insertItem(SmallIcon( "tab_remove" ), mRightWidget->isVisible() ? "Hide \"Remove\" Button" : "Show \"Remove\" Button", 1);
+ mTabbarContextPopup->insertSeparator();
+ mTabbarContextPopup->insertItem(mWidget->tabPosition()==QTabWidget::Top ? "Put Tabbar to Bottom" : "Put Tabbar to Top", 2);
+ connect(mTabbarContextPopup, SIGNAL(activated(int)), SLOT(tabbarContextMenuActivated(int)));
+
+ mTabbarContextPopup->popup(p);
+}
+
+void Test::tabbarContextMenuActivated(int item)
+{
+ switch (item) {
+ case 0: mLeftButton->toggle();
+ break;
+ case 1: mRightButton->toggle();
+ break;
+ case 2: mTabsBottom->toggle();
+ }
+ delete mTabbarContextPopup;
+ mTabbarContextPopup = 0;
+}
+
+void Test::mouseDoubleClick(QWidget *w)
+{
+ bool ok;
+ QString text = KInputDialog::getText(
+ "Rename Tab", "Enter new name:",
+ mWidget->label( mWidget->indexOf( w ) ), &ok, this );
+ if ( ok && !text.isEmpty() ) {
+ mWidget->changeTab( w, text );
+ mWidget->setTabColor( w, Qt::green );
+ }
+}
+
+void Test::mouseMiddleClick(QWidget *w)
+{
+ if ( mWidget->count()==1 ) return;
+
+ mWidget->removePage( w );
+}
+
+void Test::movedTab(int from, int to)
+{
+ kdDebug() << "Moved tab from index " << from << " to " << to << endl;
+}
+
+void Test::toggleLabels(bool state)
+{
+ mLeftWidget->setUsesTextLabel(state);
+ mLeftWidget->adjustSize();
+ mRightWidget->setUsesTextLabel(state);
+ mRightWidget->adjustSize();
+ mWidget->hide(); // trigger update
+ mWidget->show();
+}
+
+int main(int argc, char** argv )
+{
+ KCmdLineArgs::init(argc, argv, "ktabwidgettest", "ktabwidget test app", "1.0");
+ KApplication app(argc, argv);
+ Test *t = new Test();
+
+ app.setMainWidget( t );
+ t->show();
+ app.exec();
+}
+
+#include "ktabwidgettest.moc"
diff --git a/kdeui/tests/ktabwidgettest.h b/kdeui/tests/ktabwidgettest.h
new file mode 100644
index 000000000..cc96a24c6
--- /dev/null
+++ b/kdeui/tests/ktabwidgettest.h
@@ -0,0 +1,69 @@
+#ifndef KTABWIDGETTEST_H
+#define KTABWIDGETTEST_H
+
+#include <kiconloader.h>
+#include <qwidget.h>
+#include <ktabwidget.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qpopupmenu.h>
+#include <stdlib.h>
+#include <qvbox.h>
+#include <time.h>
+#include <qcheckbox.h>
+#include <qtoolbutton.h>
+
+class Test : public QVBox
+{
+ Q_OBJECT
+public:
+ Test( QWidget* parent=0, const char *name =0 );
+
+private slots:
+ void addTab();
+ void removeCurrentTab();
+ void toggleLeftButton(bool);
+ void toggleRightButton(bool);
+ void toggleLeftPopup(bool);
+ void toggleRightPopup(bool);
+ void toggleTabPosition(bool);
+ void toggleTabShape(bool);
+ void toggleCloseButtons(bool);
+ void toggleLabels(bool);
+
+ void currentChanged(QWidget*);
+ void contextMenu(QWidget*, const QPoint&);
+ void tabbarContextMenu(const QPoint&);
+ void testCanDecode(const QDragMoveEvent *, bool & /* result */);
+ void receivedDropEvent( QDropEvent* );
+ void initiateDrag( QWidget * );
+ void receivedDropEvent( QWidget *, QDropEvent * );
+ void mouseDoubleClick(QWidget*);
+ void mouseMiddleClick(QWidget*);
+ void movedTab( int, int );
+
+ void leftPopupActivated(int);
+ void rightPopupActivated(int);
+ void contextMenuActivated(int);
+ void tabbarContextMenuActivated(int);
+
+private:
+ KTabWidget* mWidget;
+ int mChange;
+
+ QCheckBox * mLeftButton;
+ QCheckBox * mRightButton;
+ QCheckBox * mTabsBottom;
+
+ QToolButton* mLeftWidget;
+ QToolButton* mRightWidget;
+
+ QPopupMenu* mLeftPopup;
+ QPopupMenu* mRightPopup;
+ QPopupMenu* mTabbarContextPopup;
+ QPopupMenu* mContextPopup;
+ QWidget* mContextWidget;
+};
+
+
+#endif
diff --git a/kdeui/tests/ktextedittest.cpp b/kdeui/tests/ktextedittest.cpp
new file mode 100644
index 000000000..d37afab30
--- /dev/null
+++ b/kdeui/tests/ktextedittest.cpp
@@ -0,0 +1,43 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <kapplication.h>
+#include <ktextedit.h>
+
+#include <qfile.h>
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "ktextedittest" );
+ KTextEdit *edit = new KTextEdit();
+ edit->setReadOnly( true );
+ edit->setCheckSpellingEnabled( true );
+
+ QFile file( "ktextedittest.cpp" );
+ if ( file.open( IO_ReadOnly ) )
+ {
+ edit->setText( file.readAll() );
+ file.close();
+ }
+
+ edit->resize( 600, 600 );
+ edit->show();
+ edit->setReadOnly( false ); // also enables spell checking
+ return app.exec();
+}
diff --git a/kdeui/tests/ktimewidgettest.cpp b/kdeui/tests/ktimewidgettest.cpp
new file mode 100644
index 000000000..f2767b416
--- /dev/null
+++ b/kdeui/tests/ktimewidgettest.cpp
@@ -0,0 +1,14 @@
+#include "ktimewidget.h"
+#include <kapplication.h>
+#include <klocale.h>
+
+int main(int argc, char** argv)
+{
+ KLocale::setMainCatalogue("kdelibs");
+ KApplication app(argc, argv, "KTimeWidgettest");
+ KTimeWidget timeWidget;
+ app.setMainWidget(&timeWidget);
+ timeWidget.show();
+ // timeWidget.setEnabled(false);
+ return app.exec();
+}
diff --git a/kdeui/tests/ktoolbarlabelactiontest.cpp b/kdeui/tests/ktoolbarlabelactiontest.cpp
new file mode 100644
index 000000000..8ff2ccb74
--- /dev/null
+++ b/kdeui/tests/ktoolbarlabelactiontest.cpp
@@ -0,0 +1,97 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2004 Felix Berger <felixberger@beldesign.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., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <qguardedptr.h>
+
+#include <kapplication.h>
+#include <kmainwindow.h>
+#include <klineedit.h>
+#include <klistview.h>
+#include <kstandarddirs.h>
+#include <ktoolbarlabelaction.h>
+#include <ksqueezedtextlabel.h>
+#include <kdebug.h>
+#include <qvbox.h>
+
+#include <assert.h>
+
+class MainWindow : public KMainWindow
+{
+public:
+ MainWindow()
+ {
+ QVBox* main = new QVBox(this);
+ setCentralWidget(main);
+
+ KSqueezedTextLabel* accel = new KSqueezedTextLabel
+ ("&Really long, long, long and boring text goes here", main,
+ "kde toolbar widget");
+ new KSqueezedTextLabel
+ ("Really long, long, long and boring text goes here", main,
+ "kde toolbar widget");
+
+
+ // first constructor
+ KToolBarLabelAction* label1 = new KToolBarLabelAction("&Label 1", 0,
+ 0, 0,
+ actionCollection(),
+ "label1");
+ // second constructor
+ KLineEdit* lineEdit = new KLineEdit(this);
+ new KWidgetAction(lineEdit, "Line Edit", 0, this, 0,
+ actionCollection(), "lineEdit");
+ KToolBarLabelAction* label2 =
+ new KToolBarLabelAction(lineEdit, "L&abel 2", 0, 0, 0,
+ actionCollection(),
+ "label2");
+
+ // set buddy for label1
+ label1->setBuddy(lineEdit);
+ accel->setBuddy(lineEdit);
+
+ // third constructor
+ QLabel* customLabel = new KSqueezedTextLabel
+ ("&Really long, long, long and boring text goes here", this,
+ "kde toolbar widget");
+
+ KToolBarLabelAction* label3 = new KToolBarLabelAction(customLabel, 0, 0, 0,
+ actionCollection(),
+ "label3");
+
+ // set buddy for label3
+ label3->setBuddy(lineEdit);
+
+ // customLabel->setText("&test me again some time soon");
+
+ createGUI("ktoolbarlabelactiontestui.rc");
+ }
+};
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "ktoolbarlabelactiontest" );
+
+ KGlobal::instance()->dirs()->addResourceDir("data", ".");
+
+ MainWindow* mw = new MainWindow;
+ app.setMainWidget(mw);
+ mw->show();
+
+ return app.exec();
+}
+
diff --git a/kdeui/tests/ktoolbarlabelactiontestui.rc b/kdeui/tests/ktoolbarlabelactiontestui.rc
new file mode 100644
index 000000000..75d02e54e
--- /dev/null
+++ b/kdeui/tests/ktoolbarlabelactiontestui.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="ktoolbarlabelactiontest" version="0.1">
+<ToolBar>
+<Action name="label1"/>
+<Action name="label2"/>
+<Action name="lineEdit"/>
+<Action name="label3"/>
+</ToolBar>
+</kpartgui>
diff --git a/kdeui/tests/kunbalancedgrdtest.cpp b/kdeui/tests/kunbalancedgrdtest.cpp
new file mode 100644
index 000000000..ec3ce967b
--- /dev/null
+++ b/kdeui/tests/kunbalancedgrdtest.cpp
@@ -0,0 +1,176 @@
+#include "kunbalancedgrdtest.h"
+#include <kapplication.h>
+#include <kpixmapeffect.h>
+#include <qpainter.h>
+#include <qstring.h>
+#include <qlayout.h>
+
+int cols = 3, rows = 3; // how many
+
+
+KGradientWidget::KGradientWidget(QWidget *parent, const char *name)
+ :QWidget(parent, name)
+{
+ time.start();
+ setMinimumSize(250 * cols, 250 * rows);
+}
+
+void KGradientWidget::paintEvent(QPaintEvent *)
+{
+ int it, ft;
+ QString say;
+
+ QColor ca = Qt::black, cb = Qt::cyan;
+
+ int x = 0, y = 0;
+
+ pix.resize(width()/cols, height()/rows);
+ QPainter p(this);
+ p.setPen(Qt::white);
+
+ // draw once, so that the benchmarking be fair :-)
+ KPixmapEffect::unbalancedGradient(pix,ca, cb,
+ KPixmapEffect::VerticalGradient,
+ xbalance, ybalance);
+
+ // vertical
+ time.start();
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix,ca, cb,
+ KPixmapEffect::VerticalGradient,
+ xbalance, ybalance);
+ ft = time.elapsed();
+ say.setNum( ft - it); say = "Vertical";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5 + (x++)*width()/cols, 15+y*height()/rows, say); // augment x
+
+ // horizontal
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix,ca, cb,
+ KPixmapEffect::HorizontalGradient,
+ xbalance, ybalance);
+ ft = time.elapsed() ;
+ say.setNum( ft - it); say = "Horizontal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // elliptic
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix, ca, cb,
+ KPixmapEffect::EllipticGradient,
+ xbalance, ybalance);
+ ft = time.elapsed() ;
+ say.setNum( ft - it); say = "Elliptic";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ y++; // next row
+ x = 0; // reset the columns
+
+ // diagonal
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix,ca, cb,
+ KPixmapEffect::DiagonalGradient,
+ xbalance, ybalance);
+ ft = time.elapsed();
+ say.setNum( ft - it); say = "Diagonal";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // crossdiagonal
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix,ca, cb,
+ KPixmapEffect::CrossDiagonalGradient,
+ xbalance, ybalance);
+ ft = time.elapsed();
+ say.setNum( ft - it); say = "CrossDiagonal";
+ p.drawPixmap(width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ y++; // next row
+ x = 0; // reset the columns
+
+ // pyramidal
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix, ca, cb,
+ KPixmapEffect::PyramidGradient,
+ xbalance, ybalance);
+ ft = time.elapsed();
+ say.setNum( ft - it); say = "Pyramid";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/cols, 15+y*height()/rows, say);
+
+ // rectangular
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix, ca, cb,
+ KPixmapEffect::RectangleGradient,
+ xbalance, ybalance);
+ ft = time.elapsed();
+ say.setNum( ft - it); say = "Rectangle";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/rows, 15+y*height()/rows, say);
+
+ // crosspipe
+ it = time.elapsed();
+ KPixmapEffect::unbalancedGradient(pix, ca, cb,
+ KPixmapEffect::PipeCrossGradient,
+ xbalance, ybalance);
+ ft = time.elapsed();
+ say.setNum( ft - it); say = "PipeCross";
+ p.drawPixmap(x*width()/cols, y*height()/rows, pix);
+ p.drawText(5+(x++)*width()/rows, 15+y*height()/rows, say);
+}
+
+myTopWidget::myTopWidget (QWidget *parent, const char *name)
+ :QWidget(parent, name)
+{
+ QGridLayout *lay = new QGridLayout (this, 2, 3, 0);
+
+ grds = new KGradientWidget(this);
+ lay->addMultiCellWidget(grds, 0, 0 ,0, 2);
+
+ bLabel = new QLabel("Balance: X = 000; Y = 000", this);
+ lay->addWidget(bLabel, 1, 0);
+
+ xSlider = new QSlider ( -200, 200, 1, 100, QSlider::Horizontal, this);
+ lay->addWidget(xSlider, 1, 1);
+
+ ySlider = new QSlider ( -200, 200, 1, 100, QSlider::Horizontal, this);
+ lay->addWidget(ySlider, 1, 2);
+
+ connect(xSlider, SIGNAL(valueChanged(int)), this, SLOT(rebalance()));
+ connect(ySlider, SIGNAL(valueChanged(int)), this, SLOT(rebalance()));
+
+ rebalance();
+
+ itime = otime = 0;
+ time.start();
+}
+
+void myTopWidget::rebalance()
+{
+ otime = time.elapsed();
+
+ QString val; val.sprintf("Balance: X = %3d; Y = %3d",
+ xSlider->value(), ySlider->value());
+
+ bLabel->setText(val);
+ grds->setBalance(xSlider->value(), ySlider->value());
+
+ if ((otime - itime )> 500)
+ {
+ grds->repaint(false);
+ itime = time.elapsed();
+ }
+}
+
+int main(int argc, char **argv)
+{
+ KApplication *app = new KApplication(argc, argv, "KUnbalancedGradientTest");
+ myTopWidget w;
+ app->setMainWidget(&w);
+ w.show();
+ return(app->exec());
+}
+
+#include "kunbalancedgrdtest.moc"
diff --git a/kdeui/tests/kunbalancedgrdtest.h b/kdeui/tests/kunbalancedgrdtest.h
new file mode 100644
index 000000000..6af7e4e92
--- /dev/null
+++ b/kdeui/tests/kunbalancedgrdtest.h
@@ -0,0 +1,49 @@
+//
+// Simple little hack to show off new diagonal gradients.
+//
+// (C) KDE Artistic Daniel M. Duley <mosfet@kde.org>
+//
+
+#ifndef __KGRADIENT_TEST_H
+#define __KGRADIENT_TEST_H
+
+#include <qwidget.h>
+#include <kpixmap.h>
+#include <qslider.h>
+#include <qlabel.h>
+#include <qdatetime.h>
+
+class KGradientWidget : public QWidget
+{
+public:
+ KGradientWidget(QWidget *parent=0, const char *name=0);
+
+ void setBalance(int a, int b) { xbalance = a; ybalance = b; }
+protected:
+ void paintEvent(QPaintEvent *ev);
+private:
+ KPixmap pix;
+ int xbalance, ybalance;
+ QTime time;
+
+};
+
+class myTopWidget: public QWidget
+{
+ Q_OBJECT
+public:
+ myTopWidget(QWidget *parent=0, const char *name=0);
+
+private:
+ QLabel *bLabel;
+ QSlider *xSlider, *ySlider;
+ KGradientWidget *grds;
+
+ QTime time;
+
+ int itime, otime;
+
+private slots:
+ void rebalance();
+};
+#endif
diff --git a/kdeui/tests/kwindowtest.cpp b/kdeui/tests/kwindowtest.cpp
new file mode 100644
index 000000000..ae19dd7e3
--- /dev/null
+++ b/kdeui/tests/kwindowtest.cpp
@@ -0,0 +1,528 @@
+#include <qmessagebox.h>
+#include <qpopupmenu.h>
+#include <qpixmap.h>
+#include <qkeycode.h>
+#include <qwidget.h>
+#include <qstring.h>
+#include <qcursor.h>
+
+#include <stdlib.h>
+
+#include <kstatusbar.h>
+#include <kapplication.h>
+#include <kcombobox.h>
+#include <khelpmenu.h>
+#include <kcmdlineargs.h>
+#include <kmenubar.h>
+#include <ktoolbarradiogroup.h>
+#include <kiconloader.h>
+#include <kpopupmenu.h>
+#include <qmultilineedit.h>
+#include "kwindowtest.h"
+
+#include <kglobal.h>
+
+
+//#include <dclock.h>
+
+/*
+ Ok this is a constructor of our top widget. It inherits KMainWindow.
+ In constructor wi will create all of our interface elements:
+ menubar, toolbar(s), statusbar, and main widget. Non of those
+ interface is obligatory, i.e. you don't have to use menubar,
+ toolbars or statusbar if you don't want to. Theoreticly, you
+ don't need even main widget (but in that case, you'll get blank
+ KMainWindow).
+ */
+
+static int itemId = 0;
+
+testWindow::testWindow (QWidget *parent, const char *name)
+ : KMainWindow (parent,name)
+{
+ ena=false;
+ setCaption("test window");
+setAutoSaveSettings();
+ /******************************/
+ /* First, we setup setup Menus */
+ /******************************/
+ menuBar = new KMenuBar (this);
+
+ // First popup...
+ fileMenu = new QPopupMenu;
+ // We insert this popup in menubar with caption "File".
+ // Prefix "&" means that "F" will be underlined
+ menuBar->insertItem ("&File", fileMenu);
+ // We insert item "Exit" with accelerator ALT-Q, and connect
+ // it to application's exit-slot.
+ fileMenu->insertItem ("&Exit", KApplication::kApplication(),
+ SLOT( quit() ), ALT + Key_Q );
+
+ // Another popup...
+ toolBarMenu = new QPopupMenu;
+ menuBar->insertItem ("&Toolbars", toolBarMenu);
+ toolBarMenu->insertItem ("(Un)Hide tollbar 1", this, SLOT(slotHide1()));
+ toolBarMenu->insertItem ("(Un)Hide tollbar 2", this, SLOT(slotHide2()));
+
+ itemsMenu = new QPopupMenu;
+ menuBar->insertItem ("&Items", itemsMenu);
+
+ exitB = true; // exit button is shown
+ lineL = true; // Lined is enabled
+ greenF = false; // Frame not inserted
+
+ itemsMenu->insertItem ("delete/insert exit button", this, SLOT(slotExit()));
+ itemsMenu->insertItem ("insert/delete green frame!", this, SLOT(slotFrame()));
+ itemsMenu->insertItem ("enable/disable Lined", this, SLOT(slotLined()));
+ itemsMenu->insertItem ("Toggle fileNew", this, SLOT(slotNew()));
+ itemsMenu->insertItem ("Clear comboBox", this, SLOT(slotClearCombo()));
+ itemsMenu->insertItem ("Insert List in Combo", this, SLOT(slotInsertListInCombo()));
+ itemsMenu->insertItem ("Make item 3 curent", this, SLOT(slotMakeItem3Current()));
+ //itemsMenu->insertItem ("Insert clock!", this, SLOT(slotInsertClock()));
+ itemsMenu->insertItem ("Important!", this, SLOT(slotImportant()));
+
+ menuBar->insertSeparator();
+ helpMenu = new KHelpMenu(this, "KWindowTest was programmed by Sven Radej");
+ menuBar->insertItem( "&Help", helpMenu->menu() );
+
+ /**************************************************/
+ /*Now, we setup statusbar order is not important. */
+ /**************************************************/
+ statusBar = new KStatusBar (this);
+ statusBar->insertItem("Hi there! ", 0);
+ statusBar->insertItem("Look for tooltips to see functions", 1);
+
+ //DigitalClock *clk = new DigitalClock (statusBar);
+ //clk->setFrameStyle(QFrame::NoFrame);
+ //statusBar->insertWidget(clk, 70, 2);
+
+ /***********************/
+ /* And now the toolbar */
+ /***********************/
+
+ // pixmap which we will use
+ QPixmap pix;
+
+ // Create toolbar...
+ tb = toolBar();
+
+ // and set it to full width
+ tb->setFullSize(true);
+
+
+
+ // First four buttons
+ pix = BarIcon("filenew");
+ itemId = tb->insertButton(pix, 0, SIGNAL(clicked()), this, SLOT(slotNew()),
+ true, "Create.. (toggles upper button)", 50);
+ pix = BarIcon("fileopen");
+ tb->insertButton(pix, 1, SIGNAL(clicked()), this, SLOT(slotOpen()),
+ false, "Open");
+ pix = BarIcon("filefloppy");
+ tb->insertButton(pix, 2, SIGNAL(clicked()), this, SLOT(slotSave()),
+ true, "Save (beep or delayed popup)");
+ tb->setDelayedPopup(2, itemsMenu);
+ pix = BarIcon("fileprint");
+ tb->insertButton(pix, 3, SIGNAL(clicked()), this, SLOT(slotPrint()),
+ true, "Print (enables/disables open)");
+
+ // And a combobox
+ // arguments: text (or strList), ID, writable, signal, object, slot, enabled,
+ // tooltiptext, size
+ tb->insertCombo (QString("one"), 4, true, SIGNAL(activated(const QString&)), this,
+ SLOT(slotList(const QString&)), true, "ComboBox", 150);
+
+
+ // Then one line editor
+ // arguments: text, id, signal, object (this), slot, enabled, tooltiptext, size
+ tb->insertLined ("ftp://ftp.kde.org/pub/kde", 5, SIGNAL(returnPressed()), this,
+ SLOT(slotReturn()), true, "Location", 200);
+
+ // Set this Lined to auto size itself. Note that only one item (Lined or Combo)
+ // Can be set to autosize; If you specify more of them only last (according to
+ /// index) will be set to autosize itself. Only Lined or Combo can be
+ // set to autosize. All items after autoSized one must be aligned right.
+ // Auto size is valid only for fullWidth toolbars.
+
+ tb->setItemAutoSized (5);
+
+ // Now add another button and align it right
+ pix = BarIcon("exit");
+ tb->insertButton(pix, 6, SIGNAL(clicked()), KApplication::kApplication(),
+ SLOT( quit() ), true, "Exit");
+ tb->alignItemRight (6);
+
+ // Another toolbar
+ tb1 = new KToolBar(this, QMainWindow::DockTop); // this one is normal and has separators
+
+
+ pix = BarIcon("filenew");
+ tb1->insertButton(pix, 0, true, "Create new file2 (Toggle)");
+ tb1->setToggle(0);
+ tb1->addConnection (0, SIGNAL(toggled(bool)), this, SLOT(slotToggle(bool)));
+
+ pix = BarIcon("fileopen");
+ tb1->insertButton(pix, 1, SIGNAL(clicked()), this, SLOT(slotOpen()),
+ true, "Open (starts progres in sb)");
+
+ tb1->insertSeparator ();
+
+ pix = BarIcon("filefloppy");
+ tb1->insertButton(pix, 2, SIGNAL(clicked()), this, SLOT(slotSave()),
+ true, "Save file2 (autorepeat)");
+ tb1->setAutoRepeat(2);
+
+ pix = BarIcon("fileprint");
+ tb1->insertButton(pix, 3, itemsMenu, true, "Print (pops menu)");
+
+ tb1->insertSeparator ();
+ /**** RADIO BUTTONS */
+ pix = BarIcon("filenew");
+ tb1->insertButton(pix, 4, true, "Radiobutton1");
+ tb1->setToggle(4);
+
+ pix = BarIcon("fileopen");
+ tb1->insertButton(pix, 5, true, "Radiobutton2");
+ tb1->setToggle(5);
+
+ pix = BarIcon("filefloppy");
+ tb1->insertButton(pix, 6, true, "Radiobutton3");
+ tb1->setToggle(6);
+
+ pix = BarIcon("fileprint");
+ tb1->insertButton(pix, 7, true, "Radiobutton4");
+ tb1->setToggle(7);
+
+ //Create
+ rg = new KToolBarRadioGroup (tb1);
+
+ rg->addButton(4);
+ rg->addButton(5);
+ rg->addButton(6);
+ rg->addButton(7);
+
+ connect (tb1, SIGNAL(toggled(int)), this, SLOT(slotToggled(int)));
+
+ // Set caption for floating toolbars
+ tb->setTitle ("Toolbar 1");
+ tb1->setTitle ("Toolbar 2");
+
+ // Set main widget. In this example it is Qt's multiline editor.
+ widget = new QMultiLineEdit (this);
+
+ // Setup is now complete
+
+ // add two toolbars
+ //addToolBar (tb1);
+ //addToolBar (tb);
+
+ connect (tb, SIGNAL(highlighted(int,bool)), this, SLOT(slotMessage(int, bool)));
+ connect (tb1, SIGNAL(highlighted(int, bool)), this, SLOT(slotMessage(int, bool)));
+
+ // Floating is enabled by default, so you don't need this.
+ // tb->enableFloating(true);
+ // tb1->enableFloating(true);
+
+ // Show toolbars
+ tb->show();
+ tb1->show();
+
+ //... and main widget
+ setCentralWidget (widget);
+
+ // This is not strictly related to toolbars, menubars or KMainWindow.
+ // Setup popup for completions
+ completions = new QPopupMenu;
+
+ completions->insertItem("/");
+ completions->insertItem("/usr/");
+ completions->insertItem("/lib/");
+ completions->insertItem("/var/");
+ completions->insertItem("/bin/");
+ completions->insertItem("/kde/");
+ completions->insertItem("/home/");
+ completions->insertItem("/vmlinuz :-)");
+
+ connect (completions, SIGNAL(activated(int)), this, SLOT(slotCompletionsMenu(int)));
+ pr = 0;
+}
+/***********************************/
+/* Now slots for toolbar actions */
+/***********************************/
+void testWindow::slotToggled(int)
+{
+ statusBar->message ("Buton toggled", 1500);
+}
+
+void testWindow::slotInsertClock()
+{
+ //DigitalClock *clock = new DigitalClock(tb1);
+ //clock->setFrameStyle(QFrame::NoFrame);
+ //tb1->insertWidget(8, 70, clock);
+}
+
+void testWindow::slotNew()
+{
+ tb1->toggleButton(0);
+ toolBar()->removeItem( itemId );
+}
+void testWindow::slotOpen()
+{
+ if (pr == 0)
+ pr = new QProgressBar (statusBar);
+// statusBar->message(pr);
+ timer = new QTimer (pr);
+
+ connect (timer, SIGNAL(timeout()), this, SLOT(slotGoGoGoo()));
+ timer->start(100);
+}
+
+void testWindow::slotGoGoGoo()
+{
+ pr->setProgress(pr->progress()+1);
+ if (pr->progress()==100)
+ {
+ timer->stop();
+ statusBar->clear();
+ delete pr;
+ pr = 0;
+ }
+}
+
+void testWindow::slotSave()
+{
+ kapp->beep();
+ statusBar->changeItem("Saving properties...", 0);
+}
+
+void testWindow::slotPrint()
+{
+ statusBar->changeItem("Print file pressed", 0);
+ ena=!ena;
+ tb->setItemEnabled(1,ena );
+}
+void testWindow::slotReturn()
+{
+ QString s = "You entered ";
+ s = s + tb->getLinedText(5);
+ statusBar->changeItem(s, 0);
+
+}
+void testWindow::slotList(const QString &str)
+{
+ QString s = "You chose ";
+ s = s + str;
+ statusBar->changeItem(s, 0);
+}
+
+void testWindow::slotCompletion()
+{
+ // Now do a completion
+ // Call your completing function and set that text in klined
+ // QString s = tb->getLinedText(/* ID */ 4)
+ // QString completed = complete (s);
+ // tb->setLinedText(/* ID */ 4, completed.data())
+
+ // for now this:
+
+ completions->popup(QCursor::pos()); // This popup should understunf keys up and down
+
+ /* This is just an example. KLined automatically sets cursor at end of string
+ when ctrl-d or ctrl-s is pressed. KToolBar will also put cursor at end of text in Lined
+ after inserting text with setLinedText (...).
+ */
+
+}
+
+void testWindow::slotListCompletion()
+{
+ /*
+ Combo is not behaving good and it is ugly. I will see how it behaves in Qt-1.3,
+ and then decide should I make a new combobox.
+ */
+ QString s(tb->getComboItem(4)); // get text in combo
+ s+= "(completing)";
+ //tb->getCombo(4)->changeItem(s.data()); // setTextIncombo
+
+}
+
+void testWindow::slotCompletionsMenu(int id)
+{
+ // Now set text in lined
+ QString s =completions->text(id);
+ tb->setLinedText(5, s); // Cursor is automatically at the end of string after this
+}
+
+void testWindow::slotHide2 ()
+{
+ tb1->show();
+}
+
+void testWindow::slotHide1 ()
+{
+ tb->show();
+}
+
+testWindow::~testWindow ()
+{
+ /********************************************************/
+ /* */
+ /* THIS IS NOT ANY MORE IMPORTANT BUT ALLOWED!!! */
+ /* */
+ /********************************************************/
+
+ delete tb1->getWidget(8);
+ //debug ("kwindowtest: deleted clock");
+
+ delete tb;
+ delete tb1;
+ delete menuBar;
+
+ qDebug ("kwindowtest finished");
+}
+
+void testWindow::beFixed()
+{
+ widget->setFixedSize (400, 200);
+}
+
+void testWindow::beYFixed()
+{
+ widget->setMinimumSize(400, 200);
+ widget->setMaximumSize(9999, 200);
+}
+
+void testWindow::slotImportant ()
+{
+ statusBar->message("This important message will go away in 15 seconds", 15000);
+}
+
+void testWindow::slotExit ()
+{
+ if (exitB == true)
+ {
+ tb->removeItem(6);
+ exitB = false;
+ }
+ else
+ {
+ QPixmap pix;
+ pix = BarIcon("exit");
+ tb->insertButton(pix, 6, SIGNAL(clicked()), KApplication::kApplication(),
+ SLOT( quit() ), true, "Exit");
+ tb->alignItemRight (6);
+ exitB = true;
+ }
+}
+
+void testWindow::slotLined()
+{
+ lineL = !lineL;
+ tb->setItemEnabled(5, lineL); // enable/disable lined
+}
+
+void testWindow::slotToggle (bool on)
+{
+ if (on == true)
+ statusBar->changeItem("Toggle is on", 0);
+ else
+ statusBar->changeItem("Toggle is off", 0);
+}
+
+void testWindow::slotFrame()
+{
+#if 0
+ if (greenF == false)
+ {
+ tb1->insertFrame(10, 100);
+ tb1->alignItemRight (10); // this is pointless 'cause tb1 is not fullwidth
+
+ QFrame *myFrame = tb1->getFrame(10); // get frame pointer
+
+ if (myFrame == 0)
+ {
+ warning ("bad frame ID");
+ return;
+ }
+
+ //paint it green
+ // Or do whatever you want with it, just don't change its height (height = hardcoded = 24)
+ // And don't move it
+ // If you want to have something right from your toolbar you can reduce its
+ // max_width with setMaxWidth()
+ myFrame->setBackgroundColor (QColor("green"));
+
+ greenF = true;
+ }
+ else
+ {
+ tb1->removeItem (10);
+ greenF = false;
+ }
+#endif
+}
+
+void testWindow::slotMessage(int, bool boo)
+{
+ if (boo)
+ statusBar->message("This button does this and that", 1500);
+ else
+ statusBar->clear();
+}
+// Now few Combo slots, for Torben
+
+void testWindow::slotClearCombo()
+{
+ tb->getCombo(4)->clear();
+}
+
+void testWindow::slotInsertListInCombo()
+{
+ QStringList list;
+ list.append("ListOne");
+ list.append("ListTwo");
+ list.append("ListThree");
+ list.append("ListFour");
+ list.append("ListFive");
+ list.append("ListSix");
+ list.append("ListSeven");
+ list.append("ListEight");
+ list.append("ListNine");
+ list.append("ListTen");
+ list.append("ListEleven");
+ list.append("ListAndSoOn");
+ tb->getCombo(4)->insertStringList (list,0);
+}
+
+void testWindow::slotMakeItem3Current()
+{
+ tb->getCombo(4)->setCurrentItem(3);
+}
+
+int main( int argc, char *argv[] )
+{
+ int i;
+ KCmdLineArgs::init(argc, argv, "KWindowTest", "description", "version");
+
+ KApplication *myApp = new KApplication();
+ testWindow *test = new testWindow;
+
+ myApp->setMainWidget(test);
+
+ i = QMessageBox::information(0, "Select", "Select type of mainwidget",
+ "Fixed", "Y-fixed", "Resizable");
+ if (i == 0)
+ test->beFixed();
+ else if (i == 1)
+ test->beYFixed();
+
+ test->show();
+ test->resize(400, 500);
+ int ret = myApp->exec();
+
+ //delete test;
+ return ret;
+}
+
+#include "kwindowtest.moc"
+
diff --git a/kdeui/tests/kwindowtest.h b/kdeui/tests/kwindowtest.h
new file mode 100644
index 000000000..c041d7723
--- /dev/null
+++ b/kdeui/tests/kwindowtest.h
@@ -0,0 +1,71 @@
+#ifndef testwindow_h
+#define testwindow_h
+
+#include <qpopupmenu.h>
+#include <qtimer.h>
+#include <qprogressbar.h>
+#include <kmenubar.h>
+#include <kstatusbar.h>
+#include <ktoolbar.h>
+#include <kmainwindow.h>
+
+class QMultiLineEdit;
+class KToolBarRadioGroup;
+class KHelpMenu;
+
+class testWindow : public KMainWindow
+{
+ Q_OBJECT
+
+public:
+ testWindow (QWidget *parent=0, const char *name=0);
+ ~testWindow ();
+
+public slots:
+ void beFixed();
+ void beYFixed();
+
+ void slotNew();
+ void slotPrint();
+ void slotReturn();
+ void slotSave();
+ void slotList(const QString &str);
+ void slotOpen();
+ void slotCompletion();
+ void slotCompletionsMenu(int id);
+ void slotHide2 ();
+ void slotInsertClock();
+ void slotHide1 ();
+ void slotLined ();
+ void slotImportant ();
+ void slotExit();
+ void slotFrame();
+ void slotListCompletion();
+ void slotMessage(int, bool);
+ void slotToggle(bool);
+ void slotClearCombo();
+ void slotGoGoGoo();
+ void slotInsertListInCombo ();
+ void slotMakeItem3Current ();
+ void slotToggled(int);
+protected:
+ KMenuBar *menuBar;
+ QPopupMenu *fileMenu;
+ QPopupMenu *itemsMenu;
+ QPopupMenu *completions;
+ QPopupMenu *toolBarMenu;
+ KStatusBar *statusBar;
+ KHelpMenu *helpMenu;
+ KToolBar *tb;
+ KToolBar *tb1;
+ bool lineL;
+ bool exitB;
+ bool greenF;
+ bool ena;
+ QMultiLineEdit *widget;
+ QTimer *timer;
+ QProgressBar *pr;
+ KToolBarRadioGroup *rg;
+};
+#endif
+
diff --git a/kdeui/tests/kwizardtest.cpp b/kdeui/tests/kwizardtest.cpp
new file mode 100644
index 000000000..2d5f7e288
--- /dev/null
+++ b/kdeui/tests/kwizardtest.cpp
@@ -0,0 +1,54 @@
+/*
+ * kwizardtest - a test program for the KWizard dialog
+ * Copyright (C) 1998 Thomas Tanghus (tanghus@kde.org)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <qlabel.h>
+#include <qlayout.h>
+#include <kapplication.h>
+#include <kwizard.h>
+
+int main(int argc, char **argv)
+{
+ KApplication a(argc,argv,"kwizardtest");
+ KWizard *wiz = new KWizard(0, "kwizardtest", false);
+ QObject::connect((QObject*) wiz->cancelButton(), SIGNAL(clicked()),
+ &a, SLOT(quit()));
+ QObject::connect((QObject*) wiz->finishButton(), SIGNAL(clicked()),
+ &a, SLOT(quit()));
+ for(int i = 1; i < 11; i++)
+ {
+ QWidget *p = new QWidget;
+ QString msg = QString("This is page %1 out of 10").arg(i);
+ QLabel *label = new QLabel(msg, p);
+ QHBoxLayout *layout = new QHBoxLayout(p, 5);
+ label->setAlignment(Qt::AlignCenter);
+ label->setFixedSize(300, 200);
+ layout->addWidget(label);
+ QString title = QString("%1. page").arg(i);
+ wiz->addPage(p, title);
+ wiz->setFinishEnabled(p, (i==10));
+ }
+
+ a.setMainWidget(wiz);
+ wiz->show();
+ return a.exec();
+}
+
+
+
diff --git a/kdeui/tests/kwordwraptest.cpp b/kdeui/tests/kwordwraptest.cpp
new file mode 100644
index 000000000..60a35b394
--- /dev/null
+++ b/kdeui/tests/kwordwraptest.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2003 David Faure <faure@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., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <kapplication.h>
+#include <kdebug.h>
+#include <qwidget.h>
+#include "kwordwrap.h"
+
+int main(int argc, char *argv[])
+{
+ KApplication app(argc, argv, "KWordWrapTest");
+
+ QFont font( "helvetica", 12 ); // let's hope we all have the same...
+ QFontMetrics fm( font );
+ QRect r( 0, 0, 100, -1 );
+ QString str = "test wadabada [/foo/bar/waba]";
+ KWordWrap* ww = KWordWrap::formatText( fm, r, 0, str );
+ kdDebug() << str << " => " << ww->truncatedString() << endl;
+ delete ww;
+
+ str = "</p></p></p></p>";
+ for ( ; r.width() > 0 ; r.setWidth( r.width()-10 ) )
+ {
+ ww = KWordWrap::formatText( fm, r, 0, str );
+ kdDebug() << str << " => " << ww->truncatedString() << endl;
+ delete ww;
+ }
+}
diff --git a/kdeui/tests/kxmlguitest.cpp b/kdeui/tests/kxmlguitest.cpp
new file mode 100644
index 000000000..949eb03c4
--- /dev/null
+++ b/kdeui/tests/kxmlguitest.cpp
@@ -0,0 +1,64 @@
+#include "kxmlguitest.h"
+#include <kapplication.h>
+#include <kmainwindow.h>
+#include <kxmlguifactory.h>
+#include <kxmlguiclient.h>
+#include <kxmlguibuilder.h>
+#include <kaction.h>
+#include <kdebug.h>
+#include <kstdaction.h>
+#include <kstandarddirs.h>
+#include <qlineedit.h>
+#include <qdir.h>
+
+void Client::slotSec()
+{
+ kdDebug() << "Client::slotSec()" << endl;
+}
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "kxmlguitest" );
+
+ // KXMLGUIClient looks in the "data" resource for the .rc files
+ // Let's add $PWD (ideally $srcdir instead...) to it
+ KGlobal::dirs()->addResourceDir( "data", QDir::currentDirPath() );
+
+ KMainWindow *mainwindow = new KMainWindow;
+
+ QLineEdit* line = new QLineEdit( mainwindow );
+ mainwindow->setCentralWidget( line );
+
+ mainwindow->show();
+
+ KXMLGUIBuilder *builder = new KXMLGUIBuilder( mainwindow );
+
+ KXMLGUIFactory *factory = new KXMLGUIFactory( builder );
+
+ Client *shell = new Client;
+ shell->setInstance( new KInstance( "konqueror" ) );
+ shell->instance()->dirs()->addResourceDir( "data", QDir::currentDirPath() );
+
+ (void)new KAction( "Split", "view_left_right", 0, 0, 0, shell->actionCollection(), "splitviewh" );
+
+ shell->setXMLFile( "./kxmlguitest_shell.rc" );
+
+ factory->addClient( shell );
+
+ Client *part = new Client;
+
+ (void)new KAction( "decfont", "viewmag-", 0, 0, 0, part->actionCollection(), "decFontSizes" );
+ (void)new KAction( "sec", "unlock", Qt::ALT + Qt::Key_1, part, SLOT( slotSec() ), part->actionCollection(), "security" );
+
+ part->setXMLFile( "./kxmlguitest_part.rc" );
+
+ factory->addClient( part );
+ for ( int i = 0; i < 10; ++i )
+ {
+ factory->removeClient( part );
+ factory->addClient( part );
+ }
+
+ return app.exec();
+}
+#include "kxmlguitest.moc"
diff --git a/kdeui/tests/kxmlguitest.h b/kdeui/tests/kxmlguitest.h
new file mode 100644
index 000000000..de651e8a9
--- /dev/null
+++ b/kdeui/tests/kxmlguitest.h
@@ -0,0 +1,19 @@
+#ifndef KXMLGUITEST_H
+#define KXMLGUITEST_H
+
+#include <kxmlguiclient.h>
+#include <qobject.h>
+
+class Client : public QObject, public KXMLGUIClient
+{
+ Q_OBJECT
+public:
+ Client() {}
+
+ void setXMLFile( const QString &f, bool merge = true ) { KXMLGUIClient::setXMLFile( f, merge ); }
+ void setInstance( KInstance *inst ) { KXMLGUIClient::setInstance( inst ); }
+
+public slots:
+ void slotSec();
+};
+#endif
diff --git a/kdeui/tests/kxmlguitest_part.rc b/kdeui/tests/kxmlguitest_part.rc
new file mode 100644
index 000000000..84f5e4f57
--- /dev/null
+++ b/kdeui/tests/kxmlguitest_part.rc
@@ -0,0 +1,8 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="khtmlpart" version="7">
+<ToolBar name="mainToolBar"><text>Main Toolbar</text>
+ <Action name="decFontSizes" />
+ <Separator />
+ <Action name="security" />
+</ToolBar>
+</kpartgui>
diff --git a/kdeui/tests/kxmlguitest_shell.rc b/kdeui/tests/kxmlguitest_shell.rc
new file mode 100644
index 000000000..f211eb259
--- /dev/null
+++ b/kdeui/tests/kxmlguitest_shell.rc
@@ -0,0 +1,7 @@
+<!DOCTYPE kpartgui ><kpartgui version="31" name="Konqueror" >
+ <ToolBar newline="true" name="mainToolBar" fullWidth="true" >
+ <text>Main Toolbar</text>
+ <Merge/>
+ <Action name="splitviewh" />
+ </ToolBar>
+</kpartgui>
diff --git a/kdeui/tests/qxembedtest.cpp b/kdeui/tests/qxembedtest.cpp
new file mode 100644
index 000000000..513231051
--- /dev/null
+++ b/kdeui/tests/qxembedtest.cpp
@@ -0,0 +1,88 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "qapplication.h"
+#include "qpushbutton.h"
+#include "qlineedit.h"
+#include "qhbox.h"
+#include "qvbox.h"
+#include "qxembed.h"
+
+WId windowWithName(const char *);
+
+
+int
+main(int argc, char**argv)
+{
+ if (argc != 2)
+ {
+ fprintf(stderr,
+ "usage: qxembedtest [qtoptions] windowid\n"
+ " qxembedtest [qtoptions] windowTitle\n");
+ exit(10);
+ }
+
+
+ QApplication a(argc,argv);
+
+ QWidget *main = new QVBox(NULL,"main",Qt::WDestructiveClose);
+ QWidget *top = new QHBox(main);
+ QPushButton *quit = new QPushButton("Quit", top);
+ QObject::connect( quit, SIGNAL(clicked()), main, SLOT(close()) );
+ QLineEdit *edit = new QLineEdit(top);
+ edit->setText( "Just to see focus changes");
+ QXEmbed *embed = new QXEmbed(main);
+ embed->setProtocol(QXEmbed::XPLAIN);
+ a.setMainWidget(main);
+ main->show();
+
+ WId wid = strtol(argv[1], NULL, 0);
+ if (! wid)
+ wid = windowWithName(argv[1]);
+ if (! wid)
+ {
+ fprintf(stderr,"qxembedtest: window not found\n");
+ exit(10);
+ }
+
+ fprintf(stderr,"qxembedtest: embedding wid=0x%08x\n", (unsigned int)wid);
+
+ embed->embed(wid);
+
+ return a.exec();
+}
+
+
+
+
+
+#include <X11/Xlib.h>
+#include <qpaintdevice.h>
+
+// This is lifted from X11 xprop.
+
+Window Window_With_Name(Display *dpy, Window top, const char *name)
+{
+ Window *children, dummy;
+ unsigned int nchildren;
+ Window w=0;
+ char *window_name;
+ if (XFetchName(dpy, top, &window_name) && !strcmp(window_name, name))
+ return(top);
+ if (!XQueryTree(dpy, top, &dummy, &dummy, &children, &nchildren))
+ return(0);
+ for (unsigned int i=0; i<nchildren; i++) {
+ w = Window_With_Name(dpy, children[i], name);
+ if (w)
+ break;
+ }
+ if (children)
+ XFree ((char *)children);
+ return(w);
+}
+
+
+WId windowWithName(const char *name)
+{
+ return Window_With_Name(qt_xdisplay(), qt_xrootwin(), name);
+}
diff --git a/kdeui/tests/testimage.png b/kdeui/tests/testimage.png
new file mode 100644
index 000000000..2f591d8e8
--- /dev/null
+++ b/kdeui/tests/testimage.png
Binary files differ