diff --git a/kdeclarative/CMakeLists.txt b/kdeclarative/CMakeLists.txt index c5feec63..c276e8ee 100644 --- a/kdeclarative/CMakeLists.txt +++ b/kdeclarative/CMakeLists.txt @@ -43,10 +43,6 @@ target_link_libraries(kdeclarative PUBLIC kdeui ) -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() - generate_export_header(kdeclarative) install( diff --git a/kdeclarative/tests/CMakeLists.txt b/kdeclarative/tests/CMakeLists.txt deleted file mode 100644 index d3bcf86d..00000000 --- a/kdeclarative/tests/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -kde4_add_manual_test(kdeclarative-test test.cpp) -target_link_libraries(kdeclarative-test kdeclarative) diff --git a/kdeclarative/tests/test.cpp b/kdeclarative/tests/test.cpp deleted file mode 100644 index 32c3bfc0..00000000 --- a/kdeclarative/tests/test.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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 -#include -#include -#include - -#include "kdeclarative.h" -#include "kaboutdata.h" -#include "kcmdlineargs.h" - -#include "testobject_p.h" - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - KAboutData about("kdeclarative-test", QByteArray(), ki18n("kdeclarative-test"), "1.0"); - KCmdLineArgs::init(argc, argv, &about); - - QDeclarativeView view; - QDeclarativeContext *context = view.rootContext(); - context->setContextProperty("backgroundColor", - QColor(Qt::yellow)); - - KDeclarative kdeclarative; - kdeclarative.setDeclarativeEngine(view.engine()); - kdeclarative.initialize(); - //binds things like kconfig and icons - kdeclarative.setupBindings(); - - //If all gone well, the QScriptEngine has been extracted - QScriptEngine *scriptEngine = kdeclarative.scriptEngine(); - Q_ASSERT(scriptEngine); - - //Bind a test QObject in the "QtScript way" - QScriptValue global = scriptEngine->globalObject(); - TestObject *testObject = new TestObject(); - QScriptValue testValue = scriptEngine->newQObject(testObject); - global.setProperty("testObject", testValue); - - view.setSource(QUrl::fromLocalFile(KDESRCDIR "test.qml")); - view.show(); - - return app.exec(); -} - -#include "moc_testobject_p.cpp" diff --git a/kdeclarative/tests/test.qml b/kdeclarative/tests/test.qml deleted file mode 100644 index 07f7510b..00000000 --- a/kdeclarative/tests/test.qml +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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. - */ - -import QtQuick 1.1 -import org.kde.plasma.core 0.1 as PlasmaCore -import org.kde.plasma.graphicswidgets 0.1 as PlasmaWidgets - -Rectangle { - width: 300 - height: 300 - color: "red" - - Component.onCompleted: { - print(testObject.prop) - testObject.prop = i18n("New text") - print(testObject.prop) - //QtScript binded elements don't appear to notify - textElement.text = testObject.prop - - //test urls - var url = new Url("https://osdn.net/projects/kde/") - print(url.protocol) - print(url.host) - - //test icons - iconWidget.icon = new QIcon("konqueror") - } - Column { - anchors.fill: parent - Text { - id: textElement - text: testObject.prop - } - PlasmaWidgets.IconWidget { - id: iconWidget - } - } -} diff --git a/kdeclarative/tests/testobject_p.h b/kdeclarative/tests/testobject_p.h deleted file mode 100644 index 005e1058..00000000 --- a/kdeclarative/tests/testobject_p.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2011 Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library 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. - */ - -#ifndef TESTOBJECT_P_H -#define TESTOBJECT_P_H - -#include - -class TestObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString prop READ prop WRITE setProp NOTIFY propChanged) - -public: - void setProp(const QString &prop) - { - m_prop = prop; - emit propChanged(); - } - - QString prop() const - { - return m_prop; - } - -Q_SIGNALS: - void propChanged(); - -private: - QString m_prop; -}; - -#endif diff --git a/kdecore/tests/CMakeLists.txt b/kdecore/tests/CMakeLists.txt index 9bc47bb7..35b350d6 100644 --- a/kdecore/tests/CMakeLists.txt +++ b/kdecore/tests/CMakeLists.txt @@ -60,9 +60,6 @@ KDECORE_UNIT_TESTS( ) KDECORE_EXECUTABLE_TESTS( - kcmdlineargstest - dbuscalltest - startserviceby klockfile_testlock # helper for klockfiletest ) diff --git a/kdecore/tests/dbuscalltest.cpp b/kdecore/tests/dbuscalltest.cpp deleted file mode 100644 index f54f51f0..00000000 --- a/kdecore/tests/dbuscalltest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -//#include -#include -#include -#include - -int main( int argc, char** argv ) -{ - KAboutData about("DBusCallTest", 0, ki18n("DBusCallTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); -// KApplication app(false); - - QDBusConnectionInterface *bus = 0; - if (!QDBusConnection::sessionBus().isConnected() || !(bus = QDBusConnection::sessionBus().interface())) { - kFatal() << "Session bus not found"; - return 125; - } - - kDebug() << "sending reparseConfiguration to object Konqueror in konqueror"; - QDBusMessage message = QDBusMessage::createSignal("/Konqueror", "org.kde.Konqueror", "reparseConfiguration"); - if(!QDBusConnection::sessionBus().send(message)) - kDebug() << "void expected, " << QDBusConnection::sessionBus().lastError().name() << " returned"; - - return 0; -} diff --git a/kdecore/tests/kcmdlineargstest.cpp b/kdecore/tests/kcmdlineargstest.cpp deleted file mode 100644 index cccbb28e..00000000 --- a/kdecore/tests/kcmdlineargstest.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include - -#if 1 -int -main(int argc, char *argv[]) -{ - KCmdLineOptions options; - options.add("test", ki18n("do a short test only, note that\n" - "this is rather long comment")); - options.add("b"); - options.add("baud ", ki18n("set baudrate"), "9600"); - options.add("+file(s)", ki18n("Files to load")); - - KCmdLineArgs::init(argc, argv, "testapp", 0, - ki18n("TestApp"), "v0.0.2", - ki18n("This is a test program.\n" - "1999 (c) Waldo Bastian")); - - KCmdLineArgs::addCmdLineOptions( options ); // Add my own options. - - // MyWidget::addCmdLineOptions(); - - //KApplication app( false ); - QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() ); - - // Get application specific arguments - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - // Check if an option is set - if (args->isSet("test")) - { - // Do stuff - printf("Option 'test' is set.\n"); - } - - if (args->isSet("baud")) - { - // Do stuff - printf("Option 'baud' is set.\n"); - } - - kDebug() << "allArguments:" << KCmdLineArgs::allArguments(); - - // Read the value of an option. - QString baudrate = args->getOption("baud"); // 9600 is the default value. - - printf("Baudrate = %s\n", baudrate.toLocal8Bit().data()); - - printf("Full list of baudrates:\n"); - QStringList result = args->getOptionList("baud"); - Q_FOREACH(const QString& it, result) { - printf("Baudrate = %s\n", it.toLocal8Bit().data()); - } - printf("End of list\n"); - - for(int i = 0; i < args->count(); i++) - { - printf("%d: %s\n", i, args->arg(i).toLocal8Bit().data()); - printf("%d: %s\n", i, args->url(i).url().toLocal8Bit().data()); - } - - // Check how KCmdLineArgs::url() works - KUrl u = KCmdLineArgs::makeURL("/tmp"); - kDebug() << u; - assert(u.toLocalFile() == "/tmp"); - u = KCmdLineArgs::makeURL("foo"); - kDebug() << u << " expected: " << KUrl(QDir::currentPath()+"/foo"); - assert(u.toLocalFile() == QDir::currentPath()+"/foo"); - u = KCmdLineArgs::makeURL("http://www.kde.org"); - kDebug() << u; - assert(u.url() == "http://www.kde.org"); - - QFile file("a:b"); - bool ok = file.open(QIODevice::WriteOnly); - assert(ok); - u = KCmdLineArgs::makeURL("a:b"); - qDebug() << u.toLocalFile(); - assert(u.isLocalFile()); - assert(u.toLocalFile().endsWith(QLatin1String("a:b"))); - - args->clear(); // Free up memory. - - Q_UNUSED(ok); -// return app.exec(); - return 0; -} -#else -int -main(int argc, char *argv[]) -{ - KCmdLineArgs::init( argc, argv, "testapp", description, version); - - QApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv(), false ); - - return app.exec(); -} -#endif - - diff --git a/kdecore/tests/startserviceby.cpp b/kdecore/tests/startserviceby.cpp deleted file mode 100644 index b547b804..00000000 --- a/kdecore/tests/startserviceby.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (c) 1999 Waldo Bastian - Copyright (c) 2009 David Faure - - 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 -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - KAboutData about("ktoolinvocationtest", 0, ki18n("ktoolinvocationtest"), "version"); - KComponentData cData(&about); - //KCmdLineArgs::init(argc, argv, &about); - //KApplication a; - - QString serviceId = "kwrite.desktop"; - if (argc > 1) { - serviceId = QString::fromLocal8Bit(argv[1]); - } - QString url; - if (argc > 2) { - url = QString::fromLocal8Bit(argv[2]); - } - - QString error; - KToolInvocation::startServiceByDesktopPath( serviceId, url, &error ); - kDebug() << "Started. error=" << error; - - return 0; -} diff --git a/kdeui/tests/CMakeLists.txt b/kdeui/tests/CMakeLists.txt index 6410dd49..e7121d8a 100644 --- a/kdeui/tests/CMakeLists.txt +++ b/kdeui/tests/CMakeLists.txt @@ -73,81 +73,8 @@ KDEUI_UNIT_TESTS( ) KDEUI_EXECUTABLE_TESTS( - kaccelgentest - kactionselectortest - kapptest - kassistantdialogtest - kcategorizedviewtest - kcodecactiontest - kcolorcollectiontest - kcolordlgtest - kcolorcombotest - kcomboboxtest - kdatepicktest - klanguagebuttontest - kdatetabletest - kdatetimewidgettest - kdatewidgettest - kdebugtest_gui - kdialogbuttonboxtest - kdialogtest - kfontdialogtest kglobalsettingsclient # helper program for kglobalsettingstest - khboxtest - kiconeffecttest - kiconloadertest - kinputdialogtest - kjobtrackerstest - kledtest - klineedittest - kmessageboxtest - kmessagetest - kmessagewidgettest - knewpassworddialogtest - kstatusnotifieritemtest - knotificationrestrictionstest - knuminputtest - kpagedialogtest - kpagewidgettest - kpassivepopuptest - kpassworddialogtest - kpixmapregionselectordialogtest - kpopuptest - kprogressdialogtest - krulertest - kselectactiontest - kseparatortest - kstatusbartest - ksqueezedtextlabeltest - ksystemtraytest - ktabwidgettest - ktextedittest - ktitlewidgettest - ktoolbartest - ktoolbarlabelactiontest - kwidgetitemdelegatetest kwindowtest - kxmlguitest - kxmlguiwindowtest - testqtargs - kpixmapsequenceoverlaypaintertest - ktreewidgetsearchlinetest - kcompletionuitest - kmainwindowrestoretest - kmainwindowtest fixx11h_test fixx11h_test2 - kxerrorhandlertest ) - -target_link_libraries(kdeui-kxerrorhandlertest ${X11_X11_LIB}) - -## kcolorutilsdemo - -set(kcolorUtilsDemoSources - kcolorutilsdemo.cpp - kimageframe.cpp - ../colors/kcolorspaces.cpp -) -kde4_add_manual_test(kcolorutilsdemo ${kcolorUtilsDemoSources}) -target_link_libraries(kcolorutilsdemo kdeui) diff --git a/kdeui/tests/kaccelgentest.cpp b/kdeui/tests/kaccelgentest.cpp deleted file mode 100644 index 24afd07c..00000000 --- a/kdeui/tests/kaccelgentest.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright 2004 Frerich Raabe - - 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) version 3. - - 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, see . -*/ - -#include "kaccelgen.h" - -#include - -#include - -using std::cout; -using std::endl; - -void check( const QString &what, const QStringList &expected, const QStringList &received ) -{ - cout << "Testing " << qPrintable( what ) << ": "; - if ( expected == received ) { - cout << "ok" << endl; - } else { - cout << "ERROR!" << endl; - cout << "Expected: " << qPrintable( expected.join( "," ) ) << endl; - cout << "Received: " << qPrintable( received.join( "," ) ) << 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 map; - for (QStringList::ConstIterator it = input.constBegin(); it != input.constEnd(); ++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/kactionselectortest.cpp b/kdeui/tests/kactionselectortest.cpp deleted file mode 100644 index cfb96d90..00000000 --- a/kdeui/tests/kactionselectortest.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (c) 2006 David Faure - - 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 - -#include -#include -#include - -#include -#include - -int main( int argc, char *argv[] ) -{ - QApplication app( argc, argv ); - KAboutData aboutData( "kactionselectortest", 0, ki18n("kactionselectortest"), "1.0" ); - KComponentData i( &aboutData ); - - KActionSelector actionSelector(0); - actionSelector.availableListWidget()->addItems(QStringList() << "A" << "B" << "C" << "D" << "E"); - actionSelector.selectedListWidget()->addItems(QStringList() << "1" << "2"); - actionSelector.show(); - - return app.exec(); -} diff --git a/kdeui/tests/kapptest.cpp b/kdeui/tests/kapptest.cpp deleted file mode 100644 index babc2ee8..00000000 --- a/kdeui/tests/kapptest.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (c) 1999 Waldo Bastian - - 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 - -#include -#include -#include -#include - -int -main(int argc, char *argv[]) -{ - KAboutData about("kapptest", 0, ki18n("kapptest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication a; - - KSycoca *s = KSycoca::self(); - - qDebug("s->language() %s", s->language().toLatin1().constData()); -} diff --git a/kdeui/tests/kassistantdialogtest.cpp b/kdeui/tests/kassistantdialogtest.cpp deleted file mode 100644 index 2fd10987..00000000 --- a/kdeui/tests/kassistantdialogtest.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * kassistantdialogtest - a test program for the KAssistantDialog class - * 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 -#include -//Added by qt3to4: -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", - ki18n("test app") ); - KApplication a; - KAssistantDialog *dlg = new KAssistantDialog(); - QObject::connect(dlg, SIGNAL(finished(int)), &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); - label->setAlignment(Qt::AlignCenter); - label->setFixedSize(300, 200); - layout->addWidget(label); - QString title = QString("%1. page").arg(i); - dlg->addPage(p, title); - } - - dlg->show(); - return a.exec(); -} - - - diff --git a/kdeui/tests/kcategorizedviewtest.cpp b/kdeui/tests/kcategorizedviewtest.cpp deleted file mode 100644 index 158597ea..00000000 --- a/kdeui/tests/kcategorizedviewtest.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/** - * This file is part of the KDE project - * Copyright (C) 2007, 2009 Rafael Fernández López - * - * 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 -#include - -#include -#include -#include -#include - -#include -#include -#include - -QStringList icons; - -class MyModel - : public QStringListModel -{ -public: - virtual QVariant data(const QModelIndex &index, int role) const - { - switch (role) { - case KCategorizedSortFilterProxyModel::CategoryDisplayRole: { - return QString::number(index.row() / 10); - } - case KCategorizedSortFilterProxyModel::CategorySortRole: { - return index.row() / 10; - } - case Qt::DecorationRole: - return DesktopIcon(icons[index.row() % 4], KIconLoader::Desktop); - default: - break; - } - return QStringListModel::data(index, role); - } -}; - -int main(int argc, char **argv) -{ - icons << "konqueror"; - icons << "okular"; - icons << "plasma"; - icons << "system-file-manager"; - - KAboutData aboutData("KCategorizedViewTest", - 0, - ki18n("KCategorizedViewTest"), - "1.0", - ki18n("KCategorizedViewTest"), - KAboutData::License_LGPL_V3, - ki18n("(c) 2009 Rafael Fernández López"), - ki18n("KCategorizedViewTest"), - "http://www.kde.org"); - - KCmdLineArgs::init(argc, argv, &aboutData); - KApplication app; - - QMainWindow *mainWindow = new QMainWindow(); - mainWindow->setMinimumSize(640, 480); - KCategorizedView *listView = new KCategorizedView(); - listView->setCategoryDrawer(new KCategoryDrawer(listView)); - listView->setViewMode(QListView::IconMode); - MyModel *model = new MyModel(); - - model->insertRows(0, 100); - for (int i = 0; i < 100; ++i) - { - model->setData(model->index(i, 0), QString::number(i), Qt::DisplayRole); - } - - KCategorizedSortFilterProxyModel *proxyModel = new KCategorizedSortFilterProxyModel(); - proxyModel->setCategorizedModel(true); - proxyModel->setSourceModel(model); - - listView->setModel(proxyModel); - - mainWindow->setCentralWidget(listView); - - mainWindow->show(); - - return app.exec(); -} - diff --git a/kdeui/tests/kcodecactiontest.cpp b/kdeui/tests/kcodecactiontest.cpp deleted file mode 100644 index 4a1b8546..00000000 --- a/kdeui/tests/kcodecactiontest.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -#include "kcodecactiontest.h" - -#include -#include - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "kcodecactiontest", 0, ki18n("KCodecActionTest"), "1.0", ki18n("kselectaction test app")); - KApplication app; - - CodecActionTest* test = new CodecActionTest; - test->show(); - - return app.exec(); -} - -CodecActionTest::CodecActionTest(QWidget *parent) - : KXmlGuiWindow(parent) - , m_comboCodec(new KCodecAction("Combo Codec Action", this)) - , m_buttonCodec(new KCodecAction("Button Codec Action", this)) -{ - actionCollection()->addAction("combo", m_comboCodec); - actionCollection()->addAction("button", m_buttonCodec); - m_comboCodec->setToolBarMode(KCodecAction::ComboBoxMode); - connect(m_comboCodec, SIGNAL(triggered(QAction*)), SLOT(triggered(QAction*))); - connect(m_comboCodec, SIGNAL(triggered(int)), SLOT(triggered(int))); - connect(m_comboCodec, SIGNAL(triggered(QString)), SLOT(triggered(QString))); - connect(m_comboCodec, SIGNAL(triggered(QTextCodec*)), SLOT(triggered(QTextCodec*))); - - m_buttonCodec->setToolBarMode(KCodecAction::MenuMode); - connect(m_buttonCodec, SIGNAL(triggered(QAction*)), SLOT(triggered(QAction*))); - connect(m_buttonCodec, SIGNAL(triggered(int)), SLOT(triggered(int))); - connect(m_buttonCodec, SIGNAL(triggered(QString)), SLOT(triggered(QString))); - connect(m_buttonCodec, SIGNAL(triggered(QTextCodec*)), SLOT(triggered(QTextCodec*))); - - menuBar()->addAction(m_comboCodec); - menuBar()->addAction(m_buttonCodec); - - QToolBar* toolBar = addToolBar("Test"); - toolBar->addAction(m_comboCodec); - toolBar->addAction(m_buttonCodec); -} - -void CodecActionTest::triggered(QAction* action) -{ - kDebug() << action; -} - -void CodecActionTest::triggered(int index) -{ - kDebug() << index; -} - -void CodecActionTest::triggered(const QString& text) -{ - kDebug() << '"' << text << '"'; -} - -void CodecActionTest::triggered(QTextCodec *codec) -{ - kDebug() << codec->name() << ':' << codec->mibEnum(); -} - -void CodecActionTest::slotActionTriggered(bool state) -{ - kDebug() << sender() << " state " << state; -} - -#include "moc_kcodecactiontest.cpp" - diff --git a/kdeui/tests/kcodecactiontest.h b/kdeui/tests/kcodecactiontest.h deleted file mode 100644 index e6623bfd..00000000 --- a/kdeui/tests/kcodecactiontest.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef KSELECTACTION_TEST_H -#define KSELECTACTION_TEST_H - -#include - -class KCodecAction; - -class CodecActionTest : public KXmlGuiWindow -{ - Q_OBJECT - -public: - CodecActionTest(QWidget* parent = 0); - -public Q_SLOTS: - void triggered(QAction* action); - void triggered(int index); - void triggered(const QString& text); - void triggered(QTextCodec *codec); - - void slotActionTriggered(bool state); - -private: - KCodecAction* m_comboCodec; - KCodecAction* m_buttonCodec; -}; - -#endif diff --git a/kdeui/tests/kcolorcollectiontest.cpp b/kdeui/tests/kcolorcollectiontest.cpp deleted file mode 100644 index a812818d..00000000 --- a/kdeui/tests/kcolorcollectiontest.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include "kcolorcollection.h" -#include "kledtest.h" -#include - -#include - - -int main( int argc, char **argv ) -{ - KAboutData about("KColorCollectionTest", 0, ki18n("KColorCollectionTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - KApplication a; - - QStringList collections = KColorCollection::installedCollections(); - for(QStringList::ConstIterator it = collections.constBegin(); - it != collections.constEnd(); ++it) - { - printf("Palette = %s\n", (*it).toLatin1().constData()); - - KColorCollection myColorCollection = KColorCollection(*it); - - printf("Palette Name = \"%s\"\n", myColorCollection.name().toLatin1().constData()); - printf("Description:\n\"%s\"\n", myColorCollection.description().toLatin1().constData()); - printf("Nr of Colors = %d\n", myColorCollection.count()); - for(int i = 0; i < myColorCollection.count(); i++) - { - int r,g,b; - myColorCollection.color(i).getRgb(&r, &g, &b); - printf("#%d Name = \"%s\" #%02x%02x%02x\n", - i, myColorCollection.name(i).toLatin1().constData(), r,g,b); - } - } -} - - diff --git a/kdeui/tests/kcolorcombotest.cpp b/kdeui/tests/kcolorcombotest.cpp deleted file mode 100644 index 5e688570..00000000 --- a/kdeui/tests/kcolorcombotest.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* - This file is part of the KDE Libraries - - Copyright (c) 2007 David Jarvie - - 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 "kcolorcombotest.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -KColorComboTest::KColorComboTest(QWidget* widget) - : QWidget(widget) -{ - QVBoxLayout *vbox = new QVBoxLayout(this); - - // Standard color list - KHBox *hbox = new KHBox(this); - hbox->setSpacing(-1); - QLabel *lbl = new QLabel("&Standard colors:", hbox); - lbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - - mStandard = new KColorCombo(hbox); - mStandard->setObjectName("StandardColors"); - lbl->setBuddy(mStandard); - new QLabel("Preset to green (0,255,0)", hbox); - vbox->addWidget(hbox); - - // Custom color list - hbox = new KHBox(this); - hbox->setSpacing(-1); - lbl = new QLabel("&Reds, greens, blues:", hbox); - lbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - - mCustom = new KColorCombo(hbox); - mCustom->setObjectName("CustomColors"); - lbl->setBuddy(mCustom); - new QLabel("Preset to green (0,192,0)", hbox); - vbox->addWidget(hbox); - - // Create an exit button - hbox = new KHBox(this); - mExit = new QPushButton("E&xit", hbox); - QObject::connect(mExit, SIGNAL(clicked()), SLOT(quitApp())); - - vbox->addWidget(hbox); - - // Populate the custom list - QList standardList; - standardList << Qt::red << Qt::green << Qt::blue << Qt::cyan << Qt::magenta << Qt::yellow << Qt::darkRed - << Qt::darkGreen << Qt::darkBlue << Qt::darkCyan << Qt::darkMagenta << Qt::darkYellow - << Qt::white << Qt::lightGray << Qt::gray << Qt::darkGray << Qt::black; - QList list; - list << QColor(255,0,0) << QColor(192,0,0) << QColor(128,0,0) << QColor(64,0,0) - << QColor(0,255,0) << QColor(0,192,0) << QColor(0,128,0) << QColor(0,64,0) - << QColor(0,0,255) << QColor(0,0,192) << QColor(0,0,128) << QColor(0,0,64); - mCustom->setColors(list); - if (mCustom->colors() != list) - kError() << "Custom combo: setColors() != colors()"; - mCustom->setColors(QList()); - if (mCustom->colors() != standardList) - kError() << "Custom combo: setColors(empty) != standard colors"; - mCustom->setColors(list); - if (mCustom->colors() != list) - kError() << "Custom combo: setColors() != colors()"; - - if (mStandard->colors() != standardList) - kError() << "Standard combo: colors()"; - - QColor col = QColor(1,2,3); - mStandard->setColor(col); - if (mStandard->color() != col) - kError() << "Standard combo: set custom color -> " << mStandard->color().red() << "," << mStandard->color().green() << "," << mStandard->color().blue(); - if (!mStandard->isCustomColor()) - kError() << "Standard combo: custom color: isCustomColor() -> false"; - mStandard->setColor(Qt::green); - if (mStandard->color() != Qt::green) - kError() << "Standard combo: color() -> " << mStandard->color().red() << "," << mStandard->color().green() << "," << mStandard->color().blue(); - if (mStandard->isCustomColor()) - kError() << "Standard combo: standard color: isCustomColor() -> true"; - - col = QColor(1,2,3); - mCustom->setColor(col); - if (mCustom->color() != col) - kError() << "Custom combo: set custom color -> " << mCustom->color().red() << "," << mCustom->color().green() << "," << mCustom->color().blue(); - if (!mCustom->isCustomColor()) - kError() << "Custom combo: custom color: isCustomColor() -> false"; - col = QColor(0,192,0); - mCustom->setColor(col); - if (mCustom->color() != col) - kError() << "Custom combo: color() -> " << mCustom->color().red() << "," << mCustom->color().green() << "," << mCustom->color().blue(); - if (mCustom->isCustomColor()) - kError() << "Custom combo: standard color: isCustomColor() -> true"; - -} - -KColorComboTest::~KColorComboTest() -{ -} - -void KColorComboTest::quitApp() -{ - kapp->closeAllWindows(); -} - -int main(int argc, char **argv) -{ - KAboutData about("kcolorcombotest", 0, ki18n("kcolorcombotest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication a; - - KColorComboTest* t= new KColorComboTest; - t->show(); - return a.exec(); -} - -#include "moc_kcolorcombotest.cpp" diff --git a/kdeui/tests/kcolorcombotest.h b/kdeui/tests/kcolorcombotest.h deleted file mode 100644 index 30a347be..00000000 --- a/kdeui/tests/kcolorcombotest.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef KCOLORCOMBOTEST_H -#define KCOLORCOMBOTEST_H - -#include - -#include -class KColorCombo; - -class KColorComboTest : public QWidget -{ - Q_OBJECT - -public: - KColorComboTest(QWidget *parent = 0); - ~KColorComboTest(); - -private Q_SLOTS: - void quitApp(); - -protected: - KColorCombo* mStandard; - KColorCombo* mCustom; - QPushButton* mExit; -}; - -#endif diff --git a/kdeui/tests/kcolordlgtest.cpp b/kdeui/tests/kcolordlgtest.cpp deleted file mode 100644 index 0a73cc3d..00000000 --- a/kdeui/tests/kcolordlgtest.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 -#include -#include -#include "kcolordialog.h" -#include -#include - -int main( int argc, char *argv[] ) -{ - KAboutData about("KColorDialogTest", "kdelibs4", ki18n("KColorDialogTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - //KApplication::disableAutoDcopRegistration(); - - KApplication a; - - QColor color; - int nRet = KColorDialog::getColor( color, Qt::red /*testing default color*/ ); - - return nRet; -} - diff --git a/kdeui/tests/kcolorutilsdemo.cpp b/kdeui/tests/kcolorutilsdemo.cpp deleted file mode 100644 index 5d13f7a6..00000000 --- a/kdeui/tests/kcolorutilsdemo.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright 2009 Matthew Woehlke - * - * 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, see . - */ - -#include "kcolorutilsdemo.h" -#include "../colors/kcolorspaces.h" -#include -#include -#include -#include -#include - -KColorUtilsDemo::KColorUtilsDemo(QWidget *parent) : QWidget(parent), - _leOutImg(128, 128, QImage::Format_RGB32), - _mtMixOutImg(128, 16, QImage::Format_RGB32), - _mtTintOutImg(128, 16, QImage::Format_RGB32) -{ - _noUpdate = true; - setupUi(this); - _noUpdate = false; - - inputSpinChanged(); - targetSpinChanged(); -} - -void KColorUtilsDemo::inputChanged() -{ - KColorSpaces::KHCY c(inColor->color()); - ifHue->setValue(c.h); - ifChroma->setValue(c.c); - ifLuma->setValue(c.y); - ifGray->setValue(qGray(inColor->color().rgb())); - - lumaChanged(); - mixChanged(); - shadeChanged(); -} - -void KColorUtilsDemo::lumaChanged() -{ - QColor base = inColor->color(); - - for (int y = 0; y < 128; ++y) - { - qreal k = qreal(y - 64) / 64.0; - - for (int x = 0; x < 128; ++x) - { - qreal c; - - QColor r; - if (leOpLighten->isChecked()) - { - c = qreal(128 - x) / 64.0; - r = KColorUtils::lighten(base, k, c); - } - else if (leOpDarken->isChecked()) - { - c = qreal(x) / 64.0; - r = KColorUtils::darken(base, -k, c); - } - else - { - c = qreal(x - 64) / 64.0; - r = KColorUtils::shade(base, k, c); - } - _leOutImg.setPixel(x, y, r.rgb()); - } - } - - leOut->setImage(_leOutImg); -} - -void KColorUtilsDemo::mixChanged() -{ - QColor base = inColor->color(); - QColor target = mtTarget->color(); - - for (int x = 0; x < 128; ++x) - { - qreal k = qreal(x) / 128.0; - - QRgb m = KColorUtils::mix(base, target, k).rgb(); - QRgb t = KColorUtils::tint(base, target, k).rgb(); - - for (int y = 0; y < 16; ++y) - { - _mtMixOutImg.setPixel(x, y, m); - _mtTintOutImg.setPixel(x, y, t); - } - } - - mtMixOut->setImage(_mtMixOutImg); - mtTintOut->setImage(_mtTintOutImg); -} - -void setBackground(QWidget *widget, const QColor &color) -{ - QPalette palette = widget->palette(); - palette.setColor(widget->backgroundRole(), color); - widget->setPalette(palette); - - QString name = color.name(); - name += " (" + QString::number(color.red()) + ", " - + QString::number(color.green()) + ", " - + QString::number(color.blue()) + ")"; - widget->setToolTip(name); -} - -#define SET_SHADE(_n, _c, _cn, _ch) \ - setBackground(ss##_n, KColorScheme::shade(_c, KColorScheme::_n##Shade, _cn, _ch)); - -void KColorUtilsDemo::shadeChanged() -{ - qreal cn = ssContrast->value(); - qreal ch = ssChroma->value(); - - QColor base = inColor->color(); - setBackground(ssOut, base); - setBackground(ssBase, base); - SET_SHADE(Light, base, cn, ch); - SET_SHADE(Midlight, base, cn, ch); - SET_SHADE(Mid, base, cn, ch); - SET_SHADE(Dark, base, cn, ch); - SET_SHADE(Shadow, base, cn, ch); -} - -void updateSwatch(KColorButton *s, const QSpinBox *r, const QSpinBox *g, const QSpinBox *b) -{ - s->setColor(QColor(r->value(), g->value(), b->value())); -} - -void updateSpins(const QColor &c, QSpinBox *r, QSpinBox *g, QSpinBox *b) -{ - r->setValue(c.red()); - g->setValue(c.green()); - b->setValue(c.blue()); -} - -void KColorUtilsDemo::inputSpinChanged() -{ - if (_noUpdate) - return; - _noUpdate = true; - - updateSwatch(inColor, inRed, inGreen, inBlue); - inputChanged(); - - _noUpdate = false; -} - -void KColorUtilsDemo::targetSpinChanged() -{ - if (_noUpdate) - return; - _noUpdate = true; - - updateSwatch(mtTarget, mtRed, mtGreen, mtBlue); - mixChanged(); - - _noUpdate = false; -} - -void KColorUtilsDemo::inputSwatchChanged(const QColor &color) -{ - if (_noUpdate) - return; - _noUpdate = true; - - updateSpins(color, inRed, inGreen, inBlue); - inputChanged(); - - _noUpdate = false; -} - -void KColorUtilsDemo::targetSwatchChanged(const QColor &color) -{ - if (_noUpdate) - return; - _noUpdate = true; - - updateSpins(color, mtRed, mtGreen, mtBlue); - mixChanged(); - - _noUpdate = false; -} - -int main(int argc, char* argv[]) { - KAboutData about("kcolorutilsdemo", 0, ki18n("kcolorutilsdemo"), "0.1", - ki18n("KColorUtils demo/test application"), - KAboutData::License_GPL, ki18n("Copyright 2009 Matthew Woehlke"), - KLocalizedString(), 0, "mw_triad@users.sourceforge.net"); - about.addAuthor(ki18n("Matthew Woehlke"), KLocalizedString(), - "mw_triad@users.sourceforge.net"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - Q_UNUSED(args); - - KColorUtilsDemo *d = new KColorUtilsDemo; - d->show(); - return app.exec(); -} - -#include "moc_kcolorutilsdemo.cpp" -// kate: hl C++; indent-width 4; replace-tabs on; diff --git a/kdeui/tests/kcolorutilsdemo.h b/kdeui/tests/kcolorutilsdemo.h deleted file mode 100644 index 09e867a9..00000000 --- a/kdeui/tests/kcolorutilsdemo.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2009 Matthew Woehlke - * - * 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, see . - */ - -#ifndef KCOLORUTILSDEMO_H -#define KCOLORUTILSDEMO_H - -#include "ui_kcolorutilsdemo.h" - -class KColorUtilsDemo: public QWidget, Ui::form -{ - Q_OBJECT -public: - KColorUtilsDemo(QWidget* parent = 0); - virtual ~KColorUtilsDemo() {} - -public Q_SLOTS: - void inputChanged(); - void lumaChanged(); - void mixChanged(); - void shadeChanged(); - - void inputSpinChanged(); - void inputSwatchChanged(const QColor&); - - void targetSpinChanged(); - void targetSwatchChanged(const QColor&); - -protected: - QImage _leOutImg, _mtMixOutImg, _mtTintOutImg; - bool _noUpdate; -}; - -#endif -// kate: hl C++; indent-width 4; replace-tabs on; diff --git a/kdeui/tests/kcolorutilsdemo.ui b/kdeui/tests/kcolorutilsdemo.ui deleted file mode 100644 index df261f97..00000000 --- a/kdeui/tests/kcolorutilsdemo.ui +++ /dev/null @@ -1,966 +0,0 @@ - - - form - - - - 0 - 0 - 428 - 344 - - - - KColorUtils Demo - - - - - - Input - - - - - - Red - - - - - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 255 - - - 128 - - - - - - - Green - - - - - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 255 - - - 128 - - - - - - - Blue - - - - - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 255 - - - 128 - - - - - - - - 0 - 0 - - - - - - - - - - - QTabWidget::West - - - 0 - - - - &Luma Effects - - - - - - Operation - - - - - - Darken - - - - - - - Lighten - - - - - - - Shade - - - true - - - - - - - - - - Output - - - - - - - 144 - 144 - - - - true - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - - - - - - - - &Mix/Tint - - - - - - Target - - - - - - Red - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 255 - - - 128 - - - - - - - Green - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 255 - - - 128 - - - - - - - Blue - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 255 - - - 128 - - - - - - - - - - - - - Mix Output - - - - - - - 40 - 40 - - - - true - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - - - - - - - Tint Output - - - - - - - 40 - 40 - - - - true - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - - - - - - - - &Scheme Shade - - - - - - Parameters - - - - - - Contrast - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - -1.000000000000000 - - - 1.000000000000000 - - - 0.010000000000000 - - - 0.700000000000000 - - - - - - - Chroma Adjust - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - -1.000000000000000 - - - 1.000000000000000 - - - 0.010000000000000 - - - - - - - - - - Output - - - - 8 - - - 8 - - - - - - - - - - - - Light - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Midlight - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Base - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Mid - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Dark - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Shadow - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - 40 - 120 - - - - true - - - QFrame::StyledPanel - - - QFrame::Sunken - - - - 0 - - - 12 - - - - - - 16 - 16 - - - - true - - - - - - - - 16 - 16 - - - - true - - - - - - - - 16 - 16 - - - - true - - - - - - - - 16 - 16 - - - - true - - - - - - - - 16 - 16 - - - - true - - - - - - - - 16 - 16 - - - - true - - - - - - - - label_8 - label_3 - label_4 - label_10 - label_5 - label_6 - label_7 - label_9 - ssOut - - - - - - - - - - Information - - - - - - Hue - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - 3 - - - - - - - Chroma - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - 3 - - - - - - - Luma - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - 3 - - - - - - - Gray Value - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - true - - - - - label_17 - ifHue - label_19 - ifChroma - label_18 - ifLuma - label_20 - ifGray - - - - - - - KColorButton - QPushButton -
kcolorbutton.h
-
- - KImageFrame - QFrame -
kimageframe.h
- 1 -
-
- - - inRed - valueChanged(int) - form - inputSpinChanged() - - - 126 - 52 - - - 209 - 171 - - - - - inGreen - valueChanged(int) - form - inputSpinChanged() - - - 126 - 84 - - - 209 - 171 - - - - - inBlue - valueChanged(int) - form - inputSpinChanged() - - - 126 - 116 - - - 209 - 171 - - - - - inColor - changed(QColor) - form - inputSwatchChanged(QColor) - - - 126 - 146 - - - 209 - 171 - - - - - leOpDarken - clicked() - form - lumaChanged() - - - 307 - 60 - - - 209 - 171 - - - - - leOpLighten - clicked() - form - lumaChanged() - - - 307 - 88 - - - 209 - 171 - - - - - leOpShade - clicked() - form - lumaChanged() - - - 307 - 116 - - - 209 - 171 - - - - - mtRed - valueChanged(int) - form - targetSpinChanged() - - - 353 - 129 - - - 209 - 171 - - - - - mtGreen - valueChanged(int) - form - targetSpinChanged() - - - 353 - 161 - - - 209 - 171 - - - - - mtBlue - valueChanged(int) - form - targetSpinChanged() - - - 353 - 193 - - - 209 - 171 - - - - - mtTarget - changed(QColor) - form - targetSwatchChanged(QColor) - - - 353 - 222 - - - 209 - 171 - - - - - ssContrast - valueChanged(double) - form - shadeChanged() - - - 362 - 60 - - - 209 - 171 - - - - - ssChroma - valueChanged(double) - form - shadeChanged() - - - 362 - 92 - - - 209 - 171 - - - - - - inputChanged() - inputSpinChanged() - inputSwatchChanged(QColor) - targetSpinChanged() - targetSwatchChanged(QColor) - lumaChanged() - mixChanged() - shadeChanged() - -
diff --git a/kdeui/tests/kcomboboxtest.cpp b/kdeui/tests/kcomboboxtest.cpp deleted file mode 100644 index dda5e57f..00000000 --- a/kdeui/tests/kcomboboxtest.cpp +++ /dev/null @@ -1,240 +0,0 @@ -#include "kcomboboxtest.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -KComboBoxTest::KComboBoxTest(QWidget* widget) - :QWidget(widget) -{ - QVBoxLayout *vbox = new QVBoxLayout (this); - - // Qt combobox - KHBox* hbox = new KHBox(this); - hbox->setSpacing (-1); - QLabel* lbl = new QLabel("&QCombobox:", hbox); - lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred); - - m_qc = new QComboBox(hbox); - m_qc->setObjectName( QLatin1String( "QtReadOnlyCombo" ) ); - lbl->setBuddy (m_qc); - connectComboSignals(m_qc); - vbox->addWidget (hbox); - - // Read-only combobox - hbox = new KHBox(this); - hbox->setSpacing (-1); - lbl = new QLabel("&Read-Only Combo:", hbox); - lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred); - - m_ro = new KComboBox(hbox ); - m_ro->setObjectName( "ReadOnlyCombo" ); - lbl->setBuddy (m_ro); - m_ro->setCompletionMode( KGlobalSettings::CompletionAuto ); - connectComboSignals(m_ro); - vbox->addWidget (hbox); - - // Read-write combobox - hbox = new KHBox(this); - hbox->setSpacing (-1); - lbl = new QLabel("&Editable Combo:", hbox); - lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred); - - m_rw = new KComboBox( true, hbox ); - m_rw->setObjectName( "ReadWriteCombo" ); - lbl->setBuddy (m_rw); - m_rw->setDuplicatesEnabled( true ); - m_rw->setInsertPolicy( QComboBox::NoInsert ); - m_rw->setTrapReturnKey( true ); - connectComboSignals(m_rw); - vbox->addWidget (hbox); - - // History combobox... - hbox = new KHBox(this); - hbox->setSpacing (-1); - lbl = new QLabel("&History Combo:", hbox); - lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred); - - m_hc = new KHistoryComboBox( hbox ); - m_hc->setObjectName( "HistoryCombo" ); - lbl->setBuddy (m_hc); - m_hc->setDuplicatesEnabled( true ); - m_hc->setInsertPolicy( QComboBox::NoInsert ); - connectComboSignals(m_hc); - vbox->addWidget (hbox); - m_hc->setTrapReturnKey(true); - - // Read-write combobox that is a replica of code in konqueror... - hbox = new KHBox(this); - hbox->setSpacing (-1); - lbl = new QLabel( "&Completion Combo:", hbox); - lbl->setSizePolicy (QSizePolicy::Maximum, QSizePolicy::Preferred); - - m_comp = new KComboBox( true, hbox ); - m_comp->setObjectName( "CompletionCombo" ); - lbl->setBuddy (m_comp); - m_comp->setMaxCount( 10 ); - connectComboSignals(m_comp); - vbox->addWidget (hbox); - - // Create an exit button - hbox = new KHBox (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->addItems(list ); - - // Setup read-only combo - m_ro->addItems( list ); - m_ro->completionObject()->setItems( list ); - - // Setup read-write combo - m_rw->addItems( list ); - m_rw->completionObject()->setItems( list ); - - // Setup history combo - m_hc->addItems( list ); - m_hc->completionObject()->setItems( list + QStringList() << "One" << "Two" << "Three" ); - - // Setup completion combobox - QStringList urls; - urls << "https://www.google.com/" << "https://github.com/" << "https://www.youtube.com/"; - KCompletion * s_pCompletion = new KCompletion; - s_pCompletion->setOrder( KCompletion::Weighted ); - s_pCompletion->setItems( urls ); - s_pCompletion->setCompletionMode( KGlobalSettings::completionMode() ); - m_comp->setCompletionObject( s_pCompletion ); - - QPixmap pix = SmallIcon("www"); - m_comp->addItem( pix, "http://www.kde.org" ); - m_comp->setCurrentIndex( m_comp->count()-1 ); - - m_timer = new QTimer (this); - connect (m_timer, SIGNAL (timeout()), SLOT (slotTimeout())); -} - -KComboBoxTest::~KComboBoxTest() -{ - delete m_timer; - m_timer = 0; -} - -void KComboBoxTest::connectComboSignals(QComboBox* combo) -{ - QObject::connect(combo, SIGNAL(activated(int)), SLOT(slotActivated(int))); - QObject::connect(combo, SIGNAL(activated(QString)), SLOT(slotActivated(QString))); - QObject::connect(combo, SIGNAL(currentIndexChanged(int)), SLOT(slotCurrentIndexChanged(int))); - QObject::connect(combo, SIGNAL(currentIndexChanged(QString)), SLOT(slotCurrentIndexChanged(QString))); - QObject::connect(combo, SIGNAL(returnPressed()), SLOT(slotReturnPressed())); - QObject::connect(combo, SIGNAL(returnPressed(QString)), SLOT(slotReturnPressed(QString))); -} - -void KComboBoxTest::slotDisable () -{ - if (m_timer->isActive()) - return; - - m_btnEnable->setEnabled (!m_btnEnable->isEnabled()); - - m_timer->setSingleShot(true); - m_timer->start (5000); -} - -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_comp->setEnabled (!enabled); - - m_btnEnable->setEnabled (!m_btnEnable->isEnabled()); -} - -void KComboBoxTest::slotCurrentIndexChanged(int index) -{ - kDebug() << qPrintable(sender()->objectName()) << ", index:" << index; -} - -void KComboBoxTest::slotCurrentIndexChanged(const QString& item) -{ - kDebug() << qPrintable(sender()->objectName()) << ", item:" << item; -} - -void KComboBoxTest::slotActivated( int index ) -{ - kDebug() << "Activated Combo:" << qPrintable(sender()->objectName()) << ", index:" << index; -} - -void KComboBoxTest::slotActivated (const QString& item) -{ - kDebug() << "Activated Combo:" << qPrintable(sender()->objectName()) << ", item:" << item; -} - -void KComboBoxTest::slotReturnPressed () -{ - kDebug() << "Return Pressed:" << qPrintable(sender()->objectName()); -} - -void KComboBoxTest::slotReturnPressed(const QString& item) -{ - kDebug() << "Return Pressed:" << qPrintable(sender()->objectName()) << ", value =" << item; -} - -void KComboBoxTest::quitApp() -{ - kapp->closeAllWindows(); -} - -int main ( int argc, char **argv) -{ - KAboutData about("kcomboboxtest", 0, ki18n("kcomboboxtest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication a; - - KComboBoxTest* t= new KComboBoxTest; - t->show (); - return a.exec(); -} - -#include "moc_kcomboboxtest.cpp" diff --git a/kdeui/tests/kcomboboxtest.h b/kdeui/tests/kcomboboxtest.h deleted file mode 100644 index aa2260ea..00000000 --- a/kdeui/tests/kcomboboxtest.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef KCOMBOBOXTEST_H -#define KCOMBOBOXTEST_H - -#include - -#include -#include -#include - -class KComboBox; - -class KComboBoxTest : public QWidget -{ - Q_OBJECT - -public: - KComboBoxTest ( QWidget *parent=0); - ~KComboBoxTest(); - -private Q_SLOTS: - void quitApp(); - void slotTimeout(); - void slotDisable(); - void slotReturnPressed(); - void slotReturnPressed(const QString&); - void slotActivated( int ); - void slotActivated( const QString& ); - void slotCurrentIndexChanged(int); - void slotCurrentIndexChanged(const QString&); - -private: - - void connectComboSignals(QComboBox* combo); - - QComboBox* m_qc; - - KComboBox* m_ro; - KComboBox* m_rw; - KComboBox* m_hc; - KComboBox* m_comp; - - - QPushButton* m_btnExit; - QPushButton* m_btnEnable; - - QTimer* m_timer; -}; - -#endif diff --git a/kdeui/tests/kcompletionuitest.cpp b/kdeui/tests/kcompletionuitest.cpp deleted file mode 100644 index f237bffc..00000000 --- a/kdeui/tests/kcompletionuitest.cpp +++ /dev/null @@ -1,208 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include "kcompletionuitest.h" - -/* - * Constructs a Form1 which is a child of 'parent', with the - * widget flags set to 'f' - */ -Form1::Form1( QWidget* parent ) - : QWidget( parent ) -{ - setAttribute( Qt::WA_DeleteOnClose ); - setObjectName( "Form1" ); - resize( 559, 465 ); - setWindowTitle( "Form1" ); - Form1Layout = new QVBoxLayout( this ); - - GroupBox1 = new QGroupBox( this ); - GroupBox1->setLayout( new QVBoxLayout() ); - GroupBox1->setTitle( "Completion Test" ); - GroupBox1->layout()->setSpacing( 0 ); - GroupBox1->layout()->setMargin( 0 ); - GroupBox1Layout = new QVBoxLayout; - GroupBox1Layout->setAlignment( Qt::AlignTop ); - GroupBox1Layout->setSpacing( 6 ); - GroupBox1Layout->setMargin( 11 ); - GroupBox1->layout()->addItem( GroupBox1Layout ); - GroupBox1Layout->setParent(GroupBox1->layout()); - - Layout9 = new QVBoxLayout; - Layout9->setSpacing( 6 ); - Layout9->setMargin( 0 ); - - Layout1 = new QHBoxLayout; - Layout1->setSpacing( 6 ); - Layout1->setMargin( 0 ); - - TextLabel1 = new QLabel( GroupBox1 ); - TextLabel1->setObjectName( "TextLabel1" ); - TextLabel1->setText( "Completion" ); - Layout1->addWidget( TextLabel1 ); - - edit = new KLineEdit( GroupBox1 ); - edit->setObjectName( "edit" ); - Layout1->addWidget( edit ); - Layout9->addLayout( Layout1 ); - edit->completionObject()->setItems( defaultItems() ); - edit->completionObject()->setIgnoreCase( true ); - edit->setFocus(); - edit->setToolTip( "right-click to change completion mode" ); - - Layout2 = new QHBoxLayout; - Layout2->setSpacing( 6 ); - Layout2->setMargin( 0 ); - - combo = new KHistoryComboBox( GroupBox1 ); - combo->setObjectName( "history combo" ); - combo->setCompletionObject( edit->completionObject() ); - // combo->setMaxCount( 5 ); - combo->setHistoryItems( defaultItems(), true ); - connect( combo, SIGNAL(activated(QString)), - combo, SLOT(addToHistory(QString))); - combo->setToolTip( "KHistoryComboBox" ); - Layout2->addWidget( combo ); - - LineEdit1 = new KLineEdit( GroupBox1 ); - LineEdit1->setObjectName( "LineEdit1" ); - Layout2->addWidget( LineEdit1 ); - - PushButton1 = new QPushButton( GroupBox1 ); - PushButton1->setObjectName( "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->setObjectName( "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 QListWidget( GroupBox1 ); - Layout8->addWidget( ListBox1 ); - connect( ListBox1, SIGNAL(currentRowChanged(int)), - SLOT(slotHighlighted(int))); - ListBox1->setToolTip("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->setObjectName( "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->setObjectName( "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().toLatin1().constData() ); - edit->completionObject()->addItem( LineEdit1->text() ); - - QStringList matches = edit->completionObject()->allMatches("S"); - QStringList::ConstIterator it = matches.constBegin(); - for ( ; it != matches.constEnd(); ++it ) - qDebug("-- %s", (*it).toLatin1().constData()); -} - -void Form1::slotRemove() -{ - edit->completionObject()->removeItem( LineEdit1->text() ); -} - -void Form1::slotList() -{ - ListBox1->clear(); - QStringList items = edit->completionObject()->items(); - ListBox1->addItems( items ); -} - -void Form1::slotHighlighted( int row ) -{ - if (row == -1) - return; - - QListWidgetItem *i = ListBox1->item( row ); - Q_ASSERT(i != 0); - - QString text = i->text(); - - // remove any "weighting" - int index = text.lastIndexOf( ':' ); - 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 ) -{ - KAboutData about("kcompletiontest", 0, ki18n("kcompletiontest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - Form1 *form = new Form1(); - form->show(); - - return app.exec(); -} - - -#include "moc_kcompletionuitest.cpp" diff --git a/kdeui/tests/kcompletionuitest.h b/kdeui/tests/kcompletionuitest.h deleted file mode 100644 index a8cca5ef..00000000 --- a/kdeui/tests/kcompletionuitest.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef FORM1_H -#define FORM1_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class KHistoryComboBox; -class KLineEdit; - - -class Form1 : public QWidget -{ - Q_OBJECT - -public: - Form1( QWidget* parent = 0 ); - ~Form1(); - - QGroupBox* GroupBox1; - QLabel* TextLabel1; - KLineEdit* LineEdit1; - QPushButton* PushButton1; - QPushButton* PushButton1_4; - QListWidget* ListBox1; - QPushButton* PushButton1_3; - QPushButton* PushButton1_2; - - KLineEdit* edit; - KHistoryComboBox *combo; - -protected Q_SLOTS: - void slotList(); - void slotAdd(); - void slotRemove(); - void slotHighlighted( int ); - -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 deleted file mode 100644 index 3993829a..00000000 --- a/kdeui/tests/kdatepicktest.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "kdatepicker.h" -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - KAboutData about("KDatePickertest", "kdelibs4", ki18n("KDatePickertest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - KDatePicker picker; - picker.show(); - // picker.setEnabled(false); - return app.exec(); -} - diff --git a/kdeui/tests/kdatetabletest.cpp b/kdeui/tests/kdatetabletest.cpp deleted file mode 100644 index 16519a43..00000000 --- a/kdeui/tests/kdatetabletest.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include - -#include "kdatetable.h" - -int main( int argc, char** argv ) -{ - KCmdLineArgs::init( argc, argv, "test", "kdelibs4", ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - - KDateTable widget; - widget.setCustomDatePainting( QDate::currentDate().addDays(-3), QColor("green"), KDateTable::CircleMode, QColor("yellow") ); - widget.show(); - - return app.exec(); -} diff --git a/kdeui/tests/kdatetimewidgettest.cpp b/kdeui/tests/kdatetimewidgettest.cpp deleted file mode 100644 index 7f46b717..00000000 --- a/kdeui/tests/kdatetimewidgettest.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "kdatetimewidget.h" -#include -#include -#include - -int main(int argc, char** argv) -{ - KCmdLineArgs::init(argc, argv, "test", "kdelibs4", ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - KDateTimeWidget dateTimeWidget; - dateTimeWidget.show(); - // dateTimeWidget.setEnabled(false); - return app.exec(); -} diff --git a/kdeui/tests/kdatewidgettest.cpp b/kdeui/tests/kdatewidgettest.cpp deleted file mode 100644 index 2e6eeb88..00000000 --- a/kdeui/tests/kdatewidgettest.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "kdatewidget.h" -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - KAboutData about("KDateWidgettest", "kdelibs4", ki18n("KDateWidgettest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - KDateWidget dateWidget; - dateWidget.show(); - // dateWidget.setEnabled(false); - return app.exec(); -} - diff --git a/kdeui/tests/kdebugtest_gui.cpp b/kdeui/tests/kdebugtest_gui.cpp deleted file mode 100644 index 30c37968..00000000 --- a/kdeui/tests/kdebugtest_gui.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "kdebug.h" -#include -#include -#include -#include - - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - QWidget widget(0); - widget.setGeometry(45, 54, 120, 80); - widget.show(); - - kDebug() << &widget; - - QRect r(9,12,58,234); - QRegion reg(r); - reg += QRect(1,60,200,59); - kDebug() << reg; - - QVariant v = QPen( Qt::red ); - kDebug() << "Variant: " << v; - - return 0; -} diff --git a/kdeui/tests/kdialogbuttonboxtest.cpp b/kdeui/tests/kdialogbuttonboxtest.cpp deleted file mode 100644 index a3768ef6..00000000 --- a/kdeui/tests/kdialogbuttonboxtest.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Mario Weilguni (mweilguni@sime.com) - Copyright (C) 2006 Olivier Goffart - 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 -#include -#include -#include "kdialogbuttonbox.h" -#include -#include -#include -#include -#include - -int main(int argc, char **argv) { - KAboutData about("kdialogbuttonboxtest", 0, ki18n("kbuttonboxtest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication a; - - // example 1 - { - QDialog *w = new QDialog; - w->setObjectName( "A common dialog" ); - w->setModal(true); - w->setWindowTitle("Example 1"); - QVBoxLayout *tl = new QVBoxLayout(w); - tl->setMargin(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); - l->setMinimumSize(l->sizeHint()); - tl->addWidget(l,1); - KDialogButtonBox *bbox = new KDialogButtonBox(w); - QPushButton *b = bbox->addButton(QLatin1String("OK"), QDialogButtonBox::AcceptRole); - b->setDefault(true); - w->connect(b, SIGNAL(clicked()), - w, SLOT(accept())); - bbox->addButton(QLatin1String("Cancel"),QDialogButtonBox::RejectRole, w, SLOT(accept())); - - bbox->addButton(QLatin1String("Help"), QDialogButtonBox::HelpRole); - - - tl->addWidget(bbox,0); - tl->activate(); - w->exec(); - delete w; - } - - - // example 2 - { - QDialog *w = new QDialog(0); - w->setObjectName("Vertical"); - w->setModal(true); - w->setWindowTitle("Example 2 "); - QHBoxLayout *tl = new QHBoxLayout(w); - tl->setMargin(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); - l->setMinimumSize(l->sizeHint()); - tl->addWidget(l,1); - KDialogButtonBox *bbox = new KDialogButtonBox(w, Qt::Vertical); - - QPushButton *b = bbox->addButton(QLatin1String("OK"), QDialogButtonBox::AcceptRole); - b->setDefault(true); - w->connect(b, SIGNAL(clicked()), - w, SLOT(accept())); - bbox->addButton(QLatin1String("Cancel"),QDialogButtonBox::RejectRole, w, SLOT(accept())); - - bbox->addButton(QLatin1String("Help"), QDialogButtonBox::HelpRole); - - - tl->addWidget(bbox,0); - tl->activate(); - w->exec(); - delete w; - } - - return 0; -} diff --git a/kdeui/tests/kdialogtest.cpp b/kdeui/tests/kdialogtest.cpp deleted file mode 100644 index f7932339..00000000 --- a/kdeui/tests/kdialogtest.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include - -int main(int argc, char** argv) -{ - KAboutData about("DialogTest", 0, ki18n("DialogTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - // ----- - QString text= // the explanation shown by the example dialog - "

KDialog Example



" - "This example shows the usage of the KDialog class. " - "KDialog is the KDE user interface class used to create " - "dialogs with simple layout without having to define an own dialog " - "style for your application.
" - "It provides some standards buttons 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.
" - "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.
" - "If you wrote a help chapter explaining what your dialog does, you " - "should add a link to it to the dialog using setHelp. 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. */ - KDialog dialog; - dialog.setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Details | KDialog::User1 | KDialog::Help ); - dialog.setButtonGuiItem( KDialog::User1 , KGuiItem("Test") ); - dialog.setCaption("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! */ - QTextBrowser view; - view.setHtml( text ); - dialog.setMainWidget( &view ); - - QLabel label("this is a place for some advanced settings" ,&dialog); - dialog.setDetailsWidget( &label); - - //view.setMinimumSize(400, view.heightForWidth(400)+20); - view.setMinimumSize( 250, 300 ); - /* 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/kfontdialogtest.cpp b/kdeui/tests/kfontdialogtest.cpp deleted file mode 100644 index dc861689..00000000 --- a/kdeui/tests/kfontdialogtest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - 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 -#include -#include -#include "kfontdialog.h" -#include - - - int main( int argc, char **argv ) -{ - KAboutData about("KFontDialogTest", 0, ki18n("KFontDialogTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - app.setFont(QFont("Helvetica",12)); - - // QFont font = QFont("Times",18,QFont::Bold); - - QFont font; - int nRet = KFontDialog::getFont(font); - KFontChooser::FontDiffFlags diffFlags; - nRet = KFontDialog::getFontDiff(font, diffFlags); - - return nRet; -} diff --git a/kdeui/tests/khboxtest.cpp b/kdeui/tests/khboxtest.cpp deleted file mode 100644 index bde44d64..00000000 --- a/kdeui/tests/khboxtest.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "khboxtest.h" -#include -#include -#include -#include - -KHBoxTest::KHBoxTest( QWidget* parentWidget ) - : KHBox( parentWidget ) -{ - pbAdd = new QPushButton( "Add a button", this ); - connect( pbAdd, SIGNAL(clicked()), this, SLOT(slotAdd()) ); - pbRemove = 0; -} - -void KHBoxTest::slotAdd() -{ - if ( !pbRemove ) { - pbRemove = new QPushButton( "Remove me", this ); - connect( pbRemove, SIGNAL(clicked()), this, SLOT(slotRemove()) ); - pbAdd->setEnabled( false ); - } -} - -void KHBoxTest::slotRemove() -{ - pbAdd->setEnabled( true ); - pbRemove->deleteLater(); - pbRemove = 0; -} - -int main( int argc, char ** argv ) -{ - KAboutData about("KHBoxTest", 0, ki18n("KHBoxTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - KHBoxTest *toplevel = new KHBoxTest(0); - toplevel->show(); - app.exec(); -} - -#include "moc_khboxtest.cpp" diff --git a/kdeui/tests/khboxtest.h b/kdeui/tests/khboxtest.h deleted file mode 100644 index 7541aacc..00000000 --- a/kdeui/tests/khboxtest.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef KHBOXTEST_H -#define KHBOXTEST_H - -#include "khbox.h" -#include - -class KHBoxTest : public KHBox { - Q_OBJECT - -public: - KHBoxTest( QWidget* parentWidget ); - -public Q_SLOTS: - void slotAdd(); - void slotRemove(); - -private: - QPushButton* pbAdd; - QPushButton* pbRemove; -}; - - -#endif diff --git a/kdeui/tests/kiconeffecttest.cpp b/kdeui/tests/kiconeffecttest.cpp deleted file mode 100644 index cee07ad3..00000000 --- a/kdeui/tests/kiconeffecttest.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "kiconeffecttest.h" - - -KIconEffectTestWidget::KIconEffectTestWidget(QWidget *parent) - : QScrollArea(parent) -{ - setAttribute(Qt::WA_DeleteOnClose); - QWidget *frame = new QWidget(this); - setWidget(frame); - setWidgetResizable(true); - QGridLayout *layout = new QGridLayout(frame); - layout->setColumnStretch(1, 1); - - img = QImage(KIconLoader::global()->iconPath("application-x-cd-image", -128)); - QImage tmp; - QSlider *slider; - - tmp = img; - KIconEffect::toGray(tmp, 0.0); - lbl[0] = new QLabel(frame); - lbl[0]->setPixmap(QPixmap::fromImage(tmp)); - layout->addWidget(lbl[0], 0, 0, 3, 1); - layout->addWidget(new QLabel("Grayscale", frame), 0, 1); - slider = new QSlider(Qt::Horizontal, frame); - slider->setRange(0, 100); - connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slotGray(int))); - layout->addWidget(slider, 1, 1); - - tmp = img; - KIconEffect::toMonochrome(tmp, Qt::black, Qt::white, 0.0); - lbl[1] = new QLabel(frame); - lbl[1]->setPixmap(QPixmap::fromImage(tmp)); - layout->addWidget(lbl[1], 4, 0, 3, 1); - layout->addWidget(new QLabel("Monochrome", frame), 4, 1); - slider = new QSlider(Qt::Horizontal, frame); - slider->setRange(0, 100); - connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slotMonochrome(int))); - layout->addWidget(slider, 5, 1); - - tmp = img; - KIconEffect::deSaturate(tmp, 0.0); - lbl[2] = new QLabel(frame); - lbl[2]->setPixmap(QPixmap::fromImage(tmp)); - layout->addWidget(lbl[2], 8, 0, 3, 1); - layout->addWidget(new QLabel("Desaturate", frame), 8, 1); - slider = new QSlider(Qt::Horizontal, frame); - slider->setRange(0, 100); - connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slotDesaturate(int))); - layout->addWidget(slider, 9, 1); - - tmp = img; - KIconEffect::toGamma(tmp, 0.0); - lbl[3] = new QLabel(frame); - lbl[3]->setPixmap(QPixmap::fromImage(tmp)); - layout->addWidget(lbl[3], 12, 0, 3, 1); - layout->addWidget(new QLabel("Gamma", frame), 12, 1); - slider = new QSlider(Qt::Horizontal, frame); - slider->setRange(0, 100); - connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slotGamma(int))); - layout->addWidget(slider, 13, 1); - - tmp = img; - colorizedColor = Qt::blue; - colorizedValue = 0.0; - KIconEffect::colorize(tmp, colorizedColor, colorizedValue); - lbl[4] = new QLabel(frame); - lbl[4]->setPixmap(QPixmap::fromImage(tmp)); - layout->addWidget(lbl[4], 16, 0, 4, 1); - layout->addWidget(new QLabel("Colorize", frame), 16, 1); - slider = new QSlider(Qt::Horizontal, frame); - slider->setRange(0, 100); - connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slotColorizeValue(int))); - layout->addWidget(slider, 17, 1); - KColorButton *btn = new KColorButton(colorizedColor, frame); - connect(btn, SIGNAL(changed(QColor)), this, SLOT(slotColorizeColor(QColor))); - layout->addWidget(btn, 18, 1); - - tmp = img; - KIconEffect::semiTransparent(tmp); - lbl[5] = new QLabel(frame); - lbl[5]->setPixmap(QPixmap::fromImage(tmp)); - layout->addWidget(lbl[5], 20, 0, 3, 1); - layout->addWidget(new QLabel("Semitransparent", frame), 20, 1); - - layout->setRowStretch(21, 1); - frame->resize(frame->sizeHint()); - -} - -void KIconEffectTestWidget::slotGray(int value) -{ - QImage tmp(img); - KIconEffect::toGray(tmp, value*0.01); - lbl[0]->setPixmap(QPixmap::fromImage(tmp)); -} - -void KIconEffectTestWidget::slotMonochrome(int value) -{ - QImage tmp(img); - KIconEffect::toMonochrome(tmp, Qt::black, Qt::white, value*0.01); - lbl[1]->setPixmap(QPixmap::fromImage(tmp)); -} - -void KIconEffectTestWidget::slotDesaturate(int value) -{ - QImage tmp(img); - KIconEffect::deSaturate(tmp, value*0.01); - lbl[2]->setPixmap(QPixmap::fromImage(tmp)); -} - -void KIconEffectTestWidget::slotGamma(int value) -{ - QImage tmp(img); - KIconEffect::toGamma(tmp, value*0.01); - lbl[3]->setPixmap(QPixmap::fromImage(tmp)); -} - -void KIconEffectTestWidget::slotColorizeColor(const QColor &c) -{ - colorizedColor = c; - QImage tmp(img); - KIconEffect::colorize(tmp, colorizedColor, colorizedValue); - lbl[4]->setPixmap(QPixmap::fromImage(tmp)); -} - -void KIconEffectTestWidget::slotColorizeValue(int value) -{ - colorizedValue = value*0.01f; - QImage tmp(img); - KIconEffect::colorize(tmp, colorizedColor, colorizedValue); - lbl[4]->setPixmap(QPixmap::fromImage(tmp)); -} - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "kiconeffecttest", 0, ki18n("KIconEffectTest"), "1.0", ki18n("KDE icon effect test")); - KApplication app; - KIconEffectTestWidget *w = new KIconEffectTestWidget; - w->show(); - return app.exec(); -} - -#include "moc_kiconeffecttest.cpp" - diff --git a/kdeui/tests/kiconeffecttest.h b/kdeui/tests/kiconeffecttest.h deleted file mode 100644 index 655ee16a..00000000 --- a/kdeui/tests/kiconeffecttest.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef KICONEFFECTTEST_H -#define KICONEFFECTTEST_H - -#include -#include - -#include - -class KIconEffectTestWidget : public QScrollArea -{ - Q_OBJECT -public: - KIconEffectTestWidget(QWidget *parent=0); -private Q_SLOTS: - void slotGray(int); - void slotMonochrome(int); - void slotDesaturate(int); - void slotGamma(int); - void slotColorizeColor(const QColor &); - void slotColorizeValue(int); -private: - QImage img; - QLabel *lbl[6]; - QColor colorizedColor; - float colorizedValue; -}; - -#endif - diff --git a/kdeui/tests/kiconloadertest.cpp b/kdeui/tests/kiconloadertest.cpp deleted file mode 100644 index 5eabbdef..00000000 --- a/kdeui/tests/kiconloadertest.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -int main(int argc, char *argv[]) -{ - KAboutData about("kiconloadertest", 0, ki18n("kiconloadertest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - KIconLoader * mpLoader = KIconLoader::global(); - KIconLoader::Context mContext = KIconLoader::Application; - QElapsedTimer dt; - dt.start(); - int count = 0; - for ( int mGroup = 0; mGroup < KIconLoader::LastGroup ; ++mGroup ) - { - kDebug() << "queryIcons " << mGroup << "," << mContext; - const QStringList filelist = mpLoader->queryIcons(mGroup, mContext); - kDebug() << " -> found " << filelist.count() << " icons."; - int i=0; - for(QStringList::ConstIterator it = filelist.begin(); - it != filelist.end() /*&& i<10*/; - ++it, ++i ) - { - //kDebug() << ( i==9 ? "..." : (*it) ); - mpLoader->loadIcon( (*it), (KIconLoader::Group)mGroup ); - ++count; - } - } - kDebug() << "Loading " << count << " icons took " << (float)(dt.elapsed()) / 1000 << " seconds"; -} - diff --git a/kdeui/tests/kinputdialogtest.cpp b/kdeui/tests/kinputdialogtest.cpp deleted file mode 100644 index d4dc58f6..00000000 --- a/kdeui/tests/kinputdialogtest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright Nadeem Hasan - * Licensed under the GNU General Public License version 2 - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -int main( int argc, char *argv[] ) -{ - QApplication app( argc, argv ); -// app.setApplicationName("kinputdialogtest"); //since there is no kapp usage, set the application name directly - KAboutData aboutData( "kinputdialogtest", 0, ki18n("kinputdialogtest"), "1.0" ); - KComponentData i( &aboutData ); - - bool ok; - QString svalue; - int ivalue; - double dvalue; - - svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok ); - kDebug() << "value1: " << svalue << ", ok: " << ok; - - QRegExpValidator validator( QRegExp( "[0-9]{3}\\-[0-9]{3}\\-[0-9]{4}" ), 0 ); - svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok, 0L, - &validator ); - kDebug() << "value2: " << svalue << ", ok: " << ok; - - svalue = KInputDialog::getText( "_caption", "_label:", "_value", &ok, 0L, 0L, - QString(), "900.900.900.900" ); - kDebug() << "value1: " << svalue << ", ok: " << ok; - - ivalue = KInputDialog::getInteger( "_caption", "_label:", 64, 0, 255, - 16, 16, &ok ); - kDebug() << "value3: " << ivalue << ", ok: " << ok; - - ivalue = KInputDialog::getInteger( "_caption", "_label:", 100, 0, 255, - 10, 10, &ok ); - kDebug() << "value4: " << ivalue << ", ok: " << ok; - - dvalue = KInputDialog::getDouble( "_caption", "_label:", 10, 0, 100, 0.1, - 2, &ok ); - kDebug() << "value5: " << dvalue << ", ok: " << ok; - - dvalue = KInputDialog::getDouble( "_caption", "_label:", 10, 0, 100, 2, &ok ); - kDebug() << "value6: " << dvalue << ", ok: " << ok; - - QStringList list, slvalue; - list << "Item 1" << "Item 2" << "Item 3" << "Item 4" << "Item 5"; - svalue = KInputDialog::getItem( "_caption", "_label:", list, 1, false, &ok ); - kDebug() << "value7: " << svalue << ", ok: " << ok; - - svalue = KInputDialog::getItem( "_caption", "_label:", list, 1, true, &ok ); - kDebug() << "value8: " << svalue << ", ok: " << ok; - - 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 ); - kDebug() << "value9: " << slvalue << ", ok: " << ok; - - select << "Item 5"; - slvalue = KInputDialog::getItemList( "_caption", "_label:", list, select, - true, &ok ); - kDebug() << "value10: " << slvalue << ", ok: " << ok; -} diff --git a/kdeui/tests/kjobtrackerstest.cpp b/kdeui/tests/kjobtrackerstest.cpp deleted file mode 100644 index e25b6192..00000000 --- a/kdeui/tests/kjobtrackerstest.cpp +++ /dev/null @@ -1,182 +0,0 @@ -/** - * This file is part of the KDE libraries - * Copyright (C) 2007 Kevin Ottens - * - * 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 "kjobtrackerstest.h" - -#include -#include - -#include -#include -#include - -#include -#include -#include - -KTestJob::KTestJob(int numberOfDirs) - : KJob(), m_numberOfDirs(numberOfDirs), m_currentSpeed(1000), m_state(Stopped) -{ - setCapabilities(KJob::Killable|KJob::Suspendable); -} - -KTestJob::~KTestJob() -{ -} - -void KTestJob::start() -{ - connect(&m_timer, SIGNAL(timeout()), - this, SLOT(nextStep())); - m_state = StatingDirs; - m_timer.start(50); - emit description(this, QString("Copying"), qMakePair(QString("Source"), QString("file:/src")), - qMakePair(QString("Destination"), QString("file:/dest"))); -} - -void KTestJob::nextStep() -{ - switch (m_state) - { - case StatingDirs: - emit infoMessage(this, QString("Initial listing")); - stateNextDir(); - break; - case CreatingDirs: - emit infoMessage(this, QString("Folder creation")); - createNextDir(); - break; - case CopyingFiles: - emit infoMessage(this, QString("Actual file copying")); - copyNextFile(); - break; - case Stopped: - kDebug() << "Do nothing, we stopped"; - } -} - -void KTestJob::stateNextDir() -{ - if (totalAmount(KJob::Directories)==m_numberOfDirs) { - m_state = CreatingDirs; - return; - } - - QString directory_name = "dir"+QString::number(totalAmount(KJob::Directories)); - - kDebug() << "Stating " << directory_name; - setTotalAmount(KJob::Directories, totalAmount(KJob::Directories)+1); - setTotalAmount(KJob::Files, totalAmount(KJob::Directories)*10); - setTotalAmount(KJob::Bytes, totalAmount(KJob::Files)*1000); - - emit description(this, QString("Stating"), qMakePair(QString("Stating"), QString("file:/src/"+directory_name))); -} - -void KTestJob::createNextDir() -{ - if (processedAmount(KJob::Directories)==totalAmount(KJob::Directories)) { - m_state = CopyingFiles; - return; - } - - QString directory_name = "dir"+QString::number(processedAmount(KJob::Directories)); - - kDebug() << "Creating " << directory_name; - setProcessedAmount(KJob::Directories, processedAmount(KJob::Directories)+1); - - emit description(this, QString("Creating Dir"), qMakePair(QString("Creating"), QString("file:/dest/"+directory_name))); -} - -void KTestJob::copyNextFile() -{ - if (processedAmount(KJob::Files)==totalAmount(KJob::Files)) { - m_state = Stopped; - m_timer.stop(); - emitResult(); - return; - } - - QString file_name = "dir"+QString::number(processedAmount(KJob::Files)/10) - +"/file"+QString::number(processedAmount(KJob::Files)%10); - - kDebug() << "Copying " << file_name; - setProcessedAmount(KJob::Files, processedAmount(KJob::Files)+1); - setProcessedAmount(KJob::Bytes, processedAmount(KJob::Bytes)+1000); - - emit description(this, QString("Copying"), qMakePair(QString("Source"), QString("file:/src/"+file_name)), - qMakePair(QString("Destination"), QString("file:/dest/"+file_name))); - - emitSpeed(m_currentSpeed); -} - -bool KTestJob::doSuspend() -{ - m_timer.stop(); - return true; -} - -bool KTestJob::doResume() -{ - m_timer.start(50); - return true; -} - -bool KTestJob::doKill() -{ - m_timer.stop(); - m_state = Stopped; - return true; -} - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc, argv, "kjobtrackerstest", 0, ki18n("KJobTrackerTest"), - "0.0", ki18n("Test several job trackers at once")); - - KApplication app; - - KTestJob *testJob = new KTestJob(10 /* 100000 bytes to process */); - - KWidgetJobTracker *tracker1 = new KWidgetJobTracker(); - tracker1->registerJob(testJob); - - QMainWindow *main = new QMainWindow; - main->setWindowTitle("Mainwindow with statusbar-job-tracker"); - main->show(); - - QStatusBar *statusBar = new QStatusBar(main); - KStatusBarJobTracker *tracker2 = new KStatusBarJobTracker(main, true); - tracker2->registerJob(testJob); - tracker2->setStatusBarMode(KStatusBarJobTracker::ProgressOnly); - statusBar->addWidget(tracker2->widget(testJob)); - - main->setStatusBar(statusBar); - - KUiServerJobTracker *tracker3 = new KUiServerJobTracker(main); - tracker3->registerJob(testJob); - - testJob->start(); - - tracker1->widget(testJob)->show(); - tracker2->widget(testJob)->show(); - - return app.exec(); -} - -#include "moc_kjobtrackerstest.cpp" diff --git a/kdeui/tests/kjobtrackerstest.h b/kdeui/tests/kjobtrackerstest.h deleted file mode 100644 index c6f3195c..00000000 --- a/kdeui/tests/kjobtrackerstest.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file is part of the KDE libraries - * Copyright (C) 2007 Kevin Ottens - * - * 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. - */ - -#ifndef KJOBTRACKERSTEST_H -#define KJOBTRACKERSTEST_H - -#include - -#include - -class KTestJob : public KJob -{ - Q_OBJECT - -public: - enum State { StatingDirs, CreatingDirs, CopyingFiles, Stopped }; - - // 10 files per directory - // 1000 bytes per files - KTestJob(int numberOfDirs = 5); - ~KTestJob(); - - void start(); - -private Q_SLOTS: - void nextStep(); - -protected: - void stateNextDir(); - void createNextDir(); - void copyNextFile(); - void deleteNextFile(); - - bool doSuspend(); - bool doResume(); - bool doKill(); - -private: - qulonglong m_numberOfDirs; - qulonglong m_currentSpeed; - State m_state; - QTimer m_timer; -}; - -#endif diff --git a/kdeui/tests/klanguagebuttontest.cpp b/kdeui/tests/klanguagebuttontest.cpp deleted file mode 100644 index e185e39d..00000000 --- a/kdeui/tests/klanguagebuttontest.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (c) 2013 David Faure - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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 "klanguagebutton.h" -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - KAboutData about("KLanguageButtonTest", "kdelibs4", ki18n("KLanguageButtonTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication app; - - KLanguageButton button; - button.loadAllLanguages(); - button.show(); - return app.exec(); -} - diff --git a/kdeui/tests/kledtest.cpp b/kdeui/tests/kledtest.cpp deleted file mode 100644 index e4b2fc89..00000000 --- a/kdeui/tests/kledtest.cpp +++ /dev/null @@ -1,164 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "kled.h" -#include "kledtest.h" - - - -KLedTest::KLedTest(QWidget* parent) - : QWidget(parent), - LedWidth(16), - LedHeight(10), - Grid(3), - ledcolor(0), - ledlook(KLed::Flat), - 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.setSingleShot(false); - t_toggle.start(1000); - t_color.setSingleShot(false); - t_color.start(3500); - t_look.setSingleShot(false); - t_look.start(3500); - 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(Qt::green); break; - case 1: l->setColor(Qt::blue); break; - case 2: l->setColor(Qt::red); break; - case 3: l->setColor(Qt::yellow); break; - } -} - - -void -KLedTest::nextLook() { - int tmp; - if (kled_round) { - tmp = (static_cast(ledlook) +1 ) % 3 ; - } - else { - tmp = (static_cast(ledlook) + 1) % 3; - } - ledlook = static_cast(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; countstate()==KLed::Off) - { - leds[count]->setState(KLed::On); - } else { - leds[count]->setState(KLed::Off); - } - } -} - - -/*#include */ - -int main( int argc, char **argv ) -{ - KAboutData about("KLedTest", 0, ki18n("KLedTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication a; - 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; - } - } - */ - widget.show(); - return a.exec(); // go -} - -#include "moc_kledtest.cpp" - diff --git a/kdeui/tests/kledtest.h b/kdeui/tests/kledtest.h deleted file mode 100644 index bc00b3d1..00000000 --- a/kdeui/tests/kledtest.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef KLEDTEST_H -#define KLEDTEST_H - -#include -#include -#include -#include - -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; - -public: - - KLedTest(QWidget* parent=0); - ~KLedTest(); - - bool kled_round; - - -public Q_SLOTS: - void timeout(); - - void nextColor(); - void nextLook(); - - -}; - -#endif - diff --git a/kdeui/tests/klineedittest.cpp b/kdeui/tests/klineedittest.cpp deleted file mode 100644 index eb2a52a2..00000000 --- a/kdeui/tests/klineedittest.cpp +++ /dev/null @@ -1,186 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "klineedittest.h" -#include -#include - -KLineEditTest::KLineEditTest ( QWidget* widget ) - :QWidget( widget ) -{ - QVBoxLayout* layout = new QVBoxLayout( this ); - - 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 ); - m_lineedit->setObjectName( "klineedittest" ); - m_lineedit->completionObject()->setItems( list ); - m_lineedit->setSqueezedTextEnabled( true ); - m_lineedit->setClearButtonShown( true ); - connect( m_lineedit, SIGNAL(returnPressed()), SLOT(slotReturnPressed()) ); - connect( m_lineedit, SIGNAL(returnPressed(QString)), - SLOT(slotReturnPressed(QString)) ); - - QHBoxLayout* restrictedHBox = new QHBoxLayout; - m_restrictedLine = new KRestrictedLine(this); - m_restrictedLine->setValidChars(QString::fromUtf8("aeiouyé")); - connect(m_restrictedLine, SIGNAL(invalidChar(int)), this, SLOT(slotInvalidChar(int))); - connect( m_restrictedLine, SIGNAL(returnPressed()), SLOT(slotReturnPressed()) ); - connect( m_restrictedLine, SIGNAL(returnPressed(QString)), - SLOT(slotReturnPressed(QString)) ); - restrictedHBox->addWidget(new QLabel("Vowels only:", this)); - restrictedHBox->addWidget(m_restrictedLine); - m_invalidCharLabel = new QLabel(this); - restrictedHBox->addWidget(m_invalidCharLabel); - - - KHBox *hbox = new KHBox (this); - m_btnExit = new QPushButton( "E&xit", hbox ); - connect( m_btnExit, SIGNAL(clicked()), SLOT(quitApp()) ); - - m_btnReadOnly = new QPushButton( "&Read Only", hbox ); - m_btnReadOnly->setCheckable (true); - connect( m_btnReadOnly, SIGNAL(toggled(bool)), SLOT(slotReadOnly(bool)) ); - - m_btnPassword = new QPushButton( "&Password", hbox ); - m_btnPassword->setCheckable (true); - connect( m_btnPassword, SIGNAL(toggled(bool)), SLOT(slotPassword(bool)) ); - - m_btnEnable = new QPushButton( "Dis&able", hbox ); - m_btnEnable->setCheckable (true); - connect( m_btnEnable, SIGNAL(toggled(bool)), SLOT(slotEnable(bool)) ); - - m_btnHide = new QPushButton( "Hi&de", hbox ); - connect( m_btnHide, SIGNAL(clicked()), SLOT(slotHide()) ); - - m_btnClickMessage = new QPushButton( "Clicked Message", hbox); - m_btnClickMessage->setCheckable (true); - connect( m_btnClickMessage, SIGNAL(toggled(bool)), SLOT(slotClickMessage(bool)) ); - - QPushButton *button = new QPushButton( "Stylesheet", hbox); - connect( button, SIGNAL(clicked()), SLOT(slotSetStyleSheet())); - - layout->addWidget( m_lineedit ); - layout->addLayout( restrictedHBox ); - layout->addWidget( hbox ); - setWindowTitle( "KLineEdit Unit Test" ); -} - -KLineEditTest::~KLineEditTest() -{ -} - -void KLineEditTest::quitApp() -{ - kapp->closeAllWindows(); -} - -void KLineEditTest::slotSetStyleSheet() -{ - m_lineedit->setStyleSheet("QLineEdit{ background-color:#baf9ce }"); -} - -void KLineEditTest::show() -{ - if (m_lineedit->isHidden()) - m_lineedit->show(); - - m_btnHide->setEnabled( true ); - - QWidget::show(); -} - -void KLineEditTest::slotReturnPressed() -{ - kDebug() << "Return pressed"; -} - -void KLineEditTest::slotReturnPressed( const QString& text ) -{ - kDebug() << "Return pressed: " << text; -} - -void KLineEditTest::resultOutput( const QString& text ) -{ - kDebug() << "KlineEditTest Debug: " << text; -} - -void KLineEditTest::slotReadOnly( bool ro ) -{ - m_lineedit->setReadOnly (ro); - QString text = (ro) ? "&Read Write" : "&Read Only"; - m_btnReadOnly->setText (text); -} - -void KLineEditTest::slotPassword( bool pw ) -{ - m_lineedit->setPasswordMode (pw); - QString text = (pw) ? "&Normal Text" : "&Password"; - m_btnPassword->setText (text); -} - -void KLineEditTest::slotEnable (bool enable) -{ - m_lineedit->setEnabled (!enable); - QString text = (enable) ? "En&able":"Dis&able"; - m_btnEnable->setText (text); -} - -void KLineEditTest::slotClickMessage(bool click) -{ - if( click ) - { - m_lineedit->setText(""); // Clear before to add message - m_lineedit->setClickMessage ("Click in this lineedit"); - } -} - -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()) ); -} - -void KLineEditTest::slotInvalidChar(int key) -{ - m_invalidCharLabel->setText(QString("Invalid char: %1").arg(key)); -} - -int main ( int argc, char **argv) -{ - KAboutData aboutData( "klineedittest", 0, ki18n("klineedittest"), "1.0" ); - KCmdLineArgs::init(argc, argv, &aboutData); - KCmdLineArgs::addStdCmdLineOptions(); - - KApplication a; - KLineEditTest *t = new KLineEditTest(); - //t->lineEdit()->setTrapReturnKey( true ); - //t->lineEdit()->completionBox()->setTabHandling( false ); - t->lineEdit()->setSqueezedTextEnabled( true ); - t->lineEdit()->setText ("This is a really really really really really really " - "really really long line because I am a talkative fool!" - "I mean ... REALLY talkative. If you don't believe me, ask my cousin."); - t->show(); - return a.exec(); -} - -#include "moc_klineedittest.cpp" diff --git a/kdeui/tests/klineedittest.h b/kdeui/tests/klineedittest.h deleted file mode 100644 index 8e86d113..00000000 --- a/kdeui/tests/klineedittest.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef KLINEEDITTEST_H -#define KLINEEDITTEST_H - -#include -#include - -#include -class KRestrictedLine; -#include -#include - -class KLineEdit; - -class KLineEditTest : public QWidget -{ - Q_OBJECT - -public: - KLineEditTest( QWidget *parent=0 ); - ~KLineEditTest(); - KLineEdit* lineEdit() const { return m_lineedit; } - -public Q_SLOTS: - virtual void show (); - -private Q_SLOTS: - void quitApp(); - void slotHide(); - void slotEnable( bool ); - void slotReadOnly( bool ); - void slotPassword( bool ); - void slotReturnPressed(); - void resultOutput( const QString& ); - void slotReturnPressed( const QString& ); - void slotClickMessage(bool click); - void slotInvalidChar(int); - void slotSetStyleSheet(); - -protected: - KLineEdit* m_lineedit; - KRestrictedLine* m_restrictedLine; - QLabel* m_invalidCharLabel; - QPushButton* m_btnExit; - QPushButton* m_btnReadOnly; - QPushButton* m_btnPassword; - QPushButton* m_btnEnable; - QPushButton* m_btnHide; - QPushButton* m_btnClickMessage; -}; - -#endif diff --git a/kdeui/tests/kmainwindowrestoretest.cpp b/kdeui/tests/kmainwindowrestoretest.cpp deleted file mode 100644 index d37be6b0..00000000 --- a/kdeui/tests/kmainwindowrestoretest.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -#include "kmainwindowrestoretest.h" - -#include -#include - -#include - -#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[] ) { - - KCmdLineArgs::init( argc, argv, "kmainwindowrestoretest", 0, ki18n("kmainwindowrestoretest"), "1.0", ki18n("kmainwindow test app")); - KApplication app; - - if ( kapp->isSessionRestored() ) { - 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 "moc_kmainwindowrestoretest.cpp" diff --git a/kdeui/tests/kmainwindowrestoretest.h b/kdeui/tests/kmainwindowrestoretest.h deleted file mode 100644 index 7bd535f7..00000000 --- a/kdeui/tests/kmainwindowrestoretest.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef _KDEUI_TESTS_KMAINWINDOWRESTORETEST_H_ -#define _KDEUI_TESTS_KMAINWINDOWRESTORETEST_H_ - -#include - -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 deleted file mode 100644 index f5b77a7a..00000000 --- a/kdeui/tests/kmainwindowtest.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright 2002 Simon Hausmann - Copyright 2005-2006 David Faure - - 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 -#include -#include - -#include -#include -#include - -#include "kmainwindowtest.h" - -MainWindow::MainWindow() -{ - QTimer::singleShot( 2*1000, this, SLOT(showMessage()) ); - - setCentralWidget( new QLabel( "foo", this ) ); - - menuBar()->addAction( "hi" ); -} - -void MainWindow::showMessage() -{ - statusBar()->show(); - statusBar()->showMessage( "test" ); -} - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "kmainwindowtest", 0, ki18n("KMainWindowTest"), "1.0", ki18n("kmainwindow test app")); - KApplication app; - - MainWindow* mw = new MainWindow; // deletes itself when closed - mw->show(); - - return app.exec(); -} - -#include "moc_kmainwindowtest.cpp" - -/* vim: et sw=4 ts=4 - */ diff --git a/kdeui/tests/kmainwindowtest.h b/kdeui/tests/kmainwindowtest.h deleted file mode 100644 index 786f4908..00000000 --- a/kdeui/tests/kmainwindowtest.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright 2002 Simon Hausmann - - 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. -*/ - -#ifndef KMAINWINDOWTEST_H -#define KMAINWINDOWTEST_H - -#include - -class MainWindow : public KMainWindow -{ - Q_OBJECT -public: - MainWindow(); - -private Q_SLOTS: - void showMessage(); -}; - -#endif // KMAINWINDOWTEST_H -/* vim: et sw=4 ts=4 - */ diff --git a/kdeui/tests/kmessageboxtest.cpp b/kdeui/tests/kmessageboxtest.cpp deleted file mode 100644 index 19359a25..00000000 --- a/kdeui/tests/kmessageboxtest.cpp +++ /dev/null @@ -1,364 +0,0 @@ -#include "kmessagebox.h" -#include - -#include -#include - -#include -#include -#include - -class ExampleWidget : public QLabel -{ -public: - ExampleWidget( QWidget *parent = 0 ); -}; - -ExampleWidget::ExampleWidget( QWidget *parent ) - : QLabel(parent ) -{ - // Make the top-level layout; a vertical box to contain all widgets - // and sub-layouts. - QSize sh; - setText("

Hello.

"); - 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("

Hello
World

"); - 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) { - setObjectName("foo"); - setModal(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; - KAboutData about("KMessageBoxTest", 0, ki18n("KMessageBoxTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - new KApplication(); - - ExampleWidget *w = new ExampleWidget(); - w->show(); - - 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 .\n" - "Are you sure?", - "Print", KGuiItem( QLatin1String("&Print") ), KStandardGuiItem::cancel(), "dontask", 0); - i = KMessageBox::warningContinueCancel(0, - "You are about to .\n" - "Are you sure?", - "Print", KGuiItem( QLatin1String("&Print") ), KStandardGuiItem::cancel(), "dontask", KMessageBox::AllowLink); - i = KMessageBox::questionYesNo(0, "

Do you have a printer? thisisaverylongdkldhklghklghklashgkllasghkdlsghkldfghklsabla bla bbla bla. It also has this URL.

", - QString("Bla"), KGuiItem(QString("Yes")), KGuiItem(QString("No")), "bla", KMessageBox::AllowLink); - break; - -case 2: - i = KMessageBox::questionYesNo(0, "Do you have a printer?", - QString("Printer setup")); - break; - -case 3: - i = KMessageBox::questionYesNo(0, - "Does your printer support color or only black and white?", - "Printer setup", KGuiItem( QLatin1String("&Color") ), KGuiItem(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", KGuiItem( QLatin1String("&Print") ) ); - break; -case 7: - i = KMessageBox::warningContinueCancel(0, - "You are about to .\n" - "Are you sure?", - "Print", KGuiItem( QLatin1String("&Print") ), KStandardGuiItem::cancel(), "dontask", 0); - 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", - QLatin1String("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", KGuiItem( QLatin1String("&Save") ), KGuiItem( QLatin1String("&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(), "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(), "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(), "Search_Words"); - break; - -default: - return 0; - } // Switch - - showResult(test, i); - } // Test -} - - - - - - -#if 0 -//this is my sequence for testing messagebox layout: - - KMessageBox::questionYesNoCancel( - 0, "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", "long", - KStandardGuiItem::saveAs(), KGuiItem("dsdddddd"), KStandardGuiItem::cancel() - ); - KMessageBox::questionYesNoCancel( - 0, "ddddddddddddddddddddd ddddddddddddddddddddd dddddddddd dddddddddd ddddddddddddddddddd dddddddddddd ddddddddd", "long wrap", - KStandardGuiItem::saveAs(), KGuiItem("dsdddddd"), KStandardGuiItem::cancel() - ); - - KMessageBox::questionYesNoCancel( - 0, "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd", "height", - KStandardGuiItem::saveAs(), KGuiItem("dsdddddd"), KStandardGuiItem::cancel() - ); - - QStringList strlist; - strlist<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfgh\nghghgfhgf"<<"f\ngfg\nhg\nhghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"<<"fgfghghghgfhgf"; - KMessageBox::errorList(0, - "short\n", - strlist,"short"); - KMessageBox::errorList(0, - "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", - strlist,"short"); - KMessageBox::errorList(0, - "ddddddddddddddddddddd ddddddddddddddddddddd dddddddddd dddddddddd ddddddddddddddddddd dddddddddddd ddddddddd", - strlist,"short"); - KMessageBox::errorList(0, - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd", - strlist,"short"); - - KMessageBox::detailedError(0, - "sss", - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - ); - KMessageBox::detailedError(0, - "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd", - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - ); - KMessageBox::detailedError(0, - "ddddddddddddddddddddd ddddddddddddddddddddd dddddddddd dddddddddd ddddddddddddddddddd dddddddddddd ddddddddd", - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - ); - KMessageBox::detailedError(0, - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd", - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - "dddddd\ndddddd\nddddddddd ddddd\ndddd\ndddddddddddd \ndddddddddd dddddddddd dd\nddddddddddd\ndd\ndddd dddd\ndddddddd ddd\ndd\ndddd" - ); - -#endif diff --git a/kdeui/tests/kmessagetest.cpp b/kdeui/tests/kmessagetest.cpp deleted file mode 100644 index da0dee05..00000000 --- a/kdeui/tests/kmessagetest.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2006 Michaël Larouche - - 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; version 2 - of the License. - - 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 "kmessagetest.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -KMessage_Test::KMessage_Test(QWidget *parent) - : QWidget(parent) -{ - QVBoxLayout *mainLayout = new QVBoxLayout(this); - - QPushButton *buttonError = new QPushButton( QLatin1String("Show error"), this ); - connect(buttonError, SIGNAL(clicked()), this, SLOT(showError())); - - QPushButton *buttonFatal = new QPushButton( QLatin1String("Show fatal"), this ); - connect(buttonFatal, SIGNAL(clicked()), this, SLOT(showFatal())); - - QPushButton *buttonInformation = new QPushButton( QLatin1String("Show information"), this ); - connect(buttonInformation, SIGNAL(clicked()), this, SLOT(showInformation())); - - QPushButton *buttonSorry = new QPushButton( QLatin1String("Show sorry"), this ); - connect(buttonSorry, SIGNAL(clicked()), this, SLOT(showSorry())); - - QPushButton *buttonWarning = new QPushButton( QLatin1String("Show warning"), this ); - connect(buttonWarning, SIGNAL(clicked()), this, SLOT(showWarning())); - - mainLayout->addWidget( buttonError ); - mainLayout->addWidget( buttonFatal ); - mainLayout->addWidget( buttonInformation ); - mainLayout->addWidget( buttonSorry ); - mainLayout->addWidget( buttonWarning ); -} - -void KMessage_Test::showError() -{ - KMessage::message( KMessage::Error, QLatin1String("Error: Destruction of the Death Star failed."), QLatin1String("KMessage_Test") ); -} - -void KMessage_Test::showFatal() -{ - KMessage::message( KMessage::Fatal, QLatin1String("Fatal: You have turn to the dark side of the Force."), QLatin1String("KMessage_Test") ); -} - -void KMessage_Test::showInformation() -{ - KMessage::message( KMessage::Information, QLatin1String("Info: This is a demonstration of the new KMessage API for kdelibs. It abstract the display of message and you can develop custom mesage handle for your application"), QLatin1String("KMessage_Test") ); -} - -void KMessage_Test::showSorry() -{ - KMessage::message( KMessage::Sorry, QLatin1String("Sorry but our princess is in another castle."), QLatin1String("KMessage_Test") ); -} - -void KMessage_Test::showWarning() -{ - KMessage::message( KMessage::Warning, QLatin1String("Warning: Loading failed. Your user experience will be affected."), QLatin1String("KMessage_Test") ); -} - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc, argv, "kmessagetest", 0, ki18n("KMessage_Test"), "version", ki18n("description")); - - KApplication app; - app.setQuitOnLastWindowClosed( false ); - - KMessage_Test *mainWidget = new KMessage_Test; - mainWidget->setAttribute( static_cast(Qt::WA_DeleteOnClose | Qt::WA_QuitOnClose) ); - - bool ok = false; - const QStringList choices = QStringList() << "KMessageBox" << "KPassivePopup" << "Default (stderr)"; - QString result = QInputDialog::getItem(0, "Select", "Select type of MessageHandler", choices, 0, false, &ok); - - if(ok && result == "KMessageBox") { - KMessage::setMessageHandler( new KMessageBoxMessageHandler(mainWidget) ); - } else if(ok && result == "KPassivePopup") { - KMessage::setMessageHandler( new KPassivePopupMessageHandler(mainWidget) ); - } - - mainWidget->show(); - - return app.exec(); -} - -#include "moc_kmessagetest.cpp" -// kate: space-indent on; indent-width 4; encoding utf-8; replace-tabs on; diff --git a/kdeui/tests/kmessagetest.h b/kdeui/tests/kmessagetest.h deleted file mode 100644 index 7de2fe50..00000000 --- a/kdeui/tests/kmessagetest.h +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2006 Michaël Larouche - - 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; version 2 - of the License. - - 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. -*/ -#ifndef KMESSAGETEST_H -#define KMESSAGETEST_H - -#include - -class KMessage_Test : public QWidget -{ - Q_OBJECT -public: - KMessage_Test(QWidget *parent = 0); - -private slots: - void showError(); - void showFatal(); - void showInformation(); - void showSorry(); - void showWarning(); - -}; - -#endif -// kate: space-indent on; indent-width 4; encoding utf-8; replace-tabs on; diff --git a/kdeui/tests/kmessagewidgettest.cpp b/kdeui/tests/kmessagewidgettest.cpp deleted file mode 100644 index 80a19323..00000000 --- a/kdeui/tests/kmessagewidgettest.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* This file is part of the KDE libraries - * - * Copyright 2012 Aurélien Gâteau - * - * Based on test program by Dominik Haumann - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -#include -#include -#include -#include -#include - -#include - -int main(int argc, char* argv[]) -{ - QApplication app(argc, argv); - QWidget* mainWindow = new QWidget(); - - QVBoxLayout* l = new QVBoxLayout(mainWindow); - - KMessageWidget* mw = new KMessageWidget(mainWindow); - mw->setWordWrap(true); - mw->setText( - "Test KMessageWidget is properly sized when word-wrap is enabled by default." - ); - // A frame to materialize the end of the KMessageWidget - QFrame* frame = new QFrame(mainWindow); - frame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); - frame->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - QCheckBox* wordWrapCb = new QCheckBox("wordWrap", mainWindow); - wordWrapCb->setChecked(true); - QObject::connect(wordWrapCb, SIGNAL(toggled(bool)), mw, SLOT(setWordWrap(bool))); - - QCheckBox* closeButtonCb = new QCheckBox("closeButton", mainWindow); - closeButtonCb->setChecked(true); - QObject::connect(closeButtonCb, SIGNAL(toggled(bool)), mw, SLOT(setCloseButtonVisible(bool))); - - l->addWidget(wordWrapCb); - l->addWidget(closeButtonCb); - l->addWidget(mw); - l->addWidget(frame); - - mainWindow->resize(400, 300); - mainWindow->show(); - - return app.exec(); - delete mainWindow; -} - -// kate: replace-tabs on; diff --git a/kdeui/tests/knewpassworddialogtest.cpp b/kdeui/tests/knewpassworddialogtest.cpp deleted file mode 100644 index 9e7213d9..00000000 --- a/kdeui/tests/knewpassworddialogtest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2007 Olivier Goffart - - 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 -#include -#include -#include -#include -#include - -int main( int argc, char *argv[] ) -{ - KAboutData about("KNewPasswordDialogTest", 0, ki18n("KNewPasswordDialogTest"), "1"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication a; - - KNewPasswordDialog dlg; - dlg.setPrompt(i18n("Enter a password for the test")); - - if( dlg.exec() ) - { - std::cout << "Entered password: " << (const char*)dlg.password().toLatin1() << std::endl; - return 0; - } - else - { - std::cout << "No password" << std::endl; - return -1; - } - -} - diff --git a/kdeui/tests/knotificationrestrictionstest.cpp b/kdeui/tests/knotificationrestrictionstest.cpp deleted file mode 100644 index 33a60e43..00000000 --- a/kdeui/tests/knotificationrestrictionstest.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright 2006 Aaron J. Seigo - - 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 - -#include -#include - -int main(int argc, char* argv[]) -{ - QApplication app(argc, argv); - - QLabel* mainWidget = new QLabel(); - mainWidget->setText("You should see on console debug outpout for KNotificationRestrictions"); - - KNotificationRestrictions knr(KNotificationRestrictions::ScreenSaver, 0); - - mainWidget->show(); - return app.exec(); -} - diff --git a/kdeui/tests/knuminputtest.cpp b/kdeui/tests/knuminputtest.cpp deleted file mode 100644 index 007ac763..00000000 --- a/kdeui/tests/knuminputtest.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* -* Tests the KNumInput Widget class -* -* Copyright 1999 by Dirk A. Mueller -* -* Licensed under the GNU General Public License version 2 or later -*/ - -#include -#include -#include - -#include -#include -#include -#include - -#include "knuminputtest.h" - -KApplication *a; - -#include -void TopLevel::slotPrint( int n ) { - kDebug() << "slotPrint( " << n << " )"; -} -void TopLevel::slotPrint( double n ) { - kDebug() << "slotPrint( " << n << " )"; -} - -#define conn(x,y) connect( x, SIGNAL(valueChanged(y)), SLOT(slotPrint(y))) -TopLevel::TopLevel(QWidget *parent) - : QWidget(parent) -{ - setWindowTitle("KNumInput test application"); - - QBoxLayout* l = new QHBoxLayout(this); - l->setMargin(10); - - QGroupBox* b1 = new QGroupBox("KIntNumInput", this); - b1->setLayout( new QVBoxLayout() ); - - i1 = new KIntNumInput(42,b1,10 /*"perc_no_slider"*/); - i1->setLabel("percent of usage (no slider)"); - i1->setRange(0, 100, 5); - i1->setSliderEnabled(false); - conn(i1,int); - b1->layout()->addWidget(i1); - - i2 = new KIntNumInput(42, b1); - i2->setLabel("percentage of usage (with slider)"); - i2->setRange(0, 100, 5); - i2->setSuffix(" %"); - i2->setSliderEnabled(true); - conn(i2,int); - b1->layout()->addWidget(i2); - - i3 = new KIntNumInput(0xAF, b1, 16); - i3->setLabel("Hex byte (no slider)"); - i3->setRange(0, 255, 1); - i3->setSliderEnabled(false); - i3->setSuffix(" (hex)"); - conn(i3,int); - b1->layout()->addWidget(i3); - - i4 = new KIntNumInput(0xfe, b1, 16); - i4->setLabel("Hex byte (with slider)"); - i4->setRange(0, 255, 1); - i4->setSliderEnabled(true); - conn(i4,int); - b1->layout()->addWidget(i4); - - - i5 = new KIntNumInput(10, b1,10); - i5->setLabel("Width (keeps aspect ratio):"); - i5->setRange(0, 200); - i5->setSliderEnabled(false); - i5->setReferencePoint( 5 ); - b1->layout()->addWidget(i5); - - - i6 = new KIntNumInput(20, b1, 10); - i6->setLabel("Height (should be 2xWidth value):"); - i6->setRange(0, 200); - i6->setReferencePoint( 10 ); - i6->setSliderEnabled(false); - b1->layout()->addWidget(i6); - - connect( i5, SIGNAL(relativeValueChanged(double)), - i6, SLOT(setRelativeValue(double)) ); - connect( i6, SIGNAL(relativeValueChanged(double)), - i5, SLOT(setRelativeValue(double)) ); - - i7 = new KIntNumInput(0, b1, 10); - i7->setLabel("math test:", Qt::AlignVCenter|Qt::AlignLeft ); - i7->setRange( 0, 200, 1 ); - conn(i7,int); - b1->layout()->addWidget(i7); - - i8 = new KIntNumInput(0, b1, 10); - i8->setLabel("plural test:", Qt::AlignVCenter|Qt::AlignLeft); - i8->setRange(0, 100, 1); - i8->setSuffix( ki18np( " suffix", " suffixes" ) ); - b1->layout()->addWidget(i8); - - l->addWidget(b1); - - QGroupBox* b2 = new QGroupBox("KDoubleNumInput", this); - b2->setLayout(new QVBoxLayout()); - d1 = new KDoubleNumInput(10,4.0,1,b2,2 /*, "perc_double_no_slider"*/); - d1->setLabel("percent of usage (no slider)", Qt::AlignTop | Qt::AlignRight); - d1->setRange(0.0, 4000.0, 0.01, false); - //d1->setValue(1.00000000000000000001); - conn(d1,double); - b2->layout()->addWidget(d1); - - d2 = new KDoubleNumInput(0,20,0.422,b2,0.1,3/*, "perc_double_with_slider"*/); - d2->setLabel("percentage of usage (with slider)", Qt::AlignBottom | Qt::AlignLeft); - d2->setRange(0, 0.05, 0.005); - d2->setSuffix("%"); - conn(d2,double); - b2->layout()->addWidget(d2); - - d3 = new KDoubleNumInput(0,20,16.20,b2); - d3->setLabel("cash: ", Qt::AlignVCenter | Qt::AlignHCenter); - d3->setRange(0.10, 100, 0.1); - d3->setPrefix("p"); - d3->setSuffix("$"); - conn(d3,double); - b2->layout()->addWidget(d3); - - - d4 = new KDoubleNumInput(0,INT_MAX,INT_MAX/10000.0,b2,1,1); -// d4->setPrecision(3); - d4->setRange(double(INT_MIN+1)/1000.0, double(INT_MAX)/1000.0, 1); - d4->setLabel("math test: ", Qt::AlignVCenter | Qt::AlignLeft); -// d4->setFormat("%g"); - conn(d4,double); - b2->layout()->addWidget(d4); - - - d5 = new KDoubleNumInput(double(INT_MIN+1)/1e9, double(INT_MAX-1)/1e9, - 0.1, b2,0.001, 9 /*, "d5"*/); - d5->setLabel("math test 2: ", Qt::AlignVCenter|Qt::AlignLeft); - conn(d5,double); - b2->layout()->addWidget(d5); - - - d6 = new KDoubleNumInput(-10, 10, 0, b2,0.001, 3 /*, "d6"*/); - d6->setLabel("aspect ratio test with a negative ratio:"); - d6->setReferencePoint( 1 ); - b2->layout()->addWidget(d6); - - - d7 = new KDoubleNumInput(-30, 30, 0, b2,0.001, 3 /*, "d7"*/); - d7->setReferencePoint( -3 ); - b2->layout()->addWidget(d7); - - - 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 ) -{ - KAboutData about("KNuminputTest", 0, ki18n("KNuminputTest"), "version"); - KCmdLineArgs::init(argc, argv, &about); - - a = new KApplication ( ); - - TopLevel *toplevel = new TopLevel(0); - - toplevel->show(); - a->exec(); -} - -#include "moc_knuminputtest.cpp" - diff --git a/kdeui/tests/knuminputtest.h b/kdeui/tests/knuminputtest.h deleted file mode 100644 index 2600d290..00000000 --- a/kdeui/tests/knuminputtest.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -* Tests the KNumInput Widget class -* -* Copyright 1999 by Dirk A. Mueller -* -* Licensed under the GNU General Public License version 2 or later -*/ -#ifndef KNUMINPUTTEST_H -#define KNUMINPUTTEST_H - -#include - -class KIntNumInput; -class KDoubleNumInput; - -class TopLevel : public QWidget -{ - Q_OBJECT -public: - - TopLevel( QWidget *parent=0 ); -protected: - KIntNumInput* i1, *i2, *i3, *i4, *i5, *i6, *i7, *i8; - KDoubleNumInput* d1, *d2, *d3, *d4, *d5, *d6, *d7; -protected Q_SLOTS: - void slotPrint( int ); - void slotPrint( double ); -}; - -#endif diff --git a/kdeui/tests/kpagedialogtest.cpp b/kdeui/tests/kpagedialogtest.cpp deleted file mode 100644 index 594e110e..00000000 --- a/kdeui/tests/kpagedialogtest.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - This file is part of the KDE Libraries - - Copyright (C) 2006 Tobias Koenig (tokoe@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include -#include - -#include "kpagedialogtest.h" - -KPageDialogTest::KPageDialogTest( QWidget *parent ) - : KPageDialog( parent ) -{ - setFaceType( Tabbed ); - - QWidget *page = new QWidget( this ); - QHBoxLayout *layout = new QHBoxLayout( page ); - - QLabel *label = new QLabel( "first page" ); - layout->addWidget( label ); - - addPage( page, "First" ); - - page = new QWidget( this ); - layout = new QHBoxLayout( page ); - - label = new QLabel( "second page" ); - label->setMinimumSize( 300, 200 ); - layout->addWidget( label ); - - addPage( page, "Second" ); -} - -KPageDialogTest::~KPageDialogTest() -{ -} - -int main( int argc, char **argv ) -{ - KAboutData about("KPageDialogTest", 0, ki18n("KPageDialogTest"), "version"); - KCmdLineArgs::init( argc, argv, &about ); - - KApplication app; - - KPageDialogTest testDialog( 0 ); - testDialog.exec(); - - return 0; -} - -#include "moc_kpagedialogtest.cpp" diff --git a/kdeui/tests/kpagedialogtest.h b/kdeui/tests/kpagedialogtest.h deleted file mode 100644 index a5e9be59..00000000 --- a/kdeui/tests/kpagedialogtest.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - This file is part of the KDE Libraries - - Copyright (C) 2006 Tobias Koenig (tokoe@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KPAGEDIALOGTEST_H -#define KPAGEDIALOGTEST_H - -#include "kpagedialog.h" - -class KPageDialogTest : public KPageDialog -{ - Q_OBJECT - - public: - KPageDialogTest( QWidget *parent = 0 ); - ~KPageDialogTest(); -}; - -#endif diff --git a/kdeui/tests/kpagewidgettest.cpp b/kdeui/tests/kpagewidgettest.cpp deleted file mode 100644 index 86d241f1..00000000 --- a/kdeui/tests/kpagewidgettest.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - This file is part of the KDE Libraries - - Copyright (C) 2006 Tobias Koenig (tokoe@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include -#include -#include -#include - -#include "kpagewidgetmodel.h" - -#include "kpagewidgettest.h" - -KPageWidgetTest::KPageWidgetTest( QWidget *parent ) - : QWidget( parent ) -{ - QGridLayout *layout = new QGridLayout( this ); - - mWidget = new KPageWidget( this ); - layout->addWidget( mWidget, 0, 0, 7, 1 ); - - connect( mWidget, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), - this, SLOT(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)) ); - connect( mWidget, SIGNAL(pageToggled(KPageWidgetItem*,bool)), - this, SLOT(pageToggled(KPageWidgetItem*,bool)) ); - - int rowCount = 0; - QPushButton *button = new QPushButton( "Auto", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(setAutoFace()) ); - rowCount++; - - button = new QPushButton( "Plain", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(setPlainFace()) ); - rowCount++; - - button = new QPushButton( "List", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(setListFace()) ); - rowCount++; - - button = new QPushButton( "Tree", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(setTreeFace()) ); - rowCount++; - - button = new QPushButton( "Tabbed", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(setTabbedFace()) ); - rowCount++; - - button = new QPushButton( "Add Page", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(addPage()) ); - rowCount++; - - button = new QPushButton( "Add Sub Page", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(addSubPage()) ); - rowCount++; - - button = new QPushButton( "Insert Page", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(insertPage()) ); - rowCount++; - - button = new QPushButton( "Delete Page", this ); - layout->addWidget( button, rowCount, 1 ); - connect( button, SIGNAL(clicked()), this, SLOT(deletePage()) ); - rowCount++; - - KPageWidgetItem *item = mWidget->addPage( new QPushButton( "folder" ), "folder" ); - item->setIcon( KIcon( "folder" ) ); - item = mWidget->addSubPage( item, new QPushButton( "subfolder" ), "subfolder" ); - item->setIcon( KIcon( "folder" ) ); - item = mWidget->addPage( new QLabel( "second folder" ), "second folder" ); - item->setIcon( KIcon( "folder" ) ); -} - -KPageWidgetTest::~KPageWidgetTest() -{ -} - -void KPageWidgetTest::setAutoFace() -{ - mWidget->setFaceType( KPageWidget::Auto ); -} - -void KPageWidgetTest::setPlainFace() -{ - mWidget->setFaceType( KPageWidget::Plain ); -} - -void KPageWidgetTest::setListFace() -{ - mWidget->setFaceType( KPageWidget::List ); -} - -void KPageWidgetTest::setTreeFace() -{ - mWidget->setFaceType( KPageWidget::Tree ); -} - -void KPageWidgetTest::setTabbedFace() -{ - mWidget->setFaceType( KPageWidget::Tabbed ); -} - -void KPageWidgetTest::addPage() -{ - static int counter = 0; - - const QString title = QString( "dynamic folder %1" ).arg( QString::number( counter ) ); - KPageWidgetItem *item = mWidget->addPage( new QPushButton( title ) , title ); - item->setIcon( KIcon( "folder" ) ); - item->setHeader( QString( "Header Test No. %1" ).arg( QString::number( counter ) ) ); - item->setCheckable( true ); - - counter++; -} - -void KPageWidgetTest::addSubPage() -{ - static int counter = 0; - - KPageWidgetItem *item = mWidget->currentPage(); - if ( !item ) - return; - - const QString title = QString( "subfolder %1" ).arg( QString::number( counter ) ); - item = mWidget->addSubPage( item, new QLabel( title ) , title ); - item->setIcon( KIcon( "folder" ) ); - - counter++; -} - -void KPageWidgetTest::insertPage() -{ - static int counter = 0; - - KPageWidgetItem *item = mWidget->currentPage(); - if ( !item ) - return; - - const QString title = QString( "before folder %1" ).arg( QString::number( counter ) ); - item = mWidget->insertPage( item, new QLabel( title ) , title ); - item->setIcon( KIcon( "folder" ) ); - - counter++; -} - -void KPageWidgetTest::deletePage() -{ - KPageWidgetItem *item = mWidget->currentPage(); - if ( item ) - mWidget->removePage( item ); -} - -void KPageWidgetTest::currentPageChanged( KPageWidgetItem *current, KPageWidgetItem *before ) -{ - if ( current ) - qDebug( "Current item: %s", qPrintable( current->name() ) ); - else - qDebug( "No current item" ); - - if ( before ) - qDebug( "Item before: %s", qPrintable( before->name() ) ); - else - qDebug( "No item before" ); -} - -void KPageWidgetTest::pageToggled( KPageWidgetItem *item, bool checked ) -{ - qDebug( "Item %s changed check state to: %s", qPrintable( item->name() ), checked ? "checked" : "unchecked" ); -} - -int main( int argc, char **argv ) -{ - KAboutData about("KPageWidgetTest", 0, ki18n("KPageWidgetTest"), "version"); - KCmdLineArgs::init( argc, argv, &about ); - - KApplication app; - - KPageWidgetTest testWidget( 0 ); - testWidget.show(); - - return app.exec(); -} - -#include "moc_kpagewidgettest.cpp" diff --git a/kdeui/tests/kpagewidgettest.h b/kdeui/tests/kpagewidgettest.h deleted file mode 100644 index 529caab8..00000000 --- a/kdeui/tests/kpagewidgettest.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - This file is part of the KDE Libraries - - Copyright (C) 2006 Tobias Koenig (tokoe@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef KPAGEWIDGETTEST_H -#define KPAGEWIDGETTEST_H - -#include - -#include "kpagewidget.h" - -class KPageWidgetTest : public QWidget -{ - Q_OBJECT - - public: - KPageWidgetTest( QWidget *parent = 0 ); - ~KPageWidgetTest(); - - private Q_SLOTS: - void setAutoFace(); - void setPlainFace(); - void setListFace(); - void setTreeFace(); - void setTabbedFace(); - - void addPage(); - void addSubPage(); - void insertPage(); - void deletePage(); - - void currentPageChanged( KPageWidgetItem*, KPageWidgetItem* ); - void pageToggled( KPageWidgetItem*, bool ); - - private: - KPageWidget *mWidget; -}; - -#endif diff --git a/kdeui/tests/kpassivepopuptest.cpp b/kdeui/tests/kpassivepopuptest.cpp deleted file mode 100644 index c5a5a8ea..00000000 --- a/kdeui/tests/kpassivepopuptest.cpp +++ /dev/null @@ -1,88 +0,0 @@ -#include "kpassivepopuptest.h" -#include "moc_kpassivepopuptest.cpp" -#include -#include -#include -#include -#include - -QPushButton *pb; -QPushButton *pb2; -QPushButton *pb3; -QPushButton *pb4; -QPushButton *pb5; -KSystemTrayIcon *icon; - -void Test::showIt() -{ - KPassivePopup::message( "Hello World", pb ); -} - -void Test::showIt2() -{ - KPassivePopup::message( "The caption is...", "Hello World", pb2 ); -} - -void Test::showIt3() -{ - KPassivePopup *pop = new KPassivePopup( pb3->winId() ); - pop->setView( "Caption", "test" ); - pop->show(); -} - -void Test::showIt4() -{ - KPassivePopup::message( KPassivePopup::Boxed, "The caption is...", "Hello World", pb4 ); -} - -void Test::showIt5() -{ - KPassivePopup::message( KPassivePopup::Balloon, "The caption is...", "Hello World", pb5 ); -} - -void Test::showIt6(QSystemTrayIcon::ActivationReason reason) -{ - if (reason == QSystemTrayIcon::Trigger) - KPassivePopup::message( "QSystemTrayIcon test", "Hello World", icon); -} - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - - Test *t = new Test(); - - pb = new QPushButton(); - pb->setText( "By taskbar entry" ); - pb->connect( pb, SIGNAL(clicked()), t, SLOT(showIt()) ); - pb->show(); - - pb2 = new QPushButton(); - pb2->setText( "By taskbar entry (with caption)" ); - pb2->connect( pb2, SIGNAL(clicked()), t, SLOT(showIt2()) ); - pb2->show(); - - pb3 = new QPushButton(); - pb3->setText( "By WinId" ); - pb3->connect( pb3, SIGNAL(clicked()), t, SLOT(showIt3()) ); - pb3->show(); - - pb4 = new QPushButton(); - pb4->setText( "Boxed taskbar entry" ); - pb4->connect( pb4, SIGNAL(clicked()), t, SLOT(showIt4()) ); - pb4->show(); - - pb5 = new QPushButton(); - pb5->setText( "Balloon taskbar entry" ); - pb5->connect( pb5, SIGNAL(clicked()), t, SLOT(showIt5()) ); - pb5->show(); - - icon = new KSystemTrayIcon(); - icon->setIcon(icon->loadIcon("xorg")); - icon->connect( icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), t, SLOT(showIt6(QSystemTrayIcon::ActivationReason)) ); - icon->show(); - - return app.exec(); - -} diff --git a/kdeui/tests/kpassivepopuptest.h b/kdeui/tests/kpassivepopuptest.h deleted file mode 100644 index 3d3fbc8a..00000000 --- a/kdeui/tests/kpassivepopuptest.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef KPASSIVEPOPUPTEST_H -#define KPASSIVEPOPUPTEST_H - -#include -#include - -class Test : public QObject -{ - Q_OBJECT - -public: - Test() : QObject() {} - ~Test() {} - -public Q_SLOTS: - void showIt(); - void showIt2(); - void showIt3(); - void showIt4(); - void showIt5(); - void showIt6(QSystemTrayIcon::ActivationReason); -}; - - -#endif // KPASSIVEPOPUPTEST_H - - diff --git a/kdeui/tests/kpassworddialogtest.cpp b/kdeui/tests/kpassworddialogtest.cpp deleted file mode 100644 index 9918b0c7..00000000 --- a/kdeui/tests/kpassworddialogtest.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2007 Olivier Goffart - - 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 -#include -#include -#include -#include -#include - -int main( int argc, char *argv[] ) -{ - KAboutData about("KNewPasswordDialogTest", 0, ki18n("KNewPasswordDialogTest"), "1"); - KCmdLineArgs::init(argc, argv, &about); - - KApplication a; - - //step 1 simple password - { - KPasswordDialog dlg(0, KPasswordDialog::ShowKeepPassword); - dlg.setPrompt(i18n("This is a long prompt line. It is important it to be long so we can test the dialog does not get broken because of multiline labels. Please enter a password:")); - dlg.addCommentLine(i18n("This is a rather large left comment line") , i18n("Right part of the comment line has to be long too so be test the layouting works really ok. Please visit http://www.kde.org")); - - if( dlg.exec() ) - { - std::cout << "Entered password: " << (const char*)dlg.password().toLatin1() << std::endl; - } - else - { - std::cout << "No password" << std::endl; - return -1; - } - } - - //step 2 readonly username - { - KPasswordDialog dlg(0, KPasswordDialog::ShowUsernameLine | KPasswordDialog::UsernameReadOnly); - dlg.setPrompt(i18n("Enter a password for the test")); - dlg.setUsername("konqui"); - dlg.addCommentLine( i18n("Site") , i18n("http://www.kde.org") ); - - if( dlg.exec() ) - { - std::cout << "Entered password: " << (const char*)dlg.password().toLatin1() << std::endl; - } - else - { - std::cout << "No password" << std::endl; - return -1; - } - } - - - //step 3 with some username preset - { - KPasswordDialog dlg(0, KPasswordDialog::ShowUsernameLine); - dlg.setPrompt(i18n("Enter a password for the test")); - QMap logins; - logins.insert("konqui" , "foo"); - logins.insert("watson" , "bar"); - logins.insert("ogoffart" , ""); - - dlg.setKnownLogins(logins); - - if( dlg.exec() ) - { - std::cout << "Entered password: " << (const char*)dlg.password().toLatin1() << " for username " << (const char*)dlg.username().toAscii() < -#include -#include -#include -#include - -int main(int argc, char**argv) -{ - KCmdLineOptions options; - options.add("+file", ki18n("The image file to open")); - - KCmdLineArgs::init(argc, argv, "test", 0, ki18n("test"), "1.0", ki18n("test")); - KCmdLineArgs::addCmdLineOptions( options ); - KApplication app; - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if (args->count()!=1) - { - std::cout << "Usage: kpixmapregionselectordialogtest " << 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/kpixmapsequenceoverlaypaintertest.cpp b/kdeui/tests/kpixmapsequenceoverlaypaintertest.cpp deleted file mode 100644 index 94596b18..00000000 --- a/kdeui/tests/kpixmapsequenceoverlaypaintertest.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "kpixmapsequenceoverlaypaintertest.h" -#include "kpixmapsequenceoverlaypainter.h" - -#include -#include -#include -#include -#include - -#include -#include -#include - - -Q_DECLARE_METATYPE(Qt::Alignment) - -TestWidget::TestWidget() - : QWidget() -{ - m_draggingLeft = false; - m_draggingRight = false; - m_draggingTop = false; - m_draggingBottom = false; - - QGridLayout* layout = new QGridLayout(this); - m_widget = new QWidget(this); - m_alignment = new QComboBox(this); - m_offsetX = new QSpinBox(this); - m_offsetY = new QSpinBox(this); - - layout->addWidget(m_widget, 0, 0, 1, 2); - layout->addWidget(m_alignment, 1, 0, 1, 2); - layout->addWidget(m_offsetX, 2, 0, 1, 1); - layout->addWidget(m_offsetY, 2, 1, 1, 1); - - m_alignment->addItem("Center", QVariant::fromValue(Qt::Alignment(Qt::AlignCenter))); - m_alignment->addItem("Top-left", QVariant::fromValue(Qt::Alignment(Qt::AlignTop|Qt::AlignLeft))); - m_alignment->addItem("Top", QVariant::fromValue(Qt::Alignment(Qt::AlignTop|Qt::AlignHCenter))); - m_alignment->addItem("Top-right", QVariant::fromValue(Qt::Alignment(Qt::AlignTop|Qt::AlignRight))); - m_alignment->addItem("Right", QVariant::fromValue(Qt::Alignment(Qt::AlignRight|Qt::AlignVCenter))); - m_alignment->addItem("Bottom-right", QVariant::fromValue(Qt::Alignment(Qt::AlignRight|Qt::AlignBottom))); - m_alignment->addItem("Bottom", QVariant::fromValue(Qt::Alignment(Qt::AlignHCenter|Qt::AlignBottom))); - m_alignment->addItem("Bottom-left", QVariant::fromValue(Qt::Alignment(Qt::AlignLeft|Qt::AlignBottom))); - m_alignment->addItem("Left", QVariant::fromValue(Qt::Alignment(Qt::AlignLeft|Qt::AlignVCenter))); - - connect(m_alignment, SIGNAL(activated(int)), this, SLOT(alignementChanged(int))); - connect(m_offsetX, SIGNAL(valueChanged(int)), this, SLOT(offsetChanged())); - connect(m_offsetY, SIGNAL(valueChanged(int)), this, SLOT(offsetChanged())); - - m_painter = new KPixmapSequenceOverlayPainter(this); - m_painter->setWidget(m_widget); - m_painter->start(); -} - - -TestWidget::~TestWidget() -{ -} - - -void TestWidget::alignementChanged(int i) -{ - m_painter->setAlignment(m_alignment->itemData(i).value()); -} - - -void TestWidget::offsetChanged() -{ - m_painter->setOffset(QPoint(m_offsetX->value(), m_offsetY->value())); -} - -bool TestWidget::eventFilter(QObject* o, QEvent* e) -{ - if(o == m_widget) { - if(e->type() == QEvent::Paint) { - - } - else if(e->type() == QEvent::MouseButtonPress) { - - } - else if(e->type() == QEvent::MouseButtonRelease) { - - } - else if(e->type() == QEvent::MouseMove) { - - } - } - return QWidget::eventFilter(o, e); -} - - - -/* --- MAIN -----------------------*/ -int main(int argc, char **argv) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - TestWidget *window; - - KApplication testapp; - window = new TestWidget(); - window->show(); - return testapp.exec(); -} - -#include "moc_kpixmapsequenceoverlaypaintertest.cpp" diff --git a/kdeui/tests/kpixmapsequenceoverlaypaintertest.h b/kdeui/tests/kpixmapsequenceoverlaypaintertest.h deleted file mode 100644 index ed90db3a..00000000 --- a/kdeui/tests/kpixmapsequenceoverlaypaintertest.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _K_PIXMAPSEQUENCE_OVERLAY_PAINTER_TEST_H_ -#define _K_PIXMAPSEQUENCE_OVERLAY_PAINTER_TEST_H_ - -#include - -class KPixmapSequenceOverlayPainter; -#include -#include -#include - -class TestWidget : public QWidget -{ - Q_OBJECT - -public: - TestWidget(); - ~TestWidget(); - - bool eventFilter(QObject*, QEvent*); - -private Q_SLOTS: - void alignementChanged(int); - void offsetChanged(); - -private: - KPixmapSequenceOverlayPainter* m_painter; - - QWidget* m_widget; - QComboBox* m_alignment; - QSpinBox* m_offsetX; - QSpinBox* m_offsetY; - - bool m_draggingLeft; - bool m_draggingRight; - bool m_draggingTop; - bool m_draggingBottom; -}; - -#endif diff --git a/kdeui/tests/kpopuptest.cpp b/kdeui/tests/kpopuptest.cpp deleted file mode 100644 index c920d7b6..00000000 --- a/kdeui/tests/kpopuptest.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "kmenu.h" - -class DemoWidget : public QWidget { -private: - KMenu *menu; - -void mousePressEvent(QMouseEvent *) -{ - menu->popup(QCursor::pos()); -} - -void paintEvent(QPaintEvent *) -{ - QPainter paint(this); - paint.drawText(32, 32, "Press a Mouse Button!"); -} - -public: - DemoWidget() : QWidget() - { - menu = new KMenu("Popup Menu:"); - menu->addAction( "Item1" ); - menu->addAction( "Item2" ); - menu->addSeparator(); - QAction *a = new QAction( "Quit", this ); - menu->addAction( a ); - connect( a, SIGNAL(triggered()), qApp, SLOT(quit())); - } -}; - -int main(int argc, char **argv) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - DemoWidget w; - w.setFont(QFont("helvetica", 12, QFont::Bold)); - w.show(); - return app.exec(); -} - diff --git a/kdeui/tests/kprogressdialogtest.cpp b/kdeui/tests/kprogressdialogtest.cpp deleted file mode 100644 index de14d5e0..00000000 --- a/kdeui/tests/kprogressdialogtest.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include -#include -#include - -#include -#include - -#include "kprogressdialog.h" - -class MyWidget : public QWidget { -public: - MyWidget() : QWidget() - { - setFixedSize(200, 80); - Cancelled = new QCheckBox("Cancelled", this); - Progress = new KProgressDialog(this); - startTimer(50); - Progress->setLabelText("label text"); - Progress->setAllowCancel(false); - Progress->showCancelButton(true); - Progress->setButtonText("button text"); - Progress->setAutoClose(false); - steps = 300; - Progress->progressBar()->setRange(0, steps); - - } - -private: - KProgressDialog *Progress; - QCheckBox *Cancelled; - - int steps; - - void timerEvent(QTimerEvent *); -}; - -void MyWidget::timerEvent(QTimerEvent *) -{ - Progress->progressBar()->setValue(Progress->progressBar()->value()+1); - Cancelled->setCheckState(Progress->wasCancelled() ? Qt::Checked : Qt::Unchecked); -} - -int main(int argc, char *argv[]) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - MyWidget w; - - w.show(); - - int ret = app.exec(); - return ret; -} diff --git a/kdeui/tests/krulertest.cpp b/kdeui/tests/krulertest.cpp deleted file mode 100644 index 206955d9..00000000 --- a/kdeui/tests/krulertest.cpp +++ /dev/null @@ -1,391 +0,0 @@ -#include - -#include "krulertest.h" - -#include "kruler.h" - -#include -#include -#include -#include -#include - -/* -void -MyCheckBox::mouseReleaseEvent(QMouseEvent *e ) -{ - QButton::mouseReleaseEvent(e); - if (); -} -*/ - -MouseWidget::MouseWidget( QWidget *parent ) - : QFrame(parent) -{ -} - -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() - : KMainWindow(0) -{ - mainframe = new QFrame(this); - - layout = new QGridLayout(mainframe); - - 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(Qt::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(Qt::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); - beginMark->setSliderEnabled(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); - endMark->setSliderEnabled(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); - lengthInput->setSliderEnabled(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(vertrot); - transX->setValue(0.0); - 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(vertrot); - transY->setValue(-12.0); - 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(vertrot); - rotV->setValue(90.0); - 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 QGroupBox("metric styles", bigwidget); - - QButtonGroup* metricstyleButtons = new QButtonGroup(bigwidget); - - metricstyle->setFixedSize(100, 120); - metricstyle->move(330-110,4); - pixelmetric = new QRadioButton("pixel", metricstyle); - pixelmetric->adjustSize(); - pixelmetric->move(5,15); - metricstyleButtons->addButton(pixelmetric, (int)KRuler::Pixel); - inchmetric = new QRadioButton("inch", metricstyle); - inchmetric->adjustSize(); - inchmetric->move(5,35); - metricstyleButtons->addButton(inchmetric, (int)KRuler::Inch); - mmmetric = new QRadioButton("millimeter", metricstyle); - mmmetric->adjustSize(); - mmmetric->move(5,55); - metricstyleButtons->addButton(mmmetric, (int)KRuler::Millimetres); - cmmetric = new QRadioButton("centimeter", metricstyle); - cmmetric->adjustSize(); - cmmetric->move(5,75); - metricstyleButtons->addButton(cmmetric, (int)KRuler::Centimetres); - mmetric = new QRadioButton("meter", metricstyle); - mmetric->adjustSize(); - mmetric->move(5,95); - metricstyleButtons->addButton(mmetric, (int)KRuler::Metres); - connect ( metricstyleButtons, SIGNAL(buttonClicked(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->setMaximum(width); -} - -void -KRulerTest::slotNewHeight(int height) -{ - vruler->setMaximum(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) -{ - Q_UNUSED(fixlen); - beginMark->setValue(hruler->offset()); - endMark->setValue(hruler->endOffset()); - lengthInput->setValue(hruler->length()); -} - -void -KRulerTest::slotSetRotate(double d) -{ - Q_UNUSED(d); -#ifdef KRULER_ROTATE_TEST - vruler->rotate = d; - vruler->update(); - //debug("rotate %.1f", d); -#endif -} - -void -KRulerTest::slotSetXTrans(double d) -{ - Q_UNUSED(d); -#ifdef KRULER_ROTATE_TEST - vruler->xtrans = d; - vruler->update(); - //debug("trans x %.1f", d); -#endif -} - -void -KRulerTest::slotSetYTrans(double d) -{ - Q_UNUSED(d); -#ifdef KRULER_ROTATE_TEST - vruler->ytrans = d; - vruler->update(); - //debug("trans y %.1f", d); -#endif -} - - -/* --- MAIN -----------------------*/ -int main(int argc, char **argv) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication *testapp; - KRulerTest *window; - - testapp = new KApplication; - testapp->setFont(QFont("Helvetica",12)); - - window = new KRulerTest(); - window->setCaption("KRulerTest"); - window->show(); - return testapp->exec(); -} - -#include "moc_krulertest.cpp" - diff --git a/kdeui/tests/krulertest.h b/kdeui/tests/krulertest.h deleted file mode 100644 index c9a130a6..00000000 --- a/kdeui/tests/krulertest.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ - -#ifndef KRULERTEST_H -#define KRULERTEST_H - -#include -#include -#include - -#include -#include -#include - -class KRuler; -#include -#include -#include -#include -#include - -class MouseWidget : public QFrame -{ -Q_OBJECT -public: -MouseWidget( QWidget *parent=0 ); - -Q_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(); -~KRulerTest(); - -private Q_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, *mainframe; - - QLabel *mouse_message; - QGroupBox *showMarks, *lineEdit, *vertrot; - QCheckBox *showTM, *showLM, *showMM, *showBM, *showEM, *showPT, *fixLen; - KIntNumInput *beginMark, *endMark, *lengthInput; - KDoubleNumInput *transX, *transY, *rotV; - QGroupBox *metricstyle; - QRadioButton *pixelmetric, *inchmetric, *mmmetric, *cmmetric, *mmetric; - -}; -#endif - diff --git a/kdeui/tests/kselectactiontest.cpp b/kdeui/tests/kselectactiontest.cpp deleted file mode 100644 index 3b8d0b9a..00000000 --- a/kdeui/tests/kselectactiontest.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright 2006 Hamish Rodda - Copyright 2006 Simon Hausmann - - 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 -#include - -#include -#include -#include - -#include "kselectactiontest.h" - -#include -#include - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "kselectactiontest", 0, ki18n("KSelectActionTest"), "1.0", ki18n("kselectaction test app")); - KApplication app; - - SelectActionTest* test = new SelectActionTest; - test->show(); - - return app.exec(); -} - -SelectActionTest::SelectActionTest(QWidget *parent) - : KXmlGuiWindow(parent) - , m_comboSelect(new KSelectAction("Combo Selection", this)) - , m_buttonSelect(new KSelectAction("Button Selection", this)) -{ - actionCollection()->addAction("combo", m_comboSelect); - actionCollection()->addAction("button", m_buttonSelect); - for (int i = 0; i < 7; ++i) { - QAction* action = m_comboSelect->addAction(QString ("Combo Action %1").arg(i)); - connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered(bool))); - action = m_buttonSelect->addAction(QString ("Action %1").arg(i)); - connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered(bool))); - } - - m_comboSelect->setToolBarMode(KSelectAction::ComboBoxMode); - m_comboSelect->setWhatsThis("What's this?"); - connect(m_comboSelect, SIGNAL(triggered(QAction*)), SLOT(triggered(QAction*))); - connect(m_comboSelect, SIGNAL(triggered(int)), SLOT(triggered(int))); - connect(m_comboSelect, SIGNAL(triggered(QString)), SLOT(triggered(QString))); - - m_buttonSelect->setToolBarMode(KSelectAction::MenuMode); - m_buttonSelect->setWhatsThis("What's this?"); - connect(m_buttonSelect, SIGNAL(triggered(QAction*)), SLOT(triggered(QAction*))); - connect(m_buttonSelect, SIGNAL(triggered(int)), SLOT(triggered(int))); - connect(m_buttonSelect, SIGNAL(triggered(QString)), SLOT(triggered(QString))); - - menuBar()->addAction(m_comboSelect); - menuBar()->addAction(m_buttonSelect); - menuBar()->addAction("Add an action", this, SLOT(addAction())); - menuBar()->addAction("Remove an action", this, SLOT(removeAction())); - - QToolBar* toolBar = addToolBar("Test"); - toolBar->addAction(m_comboSelect); - toolBar->addAction(m_buttonSelect); -} - -void SelectActionTest::triggered(QAction* action) -{ - kDebug() << action; -} - -void SelectActionTest::triggered(int index) -{ - kDebug() << index; -} - -void SelectActionTest::triggered(const QString& text) -{ - kDebug() << '"' << text << '"'; -} - -void SelectActionTest::addAction() -{ - QAction* action = m_comboSelect->addAction(QString ("Combo Action %1").arg(m_comboSelect->actions().count())); - connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered(bool))); - action = m_buttonSelect->addAction(QString ("Action %1").arg(m_buttonSelect->actions().count())); - connect(action, SIGNAL(triggered(bool)), SLOT(slotActionTriggered(bool))); -} - -void SelectActionTest::removeAction() -{ - if (!m_comboSelect->actions().isEmpty()) - m_comboSelect->removeAction(m_comboSelect->actions().last()); - - if (!m_buttonSelect->actions().isEmpty()) - m_buttonSelect->removeAction(m_buttonSelect->actions().last()); -} - -void SelectActionTest::slotActionTriggered(bool state) -{ - kDebug() << sender() << " state " << state; -} - -#include "moc_kselectactiontest.cpp" - diff --git a/kdeui/tests/kselectactiontest.h b/kdeui/tests/kselectactiontest.h deleted file mode 100644 index 451ce8e2..00000000 --- a/kdeui/tests/kselectactiontest.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright 2006 Hamish Rodda - - 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. -*/ - -#ifndef KSELECTACTION_TEST_H -#define KSELECTACTION_TEST_H - -#include - -class KSelectAction; - -class SelectActionTest : public KXmlGuiWindow -{ - Q_OBJECT - -public: - SelectActionTest(QWidget* parent = 0); - -public Q_SLOTS: - void triggered(QAction* action); - void triggered(int index); - void triggered(const QString& text); - - void slotActionTriggered(bool state); - - void addAction(); - void removeAction(); - -private: - KSelectAction* m_comboSelect; - KSelectAction* m_buttonSelect; -}; - -#endif diff --git a/kdeui/tests/kseparatortest.cpp b/kdeui/tests/kseparatortest.cpp deleted file mode 100644 index 2008ac73..00000000 --- a/kdeui/tests/kseparatortest.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 1997 Michael Roth - * - * 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 -#include -#include -#include - -#include "kseparator.h" - - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - QWidget toplevel; - QBoxLayout *mainbox = new QBoxLayout(QBoxLayout::TopToBottom,&toplevel); - mainbox->setMargin(10); - - KSeparator *sep1 = new KSeparator( Qt::Vertical, &toplevel ); - mainbox->addWidget(sep1); - - KSeparator *sep2 = new KSeparator( Qt::Horizontal, &toplevel ); - mainbox->addWidget(sep2); - mainbox->activate(); - - toplevel.show(); - return app.exec(); -} - - - - diff --git a/kdeui/tests/ksqueezedtextlabeltest.cpp b/kdeui/tests/ksqueezedtextlabeltest.cpp deleted file mode 100644 index 386d6915..00000000 --- a/kdeui/tests/ksqueezedtextlabeltest.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "ksqueezedtextlabel.h" -#include -#include -#include - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init(argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - - KVBox* box = new KVBox(); - KSqueezedTextLabel *l = new KSqueezedTextLabel( "This is a rather long string", box); - Q_UNUSED(*l); - l = new KSqueezedTextLabel( "This is another long string, selectable by mouse", box ); - l->setTextElideMode( Qt::ElideRight ); - l->setTextInteractionFlags(Qt::TextSelectableByMouse); - KSqueezedTextLabel* urlLabel = new KSqueezedTextLabel("http://www.example.com/this/url/is/selectable/by/mouse", box); - urlLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); - - new QLabel("This is a normal QLabel", box); - QLabel* selectableLabel = new QLabel("This is a normal QLabel, selectable by mouse", box); - selectableLabel->setTextInteractionFlags(Qt::TextSelectableByMouse); - - box->show(); - - return app.exec(); -} diff --git a/kdeui/tests/kstatusbartest.cpp b/kdeui/tests/kstatusbartest.cpp deleted file mode 100644 index 1953c075..00000000 --- a/kdeui/tests/kstatusbartest.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -#include "kstatusbar.h" -#include -#include -#include -#include "kstatusbartest.h" - -testWindow::testWindow (QWidget *) - : KXmlGuiWindow (0) - { - // Setup Menus - menuBar = new QMenuBar (this); - fileMenu = new QMenu; - menuBar->addAction ( "&File" ); - QAction *action = fileMenu->addAction("&Exit"); - action->setShortcut( Qt::ALT + Qt::Key_Q ); - - connect( action, SIGNAL(triggered()), KApplication::kApplication(), SLOT(quit()) ); - - 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 QTextEdit (this); - - setCentralWidget(widget); - - setCaption( KGlobal::caption() ); - - smenu = new QMenu; - - smenu->addAction("50%"); - smenu->addAction("75%"); - smenu->addAction("100%"); - smenu->addAction("150%"); - smenu->addAction("200%"); - smenu->addAction("400%"); - smenu->addAction("oo%"); - - connect (smenu, SIGNAL(triggered(QAction*)), this, SLOT(slotMenu(QAction*))); -} - -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:"); - 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(QAction *action) -{ - QString s = "Zoom: "; - s.append (action->text()); - statusbar->changeItem(s,0); -} - -testWindow::~testWindow () -{ - // I would delete toolbars here, but there are none - delete statusbar; -} - -int main( int argc, char *argv[] ) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication *myApp = new KApplication; - testWindow *test = new testWindow; - - 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 "moc_kstatusbartest.cpp" - diff --git a/kdeui/tests/kstatusbartest.h b/kdeui/tests/kstatusbartest.h deleted file mode 100644 index ca08876c..00000000 --- a/kdeui/tests/kstatusbartest.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef TEST_KSTATUSBAR_H -#define TEST_KSTATUSBAR_H - -#include -#include -#include - -#include - -class testWindow : public KXmlGuiWindow -{ - Q_OBJECT - -public: - testWindow (QWidget *parent=0); - ~testWindow (); - -public Q_SLOTS: - void slotPress(int i); - void slotClick(int i); - void slotMenu(QAction*); - -protected: - QMenu *fileMenu; - QMenu *smenu; - QMenuBar *menuBar; - KStatusBar *statusbar; - bool insert; - QTextEdit *widget; -}; -#endif diff --git a/kdeui/tests/kstatusnotifieritemtest.cpp b/kdeui/tests/kstatusnotifieritemtest.cpp deleted file mode 100644 index dd5f4789..00000000 --- a/kdeui/tests/kstatusnotifieritemtest.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* This file is part of the KDE libraries - Copyright 2009 by Marco Martin - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License (LGPL) 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 "kstatusnotifieritemtest.h" - -#include "notifications/kstatusnotifieritem.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -KStatusNotifierItemTest::KStatusNotifierItemTest(QObject *parent, KStatusNotifierItem *tray) - : QObject(parent) -{ - KMenu *menu = tray->contextMenu(); - m_tray = tray; - - QAction *needsAttention = new QAction("Set needs attention", menu); - QAction *active = new QAction("Set active", menu); - QAction *passive = new QAction("Set passive", menu); - - menu->addAction(needsAttention); - menu->addAction(active); - menu->addAction(passive); - - connect(needsAttention, SIGNAL(triggered()), this, SLOT(setNeedsAttention())); - connect(active, SIGNAL(triggered()), this, SLOT(setActive())); - connect(passive, SIGNAL(triggered()), this, SLOT(setPassive())); -} - -void KStatusNotifierItemTest::setNeedsAttention() -{ - kDebug()<<"Asking for attention"; - m_tray->showMessage("message test", "Test of the new systemtray notifications wrapper", "konqueror", 3000); - m_tray->setStatus(KStatusNotifierItem::NeedsAttention); -} - -void KStatusNotifierItemTest::setActive() -{ - kDebug()<<"Systray icon in active state"; - m_tray->setStatus(KStatusNotifierItem::Active); -} - -void KStatusNotifierItemTest::setPassive() -{ - kDebug()<<"Systray icon in passive state"; - m_tray->setStatus(KStatusNotifierItem::Passive); -} - -int main(int argc, char **argv) -{ - KAboutData aboutData( "kstatusnotifieritemtest", 0 , ki18n("KStatusNotifierItemtest"), "1.0" ); - KCmdLineArgs::init(argc, argv, &aboutData); - KCmdLineOptions options; - options.add("active-icon ", ki18n("Name of active icon"), "konqueror"); - options.add("ksni-count ", ki18n("How many instances of KStatusNotifierItem to create"), "1"); - KCmdLineArgs::addCmdLineOptions(options); - - KApplication app; - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - QLabel *l = new QLabel("System Tray Main Window", 0L); - - int ksniCount = args->getOption("ksni-count").toInt(); - for (int x=0; x < ksniCount; ++x) { - KStatusNotifierItem *tray = new KStatusNotifierItem(l); - - new KStatusNotifierItemTest(0, tray); - - tray->setTitle("DBus System tray test"); - tray->setIconByName(args->getOption("active-icon")); - //tray->setImage(KIcon("konqueror")); - //tray->setAttentionIconByName("kmail"); - tray->setOverlayIconByName("emblem-important"); - - tray->setToolTipIconByName("konqueror"); - tray->setToolTipTitle("DBus System tray test"); - tray->setToolTipSubTitle("This is a test of the new systemtray specification"); - - tray->setToolTip("konqueror", QString("DBus System tray test #%1").arg(x + 1), "This is a test of the new systemtray specification"); - - tray->showMessage("message test", "Test of the new systemtray notifications wrapper", "konqueror", 3000); - //tray->setStandardActionsEnabled(false); - } - - return app.exec(); -} - -#include "moc_kstatusnotifieritemtest.cpp" diff --git a/kdeui/tests/kstatusnotifieritemtest.h b/kdeui/tests/kstatusnotifieritemtest.h deleted file mode 100644 index 38a1e1a1..00000000 --- a/kdeui/tests/kstatusnotifieritemtest.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of the KDE libraries - Copyright 2009 by Marco Martin - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License (LGPL) 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. -*/ - -#ifndef KSTATUSNOTIFIERITEMTEST_H -#define KSTATUSNOTIFIERITEMTEST_H - -#include - -class KStatusNotifierItem; - -class KStatusNotifierItemTest : public QObject -{ - Q_OBJECT - -public: - KStatusNotifierItemTest(QObject *parent, KStatusNotifierItem *tray); - //~KStatusNotifierItemTest(); - -public Q_SLOTS: - void setNeedsAttention(); - void setActive(); - void setPassive(); -private: - KStatusNotifierItem *m_tray; -}; - -#endif diff --git a/kdeui/tests/ksystemtraytest.cpp b/kdeui/tests/ksystemtraytest.cpp deleted file mode 100644 index 0a59faf2..00000000 --- a/kdeui/tests/ksystemtraytest.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - KAboutData aboutData( "ksystemtraytest", 0 , ki18n("ksystemtraytest"), "1.0" ); - KCmdLineArgs::init(argc, argv, &aboutData); - KApplication app; - QLabel *l = new QLabel("System Tray Main Window", 0L); - KSystemTrayIcon *tray = new KSystemTrayIcon( "test", l ); - l->show(); - tray->show(); - - return app.exec(); -} diff --git a/kdeui/tests/ktabwidgettest.cpp b/kdeui/tests/ktabwidgettest.cpp deleted file mode 100644 index 6b6d6253..00000000 --- a/kdeui/tests/ktabwidgettest.cpp +++ /dev/null @@ -1,395 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "ktabwidgettest.h" - -Test::Test( QWidget* parent ) - :KVBox( parent ), mLeftWidget(0), mRightWidget(0), - mLeftPopup(0), mRightPopup(0), mTabbarContextPopup(0), mContextPopup(0) - -{ - resize( 600,300 ); - - mWidget = new KTabWidget( this ); - mWidget->addTab( new QLabel( "Testlabel 1", 0 ), "&One" ); - mWidget->addTab( new QLabel( "Testlabel 2", 0 ), "Two" ); - mWidget->addTab( new QWidget(), SmallIcon( "konsole" ), "Three" ); - mWidget->addTab( new QWidget(), "Four" ); - mWidget->setTabTextColor( 0, Qt::red ); - mWidget->setTabTextColor( 1, Qt::blue ); - mWidget->setUsesScrollButtons( false ); // corresponding checkbox is unchecked by default - - connect( mWidget, SIGNAL(currentChanged(QWidget*)), SLOT(currentChanged(QWidget*)) ); - connect( mWidget, SIGNAL(contextMenu(QWidget*,QPoint)), SLOT(contextMenu(QWidget*,QPoint))); - connect( mWidget, SIGNAL(contextMenu(QPoint)), SLOT(tabbarContextMenu(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->setMovable( true ); - - QWidget * grid = new QWidget(this); - QGridLayout * gridlayout = new QGridLayout( grid ); - - 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)) ); - - QCheckBox * elideText = new QCheckBox( "Elide text", grid ); - gridlayout->addWidget( elideText, 5, 0 ); - connect( elideText, SIGNAL(toggled(bool)), this, SLOT(toggleEliding(bool)) ); - - QCheckBox * scrollButtons = new QCheckBox( "Enable scroll buttons", grid ); - gridlayout->addWidget( scrollButtons, 5, 1 ); - connect( scrollButtons, SIGNAL(toggled(bool)), this, SLOT(toggleScrollButtons(bool)) ); -} - -void Test::currentChanged(QWidget* w) -{ - mWidget->setTabTextColor( mWidget->indexOf(w), Qt::black ); -} - -void Test::addTab() -{ - mWidget->addTab( new QWidget(), SmallIcon( "konsole" ), QString("This is tab %1").arg( mWidget->count()+1 ) ); -} - -void Test::testCanDecode(const QDragMoveEvent *e, bool &accept /* result */) -{ - if ( e->mimeData()->hasText() ) // don't accept=false if it cannot be decoded! - accept = true; -} - -void Test::receivedDropEvent( QDropEvent *e ) -{ - if (e->mimeData()->hasText()) { - mWidget->addTab( new QWidget(), e->mimeData()->text() ); - } -} - -void Test::receivedDropEvent( QWidget *w, QDropEvent *e ) -{ - if (e->mimeData()->hasText()) { - mWidget->setTabText( mWidget->indexOf( w ), e->mimeData()->text() ); - } -} - -void Test::initiateDrag( QWidget *w ) -{ - QDrag *drag = new QDrag( this ); - QMimeData *mimeData = new QMimeData; - mimeData->setText(mWidget->tabText( mWidget->indexOf(w))); - drag->setMimeData(mimeData); - drag->start(); // do NOT delete d. -} - -void Test::removeCurrentTab() -{ - if ( mWidget->count()==1 ) return; - - mWidget->removeTab( mWidget->currentIndex() ); -} - -void Test::toggleLeftButton(bool state) -{ - if (state) { - if (!mLeftWidget) { - mLeftWidget = new QToolButton( mWidget ); - connect( mLeftWidget, SIGNAL(clicked()), SLOT(addTab()) ); - mLeftWidget->setIcon( SmallIcon( "tab-new" ) ); - mLeftWidget->setText("New"); - mLeftWidget->setToolTip("New"); - mLeftWidget->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - mLeftWidget->adjustSize(); - //mLeftWidget->setGeometry( 0, 0, h, h ); - mLeftWidget->setMenu(mLeftPopup); - mWidget->setCornerWidget( mLeftWidget, Qt::TopLeftCorner ); - } - mLeftWidget->show(); - } - else - mLeftWidget->hide(); -} - -void Test::toggleLeftPopup(bool state) -{ - if (state) { - if (!mLeftPopup) { - mLeftPopup = new QMenu(this); - mLeftPopup->addAction(SmallIcon( "tab-new" ), "Empty Tab"); - mLeftPopup->addAction(SmallIcon( "tab-new" ), "Empty Tab After First"); - mLeftPopup->addSeparator(); - mLeftPopup->addAction(SmallIcon( "tab-new" ), "Button Tab"); - mLeftPopup->addAction(SmallIcon( "tab-new" ), "Label Tab"); - connect(mLeftPopup, SIGNAL(triggered(QAction*)), SLOT(leftPopupActivated(QAction*))); - } - mLeftWidget->setMenu(mLeftPopup); - } - else - mLeftWidget->setMenu(0); -} - -void Test::leftPopupActivated(QAction *action) -{ - switch (mLeftPopup->actions().indexOf(action)){ - case 0: mWidget->addTab( new QWidget(), QString("Tab %1").arg( mWidget->count()+1 ) ); - break; - case 1: mWidget->insertTab( 1, new QWidget(), QString("Tab %1").arg( mWidget->count()+1 ) ); - break; - case 3: mWidget->addTab( new QPushButton( "Testbutton" ), QString("Tab %1").arg( mWidget->count()+1 ) ); - break; - case 4: mWidget->addTab( new QLabel( "Testlabel" ), QString("Tab %1").arg( mWidget->count()+1 ) ); - break; - } -} - -void Test::toggleRightButton(bool state) -{ -if (state) { - if ( !mRightWidget) { - mRightWidget = new QToolButton( mWidget ); - QObject::connect( mRightWidget, SIGNAL(clicked()), SLOT(removeCurrentTab()) ); - mRightWidget->setIcon( SmallIcon( "tab-close" ) ); - mRightWidget->setText("Close"); - mRightWidget->setToolTip("Close"); - mRightWidget->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - mRightWidget->adjustSize(); - //mRightButton->setGeometry( 0, 0, h, h ); - mRightWidget->setMenu(mRightPopup); - mWidget->setCornerWidget( mRightWidget, Qt::TopRightCorner ); - } - mRightWidget->show(); - } - else - mRightWidget->hide(); -} - -void Test::toggleRightPopup(bool state) -{ - if (state) { - if (!mRightPopup) { - mRightPopup = new QMenu(this); - mRightPopup->addAction(SmallIcon( "tab-close" ), "Current Tab"); - mRightPopup->addSeparator(); - mRightPopup->addAction(SmallIcon( "tab-close" ), "Most Left Tab"); - mRightPopup->addAction(SmallIcon( "tab-close" ), "Most Right Tab"); - connect(mRightPopup, SIGNAL(triggered(QAction*)), SLOT(rightPopupActivated(QAction*))); - } - mRightWidget->setMenu(mRightPopup); - } - else - mRightWidget->setMenu(0); -} - -void Test::rightPopupActivated(QAction *action) -{ - switch (mRightPopup->actions().indexOf(action)) { - case 0: removeCurrentTab(); - break; - case 2: if ( mWidget->count() >1) { - mWidget->removeTab( 0 ); - } - break; - case 3: int count = mWidget->count(); - if (count>1) { - mWidget->removeTab( count-1 ); - } - break; - } -} - -void Test::toggleTabPosition(bool state) -{ - mWidget->setTabPosition(state ? QTabWidget::South : QTabWidget::North ); -} - -void Test::toggleTabShape(bool state) -{ - mWidget->setTabShape(state ? QTabWidget::Triangular : QTabWidget::Rounded); -} - -void Test::toggleCloseButtons(bool state) -{ - mWidget->setTabsClosable( state ); -} - -void Test::contextMenu(QWidget *w, const QPoint &p) -{ - delete mContextPopup; - - int idx = mWidget->indexOf( w ); - mContextPopup = new QMenu(this); - mContextPopup->addAction( "Activate Tab"); - mContextPopup->addSeparator(); - mContextPopup->addAction(SmallIcon( "konsole" ), "Set This Icon"); - mContextPopup->addAction(SmallIcon( "konqueror" ), "Set This Icon"); - mContextPopup->addSeparator(); - mContextPopup->addAction( mWidget->isTabEnabled(idx) ? "Disable Tab" : "Enable Tab"); - mContextPopup->addAction( mWidget->tabToolTip(idx).isEmpty() ? "Set Tooltip" : "Remove Tooltip"); - connect(mContextPopup, SIGNAL(triggered(QAction*)), SLOT(contextMenuActivated(QAction*))); - - mContextWidgetIndex = mWidget->indexOf( w ); - mContextPopup->popup(p); -} - -void Test::contextMenuActivated(QAction *action) -{ - switch (mContextPopup->actions().indexOf(action)) { - case 0: - mWidget->setCurrentIndex( mContextWidgetIndex ); - break; - case 2: - mWidget->setTabIcon( mContextWidgetIndex, SmallIcon( "konsole" ) ); - break; - case 3: - mWidget->setTabIcon( mContextWidgetIndex, SmallIcon( "konqueror" ) ); - break; - case 4: - mWidget->setTabEnabled( mContextWidgetIndex, !(mWidget->isTabEnabled(mContextWidgetIndex)) ); - break; - case 5: - if ( mWidget->tabToolTip(mContextWidgetIndex).isEmpty() ) - mWidget->setTabToolTip( mContextWidgetIndex, "This is a tool tip."); - else - mWidget->setTabToolTip( mContextWidgetIndex, QString() ); - break; - } -} - -void Test::tabbarContextMenu(const QPoint &p) -{ - delete mTabbarContextPopup; - - mTabbarContextPopup = new QMenu(this); - mTabbarContextPopup->addAction(SmallIcon( "tab-new" ), mLeftWidget->isVisible() ? "Hide \"Add\" Button" : "Show \"Add\" Button"); - mTabbarContextPopup->addAction(SmallIcon( "tab-close" ), mRightWidget->isVisible() ? "Hide \"Remove\" Button" : "Show \"Remove\" Button"); - mTabbarContextPopup->addSeparator(); - mTabbarContextPopup->addAction(mWidget->tabPosition()==QTabWidget::North ? "Put Tabbar to Bottom" : "Put Tabbar to Top"); - connect(mTabbarContextPopup, SIGNAL(triggered(QAction*)), SLOT(tabbarContextMenuActivated(QAction*))); - - mTabbarContextPopup->popup(p); -} - -void Test::tabbarContextMenuActivated(QAction *action) -{ - switch (mTabbarContextPopup->actions().indexOf(action)) { - case 0: mLeftButton->toggle(); - break; - case 1: mRightButton->toggle(); - break; - case 3: mTabsBottom->toggle(); - break; - } -} - -void Test::mouseDoubleClick(QWidget *w) -{ - int index = mWidget->indexOf( w ); - bool ok; - QString text = KInputDialog::getText( - "Rename Tab", "Enter new name:", - mWidget->tabText( index ), &ok, this ); - if ( ok && !text.isEmpty() ) { - mWidget->setTabText( index, text ); - mWidget->setTabTextColor( index, Qt::green ); - } -} - -void Test::mouseMiddleClick(QWidget *w) -{ - if ( mWidget->count()==1 ) return; - - mWidget->removeTab( mWidget->indexOf( w ) ); -} - -void Test::movedTab(int from, int to) -{ - kDebug() << "Moved tab from index " << from << " to " << to; -} - -void Test::toggleLabels(bool state) -{ - mLeftWidget->setToolButtonStyle(state?Qt::ToolButtonTextUnderIcon:Qt::ToolButtonIconOnly); - mLeftWidget->adjustSize(); - mRightWidget->setToolButtonStyle(state?Qt::ToolButtonTextUnderIcon:Qt::ToolButtonIconOnly); - mRightWidget->adjustSize(); - mWidget->hide(); // trigger update - mWidget->show(); -} - -void Test::toggleScrollButtons(bool state) -{ - mWidget->setUsesScrollButtons(state); -} - -void Test::toggleEliding(bool state) -{ - mWidget->setAutomaticResizeTabs(state); - //mWidget->setElideMode(state ? Qt::ElideRight : Qt::ElideNone); -} - - -int main(int argc, char** argv ) -{ - KCmdLineArgs::init(argc, argv, "ktabwidgettest", 0, ki18n("KTabWidgetTest"), "1.0", ki18n("ktabwidget test app")); - //KApplication::disableAutoDcopRegistration(); - KApplication app; - Test *t = new Test(); - t->show(); - app.exec(); -} - -#include "moc_ktabwidgettest.cpp" diff --git a/kdeui/tests/ktabwidgettest.h b/kdeui/tests/ktabwidgettest.h deleted file mode 100644 index dd875ba8..00000000 --- a/kdeui/tests/ktabwidgettest.h +++ /dev/null @@ -1,69 +0,0 @@ -#ifndef KTABWIDGETTEST_H -#define KTABWIDGETTEST_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class Test : public KVBox -{ - Q_OBJECT -public: - Test( QWidget* parent=0 ); - -private Q_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 toggleScrollButtons(bool); - void toggleEliding(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(QAction*); - void rightPopupActivated(QAction*); - void contextMenuActivated(QAction*); - void tabbarContextMenuActivated(QAction*); - -private: - KTabWidget* mWidget; - - QCheckBox * mLeftButton; - QCheckBox * mRightButton; - QCheckBox * mTabsBottom; - - QToolButton* mLeftWidget; - QToolButton* mRightWidget; - - QMenu* mLeftPopup; - QMenu* mRightPopup; - QMenu* mTabbarContextPopup; - QMenu* mContextPopup; - int mContextWidgetIndex; -}; - - -#endif diff --git a/kdeui/tests/ktextedittest.cpp b/kdeui/tests/ktextedittest.cpp deleted file mode 100644 index 13b82562..00000000 --- a/kdeui/tests/ktextedittest.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2002 Carsten Pfeiffer - - 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 -#include -#include - -#include -#include - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "ktextedittest", 0, ki18n("KTextEditTest"), "1.0", ki18n("ktextedit test app")); - KApplication app; - KTextEdit *edit = new KTextEdit(); - - //QAction* action = new QAction("Select All", edit); - //action->setShortcut( Qt::CTRL | Qt::Key_Underscore ); - //edit->addAction(action); - //QObject::connect(action, SIGNAL(triggered()), edit, SLOT(selectAll())); - - QFile file(KDESRCDIR "/ktextedittest.cpp"); - if ( file.open( QIODevice::ReadOnly ) ) - { - edit->setPlainText( file.readAll() ); - file.close(); - } - - edit->resize( 600, 600 ); - edit->show(); - return app.exec(); -} diff --git a/kdeui/tests/ktitlewidgettest.cpp b/kdeui/tests/ktitlewidgettest.cpp deleted file mode 100644 index 0e7bf14c..00000000 --- a/kdeui/tests/ktitlewidgettest.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2007 Urs Wolfer - - 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 -#include -#include -#include - -#include -#include -#include -#include - -class KTitleWidgetTestWidget : public QWidget -{ -public: - KTitleWidgetTestWidget(QWidget *parent = 0) - : QWidget(parent) - { - QVBoxLayout *mainLayout = new QVBoxLayout(this); - - KTitleWidget *titleWidget = new KTitleWidget(this); - titleWidget->setText("Title"); - titleWidget->setPixmap(KIcon("screen").pixmap(22, 22), KTitleWidget::ImageLeft); - - mainLayout->addWidget(titleWidget); - - KTitleWidget *errorTitle = new KTitleWidget(this); - errorTitle->setText("Title"); - errorTitle->setComment("Error Comment", KTitleWidget::ErrorMessage); - - mainLayout->addWidget(errorTitle); - - KTitleWidget *checkboxTitleWidget = new KTitleWidget(this); - - QWidget *checkBoxTitleMainWidget = new QWidget(this); - QVBoxLayout *titleLayout = new QVBoxLayout(checkBoxTitleMainWidget); - titleLayout->setMargin(6); - - QCheckBox *checkBox = new QCheckBox("Text Checkbox", checkBoxTitleMainWidget); - titleLayout->addWidget(checkBox); - checkboxTitleWidget->setWidget(checkBoxTitleMainWidget); - - mainLayout->addWidget(checkboxTitleWidget); - - QLabel *otherLabel = new QLabel("Some text...", this); - - mainLayout->addWidget(otherLabel); - - mainLayout->addStretch(); - } -}; - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc, argv, "ktitlewidgettest", 0, ki18n("KTitleWidgetTest"), "version", ki18n("description")); - - KApplication app; - - KTitleWidgetTestWidget *mainWidget = new KTitleWidgetTestWidget; - mainWidget->show(); - - return app.exec(); -} diff --git a/kdeui/tests/ktoolbarlabelactiontest.cpp b/kdeui/tests/ktoolbarlabelactiontest.cpp deleted file mode 100644 index 377ce76a..00000000 --- a/kdeui/tests/ktoolbarlabelactiontest.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2004 Felix Berger - - 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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -class MainWindow : public KXmlGuiWindow -{ - public: - - MainWindow() - { - - // KXMLGUIClient looks in the "data" resource for the .rc files - // This line is for test programs only! - KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); - - KVBox* main = new KVBox( this ); - setCentralWidget( main ); - - KSqueezedTextLabel* accel = new KSqueezedTextLabel( "&Really long, long, long and boring text goes here", main ); - - mainLabel = new KSqueezedTextLabel( "Click me to change Label 1 text", main ); - mainLabel->installEventFilter(this); - - // first constructor - label1 = new KToolBarLabelAction( "&Label 1", this ); - actionCollection()->addAction("label1", label1); - - KLineEdit* lineEdit = new KLineEdit( this ); - KAction* lineEditAction = new KAction( "Line Edit", this ); - actionCollection()->addAction( "lineEdit", lineEditAction ); - lineEditAction->setDefaultWidget(lineEdit); - - // second constructor - KToolBarLabelAction *label2 = new KToolBarLabelAction( lineEditAction, "This is the &second label", this ); - actionCollection()->addAction( "label2", label2 ); - - - // set buddy for label1 - label1->setBuddy( lineEditAction ); - - // set buddy for accel - accel->setBuddy( lineEdit ); - - // another widget so lineEdit can loose focus and check budyness works - new KLineEdit( main ); - - setupGUI( Default, "ktoolbarlabelactiontestui.rc" ); - } - - bool eventFilter(QObject * watched, QEvent * event ) - { - if (watched == mainLabel && event->type() == QEvent::MouseButtonPress) - { - label1->setText("&You clicked to make me change!"); - } - return KXmlGuiWindow::eventFilter(watched, event); - } - - KToolBarLabelAction* label1; - KSqueezedTextLabel *mainLabel; -}; - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - - KGlobal::mainComponent().dirs()->addResourceDir( "data", "." ); - - MainWindow* mw = new MainWindow; - mw->show(); - - return app.exec(); -} - diff --git a/kdeui/tests/ktoolbarlabelactiontestui.rc b/kdeui/tests/ktoolbarlabelactiontestui.rc deleted file mode 100644 index c7bf0fdc..00000000 --- a/kdeui/tests/ktoolbarlabelactiontestui.rc +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/kdeui/tests/ktoolbartest.cpp b/kdeui/tests/ktoolbartest.cpp deleted file mode 100644 index 2ee92d2f..00000000 --- a/kdeui/tests/ktoolbartest.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -// This is a test for "Automatically hide extra toolbar separators" -// If several separators are next to each other, only one should show up. - -int main( int argc, char **argv ) -{ - KAboutData aboutData( "kactiontest", 0, ki18n("kactiontest"), "1.0" ); - KCmdLineArgs::init(argc, argv, &aboutData); - KApplication app; - - KActionCollection coll( static_cast( 0 ) ); - - QAction* action1 = coll.addAction("test1"); - action1->setText("test1"); - QAction* action2 = coll.addAction("test2"); - action2->setText("test2"); - QAction* action3 = coll.addAction("test3"); - action3->setText("test3"); - QAction* action4 = coll.addAction("test4"); - action4->setText("test4"); - QAction* action5 = coll.addAction("test5"); - action5->setText("test5"); - QAction* action6 = coll.addAction("test6"); - action6->setText("test6"); - QAction* action7 = coll.addAction("test7"); - action7->setText("test7"); - - QMainWindow* mw = new QMainWindow(); - KToolBar* tb = new KToolBar(mw); - mw->addToolBar(tb); - - action2->setSeparator(true); - action3->setSeparator(true); - action7->setSeparator(true); - - coll.addAssociatedWidget(tb); - - mw->show(); - - app.exec(); - - mw->show(); - - action2->setVisible(false); - - app.exec(); - - mw->show(); - - action1->setVisible(false); - - return app.exec(); -} - -/* vim: et sw=4 ts=4 - */ diff --git a/kdeui/tests/ktreewidgetsearchlinetest.cpp b/kdeui/tests/ktreewidgetsearchlinetest.cpp deleted file mode 100644 index b298212b..00000000 --- a/kdeui/tests/ktreewidgetsearchlinetest.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#include "ktreewidgetsearchlinetest.h" - -#include -#include -#include -#include - -#include -#include -#include - -KTreeWidgetSearchLineTest::KTreeWidgetSearchLineTest() - : KDialog() -{ - QWidget* container = mainWidget(); - // to test KWhatsThisManager too: - container->setWhatsThis("This is a test dialog for KTreeWidgetSearchLineTest"); - tw = new QTreeWidget(container); - tw->setColumnCount(4); - tw->setHeaderLabels(QStringList() << "Item" << "Price" << "HIDDEN COLUMN" << "Source"); - tw->hideColumn(2); - - KTreeWidgetSearchLineWidget* searchWidget = new KTreeWidgetSearchLineWidget(container,tw); - m_searchLine = searchWidget->searchLine(); - - QTreeWidgetItem* red = new QTreeWidgetItem( tw, QStringList() << "Red"); - red->setWhatsThis( 0, "This item is red" ); - red->setWhatsThis( 1, "This item is pricy" ); - tw->expandItem(red); - QTreeWidgetItem* blue = new QTreeWidgetItem( tw, QStringList() << "Blue"); - tw->expandItem(blue); - QTreeWidgetItem* green = new QTreeWidgetItem( tw, QStringList() << "Green"); - tw->expandItem(green); - QTreeWidgetItem* yellow = new QTreeWidgetItem( tw, QStringList() << "Yellow"); - tw->expandItem(yellow); - - create2ndLevel(red); - create2ndLevel(blue); - create2ndLevel(green); - create2ndLevel(yellow); - - QVBoxLayout* layout = new QVBoxLayout(container); - layout->setMargin(0); - QHBoxLayout* hbox = new QHBoxLayout(); - - QPushButton* caseSensitive = new QPushButton("&Case Sensitive", container); - hbox->addWidget(caseSensitive); - caseSensitive->setCheckable(true); - connect(caseSensitive, SIGNAL(toggled(bool)), SLOT(switchCaseSensitivity(bool))); - - QPushButton* keepParentsVisible = new QPushButton("Keep &Parents Visible", container); - hbox->addWidget(keepParentsVisible); - keepParentsVisible->setCheckable(true); - keepParentsVisible->setChecked(true); - connect(keepParentsVisible, SIGNAL(toggled(bool)), m_searchLine, SLOT(setKeepParentsVisible(bool))); - - layout->addWidget(searchWidget); - layout->addWidget(tw); - layout->addLayout(hbox); - - m_searchLine->setFocus(); - - resize(350, 600); -} - -void KTreeWidgetSearchLineTest::create3rdLevel( QTreeWidgetItem * item ) -{ - new QTreeWidgetItem( item, QStringList() << "Growing" << "$2.00" << "" << "Farmer" ); - new QTreeWidgetItem( item, QStringList() << "Ripe" << "$8.00" << "" << "Market" ); - new QTreeWidgetItem( item, QStringList() << "Decaying" << "$0.50" << "" << "Ground" ); - new QTreeWidgetItem( item, QStringList() << "Pickled" << "$4.00" << "" << "Shop" ); -} - -void KTreeWidgetSearchLineTest::create2ndLevel( QTreeWidgetItem * item ) -{ - QTreeWidgetItem* beans = new QTreeWidgetItem(item, QStringList() << "Beans"); - tw->expandItem(beans); - create3rdLevel(beans); - - QTreeWidgetItem* grapes = new QTreeWidgetItem(item, QStringList() << "Grapes"); - tw->expandItem(grapes); - create3rdLevel(grapes); - - QTreeWidgetItem* plums = new QTreeWidgetItem(item, QStringList() << "Plums"); - tw->expandItem(plums); - create3rdLevel(plums); - - QTreeWidgetItem* bananas = new QTreeWidgetItem(item, QStringList() << "Bananas"); - tw->expandItem(bananas); - create3rdLevel(bananas); -} - -void KTreeWidgetSearchLineTest::switchCaseSensitivity(bool cs) -{ - m_searchLine->setCaseSensitivity(cs ? Qt::CaseSensitive : Qt::CaseInsensitive); -} - -void KTreeWidgetSearchLineTest::showEvent( QShowEvent * event ) -{ - KDialog::showEvent(event); - - for (int i = 0; i < tw->header()->count(); ++i) - if (!tw->header()->isSectionHidden(i)) - tw->resizeColumnToContents(i); -} - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "KTreeWidgetSearchLineTest", 0, ki18n("KTreeWidgetSearchLineTest"), "1.0", ki18n("KTreeWidgetSearchLine test app")); - KApplication app; - KTreeWidgetSearchLineTest dialog; - - dialog.exec(); - - return 0; -} - -#include "moc_ktreewidgetsearchlinetest.cpp" diff --git a/kdeui/tests/ktreewidgetsearchlinetest.h b/kdeui/tests/ktreewidgetsearchlinetest.h deleted file mode 100644 index d1917945..00000000 --- a/kdeui/tests/ktreewidgetsearchlinetest.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef KTREEWIDGETSEARCHLINETEST_H -#define KTREEWIDGETSEARCHLINETEST_H - -#include -#include - -class KTreeWidgetSearchLineTest : public KDialog -{ - Q_OBJECT - -public: - KTreeWidgetSearchLineTest(); - - void create2ndLevel(class QTreeWidgetItem* item); - void create3rdLevel(QTreeWidgetItem* item); - -public Q_SLOTS: - void switchCaseSensitivity(bool cs); - -protected: - virtual void showEvent(QShowEvent* event); - -private: - class KTreeWidgetSearchLine* m_searchLine; - QTreeWidget* tw; -}; - -#endif diff --git a/kdeui/tests/kwidgetitemdelegatetest.cpp b/kdeui/tests/kwidgetitemdelegatetest.cpp deleted file mode 100644 index 22ea9a5f..00000000 --- a/kdeui/tests/kwidgetitemdelegatetest.cpp +++ /dev/null @@ -1,335 +0,0 @@ -/** - * This file is part of the KDE project - * Copyright (C) 2007-2008 Rafael Fernández López - * Copyright (C) 2008 Kevin Ottens - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#define HARDCODED_BORDER 10 -#define EQUALLY_SIZED_TOOLBUTTONS 1 - -#if EQUALLY_SIZED_TOOLBUTTONS -#include -#endif - -class TestWidget - : public QWidget -{ - Q_OBJECT - -public: - TestWidget(QWidget *parent = 0) - : QWidget(parent) - { - setMouseTracking(true); - setAttribute(Qt::WA_Hover); - } - - ~TestWidget() - { - } - - QSize sizeHint() const - { - return QSize(30, 30); - } - -protected: - void paintEvent (QPaintEvent *event) - { - QPainter p(this); - - QRadialGradient radialGrad(QPointF(event->rect().width() / 2, - event->rect().height() / 2), - qMin(event->rect().width() / 2, - event->rect().height() / 2)); - - if (underMouse()) - radialGrad.setColorAt(0, Qt::green); - else - radialGrad.setColorAt(0, Qt::red); - - radialGrad.setColorAt(1, Qt::transparent); - - p.fillRect(event->rect(), radialGrad); - - p.setPen(Qt::black); - p.drawLine(0, 15, 30, 15); - p.drawLine(15, 0, 15, 30); - - p.end(); - } - - bool event(QEvent *event) - { - if (event->type() == QEvent::MouseButtonPress) { - QMouseEvent *mouseEvent = static_cast(event); - - if (mouseEvent->pos().x() > 15 && - mouseEvent->pos().y() < 15) - qDebug() << "First quarter"; - else if (mouseEvent->pos().x() < 15 && - mouseEvent->pos().y() < 15) - qDebug() << "Second quarter"; - else if (mouseEvent->pos().x() < 15 && - mouseEvent->pos().y() > 15) - qDebug() << "Third quarter"; - else - qDebug() << "Forth quarter"; - } - - return QWidget::event(event); - } -}; - -class MyDelegate - : public KWidgetItemDelegate -{ - Q_OBJECT - -public: - MyDelegate(QAbstractItemView *itemView, QObject *parent = 0) - : KWidgetItemDelegate(itemView, parent) - { - for (int i = 0; i < 100; i++) - { - installed[i] = i % 5; - } - } - - ~MyDelegate() - { - } - - QSize sizeHint(const QStyleOptionViewItem &option, - const QModelIndex &index) const - { - Q_UNUSED(option); - Q_UNUSED(index); - - return sizeHint(); - } - - QSize sizeHint() const - { - return QSize(600, 60); - } - - void paint(QPainter *painter, const QStyleOptionViewItem &option, - const QModelIndex &index) const - { - painter->save(); - - itemView()->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter, 0); - - if (option.state & QStyle::State_Selected) - { - painter->setPen(option.palette.highlightedText().color()); - } - - painter->restore(); - } - - QList createItemWidgets() const - { - KPushButton *button = new KPushButton(); - QToolButton *toolButton = new QToolButton(); - - setBlockedEventTypes(button, QList() << QEvent::MouseButtonPress - << QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick); - - setBlockedEventTypes(toolButton, QList() << QEvent::MouseButtonPress - << QEvent::MouseButtonRelease << QEvent::MouseButtonDblClick); - - connect(button, SIGNAL(clicked(bool)), this, SLOT(mySlot())); - connect(toolButton, SIGNAL(triggered(QAction*)), this, SLOT(mySlot2())); - connect(toolButton, SIGNAL(clicked(bool)), this, SLOT(mySlot3())); - - return QList() - << button - << new TestWidget() - << new KLineEdit() - << toolButton; - } - - void updateItemWidgets(const QList widgets, - const QStyleOptionViewItem &option, - const QPersistentModelIndex &index) const - { - QPushButton *button = static_cast(widgets[0]); - button->setText("Test me"); - button->setIcon(KIcon("kde")); - button->resize(button->sizeHint()); - button->move(HARDCODED_BORDER, sizeHint().height() / 2 - button->height() / 2); - - TestWidget *testWidget = static_cast(widgets[1]); - - testWidget->resize(testWidget->sizeHint()); - testWidget->move(2 * HARDCODED_BORDER + button->sizeHint().width(), - sizeHint().height() / 2 - testWidget->size().height() / 2); - - // Hide the test widget when row can be divided by three - testWidget->setVisible( (index.row() % 3) != 0 ); - - KLineEdit *lineEdit = static_cast(widgets[2]); - - lineEdit->setClearButtonShown(true); - lineEdit->resize(lineEdit->sizeHint()); - lineEdit->move(3 * HARDCODED_BORDER - + button->sizeHint().width() - + testWidget->sizeHint().width(), - sizeHint().height() / 2 - lineEdit->size().height() / 2); - - QToolButton *toolButton = static_cast(widgets[3]); - - if (!toolButton->menu()) - { - QMenu *myMenu = new QMenu(toolButton); - myMenu->addAction("Save"); - myMenu->addAction("Load"); - myMenu->addSeparator(); - myMenu->addAction("Close"); - toolButton->setMenu(myMenu); - } - - toolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - toolButton->setPopupMode(QToolButton::MenuButtonPopup); - - if (installed[index.row()]) - { - toolButton->setText("Uninstall"); - } - else - { - toolButton->setText("Install"); - } - - toolButton->resize(toolButton->sizeHint()); -#if EQUALLY_SIZED_TOOLBUTTONS - QStyleOptionToolButton toolButtonOpt; - toolButtonOpt.initFrom(toolButton); - toolButtonOpt.features = QStyleOptionToolButton::MenuButtonPopup; - toolButtonOpt.arrowType = Qt::DownArrow; - toolButtonOpt.toolButtonStyle = Qt::ToolButtonTextBesideIcon; - - toolButtonOpt.text = "Install"; - int widthInstall = QApplication::style()->sizeFromContents(QStyle::CT_ToolButton, &toolButtonOpt, QSize(option.fontMetrics.width("Install") + HARDCODED_BORDER * 3, option.fontMetrics.height()), toolButton).width(); - toolButtonOpt.text = "Uninstall"; - int widthUninstall = QApplication::style()->sizeFromContents(QStyle::CT_ToolButton, &toolButtonOpt, QSize(option.fontMetrics.width("Uninstall") + HARDCODED_BORDER * 3, option.fontMetrics.height()), toolButton).width(); - - QSize size = toolButton->sizeHint(); - size.setWidth(qMax(widthInstall, widthUninstall)); - toolButton->resize(size); -#endif - toolButton->move(option.rect.width() - toolButton->size().width() - HARDCODED_BORDER, - sizeHint().height() / 2 - toolButton->size().height() / 2); - - // Eat more space - lineEdit->resize(option.rect.width() - - toolButton->width() - - testWidget->width() - - button->width() - - 5 * HARDCODED_BORDER, - lineEdit->height()); - } - -private Q_SLOTS: - void mySlot() - { - KMessageBox::information(0, QString("The button in row %1 was clicked").arg(focusedIndex().row()), "Button clicked"); - } - - void mySlot2() - { - KMessageBox::information(0, QString("A menu item was triggered in row %1").arg(focusedIndex().row()), "Toolbutton menu item clicked"); - } - - void mySlot3() - { - bool isInstalled = installed[focusedIndex().row()]; - installed[focusedIndex().row()] = !isInstalled; - const_cast(focusedIndex().model())->setData(focusedIndex(), QString("makemodelbeupdated")); - } - -private: - bool installed[100]; -}; - -int main(int argc, char **argv) -{ - KAboutData aboutData("goyaTest", - 0, - ki18n("Goya Test"), - "1.0", - ki18n("Goya Test"), - KAboutData::License_LGPL_V3, - ki18n("(c) 2008 Rafael Fernández López and Kevin Ottens "), - ki18n("Goya Test"), - "http://www.kde.org"); - - KCmdLineArgs::init( argc, argv, &aboutData ); - KApplication app; - - QMainWindow *mainWindow = new QMainWindow(); - mainWindow->setMinimumSize(640, 480); - QListView *listView = new QListView(); - QStringListModel *model = new QStringListModel(); - - model->insertRows(0, 100); - for (int i = 0; i < 100; ++i) - { - model->setData(model->index(i, 0), QString("Test " + QString::number(i)), Qt::DisplayRole); - } - - listView->setModel(model); - MyDelegate *myDelegate = new MyDelegate(listView); - listView->setItemDelegate(myDelegate); - listView->setVerticalScrollMode(QListView::ScrollPerPixel); - - mainWindow->setCentralWidget(listView); - - mainWindow->show(); - - model->removeRows(0, 95); - - return app.exec(); -} - -#include "kwidgetitemdelegatetest.moc" diff --git a/kdeui/tests/kxerrorhandlertest.cpp b/kdeui/tests/kxerrorhandlertest.cpp deleted file mode 100644 index 0b91cbce..00000000 --- a/kdeui/tests/kxerrorhandlertest.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - - Copyright (c) 2003 Lubos Lunak - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. - -*/ -#include -#include -#include -using namespace std; - -#include - -int handler1( Display*, XErrorEvent* e ) -{ - cout << "ERR1:" << e->resourceid << ":" << (int)e->error_code << ":" << (int)e->request_code << ":" << e->serial << endl; - return 1; -} - -bool handler3( int request, int error_code, unsigned long resourceid ) -{ - cout << "ERR3:" << resourceid << ":" << error_code << ":" << request << endl; - return true; -} - -int main() -{ - Display* dpy = XOpenDisplay( NULL ); - XSetWindowAttributes attrs; - Window w = XCreateWindow( dpy, DefaultRootWindow( dpy ), 0, 0, 100, 100, 0, CopyFromParent, CopyFromParent, - CopyFromParent, 0, &attrs ); - cout << w << ":" << XNextRequest( dpy ) << endl; - XMapWindow( dpy, w ); - ++w; -// XSetInputFocus( dpy, w, RevertToParent, CurrentTime ); - { - KXErrorHandler handle1( handler1, dpy ); - cout << w << ":" << XNextRequest( dpy ) << endl; - XMapWindow( dpy, w ); - XWindowAttributes attr; - { - KXErrorHandler handle2( dpy ); - XGetWindowAttributes(dpy, w, &attr); - cout << "WAS2:" << handle2.error( false ) << endl; - } -// XSync( dpy, False ); - cout << "WAS1:" << handle1.error( false ) << endl; - } - for(;;) { - XEvent ev; - XNextEvent( dpy, &ev ); - } - XCloseDisplay( dpy ); -} diff --git a/kdeui/tests/kxmlguitest.cpp b/kdeui/tests/kxmlguitest.cpp deleted file mode 100644 index 122b14d5..00000000 --- a/kdeui/tests/kxmlguitest.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "kxmlguitest.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void Client::slotSec() -{ - kDebug() << "Client::slotSec()"; -} - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "test", 0, ki18n("Test"), "1.0", ki18n("test app")); - KApplication app; - KAction *a; - - // KXMLGUIClient looks in the "data" resource for the .rc files - // Let's add the source dir to it - KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); - - 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->setComponentData(KComponentData("konqueror")); - shell->componentData().dirs()->addResourceDir( "data", QDir::currentPath() ); - - a = new KAction( KIcon( "view-split-left-right" ), "Split", shell ); - shell->actionCollection()->addAction( "splitviewh", a ); - - shell->setXMLFile( KDESRCDIR "/kxmlguitest_shell.rc" ); - - factory->addClient( shell ); - - Client *part = new Client; - - a = new KAction( KIcon( "zoom-out" ), "decfont", part ); - part->actionCollection()->addAction( "decFontSizes", a ); - a = new KAction( KIcon( "security-low" ), "sec", part ); - part->actionCollection()->addAction( "security", a ); - a->setShortcut( KShortcut(Qt::ALT + Qt::Key_1), KAction::DefaultShortcut ); - a->connect( a, SIGNAL(triggered(bool)), part, SLOT(slotSec()) ); - - part->setXMLFile( KDESRCDIR "/kxmlguitest_part.rc" ); - - factory->addClient( part ); - for ( int i = 0; i < 10; ++i ) - { - factory->removeClient( part ); - factory->addClient( part ); - } - - return app.exec(); -} -#include "moc_kxmlguitest.cpp" diff --git a/kdeui/tests/kxmlguitest.h b/kdeui/tests/kxmlguitest.h deleted file mode 100644 index b7c0ffb8..00000000 --- a/kdeui/tests/kxmlguitest.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef KXMLGUITEST_H -#define KXMLGUITEST_H - -#include -#include - -class Client : public QObject, public KXMLGUIClient -{ - Q_OBJECT -public: - Client() {} - - void setXMLFile( const QString &f, bool merge = true, bool setXMLDoc = true ) { KXMLGUIClient::setXMLFile( f, merge, setXMLDoc ); } - void setComponentData(const KComponentData &inst) { KXMLGUIClient::setComponentData(inst); } - -public Q_SLOTS: - void slotSec(); -}; -#endif diff --git a/kdeui/tests/kxmlguitest_part.rc b/kdeui/tests/kxmlguitest_part.rc deleted file mode 100644 index 84f5e4f5..00000000 --- a/kdeui/tests/kxmlguitest_part.rc +++ /dev/null @@ -1,8 +0,0 @@ - - -Main Toolbar - - - - - diff --git a/kdeui/tests/kxmlguitest_shell.rc b/kdeui/tests/kxmlguitest_shell.rc deleted file mode 100644 index e6c39995..00000000 --- a/kdeui/tests/kxmlguitest_shell.rc +++ /dev/null @@ -1,7 +0,0 @@ - - - Main Toolbar - - - - diff --git a/kdeui/tests/kxmlguiwindowtest.cpp b/kdeui/tests/kxmlguiwindowtest.cpp deleted file mode 100644 index 19e05241..00000000 --- a/kdeui/tests/kxmlguiwindowtest.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2008 Rafael Fernández López - - 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 -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// BUG: if this symbol is defined the problem consists on: -// - main window is created. -// - settings are saved (and applied), but in this case no toolbars exist yet, so they don't -// apply to any toolbar. -// - after 1 second the GUI is created. -// -// How to reproduce ? -// - Move one toolbar to other place (bottom, left, right, or deattach it). -// - Close the test (so settings are saved). -// - Reopen the test. The toolbar you moved is not keeping the place you specified. -#define REPRODUCE_TOOLBAR_BUG - -class MainWindow - : public KXmlGuiWindow -{ - Q_OBJECT - -public: - MainWindow(QWidget *parent = 0); - -public Q_SLOTS: - void slotTest(); - void slotCreate(); - -private: - void setupActions(); -}; - -void MainWindow::slotTest() -{ - KMessageBox::information(0, "Test", "Test"); -} - -void MainWindow::slotCreate() -{ - setupGUI(ToolBar); - createGUI(xmlFile()); - - if (autoSaveConfigGroup().isValid()) { - applyMainWindowSettings(autoSaveConfigGroup()); - } -} - -void MainWindow::setupActions() -{ - KAction *testAction = new KAction(this); - testAction->setText("Test"); - testAction->setIcon(KIcon("kde")); - actionCollection()->addAction("test", testAction); - connect(testAction, SIGNAL(triggered(bool)), this, SLOT(slotTest())); - - KStandardAction::quit(kapp, SLOT(quit()), actionCollection()); - - setAutoSaveSettings(); - - // BUG: if the GUI is created after an amount of time (so settings have been saved), then toolbars - // are shown misplaced. KMainWindow uses a 500 ms timer to save window settings. -#ifdef REPRODUCE_TOOLBAR_BUG - QTimer::singleShot(1000, this, SLOT(slotCreate())); // more than 500 ms so the main window has saved settings. - // We can think of this case on natural applications when they - // load plugins and change parts. It can take 1 second perfectly. -#else - QTimer::singleShot(0, this, SLOT(slotCreate())); -#endif -} - -MainWindow::MainWindow(QWidget *parent) - : KXmlGuiWindow(parent) -{ - setXMLFile(KDESRCDIR "/kxmlguiwindowtestui.rc", true); - // Because we use a full path in setXMLFile, we need to call setLocalXMLFile too. - // In your apps, just pass a relative filename to setXMLFile instead. - setLocalXMLFile(KStandardDirs::locateLocal("data", "kxmlguiwindowtest/kxmlguiwindowtestui.rc")); - - setCentralWidget(new QTextEdit(this)); - setupActions(); -} - -int main(int argc, char **argv) -{ - KAboutData aboutData("kxmlguiwindowtest", 0, - ki18n("kxmlguiwindowtest"), "0.1", - ki18n("kxmlguiwindowtest"), - KAboutData::License_LGPL, - ki18n("Copyright (c) 2008 Rafael Fernandez Lopez")); - KCmdLineArgs::init(argc, argv, &aboutData); - KApplication app; - - KGlobal::dirs()->addResourceDir("data", KDESRCDIR); - - MainWindow *mainWindow = new MainWindow; - mainWindow->show(); - - return app.exec(); -} - -#include "kxmlguiwindowtest.moc" diff --git a/kdeui/tests/kxmlguiwindowtestui.rc b/kdeui/tests/kxmlguiwindowtestui.rc deleted file mode 100644 index 5cf28dac..00000000 --- a/kdeui/tests/kxmlguiwindowtestui.rc +++ /dev/null @@ -1,18 +0,0 @@ - - - - - Main Toolbar - - - - Other Toolbar - - - - - - - - - diff --git a/kdeui/tests/testqtargs.cpp b/kdeui/tests/testqtargs.cpp deleted file mode 100644 index 71417390..00000000 --- a/kdeui/tests/testqtargs.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - for (int i = 0; i < argc; i++) - { - qDebug("argv[%d] = %s", i, argv[i]); - } - KAboutData aboutData( "testqtargs", 0, ki18n("testqtargs"), - "1.0", ki18n("testqtargs"), KAboutData::License_GPL); - - KCmdLineOptions options; - options.add("hello ", ki18n("Says hello")); - - KCmdLineArgs::init(argc, argv, &aboutData); - KCmdLineArgs::addCmdLineOptions(options); - - KCmdLineArgs *qtargs = KCmdLineArgs::parsedArgs("qt"); - for (int i = 0; i < qtargs->count(); i++) - { - qDebug("qt arg[%d] = %s", i, qtargs->arg(i).toLocal8Bit().data()); - } - - KApplication app; - - KCmdLineArgs *kdeargs = KCmdLineArgs::parsedArgs("kde"); - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - // An arg set by Katie - if(qtargs->isSet("stylesheet")) - { - qDebug("arg stylesheet = %s", qtargs->getOption("stylesheet").toLocal8Bit().data()); - } - // An arg set by KDE - if(kdeargs->isSet("caption")) - { - qDebug("arg caption = %s", kdeargs->getOption("caption").toLocal8Bit().data()); - } - // An arg set by us. - if(args->isSet("hello")) - { - qDebug("arg hello = %s", args->getOption("hello").toLocal8Bit().data()); - } - args->clear(); - - QWidget *w = new QWidget(); - w->show(); - - return app.exec(); -} - diff --git a/kfile/tests/CMakeLists.txt b/kfile/tests/CMakeLists.txt index cc53d4e0..dcc3bb82 100644 --- a/kfile/tests/CMakeLists.txt +++ b/kfile/tests/CMakeLists.txt @@ -9,15 +9,6 @@ MACRO(KFILE_UNIT_TESTS) ) ENDFOREACH(_testname) ENDMACRO(KFILE_UNIT_TESTS) -MACRO(KFILE_EXECUTABLE_TESTS) - FOREACH(_testname ${ARGN}) - KDE4_ADD_MANUAL_TEST(kfile-${_testname} ${_testname}.cpp) - target_link_libraries(kfile-${_testname} - ${QT_QTTEST_LIBRARY} - kfile - ) - ENDFOREACH(_testname) -ENDMACRO(KFILE_EXECUTABLE_TESTS) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) @@ -31,4 +22,3 @@ KFILE_UNIT_TESTS( kdiroperatortest knewfilemenutest ) - diff --git a/kinit/CMakeLists.txt b/kinit/CMakeLists.txt index f5b41074..61f67d38 100644 --- a/kinit/CMakeLists.txt +++ b/kinit/CMakeLists.txt @@ -5,10 +5,6 @@ include_directories( ${KDE4_KIO_INCLUDES} ) -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() - add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1210) ########### kioslave ############### diff --git a/kinit/tests/CMakeLists.txt b/kinit/tests/CMakeLists.txt deleted file mode 100644 index 22dfe84d..00000000 --- a/kinit/tests/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -include_directories(${KDE4_KIO_INCLUDES}) - -kde4_add_manual_test(klaunchertest klaunchertest.cpp) - -target_link_libraries(klaunchertest kdecore kio) diff --git a/kinit/tests/klaunchertest.cpp b/kinit/tests/klaunchertest.cpp deleted file mode 100644 index 218e2429..00000000 --- a/kinit/tests/klaunchertest.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - This file is part of KDE - - Copyright (C) 1998 Waldo Bastian (bastian@kde.org) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - This software 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 library; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - KToolInvocation::kdeinitExec("konsole"); - KCmdLineArgs::init( argc, argv, "klaunchertest", 0, ki18n("klaunchertest"), 0); - KApplication k; - - //KApplication::dcopClient()->registerAs( kapp->objectName().toLatin1()) ; - -#if 0 - QString error; - QByteArray dcopService; - int pid; - int result = KToolInvocation::startServiceByDesktopName( - QLatin1String("konsole"), QString(), &error, &dcopService, &pid ); - - printf("Result = %d, error = \"%s\", dcopService = \"%s\", pid = %d\n", - result, error.toLatin1().constData(), dcopService.data(), pid); - - result = KToolInvocation::startServiceByDesktopName( - QLatin1String("konqueror"), QString(), &error, &dcopService, &pid ); - - printf("Result = %d, error = \"%s\", dcopService = \"%s\", pid = %d\n", - result, error.toLatin1().constData(), dcopService.data(), pid); -#endif -} - diff --git a/kio/tests/CMakeLists.txt b/kio/tests/CMakeLists.txt index b88801c3..f6ed5c41 100644 --- a/kio/tests/CMakeLists.txt +++ b/kio/tests/CMakeLists.txt @@ -8,12 +8,6 @@ MACRO(KIO_UNIT_TESTS) target_link_libraries(kio-${_testname} ${QT_QTTEST_LIBRARY} kio) ENDFOREACH(_testname) ENDMACRO(KIO_UNIT_TESTS) -MACRO(KIO_EXECUTABLE_TESTS) - FOREACH(_testname ${ARGN}) - kde4_add_manual_test(kio-${_testname} ${_testname}.cpp) - target_link_libraries(kio-${_testname} ${QT_QTTEST_LIBRARY} kio) - ENDFOREACH(_testname) -ENDMACRO(KIO_EXECUTABLE_TESTS) # jobtest seems to trigger a ctest problem; jobtest finishes and ctest waits for ever @@ -32,34 +26,5 @@ KIO_UNIT_TESTS( clipboardupdatertest globaltest udsentrytest + kfilemetainfotest ) - -KIO_EXECUTABLE_TESTS( - ksycocatest - getalltest - kruntest - kioslavetest - speed - previewtest - kionetrctest - kpropsdlgtest - kmfitest - ksycocaupdatetest - netaccesstest - kmimetypechoosertest_gui - kurlrequestertest - kopenwithtest - kicondialogtest - kfiledialogtest -) - -########### kfstest ############### - -set(kfstest_SRCS kfstest.cpp kfdtest.cpp) -kde4_add_manual_test(kfstest ${kfstest_SRCS}) -target_link_libraries(kfstest kio) - -########### kfilemetainfotest ############### - -kde4_add_test(kio-kfilemetainfotest kfilemetainfotest.cpp) -target_link_libraries(kio-kfilemetainfotest ${QT_QTTEST_LIBRARY} kio) diff --git a/kio/tests/getalltest.cpp b/kio/tests/getalltest.cpp deleted file mode 100644 index 6ae7f2b1..00000000 --- a/kio/tests/getalltest.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -int main(int argc, char *argv[]) -{ - KCmdLineArgs::init( argc,argv, "getalltest", 0, ki18n("getalltest"), 0); - KApplication k; // KMessageBox needs KApp for makeStdCaption - -//for (int i = 0 ; i < 2 ; ++i ) { // test twice to see if they got deleted - kDebug() << "All services"; - KService::List services = KService::allServices(); - kDebug() << "got " << services.count() << " services"; - Q_FOREACH(const KService::Ptr s, services) { - kDebug() << s->name() << " " << s->entryPath(); - } -//} - - kDebug() << "All mimeTypes"; - KMimeType::List mimeTypes = KMimeType::allMimeTypes(); - kDebug() << "got " << mimeTypes.count() << " mimeTypes"; - Q_FOREACH(const KMimeType::Ptr m, mimeTypes) { - kDebug() << m->name(); - } - - kDebug() << "All service types"; - KServiceType::List list = KServiceType::allServiceTypes(); - kDebug() << "got " << list.count() << " service types"; - Q_FOREACH(const KServiceType::Ptr st, list) { - kDebug() << st->name(); - } - - kDebug() << "done"; - - return 0; -} diff --git a/kio/tests/kfiledialogtest.cpp b/kio/tests/kfiledialogtest.cpp deleted file mode 100644 index 6c988701..00000000 --- a/kio/tests/kfiledialogtest.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/** - * This file is part of the KDE libraries - * Copyright 2008 Rafael Fernández López - * - * 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 -#include -#include -#include -#include - -int main (int argc, char **argv) -{ - KAboutData aboutData("kfiledialogtest", - 0, - ki18n("kfiledialogtest"), - "0.1", - ki18n("kfiledialogtest"), - KAboutData::License_LGPL, - ki18n("(c) 2008 Rafael Fernández López"), - ki18n("kfiledialogtest"), - "http://www.kde.org/"); - - KCmdLineArgs::init( argc, argv, &aboutData ); - KApplication app; - - // Test for: saved location keyword. - // - Should return to the starting directory last used for this test. - // - Should have no entered file name. - KFileDialog keywordDlg(KUrl("kfiledialog:///testKeyword"), QString("*.*|"), 0); - keywordDlg.setMode(KFile::Files); - keywordDlg.setCaption(QString("Test for keyword with no file name")); - keywordDlg.exec(); - - // Test for: saved location keyword with file name. - // - Should return to the starting directory last used for this test. - // - Should enter the file name 'new.file'. - KFileDialog keywordDlg2(KUrl("kfiledialog:///testKeyword/new.file"), QString("*.*|"), 0); - keywordDlg2.setMode(KFile::Files); - keywordDlg2.setCaption(QString("Test for keyword and file name")); - keywordDlg2.exec(); - - // bug 173137 - KFileDialog dlg(KUrl(QString()), QString("*.*|"), 0); - dlg.setMode(KFile::Files | KFile::Directory); - dlg.setCaption(QString("Test for bug 173137")); - dlg.exec(); - KUrl::List selectedUrls = dlg.selectedUrls(); - if (selectedUrls.count()) { - QString str("The listed files and folders below were asked to be opened:\n"); - foreach (const KUrl &filename, selectedUrls) { - str += QString("\n%1").arg(filename.url()); - } - KMessageBox::information(0, str, "Dialog for bug #173137 accepted"); - } else { - KMessageBox::information(0, QString("Dialog for bug #173137 cancelled")); - } - // end bug 173137 - - // Note: when I talk about 'filename' I mean also with path. For instance, a filename on this - // context is 'foo.txt', but also '/home/foo/bar/bar.txt'. - - // Test for: getOpenFileName. - // - Should return the selected file (if any). - // - Should return an empty string if 'Cancel' was pressed. - // - Should NOT return a non existing filename. If a non existing filename was given to it, - // it should inform the user about it, so we always get an empty string or an existing - // filename. - QString getOpenFileName = KFileDialog::getOpenFileName(QString(),QString(),0, - QString("Test getOpenFileName")); - - if (!getOpenFileName.isEmpty()) { - KMessageBox::information(0, QString("\"%1\" file was opened").arg(getOpenFileName), "Dialog for 'getOpenFileName' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getOpenFileName' cancelled")); - } - - // Test for: getOpenFileNames. - // - Should return the selected files (if any). - // - Should return an empty list of strings if 'Cancel' was pressed. - // - Should NOT return a non existing filename in the list. If a non existing filename was - // given to it, it should inform the user about it, so we always get an empty string or an - // existing list of filenames. - QStringList getOpenFileNames = KFileDialog::getOpenFileNames(QString(),QString(),0, - QString("Test getOpenFileNames")); - if (getOpenFileNames.count()) { - QString str("The listed files below were asked to be opened:\n"); - foreach (const QString &filename, getOpenFileNames) { - str += QString("\n%1").arg(filename); - } - KMessageBox::information(0, str, "Dialog for 'getOpenFileNames' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getOpenFileNames' cancelled")); - } - - // Test for: getOpenUrl. - // - Is a convenience method for getOpenFileName, that returns a KUrl object instead of a - // QString object. - // - From the previous point it is expectable that its behavior should be the same as - // getOpenFileName. - KUrl getOpenUrl = KFileDialog::getOpenUrl(QString(),QString(),0, - QString("Test getOpenUrl")); - if (getOpenUrl.isValid()) { - KMessageBox::information(0, QString("\"%1\" file was opened").arg(getOpenUrl.url()), "Dialog for 'getOpenUrl' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getOpenUrl' cancelled")); - } - - // Test for: getOpenUrls. - // - Is a convenience method for getOpenFileNames, that returns a KUrl::List object instead - // of a QStringList object. - // - From the previous point it is expectable that its behavior should be the same as - // getOpenFileNames. - KUrl::List getOpenUrls = KFileDialog::getOpenUrls(QString(),QString(),0, - QString("Test getOpenUrls")); - if (getOpenUrls.count()) { - QString str("The listed files below were asked to be opened:\n"); - foreach (const KUrl &filename, getOpenUrls) { - str += QString("\n%1").arg(filename.url()); - } - KMessageBox::information(0, str, "Dialog for 'getOpenUrls' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getOpenUrls' cancelled")); - } - - // Test for: getSaveFileName. - // - Should return the selected file (if any). - // - Should return an empty string if 'Cancel' was pressed. - // - Don't care about existing or non existing filenames. - QString getSaveFileName = KFileDialog::getSaveFileName(QString(),QString(),0, - QString("Test getSaveFileName")); - if (!getSaveFileName.isEmpty()) { - KMessageBox::information(0, QString("\"%1\" file was asked to be saved").arg(getSaveFileName), "Dialog for 'getSaveFileName' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getSaveFileName' cancelled")); - } - - // Tests for bug 194900 - // - Should enter the specified directory with the file preselected. - getSaveFileName = KFileDialog::getSaveFileName(KUrl("/usr/share/X11/rgb.txt"), - QString(),0, - QString("Test bug 194900 getSaveFileName with file preselected")); - if (!getSaveFileName.isEmpty()) { - KMessageBox::information(0, QString("\"%1\" file was asked to be saved").arg(getSaveFileName), "Dialog for 'getSaveFileName' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getSaveFileName' cancelled")); - } - // - Should enter the specified directory with no file preselected. - getSaveFileName = KFileDialog::getSaveFileName(KUrl("/usr/share/X11"), - QString(),0, - QString("Test bug 194900 getSaveFileName with no file preselected")); - if (!getSaveFileName.isEmpty()) { - KMessageBox::information(0, QString("\"%1\" file was asked to be saved").arg(getSaveFileName), "Dialog for 'getSaveFileName' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getSaveFileName' cancelled")); - } - - // Test for: getSaveUrl. - // - Is a convenience method for getSaveFileName, that returns a KUrl object instead of a - // QString object. - // - From the previous point it is expectable that its behavior should be the same as - // getSaveFileName. - KUrl getSaveUrl = KFileDialog::getSaveUrl(QString(),QString(),0, - QString("Test getSaveUrl")); - if (getSaveUrl.isValid()) { - KMessageBox::information(0, QString("\"%1\" file was asked to be saved").arg(getSaveUrl.url()), "Dialog for 'getSaveUrl' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getSaveUrl' cancelled")); - } - - // Tests for bug 194900 - // - Should enter the specified directory with the file preselected. - getSaveUrl = KFileDialog::getSaveUrl(KUrl("/usr/share/X11/rgb.txt"), - QString(),0, - QString("Test bug 194900 getSaveUrl with file preselected")); - if (getSaveUrl.isValid()) { - KMessageBox::information(0, QString("\"%1\" file was asked to be saved").arg(getSaveUrl.url()), "Dialog for 'getSaveUrl' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getSaveUrl' cancelled")); - } - // - Should enter the specified directory with no file preselected. - getSaveUrl = KFileDialog::getSaveUrl(KUrl("/usr/share/X11/"), - QString(),0, - QString("Test bug 194900 getSaveUrl with no file preselected")); - if (getSaveUrl.isValid()) { - KMessageBox::information(0, QString("\"%1\" file was asked to be saved").arg(getSaveUrl.url()), "Dialog for 'getSaveUrl' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getSaveUrl' cancelled")); - } - - // Test for: getImageOpenUrl. - // - Is the same as getOpenUrl but showing inline previews. - KUrl getImageOpenUrl = KFileDialog::getImageOpenUrl(QString(),0, - QString("Test getImageOpenUrl")); - if (getImageOpenUrl.isValid()) { - KMessageBox::information(0, QString("\"%1\" file was asked to be saved").arg(getImageOpenUrl.url()), "Dialog for 'getImageOpenUrl' accepted"); - } else { - KMessageBox::information(0, QString("Dialog for 'getImageOpenUrl' cancelled")); - } - - return 0; -} diff --git a/kio/tests/kfstest.cpp b/kio/tests/kfstest.cpp deleted file mode 100644 index d2dbf90c..00000000 --- a/kio/tests/kfstest.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997, 1998 Richard Moore - 1998 Stephan Kulow - - 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 -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#if 0 // SPLIT-TODO -#include -#include -#endif -#include -#include -#include - -#include "kfdtest.h" -#include - -int main(int argc, char **argv) -{ - KCmdLineOptions options; - options.add("+[cmd]"); - options.add("+[url]"); - - KCmdLineArgs::init(argc, argv, "kfstest", 0, ki18n("kfstest"), "0", ki18n("test app")); - KCmdLineArgs::addCmdLineOptions(options); - KApplication a; - a.setQuitOnLastWindowClosed(false); - - QString name1; - QStringList names; - - QString argv1; - KUrl startDir; - if (argc > 1) - argv1 = QLatin1String(argv[1]); - if ( argc > 2 ) - startDir = KUrl( argv[2] ); - -#if 0 // SPLIT-TODO - if (argv1 == QLatin1String("diroperator")) { - KDirOperator *op = new KDirOperator(startDir, 0); - KConfigGroup grp(KGlobal::config(), "TestGroup" ); - op->setViewConfig(grp); - op->setView(KFile::Simple); - op->show(); - a.exec(); - } else -#endif - if (argv1 == QLatin1String("localonly")) { - QString name = KFileDialog::getOpenFileName(startDir); - qDebug("filename=%s",name.toLatin1().constData()); - } - else if (argv1 == QLatin1String("oneurl")) { - KUrl url = KFileDialog::getOpenUrl(startDir); - qDebug() << "url=" << url; - } - else if (argv1 == QLatin1String("multipleurls")) { - KUrl::List urls = KFileDialog::getOpenUrls(startDir); - qDebug() << "urls=" << urls.toStringList(); - } - else if (argv1 == QLatin1String("existingDirectoryUrl")) { - KUrl url = KFileDialog::getExistingDirectoryUrl(); - qDebug("URL=%s",url.url().toLatin1().constData()); - name1 = url.url(); - } - - else if (argv1 == QLatin1String("preview")) { - KUrl u = KFileDialog::getImageOpenUrl(); - qDebug("filename=%s", u.url().toLatin1().constData()); - } - - else if (argv1 == QLatin1String("preselect")) { - names = KFileDialog::getOpenFileNames(KUrl("/etc/passwd")); - QStringList::Iterator it = names.begin(); - while ( it != names.end() ) { - qDebug("selected file: %s", (*it).toLatin1().constData()); - ++it; - } - } - - else if (argv1 == QLatin1String("dirs")) - name1 = KFileDialog::getExistingDirectory(); - - else if (argv1 == QLatin1String("heap")) { - KFileDialog *dlg = new KFileDialog( startDir, QString(), 0L); - dlg->setMode( KFile::File); - dlg->setOperationMode( KFileDialog::Saving ); - QStringList filter; - filter << "all/allfiles" << "text/plain"; - dlg->setMimeFilter( filter, "all/allfiles" ); - if ( dlg->exec() == KDialog::Accepted ) - name1 = dlg->selectedUrl().url(); - } - - else if ( argv1 == QLatin1String("eventloop") ) - { - new KFDTest( startDir ); - return a.exec(); - } - - else if (argv1 == QLatin1String("save")) { - KUrl u = KFileDialog::getSaveUrl(startDir); -// QString(QDir::homePath() + QLatin1String("/testfile")), -// QString(), 0L); - name1 = u.url(); - } - - else if (argv1 == QLatin1String("icon")) { - KIconDialog dlg; - QString icon = dlg.getIcon(); - kDebug() << icon; - } - -// else if ( argv1 == QLatin1String("dirselect") ) { -// KUrl url; -// url.setPath( "/" ); -// KUrl selected = KDirSelectDialog::selectDirectory( url ); -// name1 = selected.url(); -// qDebug("*** selected: %s", selected.url().toLatin1().constData()); -// } - - else { - KFileDialog dlg(startDir, - QString::fromLatin1("*|All Files\n" - "*.lo *.o *.la|All libtool Files"),0); -// dlg.setFilter( "*.kdevelop" ); - dlg.setMode( KFile::Files | - KFile::Directory | - KFile::ExistingOnly | - KFile::LocalOnly ); -// QStringList filter; -// filter << "text/plain" << "text/html" << "image/png"; -// dlg.setMimeFilter( filter ); -// KMimeType::List types; -// types.append( KMimeType::mimeType( "text/plain" ) ); -// types.append( KMimeType::mimeType( "text/html" ) ); -// dlg.setFilterMimeType( "Filetypes:", types, types.first() ); - if ( dlg.exec() == QDialog::Accepted ) { - const KUrl::List list = dlg.selectedUrls(); - KUrl::List::ConstIterator it = list.constBegin(); - qDebug("*** selectedUrls(): "); - while ( it != list.constEnd() ) { - name1 = (*it).url(); - qDebug(" -> %s", name1.toLatin1().constData()); - ++it; - } - qDebug("*** selectedFile: %s", dlg.selectedFile().toLatin1().constData()); - qDebug("*** selectedUrl: %s", dlg.selectedUrl().url().toLatin1().constData()); - qDebug("*** selectedFiles: "); - QStringList l = dlg.selectedFiles(); - QStringList::Iterator it2 = l.begin(); - while ( it2 != l.end() ) { - qDebug(" -> %s", (*it2).toLatin1().constData()); - ++it2; - } - } - } - - if (!(name1.isNull())) - KMessageBox::information(0, QLatin1String("You selected the file " ) + name1, - QLatin1String("Your Choice")); - return 0; -} diff --git a/kio/tests/kicondialogtest.cpp b/kio/tests/kicondialogtest.cpp deleted file mode 100644 index 7af96c94..00000000 --- a/kio/tests/kicondialogtest.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -#include - -int main( int argc, char **argv ) -{ - QApplication app(argc, argv); - KComponentData componentData(QByteArray("kicondialogtest")); - -// KIconDialog::getIcon(); - - KIconButton button; - button.show(); - - - return app.exec(); -} - -/* vim: et sw=4 - */ diff --git a/kio/tests/kionetrctest.cpp b/kio/tests/kionetrctest.cpp deleted file mode 100644 index 01332973..00000000 --- a/kio/tests/kionetrctest.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include - -#include "authinfo.h" - -void output( const KUrl& u ) -{ - kDebug() << "Looking up auto login for: " << u.url(); - KIO::NetRC::AutoLogin l; - bool result = KIO::NetRC::self()->lookup( u, l, true ); - if ( !result ) - { - kDebug() << "Either no .netrc and/or .kionetrc file was " - "found or there was problem when attempting to " - "read from them! Please make sure either or both " - "of the above files exist and have the correct " - "permission, i.e. a regular file owned by you with " - "with a read/write permission (0600)"; - return; - } - - kDebug() << "Type: " << l.type << '\n' - << "Machine: " << l.machine << '\n' - << "Login: " << l.login << '\n' - << "Password: " << l.password; - - QMap::ConstIterator it = l.macdef.constBegin(); - for ( ; it != l.macdef.constEnd(); ++it ) - { - kDebug() << "Macro: " << it.key() << "= " - << it.value().join(" "); - } -} - -int main(int argc, char **argv) -{ - const char *version = "0.5"; - KLocalizedString description = ki18n("Unit test for .netrc and kionetrc parser."); - KCmdLineOptions options; - options.add("+command", ki18n("[url1,url2 ,...]")); - - KCmdLineArgs::init( argc, argv, "kionetrctest", 0, ki18n("KIO-netrc-test"), version, description ); - KCmdLineArgs::addCmdLineOptions( options ); - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - int count = args->count(); - KApplication app; - - if ( !count ) - args->usage(); - else - { - KUrl u; - for( int i=0 ; i < count; i++ ) - { - u = args->arg(i); - if ( !u.isValid() ) - { - kDebug() << u.url() << " is invalid! Ignoring..."; - continue; - } - output( u ); - } - } - args->clear(); - return 0; -} diff --git a/kio/tests/kioslavetest.cpp b/kio/tests/kioslavetest.cpp deleted file mode 100644 index 105a5127..00000000 --- a/kio/tests/kioslavetest.cpp +++ /dev/null @@ -1,513 +0,0 @@ - /* - This file is or will be part of KDE desktop environment - - Copyright 1999 Matt Koss - - It is licensed under GPL version 2. - - If it is part of KDE libraries than this file is licensed under - LGPL version 2. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kioslavetest.h" - -#include - -using namespace KIO; - -KioslaveTest::KioslaveTest( QString src, QString dest, uint op, uint pr ) - : KMainWindow(0) -{ - - job = 0L; - - main_widget = new QWidget( this ); - QBoxLayout *topLayout = new QVBoxLayout( main_widget ); - - QGridLayout *grid = new QGridLayout(); - topLayout->addLayout( grid ); - - grid->setRowStretch(0,1); - grid->setRowStretch(1,1); - - grid->setColumnStretch(0,1); - grid->setColumnStretch(1,100); - - lb_from = new QLabel( "From:", main_widget ); - grid->addWidget( lb_from, 0, 0 ); - - le_source = new QLineEdit( main_widget ); - grid->addWidget( le_source, 0, 1 ); - le_source->setText( src ); - - lb_to = new QLabel( "To:", main_widget ); - grid->addWidget( lb_to, 1, 0 ); - - le_dest = new QLineEdit( main_widget ); - grid->addWidget( le_dest, 1, 1 ); - le_dest->setText( dest ); - - // Operation groupbox & buttons - opButtons = new QButtonGroup( main_widget ); - QGroupBox *box = new QGroupBox( "Operation", main_widget ); - topLayout->addWidget( box, 10 ); - connect( opButtons, SIGNAL(buttonClicked(QAbstractButton*)), SLOT(changeOperation(QAbstractButton*)) ); - - QBoxLayout *hbLayout = new QHBoxLayout( box ); - - rbList = new QRadioButton( "List", box ); - opButtons->addButton( rbList ); - hbLayout->addWidget( rbList, 5 ); - - rbListRecursive = new QRadioButton( "ListRecursive", box ); - opButtons->addButton( rbListRecursive ); - hbLayout->addWidget( rbListRecursive, 5 ); - - rbStat = new QRadioButton( "Stat", box ); - opButtons->addButton( rbStat ); - hbLayout->addWidget( rbStat, 5 ); - - rbGet = new QRadioButton( "Get", box ); - opButtons->addButton( rbGet ); - hbLayout->addWidget( rbGet, 5 ); - - rbPut = new QRadioButton( "Put", box ); - opButtons->addButton( rbPut ); - hbLayout->addWidget( rbPut, 5 ); - - rbCopy = new QRadioButton( "Copy", box ); - opButtons->addButton( rbCopy ); - hbLayout->addWidget( rbCopy, 5 ); - - rbMove = new QRadioButton( "Move", box ); - opButtons->addButton( rbMove ); - hbLayout->addWidget( rbMove, 5 ); - - rbDelete = new QRadioButton( "Delete", box ); - opButtons->addButton( rbDelete ); - hbLayout->addWidget( rbDelete, 5 ); - - rbMkdir = new QRadioButton( "Mkdir", box ); - opButtons->addButton( rbMkdir ); - hbLayout->addWidget( rbMkdir, 5 ); - - rbMimetype = new QRadioButton( "Mimetype", box ); - opButtons->addButton( rbMimetype ); - hbLayout->addWidget( rbMimetype, 5 ); - - QAbstractButton *b = opButtons->buttons()[op]; - b->setChecked( true ); - changeOperation( b ); - - // Progress groupbox & buttons - progressButtons = new QButtonGroup( main_widget ); - box = new QGroupBox( "Progress dialog mode", main_widget ); - topLayout->addWidget( box, 10 ); - connect( progressButtons, SIGNAL(buttonClicked(QAbstractButton*)), SLOT(changeProgressMode(QAbstractButton*)) ); - - hbLayout = new QHBoxLayout( box ); - - rbProgressNone = new QRadioButton( "None", box ); - progressButtons->addButton( rbProgressNone ); - hbLayout->addWidget( rbProgressNone, 5 ); - - rbProgressDefault = new QRadioButton( "Default", box ); - progressButtons->addButton( rbProgressDefault ); - hbLayout->addWidget( rbProgressDefault, 5 ); - - rbProgressStatus = new QRadioButton( "Status", box ); - progressButtons->addButton( rbProgressStatus ); - hbLayout->addWidget( rbProgressStatus, 5 ); - - b = progressButtons->buttons()[pr]; - b->setChecked( true ); - changeProgressMode( b ); - - // statusbar progress widget - statusTracker = new KStatusBarJobTracker( statusBar() ); - - // run & stop butons - hbLayout = new QHBoxLayout(); - topLayout->addLayout( hbLayout ); - hbLayout->setParent( topLayout ); - - pbStart = new QPushButton( "&Start", main_widget ); - pbStart->setFixedSize( pbStart->sizeHint() ); - connect( pbStart, SIGNAL(clicked()), SLOT(startJob()) ); - hbLayout->addWidget( pbStart, 5 ); - - pbStop = new QPushButton( "Sto&p", main_widget ); - pbStop->setFixedSize( pbStop->sizeHint() ); - pbStop->setEnabled( false ); - connect( pbStop, SIGNAL(clicked()), SLOT(stopJob()) ); - hbLayout->addWidget( pbStop, 5 ); - - // close button - close = new QPushButton( "&Close", main_widget ); - close->setFixedSize( close->sizeHint() ); - connect(close, SIGNAL(clicked()), this, SLOT(slotQuit())); - - topLayout->addWidget( close, 5 ); - - main_widget->setMinimumSize( main_widget->sizeHint() ); - setCentralWidget( main_widget ); -} - -void KioslaveTest::slotQuit(){ - qApp->quit(); -} - - -void KioslaveTest::changeOperation( QAbstractButton *b ) { - // only two urls for copy and move - bool enab = rbCopy->isChecked() || rbMove->isChecked(); - - le_dest->setEnabled( enab ); - - selectedOperation = opButtons->buttons().indexOf( b ); -} - - -void KioslaveTest::changeProgressMode( QAbstractButton *b ) { - progressMode = progressButtons->buttons().indexOf( b ); - - if ( progressMode == ProgressStatus ) { - statusBar()->show(); - } else { - statusBar()->hide(); - } -} - - -void KioslaveTest::startJob() { - KUrl sCurrent( QUrl::fromLocalFile( QDir::currentPath() ) ); - QString sSrc( le_source->text() ); - KUrl src = KUrl( sCurrent, sSrc ); - - if ( !src.isValid() ) { - QMessageBox::critical(this, "Kioslave Error Message", "Source URL is malformed" ); - return; - } - - QString sDest( le_dest->text() ); - KUrl dest( sCurrent, sDest ); - - if ( !dest.isValid() && - ( selectedOperation == Copy || selectedOperation == Move ) ) { - QMessageBox::critical(this, "Kioslave Error Message", - "Destination URL is malformed" ); - return; - } - - pbStart->setEnabled( false ); - - KIO::JobFlags observe = DefaultFlags; - if (progressMode != ProgressDefault) { - observe = HideProgressInfo; - } - - SimpleJob *myJob = 0; - - switch ( selectedOperation ) { - case List: - myJob = KIO::listDir( src ); - connect(myJob, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), - SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList))); - break; - - case ListRecursive: - myJob = KIO::listRecursive( src ); - connect(myJob, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), - SLOT(slotEntries(KIO::Job*,KIO::UDSEntryList))); - break; - - case Stat: - myJob = KIO::stat( src, KIO::StatJob::SourceSide, 2 ); - break; - - case Get: - myJob = KIO::get( src, KIO::Reload ); - connect(myJob, SIGNAL(data(KIO::Job*,QByteArray)), - SLOT(slotData(KIO::Job*,QByteArray))); - break; - - case Put: - { - putBuffer = 0; - KIO::TransferJob* tjob = KIO::put( src, -1, KIO::Overwrite ); - tjob->setTotalSize(48*1024*1024); - myJob = tjob; - connect(tjob, SIGNAL(dataReq(KIO::Job*,QByteArray&)), - SLOT(slotDataReq(KIO::Job*,QByteArray&))); - break; - } - - case Copy: - job = KIO::copy( src, dest, observe ); - break; - - case Move: - job = KIO::move( src, dest, observe ); - break; - - case Delete: - job = KIO::del( src, observe ); - break; - - case Mkdir: - myJob = KIO::mkdir( src ); - break; - - case Mimetype: - myJob = KIO::mimetype( src ); - break; - } - if (myJob) - { - job = myJob; - KIO::Scheduler::doJob(myJob); - } - - statusBar()->addWidget( statusTracker->widget(job), 0 ); - - connect( job, SIGNAL(result(KJob*)), - SLOT(slotResult(KJob*)) ); - - connect( job, SIGNAL(canceled(KJob*)), - SLOT(slotResult(KJob*)) ); - - if (progressMode == ProgressStatus) { - statusTracker->registerJob( job ); - } - - pbStop->setEnabled( true ); -} - - -void KioslaveTest::slotResult( KJob * _job ) -{ - if ( _job->error() ) - { - job->uiDelegate()->showErrorMessage(); - } - else if ( selectedOperation == Stat ) - { - UDSEntry entry = ((KIO::StatJob*)_job)->statResult(); - printUDSEntry( entry ); - } - else if ( selectedOperation == Mimetype ) - { - kDebug() << "mimetype is " << ((KIO::MimetypeJob*)_job)->mimetype(); - } - - if (job == _job) - job = 0L; - - pbStart->setEnabled( true ); - pbStop->setEnabled( false ); - - //statusBar()->removeWidget( statusTracker->widget(job) ); -} - -void KioslaveTest::printUDSEntry( const KIO::UDSEntry & entry ) -{ - // It's rather rare to iterate that way, usually you'd use numberValue/stringValue directly. - // This is just to print out all that we got - - const QList keys = entry.listFields(); - QList::const_iterator it = keys.begin(); - for( ; it != keys.end(); ++it ) { - switch ( *it ) { - case KIO::UDSEntry::UDS_FILE_TYPE: - { - mode_t mode = (mode_t)entry.numberValue(*it); - kDebug() << "File Type : " << mode; - if ( S_ISDIR( mode ) ) - { - kDebug() << "is a dir"; - } - } - break; - case KIO::UDSEntry::UDS_ACCESS: - kDebug() << "Access permissions : " << (mode_t)( entry.numberValue(*it) ) ; - break; - case KIO::UDSEntry::UDS_USER: - kDebug() << "User : " << ( entry.stringValue(*it) ); - break; - case KIO::UDSEntry::UDS_GROUP: - kDebug() << "Group : " << ( entry.stringValue(*it) ); - break; - case KIO::UDSEntry::UDS_NAME: - kDebug() << "Name : " << ( entry.stringValue(*it) ); - //m_strText = decodeFileName( it.value().toString() ); - break; - case KIO::UDSEntry::UDS_URL: - kDebug() << "URL : " << ( entry.stringValue(*it) ); - break; - case KIO::UDSEntry::UDS_MIME_TYPE: - kDebug() << "MimeType : " << ( entry.stringValue(*it) ); - break; - case KIO::UDSEntry::UDS_LINK_DEST: - kDebug() << "LinkDest : " << ( entry.stringValue(*it) ); - break; - case KIO::UDSEntry::UDS_SIZE: - kDebug() << "Size: " << KIO::convertSize(entry.numberValue(*it)); - break; - } - } -} - -void KioslaveTest::slotEntries(KIO::Job* job, const KIO::UDSEntryList& list) { - - KUrl url = static_cast( job )->url(); - UDSEntryList::ConstIterator it=list.begin(); - for (; it != list.end(); ++it) { - // For each file... - QString name = (*it).stringValue( KIO::UDSEntry::UDS_NAME ); - kDebug() << name; - } -} - -void KioslaveTest::slotData(KIO::Job*, const QByteArray &data) -{ - if (data.size() == 0) - { - kDebug() << "Data: "; - } - else - { - kDebug() << "Data: \"" << QString( data ) << "\""; - } -} - -void KioslaveTest::slotDataReq(KIO::Job*, QByteArray &data) -{ - const char *fileDataArray[] = - { - "Hello world\n", - "This is a test file\n", - "You can safely delete it.\n", - "BIG\n", - "BIG1\n", - "BIG2\n", - "BIG3\n", - "BIG4\n", - "BIG5\n", - 0 - }; - const char *fileData = fileDataArray[putBuffer++]; - - if (!fileData) - { - kDebug() << "DataReq: "; - return; - } - if (!strncmp(fileData, "BIG", 3)) - data.fill(0, 8*1024*1024); - else - data = QByteArray(fileData, strlen(fileData)); - kDebug() << "DataReq: \"" << fileData << "\""; - sleep(1); // want to see progress info... -} - -void KioslaveTest::stopJob() { - kDebug() << "KioslaveTest::stopJob()"; - job->kill(); - job = 0L; - - pbStop->setEnabled( false ); - pbStart->setEnabled( true ); -} - -int main(int argc, char **argv) { - - KCmdLineOptions options; - options.add("s"); - options.add("src ", ki18n("Source URL"), QByteArray()); - options.add("d"); - options.add("dest ", ki18n("Destination URL"), QByteArray()); - options.add("o"); - options.add("operation ", ki18n("Operation (list,listrecursive,stat,get,put,copy,move,del,mkdir)")); - options.add("p"); - options.add("progress ", ki18n("Progress Type (none,default,status)"), QByteArray("default")); - - const char version[] = "v0.0.0 0000"; // :-) - KLocalizedString description = ki18n("Test for kioslaves"); - - KCmdLineArgs::init( argc, argv, "kioslavetest", 0, ki18n("KIOSlave test"), version, description ); - KCmdLineArgs::addCmdLineOptions( options ); - KApplication app; - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - QString src = args->getOption("src"); - QString dest = args->getOption("dest"); - - uint op = KioslaveTest::Copy; - uint pr = 0; - - QString operation = args->getOption("operation"); - if ( operation == "list") { - op = KioslaveTest::List; - } else if ( operation == "listrecursive") { - op = KioslaveTest::ListRecursive; - } else if ( operation == "stat") { - op = KioslaveTest::Stat; - } else if ( operation == "get") { - op = KioslaveTest::Get; - } else if ( operation == "put") { - op = KioslaveTest::Put; - } else if ( operation == "copy") { - op = KioslaveTest::Copy; - } else if ( operation == "move") { - op = KioslaveTest::Move; - } else if ( operation == "del") { - op = KioslaveTest::Delete; - } else if ( operation == "mkdir") { - op = KioslaveTest::Mkdir; - } else if (!operation.isEmpty()) { - KCmdLineArgs::usageError("unknown operation"); - } - - QString progress = args->getOption("progress"); - if ( progress == "none") { - pr = KioslaveTest::ProgressNone; - } else if ( progress == "default") { - pr = KioslaveTest::ProgressDefault; - } else if ( progress == "status") { - pr = KioslaveTest::ProgressStatus; - } else KCmdLineArgs::usageError("unknown progress mode"); - - args->clear(); // Free up memory - - KioslaveTest* test = new KioslaveTest( src, dest, op, pr ); - if (!operation.isEmpty()) - QTimer::singleShot(100, test, SLOT(startJob())); - test->show(); - test->resize( test->sizeHint() ); - - app.exec(); -} - - -#include "moc_kioslavetest.cpp" diff --git a/kio/tests/kioslavetest.h b/kio/tests/kioslavetest.h deleted file mode 100644 index 2fae3e74..00000000 --- a/kio/tests/kioslavetest.h +++ /dev/null @@ -1,106 +0,0 @@ - /* - This file is or will be part of KDE desktop environment - - Copyright 1999 Matt Koss - - It is licensed under GPL version 2. - - If it is part of KDE libraries than this file is licensed under - LGPL version 2. - */ - -#ifndef KIOSLAVETEST_H -#define KIOSLAVETEST_H - -#include -#include -#include -#include -#include -#include - -#include - -#include "kio/job.h" -#include "kio/global.h" -#include "kstatusbarjobtracker.h" - -class KioslaveTest : public KMainWindow { - Q_OBJECT - -public: - KioslaveTest( QString src, QString dest, uint op, uint pr ); - - ~KioslaveTest() - { - if ( job ) { - job->kill( KJob::Quietly ); // kill the job quietly - } - } - - enum Operations { List = 0, ListRecursive, Stat, Get, Put, Copy, Move, Delete, Mkdir, Mimetype }; - - enum ProgressModes { ProgressNone = 0, ProgressDefault, ProgressStatus }; - -protected: - void printUDSEntry( const KIO::UDSEntry & entry ); - - // info stuff - QLabel *lb_from; - QLineEdit *le_source; - - QLabel *lb_to; - QLineEdit *le_dest; - - // operation stuff - QButtonGroup *opButtons; - - QRadioButton *rbList; - QRadioButton *rbListRecursive; - QRadioButton *rbStat; - QRadioButton *rbGet; - QRadioButton *rbPut; - QRadioButton *rbCopy; - QRadioButton *rbMove; - QRadioButton *rbDelete; - QRadioButton *rbMkdir; - QRadioButton *rbMimetype; - - // progress stuff - QButtonGroup *progressButtons; - - QRadioButton *rbProgressNone; - QRadioButton *rbProgressDefault; - QRadioButton *rbProgressStatus; - - QPushButton *pbStart; - QPushButton *pbStop; - - QPushButton *close; - -protected Q_SLOTS: - void changeOperation( QAbstractButton *b ); - void changeProgressMode( QAbstractButton *b ); - - void startJob(); - void stopJob(); - - void slotResult( KJob * ); - void slotEntries( KIO::Job *, const KIO::UDSEntryList& ); - void slotData( KIO::Job *, const QByteArray &data ); - void slotDataReq( KIO::Job *, QByteArray &data ); - - void slotQuit(); - -private: - KIO::Job *job; - QWidget *main_widget; - - KStatusBarJobTracker *statusTracker; - - int selectedOperation; - int progressMode; - int putBuffer; -}; - -#endif // KIOSLAVETEST_H diff --git a/kio/tests/kmfitest.cpp b/kio/tests/kmfitest.cpp deleted file mode 100644 index b914585c..00000000 --- a/kio/tests/kmfitest.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int main (int argc, char **argv) -{ - KComponentData ins(QByteArray("kmfitest")); - - if (argc < 2) { - printf("usage: %s \n", argv[0]); - return 1; - } - - for (int i = 1; i < argc; i++) { - QString file = QFile::decodeName(argv[i]); - qWarning("File: %s", file.toLocal8Bit().data()); - KMimeType::Ptr p; - p = KMimeType::findByPath(file); - qWarning("Mime type (findByPath): %s", p->name().toLatin1().constData()); - KFileMetaInfo meta(file, KFileMetaInfo::TechnicalInfo | KFileMetaInfo::ContentInfo); - } - - return 0; -} diff --git a/kio/tests/kmimetypechoosertest_gui.cpp b/kio/tests/kmimetypechoosertest_gui.cpp deleted file mode 100644 index ba45bd83..00000000 --- a/kio/tests/kmimetypechoosertest_gui.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2006 David Faure - - 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 -#include -#include -#include -#include - -int main( int argc, char** argv ) { - QApplication app( argc, argv ); - KComponentData componentData(QByteArray("kmimetypechoosertest_gui")); - - QString text = i18n("Select the MimeTypes you want for this file type."); - QStringList list; list << "inode/directory"; list << "text/plain"; - KMimeTypeChooserDialog dlg( i18n("Select Mime Types"), text, list, "text", QStringList(), - KMimeTypeChooser::Comments|KMimeTypeChooser::Patterns|KMimeTypeChooser::EditButton, - (QWidget*)0 ); - if ( dlg.exec() == KDialog::Accepted ) { - kDebug() << dlg.chooser()->patterns(); - kDebug() << dlg.chooser()->mimeTypes().join(";"); - } - - return 0; // app.exec(); -} diff --git a/kio/tests/kopenwithtest.cpp b/kio/tests/kopenwithtest.cpp deleted file mode 100644 index 7862744b..00000000 --- a/kio/tests/kopenwithtest.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2002 Dirk Mueller - Copyright (C) 2003 David Faure - - 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 -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc, argv, "kopenwithdialogtest", 0, ki18n("kopenwithdialogtest"), "0.1", ki18n("kopenwithdialogtest")); - KApplication app; - KUrl::List list; - - list += KUrl("file:///tmp/testfile.txt"); - - // Test with one URL - KOpenWithDialog* dlg = new KOpenWithDialog(list, "OpenWith_Text", "OpenWith_Value", 0); - if(dlg->exec()) { - kDebug() << "Dialog ended successfully\ntext: " << dlg->text(); - } - else - kDebug() << "Dialog was canceled."; - delete dlg; - - // Test with two URLs - list += KUrl("http://www.kde.org/index.html"); - dlg = new KOpenWithDialog(list, "OpenWith_Text", "OpenWith_Value", 0); - if(dlg->exec()) { - kDebug() << "Dialog ended successfully\ntext: " << dlg->text(); - } - else - kDebug() << "Dialog was canceled."; - delete dlg; - - // Test with a mimetype - QString mimetype = "text/plain"; - dlg = new KOpenWithDialog( mimetype, "kedit", 0); - if(dlg->exec()) { - kDebug() << "Dialog ended successfully\ntext: " << dlg->text(); - } - else - kDebug() << "Dialog was canceled."; - delete dlg; - - return 0; -} - diff --git a/kio/tests/kpropsdlgtest.cpp b/kio/tests/kpropsdlgtest.cpp deleted file mode 100644 index 73121806..00000000 --- a/kio/tests/kpropsdlgtest.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include -#include - - -int main ( int argc, char** argv ) -{ - KCmdLineOptions options; - options.add("+url", ki18n("the path or url to the file/dir for which to show properties")); - - KAboutData aboutData(QByteArray("kpropertiesdialogtest"), QByteArray(), ki18n("KIO Properties Dialog Test"), QByteArray("1.0")); - KCmdLineArgs::init(argc, argv, &aboutData); - KCmdLineArgs::addCmdLineOptions( options ); - - KApplication app; - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if ( args->count() < 1 ) - KCmdLineArgs::usage(); - KUrl u = args->url( 0 ); - - // This is the test for the KPropertiesDialog constructor that is now - // documented to NOT work. Passing only a URL means a KIO::NetAccess::stat will happen, - // and asking for the dialog to be modal too creates problems. - // (A non-modal, URL-only dialog is the one kicker uses for app buttons, no problem there) - { - KPropertiesDialog dlg( u, 0 ); - dlg.exec(); - } - - return 0; -} diff --git a/kio/tests/kruntest.cpp b/kio/tests/kruntest.cpp deleted file mode 100644 index 06524e46..00000000 --- a/kio/tests/kruntest.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2002 David Faure - * Copyright (C) 2003 Waldo Bastian - * - * 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 "kruntest.h" -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -const int MAXKRUNS = 100; - -testKRun * myArray[MAXKRUNS]; - -void testKRun::foundMimeType( const QString& _type ) -{ - kDebug() << "testKRun::foundMimeType " << _type; - kDebug() << "testKRun::foundMimeType URL=" << url().url(); - setFinished( true ); - return; -} - -static const char testFile[] = KDESRCDIR "/kruntest.cpp"; - -static const struct { - const char* text; - const char* expectedResult; - const char* exec; - const char* url; -} s_tests[] = { - { "run(kwrite, no url)", "should work normally", "kwrite", 0 }, - { "run(kwrite, file url)", "should work normally", "kwrite", testFile }, - { "run(kwrite, remote url)", "should work normally", "kwrite", "http://www.kde.org" }, - { "run(doesnotexit, no url)", "should show error message", "doesnotexist", 0 }, - { "run(doesnotexit, file url)", "should show error message", "doesnotexist", testFile }, - { "run(doesnotexit, remote url)", "should use kioexec and show error message", "doesnotexist", "http://www.kde.org" }, - { "run(missing lib, no url)", "should show error message (remove libqca.so.2 for this, e.g. by editing LD_LIBRARY_PATH if qca is in its own prefix)", "qcatool", 0 }, - { "run(missing lib, file url)", "should show error message (remove libqca.so.2 for this, e.g. by editing LD_LIBRARY_PATH if qca is in its own prefix)", "qcatool", testFile }, - { "run(missing lib, remote url)", "should show error message (remove libqca.so.2 for this, e.g. by editing LD_LIBRARY_PATH if qca is in its own prefix)", "qcatool", "http://www.kde.org" }, - { "runCommand(empty)", "should error", "", "" }, // #186036 - { "runCommand(full path)", "should work normally", "../../kdecore/tests/kurltest", "" } -}; - -Receiver::Receiver() -{ - QVBoxLayout *lay = new QVBoxLayout(this); - QPushButton * h = new QPushButton( "Press here to terminate", this ); - lay->addWidget( h ); - connect(h, SIGNAL(clicked()), qApp, SLOT(quit())); - - start = new QPushButton( "Launch KRuns", this ); - lay->addWidget( start ); - connect(start, SIGNAL(clicked()), this, SLOT(slotStart())); - - stop = new QPushButton( "Stop those KRuns", this ); - stop->setEnabled(false); - lay->addWidget( stop ); - connect(stop, SIGNAL(clicked()), this, SLOT(slotStop())); - - QPushButton* launchOne = new QPushButton( "Launch one http KRun", this ); - lay->addWidget(launchOne); - connect(launchOne, SIGNAL(clicked()), this, SLOT(slotLaunchOne())); - - for (uint i = 0; i < sizeof(s_tests)/sizeof(*s_tests); ++i) { - QHBoxLayout* hbox = new QHBoxLayout; - lay->addLayout(hbox); - QPushButton* button = new QPushButton(s_tests[i].text, this); - button->setProperty("testNumber", i); - hbox->addWidget(button); - QLabel* label = new QLabel(s_tests[i].expectedResult, this); - hbox->addWidget(label); - connect(button, SIGNAL(clicked()), this, SLOT(slotLaunchTest())); - hbox->addStretch(); - } - - adjustSize(); - show(); -} - -void Receiver::slotLaunchTest() -{ - QPushButton* button = qobject_cast(sender()); - Q_ASSERT(button); - const int testNumber = button->property("testNumber").toInt(); - KUrl::List urls; - if (QByteArray(s_tests[testNumber].text).startsWith("runCommand")) { - KRun::runCommand(s_tests[testNumber].exec, this); - } else { - if (s_tests[testNumber].url) - urls << KUrl(s_tests[testNumber].url); - KRun::run(s_tests[testNumber].exec, urls, this); - } -} - -void Receiver::slotStop() -{ - for (int i = 0 ; i < MAXKRUNS ; i++ ) - { - kDebug() << " deleting krun " << i; - delete myArray[i]; - } - start->setEnabled(true); - stop->setEnabled(false); -} - -void Receiver::slotStart() -{ - for (int i = 0 ; i < MAXKRUNS ; i++ ) - { - kDebug() << "creating testKRun " << i; - myArray[i] = new testKRun( KUrl("file:/tmp"), window(), 0, - true /*isLocalFile*/, false /* showProgressInfo */ ); - myArray[i]->setAutoDelete(false); - } - start->setEnabled(false); - stop->setEnabled(true); -} - -void Receiver::slotLaunchOne() -{ - new testKRun(KUrl("http://www.kde.org"), window()); -} - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc,argv, "kruntest", 0, ki18n("kruntest"), 0); - KApplication app; - - Receiver receiver; - return app.exec(); -} - -#include "moc_kruntest.cpp" diff --git a/kio/tests/kruntest.h b/kio/tests/kruntest.h deleted file mode 100644 index 55c547a7..00000000 --- a/kio/tests/kruntest.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2002 David Faure - * - * 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. - */ - -#ifndef KRUNTEST_H -#define KRUNTEST_H - -#include - -#include - -class testKRun : public KRun -{ - Q_OBJECT -public: - - testKRun( const KUrl& _url, QWidget *_topLevel, mode_t _mode = 0, - bool _is_local_file = false, bool _auto_delete = true ) - : KRun( _url, _topLevel, _mode, _is_local_file, _auto_delete ) {} - - virtual ~testKRun() {} - - virtual void foundMimeType( const QString& _type ); - -}; - - -#include -class Receiver : public QWidget -{ - Q_OBJECT -public: - Receiver(); - ~Receiver() {} -public Q_SLOTS: - void slotStart(); - void slotStop(); - void slotLaunchOne(); - void slotLaunchTest(); -private: - QPushButton * start; - QPushButton * stop; - -}; - -#endif diff --git a/kio/tests/ksycocatest.cpp b/kio/tests/ksycocatest.cpp deleted file mode 100644 index c667def3..00000000 --- a/kio/tests/ksycocatest.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (C) 2002-2006 David Faure - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -// ############ -// Some of the tests here (those that don't depend on other modules being installed) -// should be moved to kmimetypetest, and then kmimetypetest can be renamed ksycocatest. -// -// But it's still convenient to have an interactive test program, for checking things -// in the user's ksycoca instead of checking them in the safe .kde-unit-test one. -// -int main(int argc, char *argv[]) -{ - KCmdLineArgs::init(argc,argv, "ksycocatest", 0, ki18n("ksycocatest"), 0); - KApplication k;//(argc,argv,"whatever",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption - - QString instname = "kword"; - QString desktopPath = QString::fromLatin1( "Office/%1.desktop" ).arg( instname ); - qDebug( "Looking for %s", desktopPath.toLatin1().constData() ); - KService::Ptr service = KService::serviceByDesktopPath( desktopPath ); - if ( service ) - qDebug( "found: %s", service->entryPath().toLatin1().constData() ); - else - qDebug( "not found" ); - - qDebug( "Looking for desktop name = %s", instname.toLatin1().constData() ); - service = KService::serviceByDesktopName( instname ); - if ( service ) - qDebug( "found: %s", service->entryPath().toLatin1().constData() ); - else - qDebug( "not found" ); - - KService::Ptr se; - - - qDebug("Trying to look for kpager"); - se = KService::serviceByDesktopName("kpager"); - if ( se ) - { - qDebug("Found it !"); - qDebug("Comment is %s", qPrintable(se->comment())); - QVariant qv = se->property("X-DocPath"); - qDebug("Property type is %s", qv.typeName()); - qDebug("Property value is %s", qPrintable(qv.toString())); - } - else - { - qDebug("Not found !"); - } - - qDebug("Trying to look for System/kpager.desktop"); - se = KService::serviceByDesktopPath("System/kpager.desktop"); - if ( se ) - { - qDebug("Found it !"); - qDebug("Comment is %s", qPrintable(se->comment())); - } - else - { - qDebug("Not found !"); - } - - qDebug("Trying to look for System/fake-entry.desktop"); - se = KService::serviceByDesktopPath("System/fake-entry.desktop"); - if ( se ) - { - qDebug("Found it !"); - qDebug("Comment is %s", qPrintable(se->comment())); - } - else - { - qDebug("Not found !"); - } - -#if 1 - KServiceGroup::Ptr root = KServiceGroup::root(); - KServiceGroup::List list = root->entries(); - //KServiceGroup::Ptr topGroup = KServiceGroup::childGroup( "kview" ); - //Q_ASSERT( topGroup ); - //KServiceGroup::List list = topGroup->entries(); - - KServiceGroup::Ptr first; - - qDebug("Found %d entries", list.count()); - for( KServiceGroup::List::ConstIterator it = list.constBegin(); - it != list.constEnd(); ++it) - { - KSycocaEntry::Ptr p = (*it); - if (p->isType(KST_KService)) - { - KService::Ptr service = KService::Ptr::staticCast( p ); - qDebug("%s", qPrintable(service->name())); - qDebug("%s", qPrintable(service->entryPath())); - } - else if (p->isType(KST_KServiceGroup)) - { - KServiceGroup::Ptr serviceGroup = KServiceGroup::Ptr::staticCast(p); - qDebug(" %s -->", qPrintable(serviceGroup->caption())); - if (!first) first = serviceGroup; - } - else - { - qDebug("KServiceGroup: Unexpected object in list!"); - } - } - - if (first) - { - list = first->entries(); - qDebug("Found %d entries",list.count()); - for( KServiceGroup::List::ConstIterator it = list.constBegin(); - it != list.constEnd(); ++it) - { - KSycocaEntry::Ptr p = (*it); - if (p->isType(KST_KService)) - { - KService::Ptr service = KService::Ptr::staticCast( p ); - qDebug(" %s", qPrintable(service->name())); - } - else if (p->isType(KST_KServiceGroup)) - { - KServiceGroup::Ptr serviceGroup = KServiceGroup::Ptr::staticCast(p); - qDebug(" %s -->", qPrintable(serviceGroup->caption())); - } - else - { - qDebug("KServiceGroup: Unexpected object in list!"); - } - } - } - - qDebug("--protocols--"); - QStringList stringL = KProtocolInfo::protocols(); - qDebug() << stringL; -#endif - return 0; -} diff --git a/kio/tests/ksycocaupdatetest.cpp b/kio/tests/ksycocaupdatetest.cpp deleted file mode 100644 index bba20cff..00000000 --- a/kio/tests/ksycocaupdatetest.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -#include -#include - -int main(int argc, char *argv[]) -{ - KCmdLineArgs::init(argc,argv, "whatever", 0, ki18n("whatever"), 0); - KApplication k; - - KBuildSycocaProgressDialog::rebuildKSycoca(0); - return 0; -} diff --git a/kio/tests/kurlrequestertest.cpp b/kio/tests/kurlrequestertest.cpp deleted file mode 100644 index 1ddcc0f1..00000000 --- a/kio/tests/kurlrequestertest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include -#include - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init(argc, argv, "kurlrequestertest", 0, ki18n("kurlrequestertest"), "0", ki18n("test app")); - KApplication app; - app.setQuitOnLastWindowClosed(false); - - KUrl url = KUrlRequesterDialog::getUrl( "ftp://ftp.gnu.org/" ); - qDebug( "Selected url: %s", url.url().toLatin1().constData()); - - KUrlRequester *req = new KUrlRequester(); - KEditListWidget *el = new KEditListWidget( req->customEditor() ); - el->setWindowTitle( QLatin1String("Test") ); - el->show(); - - KUrlRequester *req1 = new KUrlRequester(); - req1->fileDialog(); - req1->setWindowTitle("AAAAAAAAAAAA"); - req1->show(); - - return app.exec(); -} diff --git a/kio/tests/netaccesstest.cpp b/kio/tests/netaccesstest.cpp deleted file mode 100644 index f7e98fcf..00000000 --- a/kio/tests/netaccesstest.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2004 David Faure - * - * 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 -#include -#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc,argv, "netaccesstest", 0, ki18n("netaccesstest"), 0); - KApplication app; - KUrl srcURL( "ftp://ftp.gnu.org/README" ); - KUrl tmpURL( "file:/tmp/netaccesstest_README" ); - - for ( uint i = 0; i < 4 ; ++i ) { - kDebug() << "file_copy"; - KIO::Job* job = KIO::file_copy(srcURL, tmpURL, -1, KIO::Overwrite); - if ( !KIO::NetAccess::synchronousRun(job, 0) ) - kError() << "file_copy failed: " << KIO::NetAccess::lastErrorString(); - else { - QFile f( tmpURL.path() ); - if (!f.open(QIODevice::ReadOnly)) - kFatal() << "Cannot open: " << f.fileName() << ". The error was: " << f.errorString(); - else { - f.close(); - } - } - } - - return 0; -} - diff --git a/kio/tests/previewtest.cpp b/kio/tests/previewtest.cpp deleted file mode 100644 index 38c1a530..00000000 --- a/kio/tests/previewtest.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "moc_previewtest.cpp" - -PreviewTest::PreviewTest() - :QWidget() -{ - QGridLayout *layout = new QGridLayout(this); - m_url = new KLineEdit(this); - m_url->setText(KDEDIR "/share/kdeui/pics/aboutkde.png"); - layout->addWidget(m_url, 0, 0); - QPushButton *btn = new QPushButton("Generate", this); - connect(btn, SIGNAL(clicked()), SLOT(slotGenerate())); - layout->addWidget(btn, 0, 1); - m_preview = new QLabel(this); - m_preview->setMinimumSize(400, 300); - layout->addWidget(m_preview, 1, 0, 1, 2); -} - -void PreviewTest::slotGenerate() -{ - KFileItemList items; - items.append(KFileItem(KFileItem::Unknown, KFileItem::Unknown, KUrl(m_url->text()), true)); - - KIO::PreviewJob *job = KIO::filePreview(items, QSize(m_preview->width(), m_preview->height())); - connect(job, SIGNAL(result(KJob*)), SLOT(slotResult(KJob*))); - connect(job, SIGNAL(gotPreview(KFileItem,QPixmap)), SLOT(slotPreview(KFileItem,QPixmap))); - connect(job, SIGNAL(failed(KFileItem)), SLOT(slotFailed())); -} - -void PreviewTest::slotResult(KJob*) -{ - kDebug() << "PreviewTest::slotResult(...)"; -} - -void PreviewTest::slotPreview(const KFileItem&, const QPixmap &pix) -{ - kDebug() << "PreviewTest::slotPreview()"; - m_preview->setPixmap(pix); -} - -void PreviewTest::slotFailed() -{ - kDebug() << "PreviewTest::slotFailed()"; - m_preview->setText("failed"); -} - -int main(int argc, char **argv) -{ - KCmdLineArgs::init(argc,argv, "previewtest", 0, ki18n("previewtest"), 0); - KApplication app; - PreviewTest *w = new PreviewTest; - w->show(); - return app.exec(); -} - diff --git a/kio/tests/previewtest.h b/kio/tests/previewtest.h deleted file mode 100644 index 3db76f60..00000000 --- a/kio/tests/previewtest.h +++ /dev/null @@ -1,25 +0,0 @@ - -#include -#include - -class KLineEdit; -#include -class KFileItem; - -class PreviewTest : public QWidget -{ - Q_OBJECT -public: - PreviewTest(); - -private Q_SLOTS: - void slotGenerate(); - void slotResult(KJob *); - void slotPreview( const KFileItem&, const QPixmap & ); - void slotFailed(); - -private: - KLineEdit *m_url; - QLabel *m_preview; -}; - diff --git a/kio/tests/speed.cpp b/kio/tests/speed.cpp deleted file mode 100644 index a9eb4bc8..00000000 --- a/kio/tests/speed.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2002, 2003 Stephan Kulow - * Copyright (C) 2003 David Faure - * - * 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 -#include -#include -#include "speed.h" -#include -#include -#include -#include -#include - -using namespace KIO; - -SpeedTest::SpeedTest( const KUrl & url ) - : QObject(0) -{ - setObjectName( "speed" ); - Job *job = listRecursive( url ); - //Job *job = del( KUrl("file:" + QDir::currentPath()) ); DANGEROUS ! - connect(job, SIGNAL(result(KJob*)), - SLOT(finished(KJob*))); - /*connect(job, SIGNAL(entries(KIO::Job*,KIO::UDSEntryList)), - SLOT(entries(KIO::Job*,KIO::UDSEntryList))); - */ -} - -void SpeedTest::entries(KIO::Job*, const UDSEntryList& list) { - - UDSEntryList::ConstIterator it = list.begin(); - const UDSEntryList::ConstIterator end = list.end(); - for (; it != end; ++it) - kDebug() << (*it).stringValue( UDSEntry::UDS_NAME ); -} - - -void SpeedTest::finished(KJob*) { - kDebug() << "job finished"; - qApp->quit(); -} - -int main(int argc, char **argv) { - - KCmdLineArgs::init( argc, argv, "speedapp", 0, ki18n("SpeedApp"), "0.0", ki18n("A KIO::listRecursive testing tool")); - - KCmdLineOptions options; - options.add("+[URL]", ki18n("the URL to list")); - - KCmdLineArgs::addCmdLineOptions( options ); - - KApplication app; -// This is the real "speed test" - // SpeedTest test( url ); - // app.exec(); - -// This is a test for KMountPoint and KIO::probably_slow_mounted etc. - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - KUrl url; - if ( args->count() == 1 ) - url = args->url(0); - else - url = QDir::currentPath(); - - const KMountPoint::List mountPoints = KMountPoint::currentMountPoints(); - - KMountPoint::Ptr mp = mountPoints.findByDevice(url.toLocalFile()); - if (!mp) { - kDebug() << "no mount point for device " << url << " found\n"; - } else - kDebug() << mp->mountPoint() << " is the mount point for device " << url; - - mp = mountPoints.findByPath(url.toLocalFile()); - if (!mp) { - kDebug() << "no mount point for path " << url << " found\n"; - } else { - kDebug() << mp->mountPoint() << " is the mount point for path " << url; - kDebug() << url << " is probably " << (mp->probablySlow() ? "slow" : "normal") << " mounted\n"; - } - - url.setPath(QDir::homePath()); - - mp = mountPoints.findByPath(url.toLocalFile()); - if (!mp) { - kDebug() << "no mount point for path " << url << " found\n"; - } else - kDebug() << mp->mountPoint() << " is the mount point for path " << url; -} - -#include "moc_speed.cpp" diff --git a/kio/tests/speed.h b/kio/tests/speed.h deleted file mode 100644 index 743e6226..00000000 --- a/kio/tests/speed.h +++ /dev/null @@ -1,26 +0,0 @@ -// -*- c++ -*- -#ifndef SPEED_H -#define SPEED_H - -#include -#include -#include - -class KJob; -namespace KIO { - class Job; -} - -class SpeedTest : public QObject { - Q_OBJECT - -public: - SpeedTest(const KUrl & url); - -private Q_SLOTS: - void entries( KIO::Job *, const KIO::UDSEntryList& ); - void finished( KJob *job ); - -}; - -#endif diff --git a/knotify/CMakeLists.txt b/knotify/CMakeLists.txt index 0a3b7755..63c9f63d 100644 --- a/knotify/CMakeLists.txt +++ b/knotify/CMakeLists.txt @@ -6,10 +6,6 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() - ########### next target ############### set(knotifyconfig_LIB_SRCS diff --git a/knotify/tests/CMakeLists.txt b/knotify/tests/CMakeLists.txt deleted file mode 100644 index 8a82bbc6..00000000 --- a/knotify/tests/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# This can be used for finding data files in the source dir, without installing them -project(knotifytest) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../config) - -########### knotifytest ############### - -set(knotifytest_SRCS main.cpp knotifytestwindow.cpp) - -kde4_add_manual_test(knotifytest ${knotifytest_SRCS}) - -target_link_libraries(knotifytest knotifyconfig kio) diff --git a/knotify/tests/knotifytest.notifyrc b/knotify/tests/knotifytest.notifyrc deleted file mode 100644 index f35f2ae1..00000000 --- a/knotify/tests/knotifytest.notifyrc +++ /dev/null @@ -1,626 +0,0 @@ -[Global] -IconName=knotifytest -Comment=Test for Knotify -Comment[af]=Toets vir Knotify -Comment[ar]=اختبار لـ Knotify -Comment[as]=Knotify ৰ বাবে পৰীক্ষা -Comment[ast]=Prueba pa KNotify -Comment[be@latin]=Test dla słužby „Knotify” -Comment[bg]=Тест за Knotify -Comment[bn]=কে-নোটিফাই-এর জন্য পরীক্ষা -Comment[bn_IN]=Knotify সংক্রান্ত পরীক্ষা -Comment[bs]=Proba za K‑obaveštenja -Comment[ca]=Prova pel Knotify -Comment[ca@valencia]=Prova pel Knotify -Comment[cs]=Test pro KNotify -Comment[csb]=Test dlô Knotify -Comment[da]=Test for Knotify -Comment[de]=Test für KNotify -Comment[el]=Δοκιμή του Knotify -Comment[en_GB]=Test for Knotify -Comment[eo]=Testo por Knotify -Comment[es]=Prueba para Knotify -Comment[et]=Knotify test -Comment[eu]=Knotify-rendako testua -Comment[fa]=آزمون برای Knotify -Comment[fi]=Testi ilmoitusjärjestelmälle -Comment[fr]=Test pour Knotify -Comment[fy]=Test foar Knotify -Comment[ga]=Tástáil Knotify -Comment[gl]=Proba do KNotify -Comment[gu]=Knotify માટે ચકાસણી -Comment[he]=בדיקה עבור Knotify -Comment[hi]=के-नोटिफ़ाई के लिए जाँच -Comment[hne]=के-नोटिफाई बर जांच -Comment[hr]=Proba za Knotify -Comment[hsb]=Test za Knotify -Comment[hu]=A KNotify tesztelése -Comment[hy]=Փորձ Knotify-ի համար -Comment[ia]=Essayo pro Knotify -Comment[id]=Tes Knotify -Comment[is]=Prófun á Knotify -Comment[it]=Prova per Knotify -Comment[ja]=Knotify のためのテスト -Comment[kk]=Knotify-дің сынағы -Comment[km]=សាកល្បង​សម្រាប់ Knotify -Comment[kn]=ಕೆನೋಟಿಫೈ ಗೆ ಪರೀಕ್ಷೆ -Comment[ko]=Knotify 테스트 -Comment[ku]=Ceribandin ji bo Khişyarî -Comment[lt]=Knotify testas -Comment[lv]=Knotify tests -Comment[mai]=के-नोटिफ़ाई क' लेल जाँच -Comment[mk]=Тест за Knotify -Comment[ml]=കെനോടിഫൈയുടെ പരിശോധന -Comment[mr]=Knotify करिता चाचणी -Comment[nb]=Test for Knotify -Comment[nds]=Na KNotify kieken -Comment[ne]=केडीई सूचनाका लागि परीक्षण -Comment[nl]=Test voor KNotify -Comment[nn]=Test for KNotify -Comment[or]=Knotify ପାଇଁ ପରୀକ୍ଷଣ -Comment[pa]=ਕੇ-ਨੋਟੀਫਾਈ ਲਈ ਟੈਸਟ -Comment[pl]=Test Knotify -Comment[ps]=لپاره ازموېنه Knotify د -Comment[pt]=Teste do KNotify -Comment[pt_BR]=Teste do KNotify -Comment[ro]=Test pentru Knotify -Comment[ru]=Проверка работы Knotify -Comment[se]=Knotify-geahččaleapmi -Comment[sk]=Test pre Knotify -Comment[sl]=Preizkus za Knotify -Comment[sr]=Проба за К‑обавештења -Comment[sr@ijekavian]=Проба за К‑обавјештења -Comment[sr@ijekavianlatin]=Proba za K‑obavještenja -Comment[sr@latin]=Proba za K‑obaveštenja -Comment[sv]=Test av Knotify -Comment[ta]=Knotifyக்கான சோதனை -Comment[tg]=Санҷиши Knotify -Comment[th]=การทดสอบสำหรับ KNotify -Comment[tr]=Knotify için Test -Comment[tt]=Knotify өчен тикшертү -Comment[ug]=Knotify ئۈچۈن سىناق -Comment[uk]=Тест для Knotify -Comment[vi]=Kiểm tra Knotify -Comment[wa]=Asprouvaedje po KNotify -Comment[x-test]=xxTest for Knotifyxx -Comment[zh_CN]=Knotify 测试 -Comment[zh_TW]=測試 Knotify -Version=4 - -[Context/group] -Name=Group -Name[af]=Groep -Name[ar]=المجموعة -Name[as]=সমষ্টি -Name[ast]=Agrupar -Name[be]=Група -Name[be@latin]=Hrupa -Name[bg]=Група -Name[bn]=গ্রুপ -Name[bn_IN]=দল -Name[bs]=Grupa -Name[ca]=Grup -Name[ca@valencia]=Grup -Name[cs]=Skupina -Name[csb]=Grëpa -Name[da]=Gruppe -Name[de]=Gruppe -Name[el]=Ομάδα -Name[en_GB]=Group -Name[eo]=Grupo -Name[es]=Grupo -Name[et]=Grupp -Name[eu]=Taldea -Name[fa]=گروه -Name[fi]=Ryhmä -Name[fr]=Groupe -Name[fy]=Groep -Name[ga]=Grúpa -Name[gl]=Grupo -Name[gu]=જૂથ -Name[he]=קבוצה -Name[hi]=समूह -Name[hne]=समूह -Name[hr]=Grupa -Name[hsb]=Skupina -Name[hu]=Csoport -Name[hy]=Խումբ -Name[ia]=Gruppo -Name[id]=Grup -Name[is]=Hópur -Name[it]=Gruppo -Name[ja]=グループ -Name[kk]=Топ -Name[km]=ក្រុម -Name[kn]=ಸಮೂಹ -Name[ko]=그룹 -Name[ku]=Kom -Name[lt]=Grupė -Name[lv]=Grupa -Name[mai]=समूह -Name[mk]=Група -Name[ml]=കൂട്ടം -Name[mr]=समूह -Name[ms]=Kumpulan -Name[nb]=Gruppe -Name[nds]=Koppel -Name[ne]=समूह -Name[nl]=Groep -Name[nn]=Gruppe -Name[oc]=Grop -Name[or]=ସମୂହ -Name[pa]=ਗਰੁੱਪ -Name[pl]=Grupa -Name[ps]=ډله -Name[pt]=Grupo -Name[pt_BR]=Grupo -Name[ro]=Grup -Name[ru]=Группа -Name[se]=Joavku -Name[si]=සමූහය -Name[sk]=Skupina -Name[sl]=Skupina -Name[sq]=Grupi -Name[sr]=Група -Name[sr@ijekavian]=Група -Name[sr@ijekavianlatin]=Grupa -Name[sr@latin]=Grupa -Name[sv]=Grupp -Name[ta]=குழுமம் -Name[tg]=Гурӯҳ -Name[th]=กลุ่ม -Name[tr]=Grup -Name[tt]=Группа -Name[ug]=گۇرۇپپا -Name[uk]=Група -Name[vi]=Nhóm -Name[wa]=Groupe -Name[x-test]=xxGroupxx -Name[zh_CN]=组 -Name[zh_TW]=群組 -Comment=The group -Comment[af]=Die groep -Comment[ar]=المجموعة -Comment[as]=সমষ্টিটো -Comment[ast]=El grupu -Comment[be@latin]=Hrupa -Comment[bg]=Група -Comment[bn]=গ্রুপটি -Comment[bn_IN]=দল -Comment[bs]=Grupa -Comment[ca]=El grup -Comment[ca@valencia]=El grup -Comment[cs]=Skupina -Comment[csb]=Grëpa -Comment[da]=Gruppen -Comment[de]=Die Gruppe -Comment[el]=Η ομάδα -Comment[en_GB]=The group -Comment[eo]=La grupo -Comment[es]=El grupo -Comment[et]=Grupp -Comment[eu]=Taldea -Comment[fa]=گروه -Comment[fi]=Ryhmä -Comment[fr]=Le groupe -Comment[fy]=De groep -Comment[ga]=An grúpa -Comment[gl]=O grupo -Comment[gu]=સમૂહ -Comment[he]=הקבוצה -Comment[hi]=समूह -Comment[hne]=समूह -Comment[hr]=Grupa -Comment[hsb]=Skupina -Comment[hu]=A csoport -Comment[hy]=Խումբը -Comment[ia]=Le gruppo -Comment[id]=Grup -Comment[is]=Hópurinn -Comment[it]=Il gruppo -Comment[ja]=グループ -Comment[kk]=Тобы -Comment[km]=ក្រុម -Comment[kn]=ಸಮೂಹ -Comment[ko]=그룹 -Comment[ku]=Kom -Comment[lt]=Grupė -Comment[lv]=Grupa -Comment[mai]=समूह -Comment[mk]=Групата -Comment[ml]=കൂട്ടം -Comment[mr]=समूह -Comment[nb]=Gruppa -Comment[nds]=De Koppel -Comment[ne]=समूह -Comment[nl]=De groep -Comment[nn]=Gruppa -Comment[or]=ଏହି ସମୂହ -Comment[pa]=ਗਰੁੱਪ -Comment[pl]=Grupa -Comment[ps]=ډله -Comment[pt]=O grupo -Comment[pt_BR]=O grupo -Comment[ro]=Grupul -Comment[ru]=Группа -Comment[se]=Joavku -Comment[si]=සමූහය -Comment[sk]=Skupina -Comment[sl]=Skupina -Comment[sr]=Група -Comment[sr@ijekavian]=Група -Comment[sr@ijekavianlatin]=Grupa -Comment[sr@latin]=Grupa -Comment[sv]=Gruppen -Comment[ta]=குழுமம் -Comment[tg]=Гурӯҳ -Comment[th]=กลุ่ม -Comment[tr]=Grup -Comment[tt]=Төркем -Comment[ug]=گۇرۇپپا -Comment[uk]=Група -Comment[vi]=Nhóm -Comment[wa]=Li groupe -Comment[x-test]=xxThe groupxx -Comment[zh_CN]=组 -Comment[zh_TW]=群組 -Icon=folder - -[Event/online] -Name=Online -Name[af]=Aanlyn -Name[ar]=متصل -Name[as]=অন-লাইন -Name[ast]=En llinia -Name[be]=У сеціве -Name[be@latin]=U siecivie -Name[bg]=Включен -Name[bn]=অনলাইন -Name[bn_IN]=অনলাইন অবস্থা -Name[bs]=Na vezi -Name[ca]=Connectat -Name[ca@valencia]=Connectat -Name[cs]=Online -Name[csb]=Online -Name[da]=Online -Name[de]=Online -Name[el]=Σε σύνδεση -Name[en_GB]=Online -Name[eo]=Enreta -Name[es]=Conectado -Name[et]=Võrgus -Name[eu]=Linean -Name[fa]=برخط -Name[fi]=Paikalla -Name[fr]=Connecté(e) -Name[fy]=Ferbining -Name[ga]=Ar Líne -Name[gl]=Con conexión -Name[gu]=ઓનલાઈન -Name[he]=מחובר -Name[hi]=ऑनलाइन -Name[hne]=आनलाइन -Name[hr]=Povezan -Name[hsb]=Online -Name[hu]=Online -Name[hy]=Առցանց -Name[ia]=In linea -Name[id]=Tersambung -Name[is]=Tengd(ur) -Name[it]=In linea -Name[ja]=オンライン -Name[kk]=Онлайн -Name[km]=លើ​បណ្ដាញ -Name[kn]=ಜಾಲಮುಖೇನ -Name[ko]=온라인 -Name[ku]=Girêdayî -Name[lt]=Prisijungę -Name[lv]=Tiešsaistē -Name[mai]=आनलाइन -Name[mk]=На мрежа -Name[ml]=ഓണ്‍ലൈന്‍ -Name[mr]=ऑनलाइन -Name[nb]=Tilkoblet -Name[nds]=Tokoppelt -Name[ne]=अनलाइन -Name[nl]=Online -Name[nn]=Tilkopla -Name[oc]=En linha -Name[or]=ସଂଯୁକ୍ତ -Name[pa]=ਆਨਲਾਇਨ -Name[pl]=Online -Name[ps]=پرليکه -Name[pt]=Ligado -Name[pt_BR]=Online -Name[ro]=Conectat -Name[ru]=В сети -Name[se]=Láktašuvvon -Name[si]=සබැඳි -Name[sk]=Online -Name[sl]=Povezan -Name[sq]=Lidhur -Name[sr]=На вези -Name[sr@ijekavian]=На вези -Name[sr@ijekavianlatin]=Na vezi -Name[sr@latin]=Na vezi -Name[sv]=Uppkopplad -Name[ta]=இணைப்பில் -Name[tg]=Дар шабака -Name[th]=ออนไลน์ -Name[tr]=Çevrim içi -Name[tt]=Онлайн -Name[ug]=توردا -Name[uk]=В мережі -Name[vi]=Trực tuyến -Name[wa]=Raloyî -Name[x-test]=xxOnlinexx -Name[zh_CN]=在线 -Name[zh_TW]=上線 -Comment=The contact is now connected -Comment[af]=Die kontak is nou gekoppel -Comment[ar]=المُراسَل متصل -Comment[as]=সংযোগৰ সৈতে এতিয়া সম্পৰ্ক কৰা হ'ল -Comment[ast]=Coneutóse'l contautu -Comment[be@latin]=Asoba ciapier spałučyłasia -Comment[bg]=Контактът е свързан -Comment[bn]=কনট্যাক্ট এখন সংযুক্ত -Comment[bn_IN]=পরিচিতির সাথে সংযোগ স্থাপিত হয়েছে -Comment[bs]=Kontakt je sada povezan -Comment[ca]=El contacte ara està connectat -Comment[ca@valencia]=El contacte ara està connectat -Comment[cs]=Kontakt je nyní připojen -Comment[csb]=Kòntakt je terô pòdłączony -Comment[da]=Kontakten er nu forbundet -Comment[de]=Der Kontakt ist jetzt verbunden -Comment[el]=Η επαφή είναι τώρα συνδεδεμένη -Comment[en_GB]=The contact is now connected -Comment[eo]=Konektiĝis al kontakto -Comment[es]=El contacto está ahora conectado -Comment[et]=Kontakt on nüüd võrgus -Comment[eu]=Kontaktua liinean dago -Comment[fa]=تماس، اکنون متصل است -Comment[fi]=Yhteystieto on nyt paikalla -Comment[fr]=Le contact est désormais connecté -Comment[fy]=De kontaktpersoan is no ferbûn -Comment[ga]=Tá an teagmháil ceangailte anois -Comment[gl]=O contacto está conectado -Comment[gu]=સંપર્ક હવે જોડાયેલ છે -Comment[he]=איש הקשר מחובר כעת -Comment[hi]=संपर्क जुड़ गया है -Comment[hne]=संपर्क जुड़ गे हे -Comment[hr]=Kontakt je sada spojen -Comment[hsb]=Kontakt je nětko nawjazany -Comment[hu]=A partner csatlakozott (online állapotú) -Comment[hy]=Կոնտակտը այժմ կապվել է։ -Comment[ia]=Le contacto nunc es connectite -Comment[id]=Kontak sekarang tersambung -Comment[is]=Tengiliðurinn er tengdur núna -Comment[it]=Il contatto è ora connesso -Comment[ja]=連絡先がオンラインになりました -Comment[kk]=Контакт қосылды -Comment[km]=ឥឡូវ ទំនាក់ទំនង​ត្រូវ​បាន​តភ្ជាប់ -Comment[kn]=ಸಂಪರ್ಕವ್ಯಕ್ತಿ ಈಗ ಸಂಪರ್ಕಗೊಂಡಿದ್ದಾನೆ -Comment[ko]=대화 상대가 연결됨 -Comment[ku]=Gehînek niha hate girêdan -Comment[lt]=Kontaktas dabar prisijungęs -Comment[lv]=Kontakts ir pieslēdzies -Comment[mai]=संपर्क जुड़ि गेल अछि -Comment[mk]=Контактот е сега на мрежа -Comment[ml]=പരിചയമുള്ളയാള്‍ ഇപ്പോള്‍ ബന്ധപ്പെട്ടിട്ടുണ്ട് -Comment[mr]=संपर्काशी आता जुळवणी झाली आहे -Comment[nb]=Kontakten er nå tilkoblet -Comment[nds]=De Kontakt is nu tokoppelt -Comment[ne]=सम्पर्क अहिले जडान गरिएको छ -Comment[nl]=De contact is nu verbonden -Comment[nn]=Kontakten er no kopla til -Comment[or]=ସମ୍ପର୍କ ଟି ବର୍ତ୍ତମାନ ସଂଯୋଗ ହୋଇଗଲା -Comment[pa]=ਸੰਪਰਕ ਹੁਣ ਕੁਨੈਕਟ ਹੋ ਗਿਆ ਹੈ -Comment[pl]=Kontakt jest obecnie dostępny -Comment[ps]=اړيکنيو اوس نښتې دی -Comment[pt]=O contacto ligou-se agora -Comment[pt_BR]=O contato está conectado agora -Comment[ro]=Contactul este acum conectat -Comment[ru]=Контакт сейчас подключён -Comment[se]=Oktavuohta lea dál láktašuvvon -Comment[si]=සබධතාව දැන් සම්බන්ධ වී ඇත -Comment[sk]=Kontakt sa práve pripojil -Comment[sl]=Stik je sedaj povezan -Comment[sr]=Контакт је сада повезан -Comment[sr@ijekavian]=Контакт је сада повезан -Comment[sr@ijekavianlatin]=Kontakt je sada povezan -Comment[sr@latin]=Kontakt je sada povezan -Comment[sv]=Kontakten är nu uppkopplad -Comment[ta]=தொடர்புடையவருடன் இணைக்கப்பட்டது -Comment[tg]=Алоқа ҳозир пайваст шуд -Comment[th]=ขณะนี้ได้เชื่อมต่อกับรายชื่อติดต่อแล้ว -Comment[tr]=Kişi şimdi bağlı -Comment[tt]=Бу контакт тоташты -Comment[ug]=ئالاقەداش باغلاندى -Comment[uk]=Контакт тепер з'єднаний -Comment[vi]=Hiện đã kết nối liên lạc -Comment[wa]=Li soçon est asteure raloyî -Comment[x-test]=xxThe contact is now connectedxx -Comment[zh_CN]=联系人现已上线 -Comment[zh_TW]=聯絡人已上線 -Contexts=group -Action=Popup - - -[Event/message] -Name=Message Received -Name[af]=Boodkap ontvang -Name[ar]=وصلت رسالة -Name[as]=সম্বাদ পোৱা গ'ল -Name[ast]=Mensaxe recibíu -Name[be@latin]=Novaje paviedamleńnie -Name[bg]=Съобшението е получено -Name[bn]=বার্তা এসেছে -Name[bn_IN]=বার্তা প্রাপ্ত হয়েছে -Name[bs]=Poruka primljena -Name[ca]=Missatge rebut -Name[ca@valencia]=Missatge rebut -Name[cs]=Obdržena zpráva -Name[csb]=Òtrzëmóno wiadło -Name[da]=Besked modtaget -Name[de]=Nachricht empfangen -Name[el]=Λήφθηκε μήνυμα -Name[en_GB]=Message Received -Name[eo]=Ricevis mesaĵon -Name[es]=Mensaje recibido -Name[et]=Saadi sõnum -Name[eu]=Mezua jaso da -Name[fa]=پیغام دریافت شد -Name[fi]=Uusi viesti -Name[fr]=Message reçu -Name[fy]=Berjocht ûntfongen -Name[ga]=Fuarthas Teachtaireacht -Name[gl]=Recibiuse unha mensaxe -Name[gu]=સંદેશો મળ્યો છે -Name[he]=ההודעה התקבלה -Name[hi]=संदेश प्राप्त -Name[hne]=संदेस प्राप्त -Name[hr]=Primljena poruka -Name[hsb]=Powěsć dóstata -Name[hu]=Üzenet érkezett -Name[hy]=Հաղորդագրությունը ստացված է -Name[ia]=Message recipite -Name[id]=Pesan Diterima -Name[is]=Skilaboð móttekin -Name[it]=Messaggio ricevuto -Name[ja]=メッセージを受信 -Name[kk]=Хабарлама келді -Name[km]=បាន​ទទួល​សារ -Name[kn]=ಸಂದೇಶ ಸ್ವೀಕರಿಸಲಾಗಿದೆ -Name[ko]=메시지 받음 -Name[ku]=Peyam Hat Standin -Name[lt]=Žinutė gauta -Name[lv]=Saņemts ziņojums -Name[mai]=संदेश प्राप्त -Name[mk]=Примена е порака -Name[ml]=സന്ദേശം ലഭിച്ചു -Name[mr]=संदेश प्राप्त झाले -Name[nb]=Melding mottatt -Name[nds]=Bescheed kregen -Name[ne]=सन्देश प्राप्त भयो -Name[nl]=Bericht ontvangen -Name[nn]=Melding motteken -Name[oc]=Messatge recebut -Name[or]=ସନ୍ଦେଶ ପ୍ରାପ୍ତ ହେଲା -Name[pa]=ਸੁਨੇਹਾ ਮਿਲਿਆ -Name[pl]=Otrzymano wiadomość -Name[ps]=استوزه ترلاسه شوه -Name[pt]=Mensagem Recebida -Name[pt_BR]=Mensagem recebida -Name[ro]=Mesaj primit -Name[ru]=Получено сообщение -Name[se]=Diehtu bođii -Name[si]=පණිවිඩය ලැබුනා -Name[sk]=Prijatá správa -Name[sl]=Prejeto sporočilo -Name[sr]=Примљена порука -Name[sr@ijekavian]=Примљена порука -Name[sr@ijekavianlatin]=Primljena poruka -Name[sr@latin]=Primljena poruka -Name[sv]=Meddelande mottaget -Name[ta]=தகவல் பெறப்பட்டது -Name[tg]=Паём қабул шуд -Name[th]=ได้รับข้อความ -Name[tr]=İleti Alındı -Name[tt]=Хәбәр кабул ителде -Name[ug]=ئۇچۇر قوبۇللىدى -Name[uk]=Повідомлення отримано -Name[vi]=Đã nhận tin nhắn -Name[wa]=Messaedje riçî -Name[x-test]=xxMessage Receivedxx -Name[zh_CN]=收到了消息 -Name[zh_TW]=接到訊息 -Comment=A Message has been received -Comment[af]='n Boodskap is ontvang -Comment[ar]=وصلت رسالة -Comment[as]=এটা সম্বাদ পোৱা হৈছে -Comment[ast]=Recibióse un mensaxe -Comment[be]=Была атрымана паведамленне -Comment[be@latin]=Atrymanaje novaje paviedamleńnie -Comment[bg]=Получено е съобщение -Comment[bn]=একটি বার্তা এসেছে -Comment[bn_IN]=একটি বার্তা প্রাপ্ত হয়েছে -Comment[bs]=Poruka je upravo primljena -Comment[ca]=S'ha rebut un missatge -Comment[ca@valencia]=S'ha rebut un missatge -Comment[cs]=Byla obdržena zpráva -Comment[csb]=Òstało òtrzëmóné wiadło -Comment[da]=En besked er blevet modtaget -Comment[de]=Es ist eine Nachricht empfangen worden -Comment[el]=Ένα μήνυμα λήφθηκε -Comment[en_GB]=A Message has been received -Comment[eo]=Ricevis mesaĵon -Comment[es]=Se ha recibido un mensaje -Comment[et]=Saadi sõnum -Comment[eu]=Mezu bat jaso da -Comment[fa]=پیغامی دریافت شده‌است -Comment[fi]=Uusi viesti on saapunut -Comment[fr]=Vous avez reçu un message -Comment[fy]=In berjocht is ûntfongen -Comment[ga]=Fuarthas teachtaireacht -Comment[gl]=Foi recibida unha mensaxe -Comment[gu]=સંદેશો મેળવવામાં આવ્યો છે -Comment[he]=ההודעה נשלחה -Comment[hi]=संदेश प्राप्त हो गया है -Comment[hne]=संदेस प्राप्त हो गे हे -Comment[hr]=Poruka je primljena -Comment[hsb]=Powěsć je so dóstała -Comment[hu]=Üzenet érkezett -Comment[hy]=Հաղորդագրություն է ընդունվել -Comment[ia]=Un message ha essite recipite -Comment[id]=Sebuah pesan telah diterima -Comment[is]=Tekið hefur verið á móti skilaboðum -Comment[it]=È stato ricevuto un messaggio -Comment[ja]=メッセージを受信しました -Comment[kk]=Хабарлама келді -Comment[km]=សារ​ត្រូវ​បាន​ទទួល -Comment[kn]=ಒಂದು ಸಂದೇಶವನ್ನು ಸ್ವೀಕರಿಸಲಾಗಿದೆ -Comment[ko]=메시지를 받았음 -Comment[ku]=Peyamek hat standin -Comment[lt]=Gauta žinutė -Comment[lv]=Ir saņemts ziņojums -Comment[mai]=संदेश प्राप्त भए गेल अछि -Comment[mk]=Беше примена порака -Comment[ml]=ഒരു സന്ദേശം ലഭിച്ചു -Comment[mr]=संदेश प्राप्त झाले आहे -Comment[nb]=En melding er mottatt -Comment[nds]=Dat hett en Bescheed geven -Comment[ne]=सन्देश प्राप्त गरियो -Comment[nl]=Er is een bericht ontvangen -Comment[nn]=Ei melding er motteken -Comment[or]=ଗୋଟିଏ ସନ୍ଦେଶ ପ୍ରାପ୍ତ ହେଲା -Comment[pa]=ਇੱਕ ਸੁਨੇਹਾ ਮਿਲਿਆ ਹੈ -Comment[pl]=Otrzymano wiadomość -Comment[ps]=يوه استوزه ترلاسه شوه -Comment[pt]=Foi recebida uma mensagem -Comment[pt_BR]=Uma mensagem foi recebida -Comment[ro]=A fost primit un mesaj -Comment[ru]=Было получено сообщение -Comment[se]=Diehtu bođii -Comment[sk]=Správa bola prijatá -Comment[sl]=Prejeto je bilo sporočilo -Comment[sr]=Порука је управо примљена -Comment[sr@ijekavian]=Порука је управо примљена -Comment[sr@ijekavianlatin]=Poruka je upravo primljena -Comment[sr@latin]=Poruka je upravo primljena -Comment[sv]=Ett meddelande har tagits emot -Comment[ta]=தகவலொன்று பெறப்பட்டுள்ளது -Comment[te]=సందేశం వచ్చింది -Comment[tg]=Як паём қабул карда шуд -Comment[th]=ได้รับข้อความแล้ว -Comment[tr]=Bir ileti alındı -Comment[tt]=Хәбәр кабул ителгән иде -Comment[ug]=بىر ئۇچۇر قوبۇللىدى -Comment[uk]=Повідомлення було отримано -Comment[vi]=Đã nhận được một tin nhắn -Comment[wa]=On messaedje a stî rçî -Comment[x-test]=xxA Message has been receivedxx -Comment[zh_CN]=收到了一条消息 -Comment[zh_TW]=訊息已接收 -Contexts=group -Action=Popup - diff --git a/knotify/tests/knotifytestui.rc b/knotify/tests/knotifytestui.rc deleted file mode 100644 index 7843c78d..00000000 --- a/knotify/tests/knotifytestui.rc +++ /dev/null @@ -1,15 +0,0 @@ - - - - &Extra - - - - - -Main Toolbar - - - - - diff --git a/knotify/tests/knotifytestview.ui b/knotify/tests/knotifytestview.ui deleted file mode 100644 index 8b7dcbd2..00000000 --- a/knotify/tests/knotifytestview.ui +++ /dev/null @@ -1,179 +0,0 @@ - - Olivier Goffart - KNotifyTestView - - - - 0 - 0 - 525 - 434 - - - - - 9 - - - 6 - - - - - 0 - - - 6 - - - - - Group: - - - - - - - - topLevel1 - - - - - friends - - - - - familly - - - - - topLevel2 - - - - - - - - - - 0 - - - 6 - - - - - contact name - - - - - - - - - - - - message - - - - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Read - - - - - - - - - 0 - - - 6 - - - - - send event - - - - - - - contact online - - - - - - - message received - - - - - - - - - 0 - - - 6 - - - - - Configure (global) - - - - - - - Configure (context) - - - - - - - - - diff --git a/knotify/tests/knotifytestwindow.cpp b/knotify/tests/knotifytestwindow.cpp deleted file mode 100644 index 84bdc405..00000000 --- a/knotify/tests/knotifytestwindow.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2005-2006 by Olivier Goffart - */ - -#include "knotifytestwindow.h" -#include "knotification.h" -#include "knotifyconfigwidget.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// ------------------------------------------------------------------------ - -KNotifyTestWindow::KNotifyTestWindow(QWidget *parent) - : KXmlGuiWindow(parent) , m_nbNewMessage(0) -{ - QWidget *w=new QWidget(this); - view.setupUi(w); -// statusBar()->message(i18n("Test program for KNotify")); - setCaption( i18n("Test program for KNotify") ); - - KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); - - setCentralWidget(w); - - // set up the actions - actionCollection()->addAction(KStandardAction::Quit, this, SLOT(close())); - actionCollection()->addAction(KStandardAction::KeyBindings, guiFactory(), SLOT(configureShortcuts())); - - createGUI(); - - connect ( view.b_online , SIGNAL(clicked()) , this , SLOT(slotSendOnlineEvent())); - connect ( view.b_message , SIGNAL(clicked()) , this , SLOT(slotSendMessageEvent())); - connect ( view.b_read , SIGNAL(clicked()) , this , SLOT(slotMessageRead())); - connect ( view.b_confG , SIGNAL(clicked()) , this , SLOT(slotConfigureG())); - connect ( view.b_confC , SIGNAL(clicked()) , this , SLOT(slotConfigureC())); - -} - -void KNotifyTestWindow::slotSendOnlineEvent() -{ - KNotification::ContextList contexts; - contexts.append( qMakePair( QString("group") , view.c_group->currentText() ) ); - KNotification *n = new KNotification( "online", this ); - n->setText(i18n("the contact %1 is now online", view.c_name->text() )); - n->setContexts(contexts); - n->sendEvent(); -} - -void KNotifyTestWindow::slotSendMessageEvent( ) -{ - m_nbNewMessage++; - if(!m_readNotif) - { - KNotification *n=new KNotification( "message", this, KNotification::Persistent ); - n->setText(i18n( "new message : %1" , view.c_text->toPlainText() )); - n->setActions( QStringList( i18n("Read") ) ); - connect( n , SIGNAL(activated(uint)), this , SLOT(slotMessageRead())); - - m_readNotif=n; - } - else - { - m_readNotif->setText(i18n("%1 new messages", m_nbNewMessage)); - } - - KNotification::ContextList cl; - cl << qMakePair( QString("group") , view.c_group->currentText() ); - m_readNotif->setContexts( cl ); - m_readNotif->sendEvent(); -} - -void KNotifyTestWindow::slotMessageRead( ) -{ - m_nbNewMessage=0; - if(m_readNotif) - m_readNotif->close(); - KMessageBox::information ( this , view.c_text->toPlainText() , i18n("reading message") ); -} - -void KNotifyTestWindow::slotConfigureG( ) -{ - KNotifyConfigWidget::configure(this); -} - -void KNotifyTestWindow::slotConfigureC( ) -{ - KDialog dialog(this); - KNotifyConfigWidget *w=new KNotifyConfigWidget(&dialog); - w->setApplication(QString() , "group", view.c_group->currentText()); - dialog.setMainWidget(w); - if(dialog.exec()) - { - w->save(); - } -} - - - - -#include "moc_knotifytestwindow.cpp" - - diff --git a/knotify/tests/knotifytestwindow.h b/knotify/tests/knotifytestwindow.h deleted file mode 100644 index ea77178c..00000000 --- a/knotify/tests/knotifytestwindow.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2005-2006 by Olivier Goffart - */ - -#ifndef __KNotifyTestWINDOW_H__ -#define __KNotifyTestWINDOW_H__ - -#include -#include "ui_knotifytestview.h" -#include - -class KNotification; - - -class KNotifyTestWindow : public KXmlGuiWindow -{ - Q_OBJECT - - public: - KNotifyTestWindow( QWidget* parent = 0); - - private: - Ui::KNotifyTestView view; - QPointer m_readNotif; - int m_nbNewMessage; - - public Q_SLOTS: - void slotSendOnlineEvent(); - void slotSendMessageEvent(); - void slotMessageRead(); - - void slotConfigureG(); - void slotConfigureC(); -}; - - - -#endif diff --git a/knotify/tests/main.cpp b/knotify/tests/main.cpp deleted file mode 100644 index 3116744d..00000000 --- a/knotify/tests/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2005-2006 by Olivier Goffart - */ -#include -#include -#include -#include - -#include "knotifytestwindow.h" - -int main( int argc, char ** argv ) -{ - KCmdLineOptions options; - KAboutData aboutData( "knotifytest", 0, ki18n("KNotifyTest"), "0.1", - ki18n( "A test program for KDE Notifications" ), - KAboutData::License_GPL, - ki18n("(c) 2006, Olivier Goffart")); - aboutData.addAuthor(ki18n("Olivier Goffart"), KLocalizedString(), "ogoffart @ kde.org"); - KCmdLineArgs::init( argc, argv, &aboutData ); - KCmdLineArgs::addCmdLineOptions( options ); - - KApplication a; - KNotifyTestWindow* knotifytestwindow = new KNotifyTestWindow; - knotifytestwindow->show(); - - return a.exec(); -} diff --git a/kparts/tests/CMakeLists.txt b/kparts/tests/CMakeLists.txt index 0d318ce0..25212168 100644 --- a/kparts/tests/CMakeLists.txt +++ b/kparts/tests/CMakeLists.txt @@ -1,45 +1,5 @@ include_directories(${KDE4_KPARTS_INCLUDES}) -########### next target ############### - -set(kpartstest_SRCS - testmainwindow.cpp - parts.cpp - notepad.cpp -) - -kde4_add_manual_test(kparts-kpartstest ${kpartstest_SRCS}) - -target_link_libraries(kparts-kpartstest kparts) - -########### next target ############### - -set(normalktmtest_SRCS - normalktm.cpp - parts.cpp - notepad.cpp -) - -kde4_add_manual_test(kparts-normalktmtest ${normalktmtest_SRCS}) - -target_link_libraries(kparts-normalktmtest kparts) - -########### next target ############### - -kde4_add_manual_test(kparts-partviewer partviewer.cpp) - -target_link_libraries(kparts-partviewer kparts) - -########### next target ############### - -kde4_add_plugin(notepadpart notepad.cpp) - -target_link_libraries(notepadpart kparts) - -target_compile_definitions(notepadpart PRIVATE -DKDESRCDIR="${CMAKE_CURRENT_SOURCE_DIR}/") - -install(TARGETS notepadpart DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}) - ########### unit tests ############### MACRO(KPARTS_UNIT_TESTS) @@ -48,21 +8,8 @@ MACRO(KPARTS_UNIT_TESTS) target_link_libraries(kparts-${_testname} ${QT_QTTEST_LIBRARY} kparts) ENDFOREACH(_testname) ENDMACRO(KPARTS_UNIT_TESTS) -MACRO(KPARTS_EXECUTABLE_TESTS) - FOREACH(_testname ${ARGN}) - kde4_add_manual_test(kparts-${_testname} ${_testname}.cpp) - target_link_libraries(kparts-${_testname} ${QT_QTTEST_LIBRARY} kparts) - ENDFOREACH(_testname) -ENDMACRO(KPARTS_EXECUTABLE_TESTS) KPARTS_UNIT_TESTS( parttest ) -########### install files ############### - -# Normally this would be needed. For the test programs we can avoid that, see addResourceDir. -#install( FILES notepadpart.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/notepadpart ) -#install( FILES partviewer_shell.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/partviewer ) -#install( FILES kpartstest_shell.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/kpartstest ) -#install( FILES kpartstest_part1.rc DESTINATION ${KDE4_DATA_INSTALL_DIR}/kpartstestpart ) diff --git a/kparts/tests/kpartstest_part1.rc b/kparts/tests/kpartstest_part1.rc deleted file mode 100644 index 9a5c10df..00000000 --- a/kparts/tests/kpartstest_part1.rc +++ /dev/null @@ -1,21 +0,0 @@ - - - - &File - - - Part1's Menu - - - Stupid Submenu - - - - - - - - - - - diff --git a/kparts/tests/kpartstest_part2.rc b/kparts/tests/kpartstest_part2.rc deleted file mode 100644 index d894af47..00000000 --- a/kparts/tests/kpartstest_part2.rc +++ /dev/null @@ -1,8 +0,0 @@ - - - - &File - - - - diff --git a/kparts/tests/kpartstest_shell.rc b/kparts/tests/kpartstest_shell.rc deleted file mode 100644 index 8ca18f28..00000000 --- a/kparts/tests/kpartstest_shell.rc +++ /dev/null @@ -1,27 +0,0 @@ - - - - &File - - - - - - - - - - - - - BlahFoo - - Dummdidumm - - - - - - - - diff --git a/kparts/tests/normalktm.cpp b/kparts/tests/normalktm.cpp deleted file mode 100644 index 1b2d5c21..00000000 --- a/kparts/tests/normalktm.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - Copyright (c) 2000 David Faure - Copyright (c) 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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 "normalktm.h" -#include "parts.h" -#include "notepad.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -TestMainWindow::TestMainWindow() - : KXmlGuiWindow() -{ - // We can do this "switch active part" because we have a splitter with - // two items in it. - // I wonder what kdevelop uses/will use to embed kedit, BTW. - m_splitter = new QSplitter( this ); - - m_part1 = new Part1(this, m_splitter); - m_part2 = new Part2(this, m_splitter); - - QMenu * pFile = new QMenu( "File", menuBar() ); - KActionCollection * coll = actionCollection(); - KAction * paLocal = new KAction( "&View local file", this ); - coll->addAction( "open_local_file", paLocal ); - connect(paLocal, SIGNAL(triggered()), this, SLOT(slotFileOpen())); - // No XML: we need to add our actions to the menus ourselves - pFile->addAction(paLocal); - - KAction * paRemote = new KAction( "&View remote file", this ); - coll->addAction( "open_remote_file", paRemote ); - connect(paRemote, SIGNAL(triggered()), this, SLOT(slotFileOpenRemote())); - pFile->addAction(paRemote); - - m_paEditFile = new KAction( "&Edit file", this ); - coll->addAction( "edit_file", m_paEditFile ); - connect(m_paEditFile, SIGNAL(triggered()), this, SLOT(slotFileEdit())); - pFile->addAction(m_paEditFile); - - m_paCloseEditor = new KAction( "&Close file editor", this ); - coll->addAction( "close_editor", m_paCloseEditor ); - connect(m_paCloseEditor, SIGNAL(triggered()), this, SLOT(slotFileCloseEditor())); - m_paCloseEditor->setEnabled(false); - pFile->addAction(m_paCloseEditor); - - KAction * paQuit = new KAction( "&Quit", this ); - coll->addAction( "shell_quit", paQuit ); - connect(paQuit, SIGNAL(triggered()), this, SLOT(close())); - paQuit->setIcon(KIcon("application-exit")); - pFile->addAction(paQuit); - - setCentralWidget( m_splitter ); - m_splitter->setMinimumSize( 400, 300 ); - - m_splitter->show(); - - m_editorpart = 0; -} - -TestMainWindow::~TestMainWindow() -{ -} - -void TestMainWindow::slotFileOpen() -{ - if ( !m_part1->openUrl( KStandardDirs::locate("data", KGlobal::mainComponent().componentName()+"/kpartstest_shell.rc" ) ) ) - KMessageBox::error(this, "Couldn't open file !"); -} - -void TestMainWindow::slotFileOpenRemote() -{ - KUrl u ( "http://www.kde.org/index.html" ); - if ( !m_part1->openUrl( u ) ) - KMessageBox::error(this, "Couldn't open file !"); -} - -void TestMainWindow::embedEditor() -{ - // replace part2 with the editor part - delete m_part2; - m_part2 = 0; - m_editorpart = new NotepadPart( m_splitter, this ); - m_editorpart->setReadWrite(); // read-write mode - ////// m_manager->addPart( m_editorpart ); - m_editorpart->widget()->show(); //// we need to do this in a normal KTM.... - m_paEditFile->setEnabled(false); - m_paCloseEditor->setEnabled(true); -} - -void TestMainWindow::slotFileCloseEditor() -{ - delete m_editorpart; - m_editorpart = 0; - m_part2 = new Part2(this, m_splitter); - ////// m_manager->addPart( m_part2 ); - m_part2->widget()->show(); //// we need to do this in a normal KTM.... - m_paEditFile->setEnabled(true); - m_paCloseEditor->setEnabled(false); -} - -void TestMainWindow::slotFileEdit() -{ - if ( !m_editorpart ) - embedEditor(); - // TODO use KFileDialog to allow testing remote files - if (!m_editorpart->openUrl(KUrl(QDir::current().absolutePath()+"/kpartstest_shell.rc"))) - KMessageBox::error(this,"Couldn't open file !"); -} - -int main( int argc, char **argv ) -{ - // we cheat and call ourselves kpartstest for TestMainWindow::slotFileOpen() - KCmdLineArgs::init( argc, argv, "kpartstest", 0, ki18n("kpartstest"), 0); - KApplication app; - - TestMainWindow *shell = new TestMainWindow; - shell->show(); - - app.exec(); - - return 0; -} - -#include "moc_normalktm.cpp" diff --git a/kparts/tests/normalktm.h b/kparts/tests/normalktm.h deleted file mode 100644 index b9957940..00000000 --- a/kparts/tests/normalktm.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2000 David Faure - Copyright (c) 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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. -*/ - -#ifndef __normalktm_h__ -#define __normalktm_h__ - -#include -#include - -class KAction; -#include - -class TestMainWindow : public KXmlGuiWindow -{ - Q_OBJECT -public: - TestMainWindow(); - virtual ~TestMainWindow(); - -protected Q_SLOTS: - void slotFileOpen(); - void slotFileOpenRemote(); - void slotFileEdit(); - void slotFileCloseEditor(); - -protected: - void embedEditor(); - -private: - - KAction * m_paEditFile; - KAction * m_paCloseEditor; - - KParts::ReadOnlyPart *m_part1; - KParts::Part *m_part2; - KParts::ReadWritePart *m_editorpart; - QWidget *m_splitter; -}; - -#endif diff --git a/kparts/tests/notepad.cpp b/kparts/tests/notepad.cpp deleted file mode 100644 index 9baf5f90..00000000 --- a/kparts/tests/notepad.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright (c) 1999, 2000 David Faure - Copyright (c) 1999, 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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 "notepad.h" -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -K_PLUGIN_FACTORY(NotepadFactory, registerPlugin();) -K_EXPORT_PLUGIN(NotepadFactory("notepadpart")) - -NotepadPart::NotepadPart( QWidget* parentWidget, - QObject* parent, - const QVariantList& ) - : KParts::ReadWritePart( parent ) -{ - setComponentData(NotepadFactory::componentData()); - - m_edit = new QTextEdit( parentWidget ); - m_edit->setPlainText( "NotepadPart's multiline edit" ); - setWidget( m_edit ); - - KAction* searchReplace = new KAction( "Search and replace", this ); - actionCollection()->addAction( "searchreplace", searchReplace ); - connect(searchReplace, SIGNAL(triggered()), this, SLOT(slotSearchReplace())); - - // KXMLGUIClient looks in the "data" resource for the .rc files - // This line is for test programs only! - componentData().dirs()->addResourceDir( "data", KDESRCDIR ); - setXMLFile( "notepadpart.rc" ); - - setReadWrite( true ); -} - -NotepadPart::~NotepadPart() -{ -} - -void NotepadPart::setReadWrite( bool rw ) -{ - m_edit->setReadOnly( !rw ); - if (rw) - connect( m_edit, SIGNAL(textChanged()), this, SLOT(setModified()) ); - else - disconnect( m_edit, SIGNAL(textChanged()), this, SLOT(setModified()) ); - - ReadWritePart::setReadWrite( rw ); -} - -KAboutData* NotepadPart::createAboutData() -{ - return new KAboutData( "notepadpart", 0, ki18n( "Notepad" ), "2.0" ); -} - -bool NotepadPart::openFile() -{ - kDebug() << "NotepadPart: opening " << localFilePath(); - QFile f(localFilePath()); - QString s; - if ( f.open(QIODevice::ReadOnly) ) { - QTextStream t( &f ); - t.setCodec( "UTF-8" ); - s = t.readAll(); - f.close(); - } - m_edit->setPlainText(s); - - emit setStatusBarText( url().prettyUrl() ); - - return true; -} - -bool NotepadPart::saveFile() -{ - if ( !isReadWrite() ) - return false; - QFile f(localFilePath()); - QString s; - if ( f.open(QIODevice::WriteOnly) ) { - QTextStream t( &f ); - t.setCodec( "UTF-8" ); - t << m_edit->toPlainText(); - f.close(); - return true; - } else - return false; -} - -void NotepadPart::slotSearchReplace() -{ -} - -#include "moc_notepad.cpp" diff --git a/kparts/tests/notepad.desktop b/kparts/tests/notepad.desktop deleted file mode 100644 index f6f39d8e..00000000 --- a/kparts/tests/notepad.desktop +++ /dev/null @@ -1,101 +0,0 @@ -[Desktop Entry] -Name=Notepad (example) -Name[af]=Notablok (voorbeeld) -Name[ar]=مفكرة (مثال) -Name[as]=Notepad (উদাহৰণ) -Name[ast]=Bloc de notes (exemplu) -Name[be]=Нататнік (узор) -Name[be@latin]=Natatnik (uzor) -Name[bg]=Notepad (пример) -Name[bn]=নোটপ্যাড (উদাহরণ) -Name[bn_IN]=Notepad (উদাহরণ) -Name[br]=Skrabvloc'h (skouer) -Name[bs]=Bilježnica (primjer) -Name[ca]=Bloc de notes (exemple) -Name[ca@valencia]=Bloc de notes (exemple) -Name[cs]=Poznámkový blok (příklad) -Name[csb]=Notownik (przëmiôr) -Name[cy]=Pad ysgrifennu (enghraifft) -Name[da]=Notepad (eksempel) -Name[de]=Notizblock-Beispiel -Name[el]=Σημειωματάριο (παράδειγμα) -Name[en_GB]=Notepad (example) -Name[eo]=Notlibro (ekzemplo) -Name[es]=Bloc de notas (ejemplo) -Name[et]=Notepad (näidis) -Name[eu]=Notepad (adibidea) -Name[fa]=دفترچه یادداشت)مثال( -Name[fi]=Muistio (esimerkki) -Name[fr]=Bloc-notes (exemple) -Name[fy]=Skriuwboekje (foarbyld) -Name[ga]=Notepad (sampla) -Name[gl]=Caderno de notas (exemplo) -Name[gu]=નોટપેડ (ઉદાહરણ) -Name[he]=פנקס רשימות (דוגמה) -Name[hi]=नोटपैड (उदाहरण) -Name[hne]=नोटपैड (उदाहरन) -Name[hr]=Notepad (primjer) -Name[hsb]=Zapisnik (přikład) -Name[hu]=Jegyzettömb (példa) -Name[hy]=Գրքույկ (օրինակ) -Name[ia]=Notepad (exemplo) -Name[id]=Notepad (contoh) -Name[is]=Notepad (sýnishorn) -Name[it]=Blocco note (esempio) -Name[ja]=ノートパッド (例) -Name[kk]=Блокнот (мысал) -Name[km]=Notepad (ឧទាហរណ៍) -Name[kn]=ನೋಟ್ಪಾಡ್ (ಉದಾಹರಣೆ) -Name[ko]=메모장 (예제) -Name[ku]=Notepad (mînak) -Name[lb]=Notizblock (Beispill) -Name[lt]=Notepad (pavyzdys) -Name[lv]=Notepad (piemērs) -Name[mai]=नोटपैड (उदाहरण) -Name[mk]=Тетратка (пример) -Name[ml]=നോട്ട്പാഡ് (ഉദാഹരണം) -Name[mr]=नोटपॅड (उदाहरण) -Name[ms]=Notepad (contoh) -Name[nb]=Notisblokk (eksempel) -Name[nds]=Notizzeddel (Bispeel) -Name[ne]=नोटप्याड (उदाहरण) -Name[nl]=Kladblok (voorbeeld) -Name[nn]=Notisblokk (eksempel) -Name[or]=ଟୀପାଖାତା (ଉଦାହରଣ) -Name[pa]=ਨੋਟਪੈਡ (ਉਦਾਹਰਨ) -Name[pl]=Notatnik (przykład) -Name[ps]=(بېلګه) Notepad -Name[pt]=Bloco de Notas (exemplo) -Name[pt_BR]=Bloco de notas (exemplo) -Name[ro]=Notepad (exemplu) -Name[ru]=Блокнот (пример) -Name[se]=Čállingirjjáš (ovdamearka) -Name[si]=සටහන්පොත (උදාහරණය) -Name[sk]=Poznámkový blok (príklad) -Name[sl]=Beležnica (zgled) -Name[sr]=Бележница (пример) -Name[sr@ijekavian]=Биљежница (примјер) -Name[sr@ijekavianlatin]=Bilježnica (primjer) -Name[sr@latin]=Beležnica (primer) -Name[sv]=Notepad (exempel) -Name[ta]=நோட்பாட் (உதாரணம்) -Name[te]=నోట్ పేడ్ (ఉదాహరణ) -Name[tg]=Notepad (қолиб) -Name[th]=โน้ตแพด (ตัวอย่าง) -Name[tr]=Not defteri (örnek) -Name[tt]=Дәфтәр (үрнәк) -Name[ug]=خاتىرە دەپتەر (مىسال) -Name[uk]=Записна книжка (приклад) -Name[uz]=Yon daftarcha (misol) -Name[uz@cyrillic]=Ён дафтарча (мисол) -Name[vi]=Notepad (ví dụ) -Name[wa]=Blok di notes (egzimpe) -Name[xh]=Iphetshan lokubhala (umzekelo) -Name[x-test]=xxNotepad (example)xx -Name[zh_CN]=记事本(示例) -Name[zh_HK]=記事本(範例) -Name[zh_TW]=記事本(範例) -MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; -X-KDE-ServiceTypes=KParts/ReadOnlyPart -X-KDE-Library=notepadpart -Type=Service diff --git a/kparts/tests/notepad.h b/kparts/tests/notepad.h deleted file mode 100644 index 46dc9029..00000000 --- a/kparts/tests/notepad.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (c) 1999, 2000 David Faure - Copyright (c) 1999, 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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. -*/ - - -#ifndef NOTEPAD_H -#define NOTEPAD_H - -#include - -class KAboutData; -#include - -/** - * Who said writing a part should be complex ? :-) - * Here is a very simple kedit-like part - * @internal - */ -class NotepadPart : public KParts::ReadWritePart -{ - Q_OBJECT -public: - NotepadPart( QWidget* parentWidget, - QObject* parent, - const QVariantList& args = QVariantList() ); - virtual ~NotepadPart(); - - virtual void setReadWrite( bool rw ); - - static KAboutData* createAboutData(); - -protected: - virtual bool openFile(); - virtual bool saveFile(); - -protected Q_SLOTS: - void slotSearchReplace(); - -protected: - QTextEdit * m_edit; -}; - -#endif diff --git a/kparts/tests/notepadpart.rc b/kparts/tests/notepadpart.rc deleted file mode 100644 index 5bf49912..00000000 --- a/kparts/tests/notepadpart.rc +++ /dev/null @@ -1,13 +0,0 @@ - - - - &File - Notepad Stuff - - - - &Edit - - - - diff --git a/kparts/tests/parts.cpp b/kparts/tests/parts.cpp deleted file mode 100644 index 542893e7..00000000 --- a/kparts/tests/parts.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (c) 1999, 2000 David Faure - Copyright (c) 1999, 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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 - -#include "parts.h" -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -Part1::Part1( QObject *parent, QWidget * parentWidget ) - : KParts::ReadOnlyPart(parent), - m_componentData("kpartstestpart") -{ - setComponentData(m_componentData); - m_edit = new QTextEdit( parentWidget ); - setWidget( m_edit ); - - // KXMLGUIClient looks in the "data" resource for the .rc files - // This line is for test programs only! - m_componentData.dirs()->addResourceDir( "data", KDESRCDIR ); - setXMLFile( "kpartstest_part1.rc" ); - - // An action and an action menu (test code for #70459) - - KAction* testAction = actionCollection()->addAction("p1_blah"); - testAction->setText("Part1's action"); - testAction->setShortcut(Qt::CTRL + Qt::Key_B); - connect(testAction, SIGNAL(triggered()), this, SLOT(slotBlah())); - - KActionMenu * menu = new KActionMenu(KIcon("mail_forward"), "Foo", this); - actionCollection()->addAction("p1_foo", menu); - - KAction* mailForward = new KAction(KIcon("mail_forward"), "Bar", this); - mailForward->setShortcut(Qt::CTRL + Qt::Key_F); - connect(mailForward, SIGNAL(triggered()), this, SLOT(slotFooBar())); - actionCollection()->addAction("p1_foo_bar", mailForward); - menu->addAction(mailForward); -} - -Part1::~Part1() -{ -} - -void Part1::slotBlah() -{ - m_edit->setText( "Blah" ); -} - -void Part1::slotFooBar() -{ - m_edit->setText( "FooBar" ); -} - -bool Part1::openFile() -{ - kDebug() << "Part1: opening " << QFile::encodeName(localFilePath()); - // Hehe this is from a tutorial I did some time ago :) - QFile f(localFilePath()); - QString s; - if ( f.open(QIODevice::ReadOnly) ) { - QTextStream t( &f ); - while ( !t.atEnd() ) { - s += t.readLine() + "\n"; - } - f.close(); - } else - return false; - m_edit->setPlainText(s); - - emit setStatusBarText( url().prettyUrl() ); - - return true; -} - -Part2::Part2( QObject *parent, QWidget * parentWidget ) - : KParts::Part(parent), - m_componentData("part2") -{ - setComponentData(m_componentData); - QWidget * w = new QWidget( parentWidget ); - w->setObjectName( "Part2Widget" ); - setWidget( w ); - - m_componentData.dirs()->addResourceDir( "data", KDESRCDIR ); - setXMLFile( "kpartstest_part2.rc" ); - - /*QCheckBox * cb =*/ new QCheckBox( "something", w ); - - //QLineEdit * l = new QLineEdit( "something", widget() ); - //l->move(0,50); - // Since the main widget is a dummy one, we HAVE to set - // strong focus for it, otherwise we get the - // the famous activating-file-menu-switches-part bug. - w->setFocusPolicy( Qt::ClickFocus ); -} - -Part2::~Part2() -{ -} - -void Part2::guiActivateEvent( KParts::GUIActivateEvent * event ) -{ - if (event->activated()) - emit setWindowCaption("[part2 activated]"); -} - -#include "moc_parts.cpp" diff --git a/kparts/tests/parts.h b/kparts/tests/parts.h deleted file mode 100644 index 86f669bf..00000000 --- a/kparts/tests/parts.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 1999, 2000 David Faure - Copyright (c) 1999, 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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. -*/ - -#ifndef __parts_h__ -#define __parts_h__ - -#include -#include - -#include - -namespace KParts { -class GUIActivateEvent; -} - -class Part1 : public KParts::ReadOnlyPart -{ - Q_OBJECT -public: - Part1( QObject *parent, QWidget * parentWidget ); - virtual ~Part1(); - -public slots: - void slotBlah(); - void slotFooBar(); - -protected: - virtual bool openFile(); - -protected: - QTextEdit * m_edit; - KComponentData m_componentData; -}; - -class Part2 : public KParts::Part -{ - Q_OBJECT -public: - Part2( QObject *parent, QWidget * parentWidget ); - virtual ~Part2(); - -protected: - // This is not mandatory - only if you care about setting the - // part caption when the part is used in a multi-part environment - // (i.e. in a part manager) - // There is a default impl for ReadOnlyPart... - virtual void guiActivateEvent( KParts::GUIActivateEvent * ); - KComponentData m_componentData; -}; - -#endif diff --git a/kparts/tests/parttest.cpp b/kparts/tests/parttest.cpp index 8618e62b..a859b319 100644 --- a/kparts/tests/parttest.cpp +++ b/kparts/tests/parttest.cpp @@ -127,8 +127,8 @@ void PartTest::testAutomaticMimeType() QVERIFY(part->closeUrl()); // nothing to do, no error QVERIFY(part->arguments().mimeType().isEmpty()); // open a file, and test the detected mimetype - part->openUrl(KUrl(KDESRCDIR "/notepad.desktop")); - QCOMPARE(part->arguments().mimeType(), QString::fromLatin1("application/x-desktop")); + part->openUrl(KUrl(KDESRCDIR "/parttest.h")); + QCOMPARE(part->arguments().mimeType(), QString::fromLatin1("text/x-chdr")); // manually closing, no mimetype should be stored now part->closeUrl(); @@ -139,9 +139,9 @@ void PartTest::testAutomaticMimeType() QCOMPARE(part->arguments().mimeType(), QString("text/x-c++src")); // open a new file, but without explicitely close the first - part->openUrl(KUrl(KDESRCDIR "/notepad.desktop")); + part->openUrl(KUrl(KDESRCDIR "/parttest.h")); // test again its (autdetected) mimetype - QCOMPARE(part->arguments().mimeType(), QString::fromLatin1("application/x-desktop")); + QCOMPARE(part->arguments().mimeType(), QString::fromLatin1("text/x-chdr")); // open a new file, but manually forcing a mimetype KParts::OpenUrlArguments args; @@ -153,9 +153,9 @@ void PartTest::testAutomaticMimeType() // clear the args and open a new file, reactivating the automatic mimetype detection again part->setArguments(KParts::OpenUrlArguments()); - part->openUrl(KUrl(KDESRCDIR "/notepad.desktop")); + part->openUrl(KUrl(KDESRCDIR "/parttest.h")); // test again its (autdetected) mimetype - QCOMPARE(part->arguments().mimeType(), QString::fromLatin1("application/x-desktop")); + QCOMPARE(part->arguments().mimeType(), QString::fromLatin1("text/x-chdr")); delete part; } diff --git a/kparts/tests/partviewer.cpp b/kparts/tests/partviewer.cpp deleted file mode 100644 index 016b2826..00000000 --- a/kparts/tests/partviewer.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (c) 2000 David Faure - Copyright (c) 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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 -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "partviewer.h" -#include -#include - -PartViewer::PartViewer() -{ - // KXMLGUIClient looks in the "data" resource for the .rc files - // This line is for test programs only! - KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); - setXMLFile( "partviewer_shell.rc" ); - - KAction * paOpen = new KAction( KIcon("document-open"), "&Open file", this ); - actionCollection()->addAction( "file_open", paOpen ); - connect( paOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen()) ); - - KAction * paQuit = new KAction( KIcon("application-exit"), "&Quit", this ); - actionCollection()->addAction( "file_quit", paQuit ); - connect(paQuit, SIGNAL(triggered()), this, SLOT(close())); - - m_part = 0; - - // Set a reasonable size - resize( 600, 350 ); - - slotFileOpen(); -} - -PartViewer::~PartViewer() -{ - delete m_part; -} - -void PartViewer::openUrl( const KUrl & url ) -{ - delete m_part; - const QString mimeType = KMimeType::findByUrl(url)->name(); - m_part = KMimeTypeTrader::self()->createPartInstanceFromQuery(mimeType, - this, - this); - - if ( m_part ) - { - setCentralWidget( m_part->widget() ); - // Integrate its GUI - createGUI( m_part ); - - m_part->openUrl( url ); - } -} - -void PartViewer::slotFileOpen() -{ - KUrl url = KFileDialog::getOpenUrl(); - if( !url.isEmpty() ) - openUrl( url ); -} - -int main( int argc, char **argv ) -{ - KCmdLineOptions options; - options.add("+file(s)", ki18n("Files to load")); - - const char version[] = "v0.0.1 2000 (c) David Faure"; - KLocalizedString description = ki18n("This is a test window for showing any part."); - - KCmdLineArgs::init(argc, argv, "partviewer", 0, ki18n("partviewer"), version, description); - KCmdLineArgs::addCmdLineOptions( options ); // Add my own options. - KApplication app; - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - PartViewer *shell = new PartViewer; - if ( args->count() == 1 ) - { - // Allow full paths, but also simple filenames from current dir - KUrl url(QString(QDir::currentPath()+'/'), args->arg(0)); - shell->openUrl( url ); - } - shell->show(); - return app.exec(); -} - -#include "moc_partviewer.cpp" diff --git a/kparts/tests/partviewer.h b/kparts/tests/partviewer.h deleted file mode 100644 index a3ce60c3..00000000 --- a/kparts/tests/partviewer.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (c) 2000 David Faure - Copyright (c) 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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. -*/ - -#ifndef PARTVIEWER_H -#define PARTVIEWER_H - -#include - -class PartViewer : public KParts::MainWindow -{ - Q_OBJECT -public: - PartViewer(); - virtual ~PartViewer(); - - void openUrl( const KUrl & url ); - -protected Q_SLOTS: - void slotFileOpen(); - -private: - KParts::ReadOnlyPart *m_part; -}; - -#endif diff --git a/kparts/tests/partviewer_shell.rc b/kparts/tests/partviewer_shell.rc deleted file mode 100644 index 23295760..00000000 --- a/kparts/tests/partviewer_shell.rc +++ /dev/null @@ -1,14 +0,0 @@ - - - - &File - - - - - - - - - - diff --git a/kparts/tests/testmainwindow.cpp b/kparts/tests/testmainwindow.cpp deleted file mode 100644 index 0f951e74..00000000 --- a/kparts/tests/testmainwindow.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright (c) 1999, 2000 David Faure - Copyright (c) 1999, 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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 "testmainwindow.h" -#include "parts.h" -#include "notepad.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -TestMainWindow::TestMainWindow() - : KParts::MainWindow() -{ - // KXMLGUIClient looks in the "data" resource for the .rc files - // This line is for test programs only! - KGlobal::dirs()->addResourceDir( "data", KDESRCDIR ); - - setXMLFile( "kpartstest_shell.rc" ); - - m_manager = new KParts::PartManager( this ); - - // When the manager says the active part changes, the builder updates (recreates) the GUI - connect( m_manager, SIGNAL(activePartChanged(KParts::Part*)), - this, SLOT(createGUI(KParts::Part*)) ); - - // We can do this "switch active part" because we have a splitter with - // two items in it. - // I wonder what kdevelop uses/will use to embed kedit, BTW. - m_splitter = new QSplitter( this ); - - m_part1 = new Part1(this, m_splitter); - m_part2 = new Part2(this, m_splitter); - - KActionCollection *coll = actionCollection(); - - KAction* paOpen = new KAction( "&View local file", this ); - coll->addAction( "open_local_file", paOpen ); - connect(paOpen, SIGNAL(triggered()), this, SLOT(slotFileOpen())); - KAction* paOpenRemote = new KAction( "&View remote file", this ); - coll->addAction( "open_remote_file", paOpenRemote ); - connect(paOpenRemote, SIGNAL(triggered()), this, SLOT(slotFileOpenRemote())); - - m_paEditFile = new KAction( "&Edit file", this ); - coll->addAction( "edit_file", m_paEditFile ); - connect(m_paEditFile, SIGNAL(triggered()), this, SLOT(slotFileEdit())); - m_paCloseEditor = new KAction( "&Close file editor", this ); - coll->addAction( "close_editor", m_paCloseEditor ); - connect(m_paCloseEditor, SIGNAL(triggered()), this, SLOT(slotFileCloseEditor())); - m_paCloseEditor->setEnabled(false); - KAction * paQuit = new KAction( "&Quit", this ); - coll->addAction( "shell_quit", paQuit ); - connect(paQuit, SIGNAL(triggered()), this, SLOT(close())); - paQuit->setIcon(KIcon("application-exit")); - -// (void)new KAction( "Yet another menu item", coll, "shell_yami" ); -// (void)new KAction( "Yet another submenu item", coll, "shell_yasmi" ); - - KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection()); - KStandardAction::keyBindings(guiFactory(), SLOT(configureShortcuts()), actionCollection()); - - setCentralWidget( m_splitter ); - m_splitter->setMinimumSize( 400, 300 ); - - m_splitter->show(); - - m_manager->addPart( m_part1, true ); // sets part 1 as the active part - m_manager->addPart( m_part2, false ); - m_editorpart = 0; -} - -TestMainWindow::~TestMainWindow() -{ - disconnect( m_manager, 0, this, 0 ); -} - -void TestMainWindow::slotFileOpen() -{ - if ( ! m_part1->openUrl( KStandardDirs::locate("data", KGlobal::mainComponent().componentName()+"/kpartstest_shell.rc" ) ) ) - KMessageBox::error(this,"Couldn't open file !"); -} - -void TestMainWindow::slotFileOpenRemote() -{ - KUrl u ( "http://www.kde.org/index.html" ); - if ( ! m_part1->openUrl( u ) ) - KMessageBox::error(this,"Couldn't open file !"); -} - -void TestMainWindow::embedEditor() -{ - if ( m_manager->activePart() == m_part2 ) - createGUI( 0 ); - - // replace part2 with the editor part - delete m_part2; - m_part2 = 0; - m_editorpart = new NotepadPart( m_splitter, this ); - m_editorpart->setReadWrite(); // read-write mode - m_manager->addPart( m_editorpart ); - m_paEditFile->setEnabled(false); - m_paCloseEditor->setEnabled(true); -} - -void TestMainWindow::slotFileCloseEditor() -{ - // It is very important to close the url of a read-write part - // before destroying it. This allows to save the document (if modified) - // and also to cancel. - if ( ! m_editorpart->closeUrl() ) - return; - - // Is this necessary ? (David) - if ( m_manager->activePart() == m_editorpart ) - createGUI( 0 ); - - delete m_editorpart; - m_editorpart = 0; - m_part2 = new Part2(this, m_splitter); - m_manager->addPart( m_part2 ); - m_paEditFile->setEnabled(true); - m_paCloseEditor->setEnabled(false); -} - -void TestMainWindow::slotFileEdit() -{ - if ( !m_editorpart ) - embedEditor(); - // TODO use KFileDialog to allow testing remote files - if (!m_editorpart->openUrl(KUrl(QDir::current().absolutePath()+"/kpartstest_shell.rc"))) - KMessageBox::error(this,"Couldn't open file !"); -} - -int main( int argc, char **argv ) -{ - KCmdLineArgs::init( argc, argv, "kpartstest", 0, ki18n("kpartstest"), 0); - KApplication app; - - TestMainWindow *shell = new TestMainWindow; - shell->show(); - - app.exec(); - - return 0; -} - -#include "moc_testmainwindow.cpp" diff --git a/kparts/tests/testmainwindow.h b/kparts/tests/testmainwindow.h deleted file mode 100644 index f9dd655f..00000000 --- a/kparts/tests/testmainwindow.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (c) 1999, 2000 David Faure - Copyright (c) 1999, 2000 Simon Hausmann - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2 of the License or ( at - your option ) version 3 or, at the discretion of KDE e.V. ( which shall - act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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. -*/ - -#ifndef TESTMAINWINDOW_H -#define TESTMAINWINDOW_H - -#include - -namespace KParts { class PartManager; } -class KAction; -#include - -class TestMainWindow : public KParts::MainWindow -{ - Q_OBJECT -public: - TestMainWindow(); - virtual ~TestMainWindow(); - -protected Q_SLOTS: - void slotFileOpen(); - void slotFileOpenRemote(); - void slotFileEdit(); - void slotFileCloseEditor(); - -protected: - void embedEditor(); - -private: - - KAction * m_paEditFile; - KAction * m_paCloseEditor; - - KParts::ReadOnlyPart *m_part1; - KParts::Part *m_part2; - KParts::ReadWritePart *m_editorpart; - KParts::PartManager *m_manager; - QWidget *m_splitter; -}; - -#endif diff --git a/kutils/kmediaplayer/CMakeLists.txt b/kutils/kmediaplayer/CMakeLists.txt index b9ead208..325498ef 100644 --- a/kutils/kmediaplayer/CMakeLists.txt +++ b/kutils/kmediaplayer/CMakeLists.txt @@ -48,7 +48,3 @@ install( ) add_subdirectory(kded) - -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() diff --git a/kutils/kmediaplayer/tests/CMakeLists.txt b/kutils/kmediaplayer/tests/CMakeLists.txt deleted file mode 100644 index 5a50cbde..00000000 --- a/kutils/kmediaplayer/tests/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/.. -) - -foreach(mantest media) - kde4_add_manual_test(kmediaplayer-${mantest} - k${mantest}widgettest.cpp - ) - target_link_libraries(kmediaplayer-${mantest} kmediaplayer) -endforeach() diff --git a/kutils/kmediaplayer/tests/kmediawidgettest.cpp b/kutils/kmediaplayer/tests/kmediawidgettest.cpp deleted file mode 100644 index 806ecfaf..00000000 --- a/kutils/kmediaplayer/tests/kmediawidgettest.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2016 Ivailo Monev - - 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 -#include -#include - -#include "kmediawidget.h" - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - QMainWindow window; - window.show(); - - KMediaWidget widget(&window, KMediaWidget::AllOptions); - window.setCentralWidget(&widget); - widget.open("https://dl5.webmfiles.org/big-buck-bunny_trailer.webm"); - - return app.exec(); -} diff --git a/kutils/kpasswdstore/CMakeLists.txt b/kutils/kpasswdstore/CMakeLists.txt index d0d19642..a873e4d8 100644 --- a/kutils/kpasswdstore/CMakeLists.txt +++ b/kutils/kpasswdstore/CMakeLists.txt @@ -46,7 +46,3 @@ install( ) add_subdirectory(kded) - -if(ENABLE_TESTING) - add_subdirectory(tests) -endif() diff --git a/kutils/kpasswdstore/tests/CMakeLists.txt b/kutils/kpasswdstore/tests/CMakeLists.txt deleted file mode 100644 index 177a7bbf..00000000 --- a/kutils/kpasswdstore/tests/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/.. -) - -kde4_add_manual_test(kpasswdstore-manual kpasswdstoretest.cpp) -target_link_libraries(kpasswdstore-manual ${QT_QTTEST_LIBRARY} kdecore kpasswdstore) - -kde4_add_manual_test(kpasswdroulettedialog-manual - kpasswdroulettedialog-manual.cpp -) -target_link_libraries(kpasswdroulettedialog-manual kpasswdstore) diff --git a/kutils/kpasswdstore/tests/kpasswdroulettedialog-manual.cpp b/kutils/kpasswdstore/tests/kpasswdroulettedialog-manual.cpp deleted file mode 100644 index 9614b4e4..00000000 --- a/kutils/kpasswdstore/tests/kpasswdroulettedialog-manual.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2022 Ivailo Monev - - 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 -#include - -#include "kpasswdroulettedialog.h" - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - KPasswdRouletteDialog kpasswdroulettedialog; - kpasswdroulettedialog.addPasswd("Is foo in the bar?", "no"); - kpasswdroulettedialog.addPasswd("Can I haz a password?", "yes"); - kpasswdroulettedialog.addPasswd("What is the meaning of life?", "whoknows"); - kpasswdroulettedialog.addPasswd("Am I getting older?", "deffinetly"); - - if (kpasswdroulettedialog.exec() != KPasswdRouletteDialog::Accepted) { - qDebug() << "password dialog not accepted"; - } else if (kpasswdroulettedialog.isValid()) { - qDebug() << "password is valid"; - } else { - qWarning() << "password is not valid"; - } - - return app.exec(); -} \ No newline at end of file diff --git a/kutils/kpasswdstore/tests/kpasswdstoretest.cpp b/kutils/kpasswdstore/tests/kpasswdstoretest.cpp deleted file mode 100644 index 0d8a2c93..00000000 --- a/kutils/kpasswdstore/tests/kpasswdstoretest.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2022 Ivailo Monev - - 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 "kpasswdstoretest.h" -#include "qtest_kde.h" -#include "kpasswdstore.h" - -#include - -QTEST_KDEMAIN(KPasswdStoreTest, GUI) - -/** - * @see QTest::initTestCase() - */ -void KPasswdStoreTest::initTestCase() -{ -} - -/** - * @see QTest::cleanupTestCase() - */ -void KPasswdStoreTest::cleanupTestCase() -{ -} - -void KPasswdStoreTest::storeAndGet() -{ - const QString testid = QString::number(qrand()); - const QByteArray testkey = QByteArray("mykey"); - const QString testpassword = QString::fromLatin1("c206e94efcffe47a03694f92bc94a392cadb79ec0895e07b71e1e2275dea3463"); - - { - KPasswdStore kpasswdstore; - kpasswdstore.setStoreID(testid); - kpasswdstore.openStore(); - } - - QString firstpass; - { - KPasswdStore kpasswdstore; - kpasswdstore.setStoreID(testid); - QVERIFY(kpasswdstore.storePasswd(testkey, testpassword)); - QVERIFY(kpasswdstore.hasPasswd(testkey)); - firstpass = kpasswdstore.getPasswd(testkey); - } - - QString secondpass; - { - KPasswdStore kpasswdstore; - kpasswdstore.setStoreID(testid); - secondpass = kpasswdstore.getPasswd(testkey); - } - - // qDebug() << firstpass << secondpass; - QCOMPARE(firstpass, testpassword); - QCOMPARE(secondpass, testpassword); - QCOMPARE(firstpass, secondpass); -} - -#include "moc_kpasswdstoretest.cpp" diff --git a/kutils/kpasswdstore/tests/kpasswdstoretest.h b/kutils/kpasswdstore/tests/kpasswdstoretest.h deleted file mode 100644 index 9f53147f..00000000 --- a/kutils/kpasswdstore/tests/kpasswdstoretest.h +++ /dev/null @@ -1,35 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 2022 Ivailo Monev - - 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. -*/ - -#ifndef KPASSWDSTORETEST_H -#define KPASSWDSTORETEST_H - -#include - -class KPasswdStoreTest : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - - void storeAndGet(); -}; - -#endif // KPASSWDSTORETEST_H - diff --git a/solid/tests/CMakeLists.txt b/solid/tests/CMakeLists.txt index 5abd5322..9c1eac84 100644 --- a/solid/tests/CMakeLists.txt +++ b/solid/tests/CMakeLists.txt @@ -35,32 +35,3 @@ target_link_libraries(solid-solidhwtest ${QT_QTTEST_LIBRARY} solid ) - -########### solidnettestdbusservice ############### - -#set(solidnettestdbusservice_SRCS -# solidnettestdbusservice.cpp ) - - -#QT4_ADD_DBUS_ADAPTOR(solidnettestdbusservice_SRCS ../solid/org.kde.Solid.Networking.Client.xml -# solidnettestdbusservice.h TestNetworkingService) - -#kde4_add_manual_test(solidnettestdbusservice ${solidnettestdbusservice_SRCS}) - -#target_link_libraries(solidnettestdbusservice -# ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTXML_LIBRARY} ${QT_QTTEST_LIBRARY}) - -########### networkingclient ############### - -set(networkingclient_SRCS - networkingclient.cpp -) - -qt4_add_dbus_interface(networkingclient_SRCS - ../solid/org.kde.Solid.Networking.Client.xml - clientinterface -) - -kde4_add_manual_test(solid-networkingclient ${networkingclient_SRCS}) - -target_link_libraries(solid-networkingclient kdeui solid) diff --git a/solid/tests/networkingclient.cpp b/solid/tests/networkingclient.cpp deleted file mode 100644 index dd5a7367..00000000 --- a/solid/tests/networkingclient.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* - Copyright 2007 Will Stephenson - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) version 3, or any - later version accepted by the membership of KDE e.V. (or its - successor approved by the membership of KDE e.V.), which shall - act as a proxy defined in Section 6 of version 3 of the license. - - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -*/ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "networkingclient.h" - -QString toString( Solid::Networking::Status st ) -{ - QString str; - switch ( st ) { - case Solid::Networking::Unknown: - str = "Unknown"; - break; - case Solid::Networking::Unconnected: - str = "Unconnected"; - break; - case Solid::Networking::Disconnecting: - str = "Disconnecting"; - break; - case Solid::Networking::Connecting: - str = "Connecting"; - break; - case Solid::Networking::Connected: - str = "Connected"; - break; - } - return str; -} - -TestClient::TestClient() - : KMainWindow( 0 ), - m_status( AppDisconnected ), m_view( new QWidget( this ) ) -{ - ui.setupUi( m_view ); - - setCentralWidget(m_view); - - networkStatusChanged( Solid::Networking::status() ); - appDisconnected(); - - kDebug() << "About to connect"; - connect( Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)), SLOT(networkStatusChanged(Solid::Networking::Status)) ); - kDebug() << "Connected."; - connect( Solid::Networking::notifier(), SIGNAL(shouldConnect()), this, SLOT(doConnect()) ); - connect( Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), this, SLOT(doDisconnect()) ); - - connect( ui.connectButton, SIGNAL(clicked()), SLOT(connectButtonClicked()) ); -} - -TestClient::~TestClient() -{ -} - -void TestClient::networkStatusChanged( Solid::Networking::Status status ) -{ - kDebug() ; - kDebug() << "Networking is now: " << toString( status ) << " (" << status << ")"; - ui.netStatusLabel->setText( toString( status ) ); - QPalette palette; - palette.setColor( ui.netStatusLabel->backgroundRole(), toQColor( m_status ) ); - ui.netStatusLabel->setPalette( palette ); -} - -void TestClient::doConnect() -{ - Q_ASSERT( Solid::Networking::status() == Solid::Networking::Connected ); - if ( m_status != AppConnected ) { - appIsConnected(); - } -} - -void TestClient::doDisconnect() -{ - Q_ASSERT( Solid::Networking::status() != Solid::Networking::Connected ); - if ( m_status == AppConnected ) { - appDisconnected(); - } -} - -void TestClient::connectButtonClicked() -{ - kDebug() ; - if ( m_status == AppDisconnected ) { - switch ( Solid::Networking::status() ) - { - case Solid::Networking::Unknown: - case Solid::Networking::Connected: - appIsConnected(); - break; - default: - appWaiting(); - break; - } - } - else if ( m_status == AppConnected || m_status == AppWaitingForConnect ) { - appDisconnected(); - } -} - -void TestClient::appWaiting() -{ - kDebug() ; - //m_status = AppWaitingForConnect; - ui.appStatusLabel->setText( "Waiting" ); -} - -void TestClient::appIsConnected() -{ - kDebug() ; - ui.connectButton->setEnabled( true ); - ui.connectButton->setText( "Disconnect" ); - ui.appStatusLabel->setText( "Connected" ); - m_status = AppConnected; -} - -void TestClient::appEstablishing() -{ - kDebug() ; - ui.netStatusLabel->setText( "Establishing" ); - ui.connectButton->setEnabled( false ); -} - -void TestClient::appDisestablishing( ) -{ - kDebug() ; - ui.connectButton->setEnabled( false ); - ui.appStatusLabel->setText( "Disconnected" ); -} - -void TestClient::appDisconnected( ) -{ - kDebug() ; - ui.connectButton->setEnabled( true ); - ui.connectButton->setText( "Start Connect" ); - ui.appStatusLabel->setText( "Disconnected" ); - m_status = AppDisconnected; -} - -QColor TestClient::toQColor( TestClient::AppStatus st ) -{ - QColor col; - switch ( st ) { - case TestClient::AppDisconnected: - col = Qt::red; - break; - case TestClient::AppWaitingForConnect: - col = Qt::yellow; - break; - case TestClient::AppConnected: - col = Qt::green; - break; - } - return col; -} -//main -static const char description[] = - I18N_NOOP("Test Client for Network Status kded module"); - -static const char version[] = "v0.1"; - -int main(int argc, char **argv) -{ - KAboutData about("KNetworkStatusTestClient", 0, ki18n("knetworkstatustestclient"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2007 Will Stephenson"), KLocalizedString(), 0, "wstephenson@kde.org"); - about.addAuthor( ki18n("Will Stephenson"), KLocalizedString(), "wstephenson@kde.org" ); - KCmdLineArgs::init(argc, argv, &about); - - KCmdLineOptions options; - KCmdLineArgs::addCmdLineOptions(options); - KApplication app; - - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - if (args->count() == 0) - { - TestClient *widget = new TestClient; - widget->show(); - } - else - { - int i = 0; - for (; i < args->count(); i++) - { - TestClient *widget = new TestClient; - widget->show(); - } - } - args->clear(); - - return app.exec(); -} - -#include "moc_networkingclient.cpp" - diff --git a/solid/tests/networkingclient.h b/solid/tests/networkingclient.h deleted file mode 100644 index 0d150c12..00000000 --- a/solid/tests/networkingclient.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright 2007 Will Stephenson - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) version 3, or any - later version accepted by the membership of KDE e.V. (or its - successor approved by the membership of KDE e.V.), which shall - act as a proxy defined in Section 6 of version 3 of the license. - - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -*/ - -#ifndef KTESTNETWORKSTATUS_H -#define KTESTNETWORKSTATUS_H - -#include -#include -//#include - -#include "ui_networkingclientview.h" - -/** - * Test client that uses a ConnectionManager to change its state - * - * @short Main window class - * @author Will Stephenson - * @version 0.1 - */ -class TestClient : public KMainWindow -{ -Q_OBJECT -public: - enum AppStatus{ AppDisconnected, AppWaitingForConnect, AppConnected }; - /** - * Default Constructor - */ - TestClient(); - - /** - * Default Destructor - */ - virtual ~TestClient(); - -private slots: - void networkStatusChanged( Solid::Networking::Status status ); - void connectButtonClicked(); - void doConnect(); - void doDisconnect(); -private: - void appWaiting(); - void appEstablishing(); - void appIsConnected(); - void appDisestablishing(); - void appDisconnected(); - static QColor toQColor( TestClient::AppStatus ); -private: - //OrgKdeSolidNetworkingClientInterface *m_service; - Ui_TestClientView ui; - AppStatus m_status; // this represents the app's status not the network's status - QWidget * m_view; -}; - -#endif // KTESTNETWORKSTATUS_H - diff --git a/solid/tests/networkingclientview.ui b/solid/tests/networkingclientview.ui deleted file mode 100644 index 41b92b37..00000000 --- a/solid/tests/networkingclientview.ui +++ /dev/null @@ -1,144 +0,0 @@ - - TestClientView - - - - 0 - 0 - 356 - 151 - - - - - - - - 0 - 0 - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'DejaVu Sans'; font-size:11pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:x-large; font-weight:600;">Client for KDE 4 Offline Mode</span></p></body></html> - - - Qt::AlignVCenter - - - false - - - - - - - - - Network status: - - - false - - - - - - - QFrame::Panel - - - STATUS - - - Qt::AlignCenter - - - false - - - - - - - - - - - App status: - - - false - - - - - - - QFrame::Panel - - - STATUS - - - Qt::AlignCenter - - - false - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 31 - 20 - - - - - - - - Start Connect - - - false - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 61 - 20 - - - - - - - - - - diff --git a/solid/tests/solidnettestdbusservice.cpp b/solid/tests/solidnettestdbusservice.cpp deleted file mode 100644 index 5dbd6a52..00000000 --- a/solid/tests/solidnettestdbusservice.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright 2007 Will Stephenson - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) version 3, or any - later version accepted by the membership of KDE e.V. (or its - successor approved by the membership of KDE e.V.), which shall - act as a proxy defined in Section 6 of version 3 of the license. - - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -*/ - -#include -#include -#include - -#include -#include "solidnettestdbusservice.h" -#include "networkingadaptor.h" - -QString statusToString( uint status ) -{ - QString asString; - switch ( status ) - { - case Solid::Networking::Unknown: - asString = "Unknown"; - break; - case Solid::Networking::Unconnected: - asString = "Unconnected"; - break; - case Solid::Networking::Connecting: - asString ="Connecting"; - break; - case Solid::Networking::Connected: - asString = "Connected"; - break; - case Solid::Networking::Disconnecting: - asString ="Disconnecting"; - break; - default: - asString = "Crap passed to statusAsString()!"; - } - return asString; -} - -Behaviour::Behaviour( TestNetworkingService * service ) : mService( service ) -{ - connect ( mService, SIGNAL(statusChanged(uint)), this, SLOT(serviceStatusChanged(uint)) ); -} - -GoOnlineOnRequest::GoOnlineOnRequest( TestNetworkingService * service ) : Behaviour( service ) -{ -} - -void GoOnlineOnRequest::go() -{ - // do nothing this only reacts to events -} - -void GoOnlineOnRequest::serviceStatusChanged( uint status ) -{ - qDebug( "GoOnlineOnRequest::serviceStatusChanged()" ); - switch ( status ) - { - case Solid::Networking::Connecting: - qDebug( " connecting..." ); - QTimer::singleShot( 5000, this, SLOT(doDelayedConnect()) ); - break; - case Solid::Networking::Disconnecting: - qDebug( " disconnecting..." ); - QTimer::singleShot( 5000, this, SLOT(doDelayedDisconnect()) ); - break; - default: - ; - } -} - -void GoOnlineOnRequest::doDelayedConnect() -{ - mService->setStatus( ( uint )Solid::Networking::Connected ); -} - -void GoOnlineOnRequest::doDelayedDisconnect() -{ - mService->setStatus( ( uint )Solid::Networking::Unconnected ); -} - -TestNetworkingService::TestNetworkingService( const QString & ) : mStatus( Solid::Networking::Unconnected ) -{ - new NetworkingAdaptor( this ); - mBehaviour = new GoOnlineOnRequest( this ); - QDBusConnection dbus = QDBusConnection::sessionBus(); - dbus.registerService( "org.kde.Solid.Networking" ); - dbus.registerObject( "/status", this ); -} - -TestNetworkingService::~TestNetworkingService() -{ - -} - -uint TestNetworkingService::requestConnection() -{ -#warning "Fix return values" - qDebug( "TestNetworkingService::requestConnection()" ); - if ( mStatus == Solid::Networking::Unconnected ) - { - setStatus( Solid::Networking::Connecting ); - return 1;//Solid::Networking::Accepted; - } - return 2;//Solid::Networking::AlreadyConnected; -} - -void TestNetworkingService::releaseConnection() -{ - qDebug( "TestNetworkingService::releaseConnection()" ); - if ( mStatus == Solid::Networking::Connected ) - { - setStatus( Solid::Networking::Disconnecting ); - } -} - -uint TestNetworkingService::status() const -{ - return mStatus; -} - -void TestNetworkingService::setStatus( uint status ) -{ - qDebug( "Setting status to %s", qPrintable( statusToString( status ) ) ); - mStatus = status; - emit statusChanged( mStatus ); -} - -int main( int argc, char** argv ) -{ - QCoreApplication app( argc, argv ); - TestNetworkingService serv( "" ); - return app.exec(); -} - -// add a ctor arg to TestNetworkingService that sets its behaviour -// behaviour types - request, delay, statuschanged -// - deny requests -// - request, delay, online, offline -// - offline, delay, unrequested online -// - intermittent on/offline -// - request, delay, online until released -// - -#include "moc_solidnettestdbusservice.cpp" - - diff --git a/solid/tests/solidnettestdbusservice.h b/solid/tests/solidnettestdbusservice.h deleted file mode 100644 index 80b26f7e..00000000 --- a/solid/tests/solidnettestdbusservice.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright 2007 Will Stephenson - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) version 3, or any - later version accepted by the membership of KDE e.V. (or its - successor approved by the membership of KDE e.V.), which shall - act as a proxy defined in Section 6 of version 3 of the license. - - 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library. If not, see . -*/ - -#ifndef SOLID_NETWORKING_TESTSERVICE_H -#define SOLID_NETWORKING_TESTSERVICE_H - -//#include -#include - -#include - -class TestNetworkingService; - -class Behaviour : public QObject -{ - Q_OBJECT - public: - Behaviour( TestNetworkingService * ); - public Q_SLOTS: - virtual void go() = 0; - virtual void serviceStatusChanged( uint ) = 0; - protected: - TestNetworkingService * mService; -}; - -class GoOnlineOnRequest : public Behaviour -{ -Q_OBJECT -public: - GoOnlineOnRequest( TestNetworkingService * ); -public Q_SLOTS: - void go(); - void serviceStatusChanged( uint ); -private Q_SLOTS: - void doDelayedConnect(); - void doDelayedDisconnect(); -}; - -class TestNetworkingService : public QObject -{ -Q_OBJECT - - Q_PROPERTY( uint Status READ status ) -public: - TestNetworkingService( const QString & behaviour ); - ~TestNetworkingService(); - void setStatus( uint ); -public Q_SLOTS: - uint requestConnection(); /*Result*/ - void releaseConnection(); - uint status() const; -Q_SIGNALS: - void statusChanged( uint ); -private: - uint mStatus; - Behaviour * mBehaviour; -}; - -#endif