summaryrefslogtreecommitdiffstats
path: root/kio/tests
diff options
context:
space:
mode:
Diffstat (limited to 'kio/tests')
-rw-r--r--kio/tests/CMakeLists.txt36
-rw-r--r--kio/tests/Makefile.am91
-rw-r--r--kio/tests/dataprotocoltest.cpp287
-rw-r--r--kio/tests/dummymeta.cpp20
-rw-r--r--kio/tests/dummymeta.desktop54
-rw-r--r--kio/tests/dummymeta.h20
-rw-r--r--kio/tests/getalltest.cpp44
-rw-r--r--kio/tests/jobtest.cpp613
-rw-r--r--kio/tests/jobtest.h79
-rw-r--r--kio/tests/kacltest.cpp309
-rw-r--r--kio/tests/kacltest.h53
-rw-r--r--kio/tests/kdcopcheck.cpp132
-rw-r--r--kio/tests/kdcopcheck.h28
-rw-r--r--kio/tests/kdefaultprogresstest.cpp39
-rw-r--r--kio/tests/kdirlistertest.cpp162
-rw-r--r--kio/tests/kdirlistertest.h120
-rw-r--r--kio/tests/kdirwatchtest.cpp82
-rw-r--r--kio/tests/kdirwatchtest.h33
-rw-r--r--kio/tests/kdirwatchunittest.cpp180
-rw-r--r--kio/tests/kdirwatchunittest.h66
-rw-r--r--kio/tests/kfiltertest.cpp118
-rw-r--r--kio/tests/kionetrctest.cpp71
-rw-r--r--kio/tests/kiopassdlgtest.cpp32
-rw-r--r--kio/tests/kioslavetest.cpp555
-rw-r--r--kio/tests/kioslavetest.h108
-rw-r--r--kio/tests/kmfitest.cpp28
-rw-r--r--kio/tests/kmimefromext.cpp53
-rw-r--r--kio/tests/kmimemagictest.cpp54
-rw-r--r--kio/tests/kmimetypetest.cpp76
-rw-r--r--kio/tests/kpropsdlgtest.cpp35
-rw-r--r--kio/tests/kprotocolinfotest.cpp59
-rw-r--r--kio/tests/kruntest.cpp209
-rw-r--r--kio/tests/kruntest.h58
-rw-r--r--kio/tests/kscantest.cpp16
-rw-r--r--kio/tests/kshredtest.cpp74
-rw-r--r--kio/tests/ktartest.cpp178
-rw-r--r--kio/tests/ktradertest.cpp108
-rw-r--r--kio/tests/kurifiltertest.cpp361
-rw-r--r--kio/tests/kurlcompletiontest.cpp189
-rw-r--r--kio/tests/kziptest.cpp435
-rw-r--r--kio/tests/metatest.cpp321
-rw-r--r--kio/tests/netaccesstest.cpp48
-rw-r--r--kio/tests/previewtest.cpp64
-rw-r--r--kio/tests/previewtest.h25
-rw-r--r--kio/tests/speed.cpp139
-rw-r--r--kio/tests/speed.h24
-rw-r--r--kio/tests/tdesycocatest.cpp360
-rw-r--r--kio/tests/tdesycocaupdatetest.cpp11
-rw-r--r--kio/tests/wronglocalsizes.zipbin325 -> 0 bytes
49 files changed, 0 insertions, 6257 deletions
diff --git a/kio/tests/CMakeLists.txt b/kio/tests/CMakeLists.txt
deleted file mode 100644
index 54378f5c8..000000000
--- a/kio/tests/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-#################################################
-#
-# (C) 2010 Serghei Amelian
-# serghei (DOT) amelian (AT) gmail.com
-#
-# Improvements and feedback are welcome
-#
-# This file is released under GPL >= 2
-#
-#################################################
-
-include_directories(
- ${TQT_INCLUDE_DIRS}
- ${CMAKE_BINARY_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}/tdecore
- ${CMAKE_SOURCE_DIR}/kio/kio
-)
-
-link_directories(
- ${TQT_LIBRARY_DIRS}
-)
-
-
-##### ktradertest ###############################
-
-set( target ktradertest )
-
-set( ${target}_SRCS
- ktradertest.cpp
-)
-
-tde_add_executable( ${target}
- SOURCES ${${target}_SRCS}
- LINK kio-shared
- DESTINATION ${BIN_INSTALL_DIR}
-)
diff --git a/kio/tests/Makefile.am b/kio/tests/Makefile.am
deleted file mode 100644
index 3a81dfc57..000000000
--- a/kio/tests/Makefile.am
+++ /dev/null
@@ -1,91 +0,0 @@
-# This file is part of the KDE libraries
-# Copyright (C) 1997 David Faure <faure@kde.org>
-
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Library General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Library General Public License for more details.
-
-# You should have received a copy of the GNU Library General Public License
-# along with this library; see the file COPYING.LIB. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
-
-INCLUDES= -I$(top_srcdir) -I$(top_srcdir)/kio $(all_includes)
-LDADD = $(LIB_KIO)
-AM_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -ltdetexteditor
-
-check_PROGRAMS = tdesycocatest getalltest kruntest ktartest kziptest\
- kioslavetest kdirwatchtest kshredtest speed kurifiltertest \
- kdefaultprogresstest kmimemagictest \
- kfiltertest kiopassdlgtest kscantest kdirlistertest \
- previewtest kionetrctest kdcopcheck metatest \
- kmimefromext kpropsdlgtest kmfitest dataprotocoltest \
- kprotocolinfotest tdesycocaupdatetest netaccesstest jobtest \
- kurlcompletiontest kmimetypetest kacltest
-
-# Unfortunately some tests depend on the network settings, it seems
-#check: kurifiltertest
-# ./kurifiltertest
-check-local: kziptest
- ./kziptest list $(srcdir)/wronglocalsizes.zip
-
-TESTS = kmimetypetest
-
-bin_PROGRAMS = ktradertest
-
-METASOURCES = AUTO
-
-speed_SOURCES = speed.cpp
-kioslavetest_SOURCES = kioslavetest.cpp
-kshredtest_SOURCES = kshredtest.cpp
-kdefaultprogresstest_SOURCES = kdefaultprogresstest.cpp
-kionetrctest_SOURCES = kionetrctest.cpp
-kiopassdlgtest_SOURCES = kiopassdlgtest.cpp
-kurifiltertest_SOURCES = kurifiltertest.cpp
-tdesycocatest_SOURCES = tdesycocatest.cpp
-kdcopcheck_SOURCES = kdcopcheck.cpp
-getalltest_SOURCES = getalltest.cpp
-kruntest_SOURCES = kruntest.cpp
-kdirwatchtest_SOURCES = kdirwatchtest.cpp
-ktradertest_SOURCES = ktradertest.cpp
-kmimemagictest_SOURCES = kmimemagictest.cpp
-kfiltertest_SOURCES = kfiltertest.cpp
-kscantest_SOURCES = kscantest.cpp
-kdirlistertest_SOURCES = kdirlistertest.cpp
-previewtest_SOURCES = previewtest.cpp
-ktartest_SOURCES = ktartest.cpp
-kziptest_SOURCES = kziptest.cpp
-metatest_SOURCES = metatest.cpp
-kmimefromext_SOURCES = kmimefromext.cpp
-kpropsdlgtest_SOURCES = kpropsdlgtest.cpp
-kmfitest_SOURCES = kmfitest.cpp
-dataprotocoltest_SOURCES = dataprotocoltest.cpp
-kprotocolinfotest_SOURCES = kprotocolinfotest.cpp
-tdesycocaupdatetest_SOURCES = tdesycocaupdatetest.cpp
-netaccesstest_SOURCES = netaccesstest.cpp
-jobtest_SOURCES = jobtest.cpp
-kurlcompletiontest_SOURCES = kurlcompletiontest.cpp
-kmimetypetest_SOURCES = kmimetypetest.cpp
-kacltest_SOURCES = kacltest.cpp
-
-
-check_LTLIBRARIES = tdeunittest_kdirwatch.la
-tdeunittest_kdirwatch_la_SOURCES = kdirwatchunittest.cpp
-tdeunittest_kdirwatch_la_LIBADD = $(LIB_KUNITTEST) $(LIB_KIO)
-tdeunittest_kdirwatch_la_LDFLAGS = -module $(KDE_CHECK_PLUGIN)
-
-# kfile meta stuff. Comment this in, if you want a small
-# metadata plugin test and "make install".
-#kde_module_LTLIBRARIES = dummymeta.la
-#dummymeta_la_SOURCES = dummymeta.cpp
-#dummymeta_la_LIBADD = $(LIB_KIO)
-#dummymeta_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN)
-
-#services_DATA = dummymeta.desktop
-#servicesdir = $(kde_servicesdir)
diff --git a/kio/tests/dataprotocoltest.cpp b/kio/tests/dataprotocoltest.cpp
deleted file mode 100644
index dfacd92e4..000000000
--- a/kio/tests/dataprotocoltest.cpp
+++ /dev/null
@@ -1,287 +0,0 @@
-// testing the data kioslave
-// (C) 2002, 2003 Leo Savernik
-//
-// invoke "make dataprotocoltest" to generate the binary inside KDE CVS
-// invoke "make test" to generate the binary outside KDE CVS
-
-// fix the symptoms, not the illness ;-)
-#ifdef QT_NO_ASCII_CAST
-# undef QT_NO_ASCII_CAST
-#endif
-
-#ifdef DATAKIOSLAVE
-# undef DATAKIOSLAVE
-#endif
-#ifndef TESTKIO
-# define TESTKIO
-#endif
-
-#include <kio/global.h>
-
-#include <tqcstring.h>
-#include <tqstring.h>
-
-#include <iostream.h>
-
-class KURL;
-
-class TestSlave {
-public:
- TestSlave() {
- }
- virtual ~TestSlave() {
- }
-
- virtual void get(const KURL &) = 0;
- virtual void mimetype(const KURL &) = 0;
-
- void mimeType(const TQString &type) {
- testStrings("MIME Type: ",mime_type_expected,type);
- }
-
- void totalSize(TDEIO::filesize_t bytes) {
-// cout << "content size: " << bytes << " bytes" << endl;
- }
-
- void setMetaData(const TQString &key, const TQString &value) {
-// meta_data[key] = value;
-// cout << " " << key << " = " << value << endl;
- TQString prefix = "Metadata[\""+key+"\"]: ";
- TDEIO::MetaData::Iterator it = attributes_expected.find(key);
- if (it != attributes_expected.end()) {
- testStrings(prefix,it.data(),value);
- // remove key from map
- attributes_expected.remove(it);
- } else {
- cout << endl << prefix << " no such key expected";
- total++;
- }
- }
-
- void sendMetaData() {
- // check here if attributes_expected contains any excess keys
- TDEIO::MetaData::ConstIterator it = attributes_expected.begin();
- TDEIO::MetaData::ConstIterator end = attributes_expected.end();
- for (; it != end; ++it) {
- cout << endl << "Metadata[\"" << it.key()
- << "\"] was expected but not defined";
- total++;
- }
- }
-
- void data(const TQByteArray &a) {
- if (a.isEmpty())
-/* cout << "<no more data>" << endl*/;
- else {
- testStrings("Content: ",content_expected,a);
- }/*end if*/
- }
-
- void finished() {
- }
-
- void dispatchLoop() {
- // dummy to make kde_main happy
- }
-
- // == stuff for regression testing
-private:
- int testcaseno; // number of testcase
- bool failure; // true if any testcase failed
- TQMap<int,bool> failed_testcases;
-
- // -- testcase related members
- TQString mime_type_expected; // expected mime type
- /** contains all attributes and values the testcase has to set */
- TDEIO::MetaData attributes_expected;
- /** contains the content as it is expected to be returned */
- TQByteArray content_expected;
- int passed; // # of passed tests
- int total; // # of total tests
-
- /**
- * compares two strings, printing an error message if they don't match.
- * @param prefix prefix string for output in case of mismatch
- * @param templat template string
- * @param s string to compare to template
- * @param casesensitive true if case sensitive compare (currently not used)
- */
- void testStrings(const TQString &prefix, const TQString &templat,
- const TQString &s, bool /*casesensitive*/ = true) {
- if (templat == s)
- passed++;
- else {
- cout << endl << prefix << "expected \"" << templat << "\", found \""
- << s << "\"";
- failure = true;
- }/*end if*/
- total++;
- }
-
-public:
- /** begins a testrun over all testcases */
- void initTestrun() {
- testcaseno = 0;
- failure = false;
- }
-
- /** reuturns true if any testcase failed
- */
- bool hasFailedTestcases() const { return failure; }
-
- /**
- * sets up a new testcase
- * @param name screen name for testcase
- */
- void beginTestcase(const char *name) {
- passed = 0;
- total = 0;
- testcaseno++;
- cout << "Testcase " << testcaseno << ": [" << name << "] ";
- }
-
- /**
- * sets the mime type that this testcase is expected to return
- */
- void setExpectedMimeType(const TQString &mime_type) {
- mime_type_expected = mime_type;
- }
-
- /**
- * sets all attribute-value pairs the testcase must deliver.
- */
- void setExpectedAttributes(const TDEIO::MetaData &attres) {
- attributes_expected = attres;
- }
-
- /**
- * sets content as expected to be delivered by the testcase.
- */
- void setExpectedContent(const TQByteArray &content) {
- content_expected = content;
- }
-
- /**
- * closes testcase, printing out stats
- */
- void endTestcase() {
- bool failed = passed < total;
- if (failed) {
- failure = true;
- failed_testcases[testcaseno] = true;
- cout << endl;
- }
- cout << "(" << passed << " of " << total << ") " << (failed ? "failed"
- : "passed") << endl;
- }
-
- void endTestrun() {
- if (failure) {
- TQMap<int,bool>::ConstIterator it = failed_testcases.begin();
- for (; it != failed_testcases.end(); ++it) {
- cout << "Testcase " << it.key() << " failed" << endl;
- }
- }
- }
-};
-
-#include "dataprotocol.cpp" // we need access to static data & functions
-
-// == general functionality
-const struct {
-const char * const name;
-const char * const exp_mime_type; // 0 means "text/plain"
-const struct {
- const char * const key;
- const char * const value;
-} exp_attrs[10]; // ended with a key==0, value==0 pair
-const char * const exp_content;
-const char * const url;
-} testcases[] = {
- // -----------------------------------------------------------------
- { "escape resolving", 0, {}, "blah blah", "data:,blah%20blah" },
- // --------------------
- { "mime type, escape resolving", "text/html", {},
- "<div style=\"border:thin orange solid;padding:1ex;background-color:"
- "yellow;color:black\">Rich <b>text</b></div>",
- "data:text/html,<div%20style=\"border:thin%20orange%20solid;"
- "padding:1ex;background-color:yellow;color:black\">Rich%20<b>text</b>"
- "</div>" },
- // -------------------- whitespace test I
- { "whitespace test I", "text/css", {
- { "charset", "iso-8859-15" }, { 0,0 } },
- " body { color: yellow; background:darkblue; font-weight:bold }",
- "data:text/css ; charset = iso-8859-15 , body { color: yellow; "
- "background:darkblue; font-weight:bold }" },
- // -------------------- out of spec argument order, base64 decoding,
- // whitespace test II
- { "out of spec argument order, base64 decoding, whitespace test II",
- 0, {
- { "charset", "iso-8859-1" }, { 0,0 } },
- "paaaaaaaasd!!\n",
- "data: ; base64 ; charset = \"iso-8859-1\" ,cGFhYWFhYWFhc2QhIQo=" },
- // -------------------- arbitrary keys, reserved names as keys,
- // whitespace test III
- { "arbitrary keys, reserved names as keys, whitespace test III", 0, {
- { "base64", "nospace" }, { "key", "onespaceinner" },
- { "key2", "onespaceouter" }, { "charset", "utf8" },
- { "<<empty>>", "" }, { 0,0 } },
- "Die, Allied Schweinehund (C) 1990 Wolfenstein 3D",
- "data: ;base64=nospace;key = onespaceinner; key2=onespaceouter ;"
- " charset = utf8 ; <<empty>>= ,Die, Allied Schweinehund "
- "(C) 1990 Wolfenstein 3D" },
- // -------------------- string literal with escaped chars, testing
- // delimiters within string
- { "string literal with escaped chars, testing delimiters within "
- "string", 0, {
- { "fortune-cookie", "Master Leep say: \"Rabbit is humble, "
- "Rabbit is gentle; follow the Rabbit\"" }, { 0,0 } },
- "(C) 1997 Shadow Warrior ;-)",
- "data:;fortune-cookie=\"Master Leep say: \\\"Rabbit is humble, "
- "Rabbit is gentle; follow the Rabbit\\\"\",(C) 1997 Shadow Warrior "
- ";-)" },
-};
-
-#if 0
-// == charset tests
- // -------------------- string
-const QChar
-const TQChar * const charset_urls[] = {
-#endif
-
-int main(int /*argc*/,char* /*argv*/[]) {
- DataProtocol kio_data;
-
- kio_data.initTestrun();
- for (uint i = 0; i < sizeof testcases/sizeof testcases[0]; i++) {
- kio_data.beginTestcase(testcases[i].name);
- kio_data.setExpectedMimeType(testcases[i].exp_mime_type != 0
- ? testcases[i].exp_mime_type : "text/plain");
-
- bool has_charset = false;
- MetaData exp_attrs;
- if (testcases[i].exp_attrs != 0) {
- for (uint j = 0; testcases[i].exp_attrs[j].key != 0; j++) {
- exp_attrs[testcases[i].exp_attrs[j].key] = testcases[i].exp_attrs[j].value;
- if (strcmp(testcases[i].exp_attrs[j].key,"charset") == 0)
- has_charset = true;
- }/*next j*/
- }
- if (!has_charset) exp_attrs["charset"] = "us-ascii";
- kio_data.setExpectedAttributes(exp_attrs);
-
- TQByteArray exp_content;
- uint exp_content_len = strlen(testcases[i].exp_content);
- exp_content.setRawData(testcases[i].exp_content,exp_content_len);
- kio_data.setExpectedContent(exp_content);
-
- kio_data.get(testcases[i].url);
-
- kio_data.endTestcase();
- exp_content.resetRawData(testcases[i].exp_content,exp_content_len);
- }/*next i*/
- kio_data.endTestrun();
-
- return kio_data.hasFailedTestcases() ? 1 : 0;
-}
-
diff --git a/kio/tests/dummymeta.cpp b/kio/tests/dummymeta.cpp
deleted file mode 100644
index 938b4d00b..000000000
--- a/kio/tests/dummymeta.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <kgenericfactory.h>
-
-#include "dummymeta.h"
-
-K_EXPORT_COMPONENT_FACTORY( dummymeta, KGenericFactory<DummyMeta> )
-
-DummyMeta::DummyMeta( TQObject *parent, const char *name,
- const TQStringList &preferredItems )
- : KFilePlugin( parent, name, preferredItems )
-{
- tqDebug("---- DummyMeta::DummyMeta: got %i preferred items.", preferredItems.count());
-}
-
-bool DummyMeta::readInfo( KFileMetaInfo::Internal & info )
-{
- tqDebug("#### DummyMeta:: readInfo: %s", info.path().latin1() );
- return 0L;
-}
-
-#include "dummymeta.moc"
diff --git a/kio/tests/dummymeta.desktop b/kio/tests/dummymeta.desktop
deleted file mode 100644
index 6d2748c82..000000000
--- a/kio/tests/dummymeta.desktop
+++ /dev/null
@@ -1,54 +0,0 @@
-[Desktop Entry]
-Type=Service
-Name=Dummy Meta
-Name[af]=Fop Meta
-Name[az]=İşə Yaramayan Meta
-Name[be]=Парожнія звесткі
-Name[bn]=ডামি মেটা
-Name[cs]=Prázdné meta
-Name[csb]=Testowé pòdôwczi
-Name[cy]=Meta Dymi
-Name[da]=Dummy-meta
-Name[el]=Εικονικό Meta
-Name[eo]=Stulta Meto
-Name[et]=Dummy meta
-Name[fa]=فراساختگی
-Name[fi]=Tyhjä meta
-Name[fr]=Données factices
-Name[ga]=Meitea Caoch
-Name[hi]=डमी मेटा
-Name[hr]=Ogledni meta podatak
-Name[hu]=Üres (dummy) metaadat
-Name[it]=Informazioni aggiuntive posticce
-Name[ko]=가짜 메타
-Name[lb]=Dummy-Meta
-Name[lt]=Netikras Meta
-Name[ms]=Meta Olok-olok
-Name[mt]=Meta fittizju
-Name[ne]=डमी मेटा
-Name[nso]=Meta wa Dummy
-Name[pa]=ਫ਼ਰਜੀ ਮੈਟਾ
-Name[pl]=Dane testowe
-Name[ro]=Test Meta
-Name[rw]=Ikiragi Kidasanzwe
-Name[sk]=Prázdne meta
-Name[sl]=Slepi Meta
-Name[sr]=Лажни мета
-Name[sr@Latn]=Lažni meta
-Name[sv]=Testmeta
-Name[ta]=வெற்று மீட்டா
-Name[te]=డమ్మి మెటా
-Name[tg]=Meta-и Ғайрикорӣ
-Name[tr]=Kukla Meta
-Name[uk]=Макет метаданих
-Name[uz]=Maʼnosiz meta
-Name[uz@cyrillic]=Маъносиз мета
-Name[ven]=Meta isa tshili
-Name[vi]=Siêu giả
-Name[zh_CN]=哑元
-Name[zh_HK]=空的資料定義
-Name[zh_TW]=空的資料定義
-ServiceTypes=KFilePlugin
-X-TDE-Library=dummymeta
-MimeType=text/plain
-PreferredItems=Author,Title,Date
diff --git a/kio/tests/dummymeta.h b/kio/tests/dummymeta.h
deleted file mode 100644
index 053c48ecb..000000000
--- a/kio/tests/dummymeta.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef DUMMYMETA_H
-#define DUMMYMETA_H
-
-#include <kfilemetainfo.h>
-
-class KFileMetaInfo;
-
-class DummyMeta : public KFilePlugin
-{
- Q_OBJECT
-
-public:
- DummyMeta( TQObject *parent, const char *name, const TQStringList &args );
- ~DummyMeta() {}
-
- virtual bool readInfo( KFileMetaInfo::Internal& info );
-
-};
-
-#endif
diff --git a/kio/tests/getalltest.cpp b/kio/tests/getalltest.cpp
deleted file mode 100644
index 07d8723ed..000000000
--- a/kio/tests/getalltest.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <kservice.h>
-#include <kmimetype.h>
-#include <kservicetype.h>
-
-#include <kapplication.h>
-#include <kdebug.h>
-
-int main(int argc, char *argv[])
-{
- TDEApplication k(argc,argv,"getalltest",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption
-
-//for (int i = 0 ; i < 2 ; ++i ) { // test twice to see if they got deleted
- kdDebug() << "All services" << endl;
- KService::List services = KService::allServices();
- kdDebug() << "got " << services.count() << " services" << endl;
- TQValueListIterator<KService::Ptr> s = services.begin();
- for ( ; s != services.end() ; ++s )
- {
- kdDebug() << (*s)->name() << " " << (*s)->desktopEntryPath() << endl;
- }
-//}
-
- kdDebug() << "All mimeTypes" << endl;
- KMimeType::List mimeTypes = KMimeType::allMimeTypes();
- kdDebug() << "got " << mimeTypes.count() << " mimeTypes" << endl;
- TQValueListIterator<KMimeType::Ptr> m = mimeTypes.begin();
- for ( ; m != mimeTypes.end() ; ++m )
- {
- kdDebug() << (*m)->name() << endl;
- }
-
- kdDebug() << "All service types" << endl;
- KServiceType::List list = KServiceType::allServiceTypes();
- kdDebug() << "got " << list.count() << " service types" << endl;
- TQValueListIterator<KServiceType::Ptr> st = list.begin();
- for ( ; st != list.end() ; ++st )
- {
- kdDebug() << (*st)->name() << endl;
- }
-
- kdDebug() << "done" << endl;
-
- return 0;
-}
diff --git a/kio/tests/jobtest.cpp b/kio/tests/jobtest.cpp
deleted file mode 100644
index e811aaec4..000000000
--- a/kio/tests/jobtest.cpp
+++ /dev/null
@@ -1,613 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2004-2006 David Faure <faure@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License 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 "jobtest.h"
-
-#include <config.h>
-
-#include <kurl.h>
-#include <kapplication.h>
-#include <klargefile.h>
-#include <kio/netaccess.h>
-#include <kdebug.h>
-#include <kcmdlineargs.h>
-#include <kprotocolinfo.h>
-
-#include <tqfileinfo.h>
-#include <tqeventloop.h>
-#include <tqdir.h>
-#include <tqfileinfo.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <time.h>
-#include <utime.h>
-
-// The code comes partly from tdebase/kioslave/trash/testtrash.cpp
-
-static bool check(const TQString& txt, TQString a, TQString b)
-{
- if (a.isEmpty())
- a = TQString::null;
- if (b.isEmpty())
- b = TQString::null;
- if (a == b) {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
- }
- else {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl;
- exit(1);
- }
- return true;
-}
-
-int main(int argc, char *argv[])
-{
- TDEApplication::disableAutoDcopRegistration();
- TDECmdLineArgs::init(argc,argv,"jobtest", 0, 0, 0, 0);
- TDEApplication app;
-
- JobTest test;
- test.setup();
- test.runAll();
- test.cleanup();
- kdDebug() << "All tests OK." << endl;
- return 0; // success. The exit(1) in check() is what happens in case of failure.
-}
-
-TQString JobTest::homeTmpDir() const
-{
- return TQDir::homeDirPath() + "/.trinity/jobtest/";
-}
-
-TQString JobTest::otherTmpDir() const
-{
- // This one needs to be on another partition
- return "/tmp/jobtest/";
-}
-
-KURL JobTest::systemTmpDir() const
-{
- return "system:/home/.trinity/jobtest-system/";
-}
-
-TQString JobTest::realSystemPath() const
-{
- return TQDir::homeDirPath() + "/.trinity/jobtest-system/";
-}
-
-void JobTest::setup()
-{
- // Start with a clean base dir
- cleanup();
- TQDir dir; // TT: why not a static method?
- bool ok = dir.mkdir( homeTmpDir() );
- if ( !ok )
- kdFatal() << "Couldn't create " << homeTmpDir() << endl;
- ok = dir.mkdir( otherTmpDir() );
- if ( !ok )
- kdFatal() << "Couldn't create " << otherTmpDir() << endl;
- ok = dir.mkdir( realSystemPath() );
- if ( !ok )
- kdFatal() << "Couldn't create " << realSystemPath() << endl;
-}
-
-void JobTest::runAll()
-{
- get();
- copyFileToSamePartition();
- copyDirectoryToSamePartition();
- copyDirectoryToExistingDirectory();
- copyFileToOtherPartition();
- copyDirectoryToOtherPartition();
- listRecursive();
- moveFileToSamePartition();
- moveDirectoryToSamePartition();
- moveFileToOtherPartition();
- moveSymlinkToOtherPartition();
- moveDirectoryToOtherPartition();
- moveFileNoPermissions();
- moveDirectoryNoPermissions();
-
- copyFileToSystem();
-}
-
-void JobTest::cleanup()
-{
- TDEIO::NetAccess::del( homeTmpDir(), 0 );
- TDEIO::NetAccess::del( otherTmpDir(), 0 );
- TDEIO::NetAccess::del( systemTmpDir(), 0 );
-}
-
-static void setTimeStamp( const TQString& path )
-{
-#ifdef Q_OS_UNIX
- // Put timestamp in the past so that we can check that the
- // copy actually preserves it.
- struct timeval tp;
- gettimeofday( &tp, 0 );
- struct utimbuf utbuf;
- utbuf.actime = tp.tv_sec - 30; // 30 seconds ago
- utbuf.modtime = tp.tv_sec - 60; // 60 second ago
- utime( TQFile::encodeName( path ), &utbuf );
- tqDebug( "Time changed for %s", path.latin1() );
-#endif
-}
-
-static void createTestFile( const TQString& path )
-{
- TQFile f( path );
- if ( !f.open( IO_WriteOnly ) )
- kdFatal() << "Can't create " << path << endl;
- f.tqwriteBlock( "Hello world", 11 );
- f.close();
- setTimeStamp( path );
-}
-
-static void createTestSymlink( const TQString& path )
-{
- // Create symlink if it doesn't exist yet
- KDE_struct_stat buf;
- if ( KDE_lstat( TQFile::encodeName( path ), &buf ) != 0 ) {
- bool ok = symlink( "/IDontExist", TQFile::encodeName( path ) ) == 0; // broken symlink
- if ( !ok )
- kdFatal() << "couldn't create symlink: " << strerror( errno ) << endl;
- }
-}
-
-static void createTestDirectory( const TQString& path )
-{
- TQDir dir;
- bool ok = dir.mkdir( path );
- if ( !ok && !dir.exists() )
- kdFatal() << "couldn't create " << path << endl;
- createTestFile( path + "/testfile" );
- createTestSymlink( path + "/testlink" );
- setTimeStamp( path );
-}
-
-void JobTest::get()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString filePath = homeTmpDir() + "fileFromHome";
- createTestFile( filePath );
- KURL u; u.setPath( filePath );
- m_result = -1;
- TDEIO::StoredTransferJob* job = TDEIO::storedGet( u );
- connect( job, TQT_SIGNAL( result( TDEIO::Job* ) ),
- this, TQT_SLOT( slotGetResult( TDEIO::Job* ) ) );
- kapp->eventLoop()->enterLoop();
- assert( m_result == 0 ); // no error
- assert( m_data.size() == 11 );
- assert( TQCString( m_data ) == "Hello world" );
-}
-
-void JobTest::slotGetResult( TDEIO::Job* job )
-{
- m_result = job->error();
- m_data = static_cast<TDEIO::StoredTransferJob *>(job)->data();
- kapp->eventLoop()->exitLoop();
-}
-
-////
-
-void JobTest::copyLocalFile( const TQString& src, const TQString& dest )
-{
- KURL u;
- u.setPath( src );
- KURL d;
- d.setPath( dest );
-
- // copy the file with file_copy
- bool ok = TDEIO::NetAccess::file_copy( u, d );
- assert( ok );
- assert( TQFile::exists( dest ) );
- assert( TQFile::exists( src ) ); // still there
-
- {
- // check that the timestamp is the same (#24443)
- // Note: this only works because of copy() in kio_file.
- // The datapump solution ignores mtime, the app has to call FileCopyJob::setModificationTime()
- TQFileInfo srcInfo( src );
- TQFileInfo destInfo( dest );
- assert( srcInfo.lastModified() == destInfo.lastModified() );
- }
-
- // cleanup and retry with TDEIO::copy()
- TQFile::remove( dest );
- ok = TDEIO::NetAccess::dircopy( u, d, 0 );
- assert( ok );
- assert( TQFile::exists( dest ) );
- assert( TQFile::exists( src ) ); // still there
- {
- // check that the timestamp is the same (#24443)
- TQFileInfo srcInfo( src );
- TQFileInfo destInfo( dest );
- assert( srcInfo.lastModified() == destInfo.lastModified() );
- }
-}
-
-void JobTest::copyLocalDirectory( const TQString& src, const TQString& _dest, int flags )
-{
- assert( TQFileInfo( src ).isDir() );
- assert( TQFileInfo( src + "/testfile" ).isFile() );
- KURL u;
- u.setPath( src );
- TQString dest( _dest );
- KURL d;
- d.setPath( dest );
- if ( flags & AlreadyExists )
- assert( TQFile::exists( dest ) );
- else
- assert( !TQFile::exists( dest ) );
-
- bool ok = TDEIO::NetAccess::dircopy( u, d, 0 );
- assert( ok );
-
- if ( flags & AlreadyExists ) {
- dest += "/" + u.fileName();
- //kdDebug() << "Expecting dest=" << dest << endl;
- }
-
- assert( TQFile::exists( dest ) );
- assert( TQFileInfo( dest ).isDir() );
- assert( TQFileInfo( dest + "/testfile" ).isFile() );
- assert( TQFile::exists( src ) ); // still there
- {
- // check that the timestamp is the same (#24443)
- TQFileInfo srcInfo( src );
- TQFileInfo destInfo( dest );
- assert( srcInfo.lastModified() == destInfo.lastModified() );
- }
-}
-
-void JobTest::copyFileToSamePartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString filePath = homeTmpDir() + "fileFromHome";
- const TQString dest = homeTmpDir() + "fileFromHome_copied";
- createTestFile( filePath );
- copyLocalFile( filePath, dest );
-}
-
-void JobTest::copyDirectoryToSamePartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString src = homeTmpDir() + "dirFromHome";
- const TQString dest = homeTmpDir() + "dirFromHome_copied";
- createTestDirectory( src );
- copyLocalDirectory( src, dest );
-}
-
-void JobTest::copyDirectoryToExistingDirectory()
-{
- kdDebug() << k_funcinfo << endl;
- // just the same as copyDirectoryToSamePartition, but it means that
- // this time dest exists.
- const TQString src = homeTmpDir() + "dirFromHome";
- const TQString dest = homeTmpDir() + "dirFromHome_copied";
- createTestDirectory( src );
- copyLocalDirectory( src, dest, AlreadyExists );
-}
-
-void JobTest::copyFileToOtherPartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString filePath = homeTmpDir() + "fileFromHome";
- const TQString dest = otherTmpDir() + "fileFromHome_copied";
- createTestFile( filePath );
- copyLocalFile( filePath, dest );
-}
-
-void JobTest::copyDirectoryToOtherPartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString src = homeTmpDir() + "dirFromHome";
- const TQString dest = otherTmpDir() + "dirFromHome_copied";
- // src is already created by copyDirectoryToSamePartition()
- // so this is just in case someone calls this method only
- if ( !TQFile::exists( src ) )
- createTestDirectory( src );
- copyLocalDirectory( src, dest );
-}
-
-void JobTest::moveLocalFile( const TQString& src, const TQString& dest )
-{
- assert( TQFile::exists( src ) );
- KURL u;
- u.setPath( src );
- KURL d;
- d.setPath( dest );
-
- // move the file with file_move
- bool ok = TDEIO::NetAccess::file_move( u, d );
- assert( ok );
- assert( TQFile::exists( dest ) );
- assert( !TQFile::exists( src ) ); // not there anymore
-
- // move it back with TDEIO::move()
- ok = TDEIO::NetAccess::move( d, u, 0 );
- assert( ok );
- assert( !TQFile::exists( dest ) );
- assert( TQFile::exists( src ) ); // it's back
-}
-
-static void moveLocalSymlink( const TQString& src, const TQString& dest )
-{
- KDE_struct_stat buf;
- assert ( KDE_lstat( TQFile::encodeName( src ), &buf ) == 0 );
- KURL u;
- u.setPath( src );
- KURL d;
- d.setPath( dest );
-
- // move the symlink with move, NOT with file_move
- bool ok = TDEIO::NetAccess::move( u, d );
- if ( !ok )
- kdWarning() << TDEIO::NetAccess::lastError() << endl;
- assert( ok );
- assert ( KDE_lstat( TQFile::encodeName( dest ), &buf ) == 0 );
- assert( !TQFile::exists( src ) ); // not there anymore
-
- // move it back with TDEIO::move()
- ok = TDEIO::NetAccess::move( d, u, 0 );
- assert( ok );
- assert ( KDE_lstat( TQFile::encodeName( dest ), &buf ) != 0 ); // doesn't exist anymore
- assert ( KDE_lstat( TQFile::encodeName( src ), &buf ) == 0 ); // it's back
-}
-
-void JobTest::moveLocalDirectory( const TQString& src, const TQString& dest )
-{
- assert( TQFile::exists( src ) );
- assert( TQFileInfo( src ).isDir() );
- assert( TQFileInfo( src + "/testfile" ).isFile() );
- assert( TQFileInfo( src + "/testlink" ).isSymLink() );
- KURL u;
- u.setPath( src );
- KURL d;
- d.setPath( dest );
-
- bool ok = TDEIO::NetAccess::move( u, d, 0 );
- assert( ok );
- assert( TQFile::exists( dest ) );
- assert( TQFileInfo( dest ).isDir() );
- assert( TQFileInfo( dest + "/testfile" ).isFile() );
- assert( !TQFile::exists( src ) ); // not there anymore
-
- assert( TQFileInfo( dest + "/testlink" ).isSymLink() );
-}
-
-void JobTest::moveFileToSamePartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString filePath = homeTmpDir() + "fileFromHome";
- const TQString dest = homeTmpDir() + "fileFromHome_moved";
- createTestFile( filePath );
- moveLocalFile( filePath, dest );
-}
-
-void JobTest::moveDirectoryToSamePartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString src = homeTmpDir() + "dirFromHome";
- const TQString dest = homeTmpDir() + "dirFromHome_moved";
- createTestDirectory( src );
- moveLocalDirectory( src, dest );
-}
-
-void JobTest::moveFileToOtherPartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString filePath = homeTmpDir() + "fileFromHome";
- const TQString dest = otherTmpDir() + "fileFromHome_moved";
- createTestFile( filePath );
- moveLocalFile( filePath, dest );
-}
-
-void JobTest::moveSymlinkToOtherPartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString filePath = homeTmpDir() + "testlink";
- const TQString dest = otherTmpDir() + "testlink_moved";
- createTestSymlink( filePath );
- moveLocalSymlink( filePath, dest );
-}
-
-void JobTest::moveDirectoryToOtherPartition()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString src = homeTmpDir() + "dirFromHome";
- const TQString dest = otherTmpDir() + "dirFromHome_moved";
- createTestDirectory( src );
- moveLocalDirectory( src, dest );
-}
-
-void JobTest::moveFileNoPermissions()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString src = "/etc/passwd";
- const TQString dest = homeTmpDir() + "passwd";
- assert( TQFile::exists( src ) );
- assert( TQFileInfo( src ).isFile() );
- KURL u;
- u.setPath( src );
- KURL d;
- d.setPath( dest );
-
- TDEIO::CopyJob* job = TDEIO::move( u, d, 0 );
- job->setInteractive( false ); // no skip dialog, thanks
- TQMap<TQString, TQString> metaData;
- bool ok = TDEIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
- assert( !ok );
- assert( TDEIO::NetAccess::lastError() == TDEIO::ERR_ACCESS_DENIED );
- // OK this is fishy. Just like mv(1), KIO's behavior depends on whether
- // a direct rename(2) was used, or a full copy+del. In the first case
- // there is no destination file created, but in the second case the
- // destination file remains.
- // In fact we assume /home is a separate partition, in this test, so:
- assert( TQFile::exists( dest ) );
- assert( TQFile::exists( src ) );
-}
-
-void JobTest::moveDirectoryNoPermissions()
-{
- kdDebug() << k_funcinfo << endl;
- const TQString src = "/etc/init.d";
- const TQString dest = homeTmpDir() + "init.d";
- assert( TQFile::exists( src ) );
- assert( TQFileInfo( src ).isDir() );
- KURL u;
- u.setPath( src );
- KURL d;
- d.setPath( dest );
-
- TDEIO::CopyJob* job = TDEIO::move( u, d, 0 );
- job->setInteractive( false ); // no skip dialog, thanks
- TQMap<TQString, TQString> metaData;
- bool ok = TDEIO::NetAccess::synchronousRun( job, 0, 0, 0, &metaData );
- assert( !ok );
- assert( TDEIO::NetAccess::lastError() == TDEIO::ERR_ACCESS_DENIED );
- assert( TQFile::exists( dest ) ); // see moveFileNoPermissions
- assert( TQFile::exists( src ) );
-}
-
-void JobTest::listRecursive()
-{
- const TQString src = homeTmpDir();
- KURL u;
- u.setPath( src );
- TDEIO::ListJob* job = TDEIO::listRecursive( u );
- connect( job, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ),
- TQT_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& ) ) );
- bool ok = TDEIO::NetAccess::synchronousRun( job, 0 );
- assert( ok );
- m_names.sort();
- check( "listRecursive", m_names.join( "," ), ".,..,"
- "dirFromHome,dirFromHome/testfile,dirFromHome/testlink,dirFromHome_copied,"
- "dirFromHome_copied/dirFromHome,dirFromHome_copied/dirFromHome/testfile,dirFromHome_copied/dirFromHome/testlink,"
- "dirFromHome_copied/testfile,dirFromHome_copied/testlink,"
- "fileFromHome,fileFromHome_copied" );
-}
-
-void JobTest::slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& lst )
-{
- for( TDEIO::UDSEntryList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
- TDEIO::UDSEntry::ConstIterator it2 = (*it).begin();
- TQString displayName;
- KURL url;
- for( ; it2 != (*it).end(); it2++ ) {
- switch ((*it2).m_uds) {
- case TDEIO::UDS_NAME:
- displayName = (*it2).m_str;
- break;
- case TDEIO::UDS_URL:
- url = (*it2).m_str;
- break;
- }
- }
- m_names.append( displayName );
- }
-}
-
-void JobTest::copyFileToSystem()
-{
- if ( !KProtocolInfo::isKnownProtocol( TQString::fromLatin1( "system" ) ) ) {
- kdDebug() << k_funcinfo << "no kio_system, skipping test" << endl;
- return;
- }
-
- // First test with support for UDS_LOCAL_PATH
- copyFileToSystem( true );
-
- TQString dest = realSystemPath() + "fileFromHome_copied";
- TQFile::remove( dest );
-
- // Then disable support for UDS_LOCAL_PATH, i.e. test what would
- // happen for ftp, smb, http etc.
- copyFileToSystem( false );
-}
-
-void JobTest::copyFileToSystem( bool resolve_local_urls )
-{
- kdDebug() << k_funcinfo << resolve_local_urls << endl;
- extern TDEIO_EXPORT bool kio_resolve_local_urls;
- kio_resolve_local_urls = resolve_local_urls;
-
- const TQString src = homeTmpDir() + "fileFromHome";
- createTestFile( src );
- KURL u;
- u.setPath( src );
- KURL d = systemTmpDir();
- d.addPath( "fileFromHome_copied" );
-
- kdDebug() << "copying " << u << " to " << d << endl;
-
- // copy the file with file_copy
- TDEIO::FileCopyJob* job = TDEIO::file_copy( u, d );
- connect( job, TQT_SIGNAL(mimetype(TDEIO::Job*,const TQString&)),
- this, TQT_SLOT(slotMimetype(TDEIO::Job*,const TQString&)) );
- bool ok = TDEIO::NetAccess::synchronousRun( job, 0 );
- assert( ok );
-
- TQString dest = realSystemPath() + "fileFromHome_copied";
-
- assert( TQFile::exists( dest ) );
- assert( TQFile::exists( src ) ); // still there
-
- {
- // do NOT check that the timestamp is the same.
- // It can't work with file_copy when it uses the datapump,
- // unless we use setModificationTime in the app code.
- }
-
- // Check mimetype
- kdDebug() << m_mimetype << endl;
- // There's no mimemagic determination in kio_file in trinity. Fixing this for kde4...
- assert( m_mimetype == "application/octet-stream" );
- //assert( m_mimetype == "text/plain" );
-
- // cleanup and retry with TDEIO::copy()
- TQFile::remove( dest );
- ok = TDEIO::NetAccess::dircopy( u, d, 0 );
- assert( ok );
- assert( TQFile::exists( dest ) );
- assert( TQFile::exists( src ) ); // still there
- {
- // check that the timestamp is the same (#79937)
- TQFileInfo srcInfo( src );
- TQFileInfo destInfo( dest );
- assert( srcInfo.lastModified() == destInfo.lastModified() );
- }
-
- // restore normal behavior
- kio_resolve_local_urls = true;
-}
-
-void JobTest::slotMimetype(TDEIO::Job* job, const TQString& type)
-{
- assert( job );
- m_mimetype = type;
-}
-
-#include "jobtest.moc"
diff --git a/kio/tests/jobtest.h b/kio/tests/jobtest.h
deleted file mode 100644
index 61051fbaf..000000000
--- a/kio/tests/jobtest.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2004 David Faure <faure@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License 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 JOBTEST_H
-#define JOBTEST_H
-
-#include <tqstring.h>
-#include <tqobject.h>
-#include <kio/job.h>
-
-class JobTest : public TQObject
-{
- Q_OBJECT
-
-public:
- JobTest() {}
- void setup();
- void runAll();
- void cleanup();
-
- // Local tests (kio_file only)
- void get();
- void copyFileToSamePartition();
- void copyDirectoryToSamePartition();
- void copyDirectoryToExistingDirectory();
- void copyFileToOtherPartition();
- void copyDirectoryToOtherPartition();
- void listRecursive();
- void moveFileToSamePartition();
- void moveDirectoryToSamePartition();
- void moveFileToOtherPartition();
- void moveSymlinkToOtherPartition();
- void moveDirectoryToOtherPartition();
- void moveFileNoPermissions();
- void moveDirectoryNoPermissions();
-
- // Remote tests
- void copyFileToSystem();
-
-private slots:
- void slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList& lst );
- void slotGetResult( TDEIO::Job* );
- void slotMimetype(TDEIO::Job*,const TQString&);
-
-private:
- TQString homeTmpDir() const;
- TQString otherTmpDir() const;
- TQString realSystemPath() const;
- KURL systemTmpDir() const;
- enum { AlreadyExists = 1 };
- void copyLocalFile( const TQString& src, const TQString& dest );
- void copyLocalDirectory( const TQString& src, const TQString& dest, int flags = 0 );
- void moveLocalFile( const TQString& src, const TQString& dest );
- void moveLocalDirectory( const TQString& src, const TQString& dest );
- void copyFileToSystem( bool resolve_local_urls );
-
- int m_result;
- TQByteArray m_data;
- TQStringList m_names;
- TQString m_mimetype;
-};
-
-#endif
diff --git a/kio/tests/kacltest.cpp b/kio/tests/kacltest.cpp
deleted file mode 100644
index 45ace585f..000000000
--- a/kio/tests/kacltest.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2005 Till Adam <adam@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 "kacltest.h"
-
-#include <config.h>
-
-#include <kacl.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kcmdlineargs.h>
-
-#include <tqfileinfo.h>
-#include <tqeventloop.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <tqdir.h>
-
-// The code comes partly from tdebase/kioslave/trash/testtrash.cpp
-
-static bool check(const TQString& txt, TQString a, TQString b)
-{
- if (a.isEmpty())
- a = TQString::null;
- if (b.isEmpty())
- b = TQString::null;
- if (a == b) {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
- }
- else {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl;
- exit(1);
- }
- return true;
-}
-
-template<typename T>
-static bool check(const TQString& txt, T a, T b)
-{
- if (a == b) {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
- }
- else {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl;
- exit(1);
- }
- return true;
-}
-
-int main(int argc, char *argv[])
-{
- TDEApplication::disableAutoDcopRegistration();
- TDECmdLineArgs::init(argc,argv,"kacltest", 0, 0, 0, 0);
- TDEApplication app;
-
- KACLTest test;
- test.setup();
- test.runAll();
- test.cleanup();
- kdDebug() << "All tests OK." << endl;
- return 0; // success. The exit(1) in check() is what happens in case of failure.
-}
-
-#ifdef Q_OS_FREEBSD
-static const TQString s_group1 = TQString::fromLatin1("staff");
-static const TQString s_group2 = TQString::fromLatin1("guest");
-#else
-static const TQString s_group1 = TQString::fromLatin1("audio");
-static const TQString s_group2 = TQString::fromLatin1("users");
-#endif
-
-static const TQString s_testACL = TQString::fromLatin1( "user::rw-\nuser:bin:rwx\ngroup::rw-\nmask::rwx\nother::r--\n" );
-static const TQString s_testACL2 = TQString::fromLatin1( "user::rwx\nuser:bin:rwx\ngroup::rw-\n") +
- TQString::fromLatin1( "group:" ) + s_group1 + TQString::fromLatin1( ":--x\n" ) +
- TQString::fromLatin1( "group:" ) + s_group2 + TQString::fromLatin1( ":r--\n" ) +
- TQString::fromLatin1( "mask::r-x\nother::r--\n" );
-static const TQString s_testACLEffective = TQString::fromLatin1( "user::rwx\nuser:bin:rwx #effective:r-x\ngroup::rw- #effective:r--\n" ) +
- TQString::fromLatin1( "group:" ) + s_group1 + TQString::fromLatin1( ":--x\n" ) +
- TQString::fromLatin1( "group:" ) + s_group2 + TQString::fromLatin1( ":r--\n" ) +
- TQString::fromLatin1( "mask::r-x\nother::r--\n" );
-
-KACLTest::KACLTest()
-:m_acl( s_testACL )
-{
-}
-
-void KACLTest::setup()
-{
-}
-
-void KACLTest::runAll()
-{
- testAsString();
- testGetOwnerPermissions();
- testGetOwningGroupPermissions();
- testGetOthersPermissions();
-
- testGetMaskPermissions();
- testGetAllUserPermissions();
-
- testIsExtended();
-
- // from here on we operate with the second test string
- testSetACL();
- testGetAllGroupsPermissions();
-
- testOperators();
- testSettingBasic();
- testSettingExtended();
- testSettingErrorHandling();
-
- testNewMask();
-}
-
-void KACLTest::cleanup()
-{
-}
-
-void KACLTest::testAsString()
-{
- check( "asString: ", m_acl.asString(), s_testACL );
-}
-
-void KACLTest::testSetACL()
-{
- m_acl.setACL( s_testACL2 );
- check( "setACL: ", m_acl.asString().simplifyWhiteSpace().remove(" "), s_testACLEffective.simplifyWhiteSpace().remove(" ") );
-}
-
-void KACLTest::testGetOwnerPermissions()
-{
- check( "Owner permissions: ", TQString::number( m_acl.ownerPermissions() ), "6" );
-}
-
-void KACLTest::testGetOwningGroupPermissions()
-{
- check( "Owning group permissions: ", TQString::number( m_acl.owningGroupPermissions() ), "6" );
-}
-
-void KACLTest::testGetOthersPermissions()
-{
- check( "Others permissions: ", TQString::number( m_acl.othersPermissions() ), "4" );
-}
-
-void KACLTest::testGetMaskPermissions()
-{
- bool exists = false;
- unsigned short mask = m_acl.maskPermissions( exists );
- check( "Mask permissions: ", TQString::number( mask ), "7" );
- check( "Mask permissions: ", exists, true );
-}
-
-void KACLTest::testGetAllUserPermissions()
-{
- ACLUserPermissionsList list = m_acl.allUserPermissions();
- ACLUserPermissionsConstIterator it = list.begin();
- TQString name;
- unsigned short permissions;
- int count = 0;
- while ( it != list.end() ) {
- name = ( *it ).first;
- permissions = ( *it ).second;
- ++it;
- ++count;
- }
- check( "All users count: ", TQString::number( count ), "1" );
- check( "All users name: ", name, "bin" );
- check( "All users permissions: ", TQString::number( permissions ), "7" );
-}
-
-void KACLTest::testGetAllGroupsPermissions()
-{
- ACLGroupPermissionsList list = m_acl.allGroupPermissions();
- ACLGroupPermissionsConstIterator it = list.begin();
- TQString name;
- unsigned short permissions;
- int count = 0;
- while ( it != list.end() ) {
- name = ( *it ).first;
- permissions = ( *it ).second;
- // setACL sorts them alphabetically ...
- if ( count == 0 ) {
- check( "All groups name: ", name, s_group1 );
- check( "All groups permissions: ", TQString::number( permissions ), "1" );
- } else if ( count == 1 ) {
- check( "All groups name: ", name, s_group2 );
- check( "All groups permissions: ", TQString::number( permissions ), "4" );
- }
- ++it;
- ++count;
- }
- check( "All users count: ", TQString::number( count ), "2" );
-}
-
-void KACLTest::testIsExtended()
-{
- KACL dukeOfMonmoth( s_testACL );
- check( "isExtended on an extended one: ", dukeOfMonmoth.isExtended(), true );
- KACL earlOfUpnor( "user::r--\ngroup::r--\nother::r--\n" );
- check( "isExtended on a not extended one: ", earlOfUpnor.isExtended(), false );
-}
-
-void KACLTest::testOperators()
-{
- KACL dukeOfMonmoth( s_testACL );
- KACL JamesScott( s_testACL );
- KACL earlOfUpnor( s_testACL2 );
- check( "operator== on different ones: ", dukeOfMonmoth == earlOfUpnor, false );
- check( "operator== on identical ones: ", dukeOfMonmoth == JamesScott, true );
- check( "operator!= on diffenrent ones: ", dukeOfMonmoth != earlOfUpnor, true );
- check( "operator!=: on identical ones: ", dukeOfMonmoth != JamesScott, false );
-}
-
-void KACLTest::testSettingBasic()
-{
- KACL CharlesII( s_testACL );
- CharlesII.setOwnerPermissions( 7 ); // clearly
- CharlesII.setOwningGroupPermissions( 0 );
- CharlesII.setOthersPermissions( 0 );
- check( "setOwnerPermissions: ", TQString::number( CharlesII.ownerPermissions() ),"7" );
- check( "setOwningGroupPermissions: ", TQString::number( CharlesII.owningGroupPermissions() ),"0" );
- check( "setOthersPermissions: ", TQString::number( CharlesII.othersPermissions() ),"0" );
-}
-
-void KACLTest::testSettingExtended()
-{
- KACL CharlesII( s_testACL );
- CharlesII.setMaskPermissions( 7 ); // clearly
- bool dummy = false;
- check( "setMaskPermissions: ", TQString::number( CharlesII.maskPermissions( dummy ) ),"7" );
-
- const TQString expected( "user::rw-\nuser:root:rwx\nuser:bin:r--\ngroup::rw-\nmask::rwx\nother::r--\n" );
-
- ACLUserPermissionsList users;
- ACLUserPermissions user = qMakePair( TQString( "root" ), ( unsigned short )7 );
- users.append( user );
- user = qMakePair( TQString( "bin" ), ( unsigned short )4 );
- users.append( user );
- CharlesII.setAllUserPermissions( users );
- check( "setAllUserPermissions: ", CharlesII.asString(), expected );
-
- CharlesII.setACL( s_testACL ); // reset
- // it already has an entry for bin, let's change it
- CharlesII.setNamedUserPermissions( TQString("bin"), 4 );
- CharlesII.setNamedUserPermissions( TQString( "root" ), 7 );
- check( "setNamedUserPermissions: ", CharlesII.asString(), expected );
-
- // groups, all and named
-
- const TQString expected2 = TQString::fromLatin1( "user::rw-\nuser:bin:rwx\ngroup::rw-\ngroup:" ) + s_group1 +
- TQString::fromLatin1( ":-wx\ngroup:" ) + s_group2 + TQString::fromLatin1(":r--\nmask::rwx\nother::r--\n" );
- CharlesII.setACL( s_testACL ); // reset
- ACLGroupPermissionsList groups;
- ACLGroupPermissions group = qMakePair( s_group1, ( unsigned short )3 );
- groups.append( group );
- group = qMakePair( s_group2, ( unsigned short )4 );
- groups.append( group );
- CharlesII.setAllGroupPermissions( groups );
- check( "setAllGroupPermissions: ", CharlesII.asString(), expected2 );
-
- CharlesII.setACL( s_testACL ); // reset
- CharlesII.setNamedGroupPermissions( s_group1, 3 );
- CharlesII.setNamedGroupPermissions( s_group2, 4 );
- check( "setNamedGroupPermissions: ", CharlesII.asString(), expected2 );
-}
-
-void KACLTest::testSettingErrorHandling()
-{
- KACL foo( s_testACL );
- bool v = foo.setNamedGroupPermissions( s_group1, 7 ); // existing group
- check( "Existing group: ", v, true );
- v = foo.setNamedGroupPermissions( "jongel", 7 ); // non-existing group
- check( "Non-existing group: ", v, false );
-
- v = foo.setNamedUserPermissions( "bin", 7 ); // existing user
- check( "Existing user: ", v, true );
- v = foo.setNamedUserPermissions( "jongel", 7 ); // non-existing user
- check( "Non-existing user: ", v, false );
-}
-
-void KACLTest::testNewMask()
-{
- KACL CharlesII( "user::rw-\ngroup::rw-\nother::rw\n" );
- bool dummy = false;
- CharlesII.maskPermissions( dummy );
- check( "mask exists: ", dummy, false );
-
- CharlesII.setMaskPermissions( 6 );
- check( "new mask set: ", TQString::number( CharlesII.maskPermissions( dummy ) ), "6" );
- check( "mask exists now: ", dummy, true );
-}
diff --git a/kio/tests/kacltest.h b/kio/tests/kacltest.h
deleted file mode 100644
index 1a85e4109..000000000
--- a/kio/tests/kacltest.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* This file is part of the KDE project
- Copyright (C) 2005 Till Adam <adam@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 KACLTEST_H
-#define KACLTEST_H
-
-#include <tqobject.h>
-#include <kacl.h>
-
-class KACLTest
-{
-public:
- KACLTest();
- void setup();
- void runAll();
- void cleanup();
-
- void testAsString();
- void testSetACL();
- void testGetOwnerPermissions();
- void testGetOwningGroupPermissions();
- void testGetOthersPermissions();
- void testGetMaskPermissions();
- void testGetAllUserPermissions();
- void testGetAllGroupsPermissions();
- void testIsExtended();
- void testOperators();
- void testSettingBasic();
- void testSettingExtended();
- void testSettingErrorHandling();
- void testNewMask();
-
-private:
- KACL m_acl;
-};
-
-#endif
diff --git a/kio/tests/kdcopcheck.cpp b/kio/tests/kdcopcheck.cpp
deleted file mode 100644
index 79f050f51..000000000
--- a/kio/tests/kdcopcheck.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <kuserprofile.h>
-#include <ktrader.h>
-#include <kservice.h>
-#include <kmimetype.h>
-#include <assert.h>
-#include <kstandarddirs.h>
-#include <kservicegroup.h>
-#include <kimageio.h>
-#include <kprotocolinfo.h>
-#include <kprocess.h>
-#include <tqtimer.h>
-
-#include "kdcopcheck.h"
-#include <dcopclient.h>
-
-#include <kapplication.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-void debug(TQString txt)
-{
- fprintf(stderr, "%s\n", txt.ascii());
-}
-
-void debug(const char *txt)
-{
- fprintf(stderr, "%s\n", txt);
-}
-void debug(const char *format, const char *txt)
-{
- fprintf(stderr, format, txt);
- fprintf(stderr, "\n");
-}
-
-TestService::TestService(const TQString &exec)
-{
- m_exec = exec;
- proc << exec;
-
- proc.start();
-
- connect(kapp->dcopClient(), TQT_SIGNAL( applicationRegistered(const TQCString&)),
- this, TQT_SLOT(newApp(const TQCString&)));
- connect(kapp->dcopClient(), TQT_SIGNAL( applicationRemoved(const TQCString&)),
- this, TQT_SLOT(endApp(const TQCString&)));
- connect(&proc, TQT_SIGNAL(processExited(TDEProcess *)),
- this, TQT_SLOT(appExit()));
-
- TQTimer::singleShot(20*1000, this, TQT_SLOT(stop()));
- result = KService::DCOP_None;
-}
-
-void TestService::newApp(const TQCString &appId)
-{
- TQString id = appId;
- if (id == m_exec)
- {
- result = KService::DCOP_Unique;
- stop();
- }
- else if (id.startsWith(m_exec))
- {
- result = KService::DCOP_Multi;
- stop();
- }
- tqWarning("Register %s", appId.data());
-}
-
-void TestService::endApp(const TQCString &appId)
-{
- tqWarning("Unegister %s", appId.data());
-}
-
-void TestService::appExit()
-{
- tqWarning("Exit");
-}
-
-void TestService::stop()
-{
- kapp->exit_loop();
-}
-
-int TestService::exec()
-{
- kapp->enter_loop();
- return result;
-}
-
-int main(int argc, char *argv[])
-{
- putenv("IGNORE_SYCOCA_VERSION=true");
- TDEApplication k(argc,argv,"whatever",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption
-
- k.dcopClient()->setNotifications(true);
-
- KService::List list = KService::allServices();
-
- tqWarning("I found %d services.", list.count());
- int i = 0;
- for(KService::List::ConstIterator it = list.begin(); it != list.end(); ++it)
- {
- if (((*it)->DCOPServiceType() == KService::DCOP_None) &&
- !(*it)->desktopEntryPath().startsWith("SuSE") &&
- (*it)->hasServiceType("Application"))
- {
- if ((*it)->exec().startsWith((*it)->desktopEntryName()))
- {
- i++;
-
- TestService *test = new TestService((*it)->desktopEntryName());
- int n = test->exec();
- delete test;
-
- TQString result;
- if (n == KService::DCOP_None)
- result = "None";
- else if (n == KService::DCOP_Unique)
- result = "Unique";
- else if (n == KService::DCOP_Multi)
- result = "Multi";
-
- tqWarning("%s %s", (*it)->desktopEntryPath().latin1(),
- result.latin1());
- }
- }
- }
- tqWarning("%d left after filtering.", i);
-}
-
-#include "kdcopcheck.moc"
diff --git a/kio/tests/kdcopcheck.h b/kio/tests/kdcopcheck.h
deleted file mode 100644
index 593dbba1e..000000000
--- a/kio/tests/kdcopcheck.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef _BLA_H_
-#define _BLA_H_
-
-#include <kprocess.h>
-#include <tqstring.h>
-#include <tqobject.h>
-
-class TestService : public TQObject
-{
- Q_OBJECT
-public:
- TestService(const TQString &exec);
-
- int exec();
-
-public slots:
- void newApp(const TQCString &appId);
- void endApp(const TQCString &appId);
- void appExit();
- void stop();
-
-protected:
- int result;
- TQString m_exec;
- TDEProcess proc;
-};
-
-#endif
diff --git a/kio/tests/kdefaultprogresstest.cpp b/kio/tests/kdefaultprogresstest.cpp
deleted file mode 100644
index 79ad44e3c..000000000
--- a/kio/tests/kdefaultprogresstest.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <kapplication.h>
-#include <kio/defaultprogress.h>
-#include <kurl.h>
-#include <kdebug.h>
-
-using namespace TDEIO;
-
-int main(int argc, char **argv)
-{
- TDEApplication app(argc, argv, "kdefaultprogresstest");
-
- DefaultProgress* dlg = new DefaultProgress();
- KURL src("http://this.host.doesn't.exist/this/dir/neither/andthisfileneither");
- KURL dest("file:/tmp/dest");
- dlg->slotCopying( 0L, src, dest );
- dlg->slotTotalSize( 0L, 12000 );
- dlg->slotTotalFiles( 0L, 12 );
- dlg->slotTotalDirs( 0L, 1 );
-
- dlg->slotSpeed( 0L, 55 );
- dlg->slotInfoMessage( 0L, TQString::fromLatin1( "Starting..." ) );
-
- int files = 0;
- for ( int size = 0 ; size < 12000 ; size += 1 )
- {
- dlg->slotProcessedSize( 0L, size );
- dlg->slotPercent( 0L, 100 * size / 12000 );
- if ( size % 1000 == 0 )
- {
- dlg->slotProcessedFiles( 0L, ++files );
- }
- kapp->processEvents();
- }
- dlg->slotInfoMessage( 0L, TQString::fromLatin1( "Done." ) );
-
- delete dlg;
- return 0;
-}
-
diff --git a/kio/tests/kdirlistertest.cpp b/kio/tests/kdirlistertest.cpp
deleted file mode 100644
index 000fb200c..000000000
--- a/kio/tests/kdirlistertest.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/* This file is part of the KDE desktop environment
-
- Copyright (C) 2001, 2002 Michael Brade <brade@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 <tqlayout.h>
-#include <tqpushbutton.h>
-
-#include <kapplication.h>
-#include <kdirlister.h>
-#include <kdebug.h>
-
-#include "kdirlistertest.h"
-
-#include <cstdlib>
-
-
-KDirListerTest::KDirListerTest( TQWidget *parent, const char *name )
- : TQWidget( parent, name )
-{
- lister = new KDirLister( false /* true */ );
- debug = new PrintSignals;
-
- TQVBoxLayout* layout = new TQVBoxLayout( this );
-
- TQPushButton* startH = new TQPushButton( "Start listing $HOME", this );
- TQPushButton* startR= new TQPushButton( "Start listing /", this );
- TQPushButton* test = new TQPushButton( "Many", this );
- TQPushButton* startT = new TQPushButton( "tarfile", this );
-
- layout->addWidget( startH );
- layout->addWidget( startR );
- layout->addWidget( startT );
- layout->addWidget( test );
- resize( layout->sizeHint() );
-
- connect( startR, TQT_SIGNAL( clicked() ), TQT_SLOT( startRoot() ) );
- connect( startH, TQT_SIGNAL( clicked() ), TQT_SLOT( startHome() ) );
- connect( startT, TQT_SIGNAL( clicked() ), TQT_SLOT( startTar() ) );
- connect( test, TQT_SIGNAL( clicked() ), TQT_SLOT( test() ) );
-
- connect( lister, TQT_SIGNAL( started( const KURL & ) ),
- debug, TQT_SLOT( started( const KURL & ) ) );
- connect( lister, TQT_SIGNAL( completed() ),
- debug, TQT_SLOT( completed() ) );
- connect( lister, TQT_SIGNAL( completed( const KURL & ) ),
- debug, TQT_SLOT( completed( const KURL & ) ) );
- connect( lister, TQT_SIGNAL( canceled() ),
- debug, TQT_SLOT( canceled() ) );
- connect( lister, TQT_SIGNAL( canceled( const KURL & ) ),
- debug, TQT_SLOT( canceled( const KURL & ) ) );
- connect( lister, TQT_SIGNAL( redirection( const KURL & ) ),
- debug, TQT_SLOT( redirection( const KURL & ) ) );
- connect( lister, TQT_SIGNAL( redirection( const KURL &, const KURL & ) ),
- debug, TQT_SLOT( redirection( const KURL &, const KURL & ) ) );
- connect( lister, TQT_SIGNAL( clear() ),
- debug, TQT_SLOT( clear() ) );
- connect( lister, TQT_SIGNAL( newItems( const KFileItemList & ) ),
- debug, TQT_SLOT( newItems( const KFileItemList & ) ) );
- connect( lister, TQT_SIGNAL( itemsFilteredByMime( const KFileItemList & ) ),
- debug, TQT_SLOT( itemsFilteredByMime( const KFileItemList & ) ) );
- connect( lister, TQT_SIGNAL( deleteItem( KFileItem * ) ),
- debug, TQT_SLOT( deleteItem( KFileItem * ) ) );
- connect( lister, TQT_SIGNAL( refreshItems( const KFileItemList & ) ),
- debug, TQT_SLOT( refreshItems( const KFileItemList & ) ) );
- connect( lister, TQT_SIGNAL( infoMessage( const TQString& ) ),
- debug, TQT_SLOT( infoMessage( const TQString& ) ) );
- connect( lister, TQT_SIGNAL( percent( int ) ),
- debug, TQT_SLOT( percent( int ) ) );
- connect( lister, TQT_SIGNAL( totalSize( TDEIO::filesize_t ) ),
- debug, TQT_SLOT( totalSize( TDEIO::filesize_t ) ) );
- connect( lister, TQT_SIGNAL( processedSize( TDEIO::filesize_t ) ),
- debug, TQT_SLOT( processedSize( TDEIO::filesize_t ) ) );
- connect( lister, TQT_SIGNAL( speed( int ) ),
- debug, TQT_SLOT( speed( int ) ) );
-
- connect( lister, TQT_SIGNAL( completed() ),
- this, TQT_SLOT( completed() ) );
-}
-
-KDirListerTest::~KDirListerTest()
-{
- delete lister;
-}
-
-void KDirListerTest::startHome()
-{
- KURL home( getenv( "HOME" ) );
- lister->openURL( home, false, false );
-// lister->stop();
-}
-
-void KDirListerTest::startRoot()
-{
- KURL root( "file:/" );
- lister->openURL( root, true, true );
-// lister->stop( root );
-}
-
-void KDirListerTest::startTar()
-{
- KURL root( "file:/home/jowenn/aclocal_1.tgz" );
- lister->openURL( root, true, true );
-// lister->stop( root );
-}
-
-void KDirListerTest::test()
-{
- KURL home( getenv( "HOME" ) );
- KURL root( "file:/" );
-/* lister->openURL( home, true, false );
- lister->openURL( root, true, true );
- lister->openURL( KURL("file:/etc"), true, true );
- lister->openURL( root, true, true );
- lister->openURL( KURL("file:/dev"), true, true );
- lister->openURL( KURL("file:/tmp"), true, true );
- lister->openURL( KURL("file:/usr/include"), true, true );
- lister->updateDirectory( KURL("file:/usr/include") );
- lister->updateDirectory( KURL("file:/usr/include") );
- lister->openURL( KURL("file:/usr/"), true, true );
-*/
- lister->openURL( KURL("file:/dev"), true, true );
-}
-
-void KDirListerTest::completed()
-{
- if ( lister->url().path() == "/")
- {
- KFileItem* item = lister->findByURL( "/tmp" );
- if ( item )
- kdDebug() << "Found /tmp: " << item << endl;
- else
- kdWarning() << "/tmp not found! Bug in findByURL?" << endl;
- }
-}
-
-int main ( int argc, char *argv[] )
-{
- TDEApplication app( argc, argv, "kdirlistertest" );
-
- KDirListerTest *test = new KDirListerTest( 0 );
- test->show();
- app.setMainWidget( test );
- return app.exec();
-}
-
-#include "kdirlistertest.moc"
diff --git a/kio/tests/kdirlistertest.h b/kio/tests/kdirlistertest.h
deleted file mode 100644
index 065f7478d..000000000
--- a/kio/tests/kdirlistertest.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* This file is part of the KDE desktop environment
-
- Copyright (C) 2001, 2002 Michael Brade <brade@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 _KDIRLISTERTEST_H_
-#define _KDIRLISTERTEST_H_
-
-#include <tqwidget.h>
-#include <tqstring.h>
-
-#include <kurl.h>
-#include <kfileitem.h>
-
-#include <iostream>
-
-using namespace std;
-
-class PrintSignals : public TQObject
-{
- Q_OBJECT
-public:
- PrintSignals() : TQObject() { }
-
-public slots:
- void started( const KURL &url )
- {
- cout << "*** started( " << url.url().local8Bit() << " )" << endl;
- }
- void canceled() { cout << "canceled()" << endl; }
- void canceled( const KURL& url )
- {
- cout << "*** canceled( " << url.prettyURL().local8Bit() << " )" << endl;
- }
- void completed() { cout << "*** completed()" << endl; }
- void completed( const KURL& url )
- {
- cout << "*** completed( " << url.prettyURL().local8Bit() << " )" << endl;
- }
- void redirection( const KURL& url )
- {
- cout << "*** redirection( " << url.prettyURL().local8Bit() << " )" << endl;
- }
- void redirection( const KURL& src, const KURL& dest )
- {
- cout << "*** redirection( " << src.prettyURL().local8Bit() << ", "
- << dest.prettyURL().local8Bit() << " )" << endl;
- }
- void clear() { cout << "*** clear()" << endl; }
- void newItems( const KFileItemList& items )
- {
- cout << "*** newItems: " << endl;
- for ( KFileItemListIterator it( items ) ; it.current() ; ++it )
- cout << it.current() << " " << it.current()->name().local8Bit() << endl;
- }
- void deleteItem( KFileItem* item )
- {
- cout << "*** deleteItem: " << item->url().prettyURL().local8Bit() << endl;
- }
- void itemsFilteredByMime( const KFileItemList& )
- {
- cout << "*** itemsFilteredByMime: " << endl;
- // TODO
- }
- void refreshItems( const KFileItemList& )
- {
- cout << "*** refreshItems: " << endl;
- // TODO
- }
- void infoMessage( const TQString& msg )
- { cout << "*** infoMessage: " << msg.local8Bit() << endl; }
-
- void percent( int percent )
- { cout << "*** percent: " << percent << endl; }
-
- void totalSize( TDEIO::filesize_t size )
- { cout << "*** totalSize: " << (long)size << endl; }
-
- void processedSize( TDEIO::filesize_t size )
- { cout << "*** processedSize: " << (long)size << endl; }
-
- void speed( int bytes_per_second )
- { cout << "*** speed: " << bytes_per_second << endl; }
-};
-
-class KDirListerTest : public TQWidget
-{
- Q_OBJECT
-public:
- KDirListerTest( TQWidget *parent=0, const char *name=0 );
- ~KDirListerTest();
-
-public slots:
- void startRoot();
- void startHome();
- void startTar();
- void test();
- void completed();
-
-private:
- KDirLister *lister;
- PrintSignals *debug;
-};
-
-#endif
diff --git a/kio/tests/kdirwatchtest.cpp b/kio/tests/kdirwatchtest.cpp
deleted file mode 100644
index c741b20f0..000000000
--- a/kio/tests/kdirwatchtest.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
- /*
- This file is or will be part of KDE desktop environment
-
- Copyright 1998 Sven Radej <sven@lisa.exp.univie.ac.at>
-
- It is licensed under GPL version 2.
-
- If it is part of KDE libraries than this file is licensed under
- LGPL version 2.
- */
-
-#include <tqfile.h>
-
-#include <kdebug.h>
-#include <kcmdlineargs.h>
-
-#include "kdirwatchtest.h"
-
-static const KCmdLineOptions options[] =
-{
- {"+[directory ...]", "Directory(ies) to watch", 0},
- KCmdLineLastOption
-};
-
-
-int main (int argc, char **argv)
-{
- TDECmdLineArgs::init(argc, argv, "KDirWatchTest",
- "Test for KDirWatch", "1.0");
- TDECmdLineArgs::addCmdLineOptions( options );
- TDEApplication::addCmdLineOptions();
-
- TDEApplication a;
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
-
- myTest testObject;
-
- KDirWatch *dirwatch1 = KDirWatch::self();
- KDirWatch *dirwatch2 = new KDirWatch;
-
- testObject.connect(dirwatch1, TQT_SIGNAL( dirty( const TQString &)), TQT_SLOT( dirty( const TQString &)) );
- testObject.connect(dirwatch1, TQT_SIGNAL( created( const TQString &)), TQT_SLOT( created( const TQString &)) );
- testObject.connect(dirwatch1, TQT_SIGNAL( deleted( const TQString &)), TQT_SLOT( deleted( const TQString &)) );
-
- if (args->count() >0) {
- for(int i = 0; i < args->count(); i++) {
- kdDebug() << "Watching: " << args->arg(i) << endl;
- dirwatch2->addDir( TQFile::decodeName( args->arg(i)));
- }
- }
-
- TQString home = TQString(getenv ("HOME")) + "/";
- TQString desk = home + "Desktop/";
- kdDebug() << "Watching: " << home << endl;
- dirwatch1->addDir(home);
- kdDebug() << "Watching file: " << home << "foo " << endl;
- dirwatch1->addFile(home+"foo");
- kdDebug() << "Watching: " << desk << endl;
- dirwatch1->addDir(desk);
- TQString test = home + "test/";
- kdDebug() << "Watching: (but skipped) " << test << endl;
- dirwatch1->addDir(test);
-
- dirwatch1->startScan();
- dirwatch2->startScan();
-
- if(!dirwatch1->stopDirScan(home))
- kdDebug() << "stopDirscan: " << home << " error!" << endl;
- if(!dirwatch1->restartDirScan(home))
- kdDebug() << "restartDirScan: " << home << "error!" << endl;
- if (!dirwatch1->stopDirScan(test))
- kdDebug() << "stopDirScan: error" << endl;
-
- KDirWatch::statistics();
-
- delete dirwatch2;
-
- KDirWatch::statistics();
-
- return a.exec();
-}
-#include "kdirwatchtest.moc"
diff --git a/kio/tests/kdirwatchtest.h b/kio/tests/kdirwatchtest.h
deleted file mode 100644
index 24dc94a91..000000000
--- a/kio/tests/kdirwatchtest.h
+++ /dev/null
@@ -1,33 +0,0 @@
- /*
- This file is or will be part of KDE desktop environment
-
- Copyright 1998 Sven Radej <sven@lisa.exp.univie.ac.at>
-
- It is licensed under GPL version 2.
-
- If it is part of KDE libraries than this file is licensed under
- LGPL version 2.
- */
-
-#ifndef _KDIRWATCHTEST_H_
-#define _KDIRWATCHTEST_H_
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <tqobject.h>
-
-#include "kdirwatch.h"
-#include "kapplication.h"
-
-class myTest : public TQObject
-{
- Q_OBJECT
-public:
- myTest() { };
-public slots:
- void dirty(const TQString &a) { printf("Dirty: %s\n", a.ascii()); };
- void created(const TQString& f) { printf("Created: %s\n", f.ascii()); }
- void deleted(const TQString& f) { printf("Deleted: %s\n", f.ascii()); }
-};
-
-#endif
diff --git a/kio/tests/kdirwatchunittest.cpp b/kio/tests/kdirwatchunittest.cpp
deleted file mode 100644
index 3d7505a3f..000000000
--- a/kio/tests/kdirwatchunittest.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
- /*
- This file is or will be part of KDE desktop environment
-
- (c) 2006 Dirk Mueller <mueller@kde.org>
-
- It is licensed under GPL version 2.
-
- If it is part of KDE libraries than this file is licensed under
- LGPL version 2.
- */
-
-#include <unistd.h>
-
-#include <tqfile.h>
-#include <tqdir.h>
-
-#include <kdebug.h>
-
-#include "kdirwatchunittest.h"
-
-void KDirWatchTest::VERIFY_NOTHING()
-{
- unsigned m_s[3];
- for(int i = 0; i < 3; ++i)
- m_s[i] = m_signals[i];
-
- for (int i = 0; i < 20; ++i) {
- usleep(100*1000);
- tqApp->processEvents();
- }
-
- bool nothing_failed = true;
- for (int i = 0; i < 3; ++i)
- if (m_s[i] != m_signals[i])
- nothing_failed = false;
-
- KDirWatch::statistics();
-
- VERIFY (nothing_failed);
-}
-
-void KDirWatchTest::VERIFY_DIRTY(const TQString& alert)
-{
- unsigned m_s[3];
- for(int i = 0; i < 3; ++i)
- m_s[i] = m_signals[i];
-
- for (int i = 0; i < 20; ++i) {
- usleep(100*1000);
- tqApp->processEvents();
- }
-
- VERIFY (m_s[sigCreated] == m_signals[sigCreated] &&
- m_s[sigDeleted] == m_signals[sigDeleted] &&
- m_s[sigDirty] + 1 == m_signals[sigDirty] &&
- m_lastSignal == alert);
-}
-
-void KDirWatchTest::VERIFY_CREATED(const TQString& alert)
-{
- unsigned m_s[3];
- for(int i = 0; i < 3; ++i)
- m_s[i] = m_signals[i];
-
- for (int i = 0; i < 20; ++i) {
- usleep(100*1000);
- tqApp->processEvents();
- }
-
- VERIFY (m_s[sigDirty] == m_signals[sigDirty] &&
- m_s[sigDeleted] == m_signals[sigDeleted] &&
- m_s[sigCreated] + 1 == m_signals[sigCreated] &&
- m_lastSignal == alert);
-}
-
-void KDirWatchTest::VERIFY_DELETED(const TQString& alert)
-{
- unsigned m_s[3];
- for(int i = 0; i < 3; ++i)
- m_s[i] = m_signals[i];
-
- for (int i = 0; i < 20; ++i) {
- usleep(100*1000);
- tqApp->processEvents();
- }
-
- VERIFY (m_s[sigDirty] == m_signals[sigDirty] &&
- m_s[sigCreated] == m_signals[sigCreated] &&
- m_s[sigDeleted] + 1 == m_signals[sigDeleted] &&
- m_lastSignal == alert);
-}
-
-void KDirWatchTest::remove_file (const TQString& file)
-{
- ::unlink (TQFile::encodeName(file));
-}
-
-void KDirWatchTest::touch_file (const TQString& file)
-{
- TQFile f(file);
- f.open(IO_WriteOnly);
-}
-
-void KDirWatchTest::rename_file(const TQString& from, const TQString& to)
-{
- ::rename(TQFile::encodeName(from), TQFile::encodeName(to));
-}
-
-KUNITTEST_MODULE ( tdeunittest_kdirwatch, "KDirWatchTest" )
-KUNITTEST_MODULE_REGISTER_TESTER (KDirWatchTest)
-
-#define SLEEP() TQApplication::processEvents();
-
-void KDirWatchTest::allTests()
-{
- for(int loop=0; loop<3; ++loop) {
- d = new KDirWatch;
- VERIFY (d != 0);
-
- TQDir* dir = new TQDir(m_workingDir);
- VERIFY (dir != 0);
-
- connect(d, TQT_SIGNAL (dirty( const TQString &)), TQT_SLOT( slotDirty( const TQString &)) );
- connect(d, TQT_SIGNAL (created( const TQString &)), TQT_SLOT( slotCreated( const TQString &)) );
- connect(d, TQT_SIGNAL (deleted( const TQString &)), TQT_SLOT( slotDeleted( const TQString &)) );
-
- VERIFY (dir->mkdir (m_workingDir));
-
- d->addDir (m_workingDir);
- VERIFY_NOTHING();
- dir->mkdir ("does");
- VERIFY_DIRTY (m_workingDir);
- touch_file (m_workingDir + "/file");
- VERIFY_DIRTY (m_workingDir);
- VERIFY_NOTHING ();
- remove_file (m_workingDir + "/file");
- d->addDir (m_workingDir + "/does/not/exist");
- d->removeDir (m_workingDir);
- VERIFY_NOTHING();
-
- dir->mkdir ("does/not");
- VERIFY_NOTHING();
- dir->mkdir ("does/not/exist");
- VERIFY_CREATED (m_workingDir + "/does/not/exist");
-
- dir->rmdir ("does/not/exist");
- VERIFY_DELETED (m_workingDir + "/does/not/exist");
- dir->rmdir ("does/not");
- VERIFY_NOTHING();
- dir->rmdir ("does");
- VERIFY_NOTHING();
-
- d->addFile(m_workingDir + "/a");
- touch_file(m_workingDir + "/a");
- VERIFY_CREATED (m_workingDir + "/a");
-
- rename_file (m_workingDir + "/a", m_workingDir + "/b");
- VERIFY_DELETED (m_workingDir + "/a");
- VERIFY_NOTHING();
-
- touch_file (m_workingDir + "/a");
- VERIFY_CREATED (m_workingDir + "/a");
- VERIFY_NOTHING();
-
- touch_file (m_workingDir + "/a");
- VERIFY_DIRTY (m_workingDir + "/a");
-
- remove_file (m_workingDir + "/b");
- VERIFY_NOTHING();
-
- d->removeFile(m_workingDir + "/a");
-
- remove_file(m_workingDir + "/a");
-
- VERIFY (dir->rmdir (m_workingDir));
- delete d;
- }
-}
-
-#include "kdirwatchunittest.moc"
diff --git a/kio/tests/kdirwatchunittest.h b/kio/tests/kdirwatchunittest.h
deleted file mode 100644
index 42222a787..000000000
--- a/kio/tests/kdirwatchunittest.h
+++ /dev/null
@@ -1,66 +0,0 @@
- /*
- This file is or will be part of KDE desktop environment
-
- Copyright 1998 Sven Radej <sven@lisa.exp.univie.ac.at>
-
- It is licensed under GPL version 2.
-
- If it is part of KDE libraries than this file is licensed under
- LGPL version 2.
- */
-
-#ifndef _KDIRWATCHTEST_H_
-#define _KDIRWATCHTEST_H_
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <tqobject.h>
-
-#include "kdirwatch.h"
-#include "kapplication.h"
-
-#include <tdeunittest/tester.h>
-#include <tdeunittest/module.h>
-
-class KDirWatchTest : public KUnitTest::Tester
-{
- Q_OBJECT
-
-public:
- enum { sigDirty, sigCreated, sigDeleted };
-
- KDirWatchTest()
- {
- m_signals[sigDirty] = m_signals[sigCreated] = m_signals[sigDeleted] = 0;
- m_workingDir = "/tmp/kdirwatchtest";
- }
-
- virtual void allTests();
-
-private slots:
- void slotDirty (const TQString& s) { m_signals[sigDirty]++; m_lastSignal = s; }
- void slotCreated (const TQString& s) { m_signals[sigCreated]++; m_lastSignal = s; }
- void slotDeleted (const TQString& s) { m_signals[sigDeleted]++; m_lastSignal = s; }
-
-private:
- unsigned m_signals[3];
-
- /* verify nothing happens */
- void VERIFY_NOTHING();
- /* verify that dirty got emitted */
- void VERIFY_DIRTY (const TQString&);
- /* verify that created got emitted */
- void VERIFY_CREATED (const TQString&);
- /* verify that deleted got emitted */
- void VERIFY_DELETED (const TQString&);
-
- void touch_file (const TQString& file);
- void remove_file (const TQString& file);
- void rename_file (const TQString& from, const TQString& to);
-
- TQString m_lastSignal;
- TQString m_workingDir;
- KDirWatch* d;
-};
-
-#endif
diff --git a/kio/tests/kfiltertest.cpp b/kio/tests/kfiltertest.cpp
deleted file mode 100644
index 1922e207e..000000000
--- a/kio/tests/kfiltertest.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2002, 2003 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "kfilterdev.h"
-#include "kfilterbase.h"
-#include <unistd.h>
-#include <limits.h>
-#include <tqfile.h>
-#include <tqtextstream.h>
-#include <kdebug.h>
-#include <kinstance.h>
-
-void test_block( const TQString & fileName )
-{
- TQIODevice * dev = KFilterDev::deviceForFile( fileName );
- if (!dev) { kdWarning() << "dev=0" << endl; return; }
- if ( !dev->open( IO_ReadOnly ) ) { kdWarning() << "open failed " << endl; return; }
-
- // This is what KGzipDev::readAll could do, if TQIODevice::readAll was virtual....
-
- TQByteArray array(1024);
- int n;
- while ( ( n = dev->tqreadBlock( array.data(), array.size() ) ) )
- {
- kdDebug() << "readBlock returned " << n << endl << endl;
- // TQCString s(array,n+1); // Terminate with 0 before printing
- // printf("%s", s.data());
-
- kdDebug() << "dev.at = " << dev->at() << endl;
- //kdDebug() << "f.at = " << f.at() << endl;
- }
- dev->close();
- delete dev;
-}
-
-void test_block_write( const TQString & fileName )
-{
- TQIODevice * dev = KFilterDev::deviceForFile( fileName );
- if (!dev) { kdWarning() << "dev=0" << endl; return; }
- if ( !dev->open( IO_WriteOnly ) ) { kdWarning() << "open failed " << endl; return; }
-
- TQCString s("hello\n");
- int ret = dev->tqwriteBlock( s, s.size()-1 );
- kdDebug() << "writeBlock ret=" << ret << endl;
- //ret = dev->tqwriteBlock( s, s.size()-1 );
- //kdDebug() << "writeBlock ret=" << ret << endl;
- dev->close();
- delete dev;
-}
-
-void test_getch( const TQString & fileName )
-{
- TQIODevice * dev = KFilterDev::deviceForFile( fileName );
- if (!dev) { kdWarning() << "dev=0" << endl; return; }
- if ( !dev->open( IO_ReadOnly ) ) { kdWarning() << "open failed " << endl; return; }
- int ch;
- while ( ( ch = dev->getch() ) != -1 )
- printf("%c",ch);
- dev->close();
- delete dev;
-}
-
-void test_textstream( const TQString & fileName )
-{
- TQIODevice * dev = KFilterDev::deviceForFile( fileName );
- if (!dev) { kdWarning() << "dev=0" << endl; return; }
- if ( !dev->open( IO_ReadOnly ) ) { kdWarning() << "open failed " << endl; return; }
- TQTextStream ts( dev );
- printf("%s\n", ts.read().latin1());
- dev->close();
- delete dev;
-}
-
-int main()
-{
- TDEInstance instance("kfiltertest");
-
- char currentdir[PATH_MAX+1];
- getcwd( currentdir, PATH_MAX );
- TQString pathgz = TQFile::decodeName(currentdir) + "/test.gz";
- TQString pathbz2 = TQFile::decodeName(currentdir) + "/test.bz2";
-
- kdDebug() << " -- test_block_write gzip -- " << endl;
- test_block_write(pathgz);
- kdDebug() << " -- test_block_write bzip2 -- " << endl;
- test_block_write(pathbz2);
-
- kdDebug() << " -- test_block gzip -- " << endl;
- test_block(pathgz);
- kdDebug() << " -- test_getch gzip -- " << endl;
- test_getch(pathgz);
- kdDebug() << " -- test_textstream gzip -- " << endl;
- test_textstream(pathgz);
-
- kdDebug() << " -- test_block bzip2 -- " << endl;
- test_block(pathbz2);
- kdDebug() << " -- test_getch bzip2 -- " << endl;
- test_getch(pathbz2);
- kdDebug() << " -- test_textstream bzip2 -- " << endl;
- test_textstream(pathbz2);
-
- return 0;
-}
diff --git a/kio/tests/kionetrctest.cpp b/kio/tests/kionetrctest.cpp
deleted file mode 100644
index 2d96c8495..000000000
--- a/kio/tests/kionetrctest.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kaboutdata.h>
-#include <kcmdlineargs.h>
-
-#include "authinfo.h"
-
-void output( const KURL& u )
-{
- kdDebug() << "Looking up auto login for: " << u.url() << endl;
- TDEIO::NetRC::AutoLogin l;
- bool result = TDEIO::NetRC::self()->lookup( u, l, true );
- if ( !result )
- {
- kdDebug() << "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)" << endl;
- return;
- }
-
- kdDebug() << "Type: " << l.type << endl
- << "Machine: " << l.machine << endl
- << "Login: " << l.login << endl
- << "Password: " << l.password << endl;
-
- TQMap<TQString,TQStringList>::ConstIterator it = l.macdef.begin();
- for ( ; it != l.macdef.end(); ++it )
- {
- kdDebug() << "Macro: " << it.key() << "= "
- << it.data().join(" ") << endl;
- }
-}
-
-int main(int argc, char **argv)
-{
- const char *version = "0.5";
- const char *description = "Unit test for .netrc and kionetrc parser.";
- KCmdLineOptions options[] =
- {
- { "+command", "[url1,url2 ,...]", 0 },
- KCmdLineLastOption
- };
-
- TDECmdLineArgs::init( argc, argv, "kionetrctest", description, version );
- TDECmdLineArgs::addCmdLineOptions( options );
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
- int count = args->count();
- TDEApplication app;
-
- if ( !count )
- args->usage();
- else
- {
- KURL u;
- for( int i=0 ; i < count; i++ )
- {
- u = args->arg(i);
- if ( !u.isValid() )
- {
- kdDebug() << u.url() << " is invalid! Ignoring..." << endl;
- continue;
- }
- output( u );
- }
- }
- args->clear();
- return 0;
-}
diff --git a/kio/tests/kiopassdlgtest.cpp b/kio/tests/kiopassdlgtest.cpp
deleted file mode 100644
index adb14a306..000000000
--- a/kio/tests/kiopassdlgtest.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <kapplication.h>
-#include <klocale.h>
-#include <kaboutdata.h>
-#include <kmessagebox.h>
-#include <kcmdlineargs.h>
-
-#include "passdlg.h"
-
-int main ( int argc, char** argv )
-{
- TDEAboutData aboutData("kiopassdlgtest", "KIO Password Dialog Test", "1.0");
- TDECmdLineArgs::init(argc, argv, &aboutData);
- TDEApplication app;
-
- TQString usr, pass, comment, label;
- label = "Site:";
- comment = "<b>localhost</b>";
- int res = TDEIO::PasswordDialog::getNameAndPassword( usr, pass, 0L,
- TQString::null, false,
- TQString::null, comment,
- label );
- if ( res == TQDialog::Accepted )
- KMessageBox::information( 0L, TQString("You entered:\n"
- " Username: %1\n"
- " Password: %2").arg(usr).arg(pass),
- "Test Result");
- else
- KMessageBox::information( 0L, "Password dialog was canceled!",
- "Test Result");
-
- return 0;
-}
diff --git a/kio/tests/kioslavetest.cpp b/kio/tests/kioslavetest.cpp
deleted file mode 100644
index 27a99eabc..000000000
--- a/kio/tests/kioslavetest.cpp
+++ /dev/null
@@ -1,555 +0,0 @@
- /*
- This file is or will be part of KDE desktop environment
-
- Copyright 1999 Matt Koss <koss@miesto.sk>
-
- It is licensed under GPL version 2.
-
- If it is part of KDE libraries than this file is licensed under
- LGPL version 2.
- */
-
-#include <tqlayout.h>
-#include <tqmessagebox.h>
-#include <tqdir.h>
-
-#include <kacl.h>
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <kurl.h>
-#include <kstatusbar.h>
-#include <kio/job.h>
-#include <kio/scheduler.h>
-#include <kprotocolinfo.h>
-
-#include "kioslavetest.h"
-
-using namespace TDEIO;
-
-KioslaveTest::KioslaveTest( TQString src, TQString dest, uint op, uint pr )
- : KMainWindow(0, "")
-{
-
- job = 0L;
-
- main_widget = new TQWidget( this, "");
- TQBoxLayout *topLayout = new TQVBoxLayout( main_widget, 10, 5 );
-
- TQGridLayout *grid = new TQGridLayout( 2, 2, 10 );
- topLayout->addLayout( grid );
-
- grid->setRowStretch(0,1);
- grid->setRowStretch(1,1);
-
- grid->setColStretch(0,1);
- grid->setColStretch(1,100);
-
- lb_from = new TQLabel( "From:", main_widget );
- grid->addWidget( lb_from, 0, 0 );
-
- le_source = new TQLineEdit( main_widget );
- grid->addWidget( le_source, 0, 1 );
- le_source->setText( src );
-
- lb_to = new TQLabel( "To:", main_widget );
- grid->addWidget( lb_to, 1, 0 );
-
- le_dest = new TQLineEdit( main_widget );
- grid->addWidget( le_dest, 1, 1 );
- le_dest->setText( dest );
-
- // Operation groupbox & buttons
- opButtons = new TQButtonGroup( "Operation", main_widget );
- topLayout->addWidget( opButtons, 10 );
- connect( opButtons, TQT_SIGNAL(clicked(int)), TQT_SLOT(changeOperation(int)) );
-
- TQBoxLayout *hbLayout = new TQHBoxLayout( opButtons, 15 );
-
- rbList = new TQRadioButton( "List", opButtons );
- opButtons->insert( rbList, List );
- hbLayout->addWidget( rbList, 5 );
-
- rbListRecursive = new TQRadioButton( "ListRecursive", opButtons );
- opButtons->insert( rbListRecursive, ListRecursive );
- hbLayout->addWidget( rbListRecursive, 5 );
-
- rbStat = new TQRadioButton( "Stat", opButtons );
- opButtons->insert( rbStat, Stat );
- hbLayout->addWidget( rbStat, 5 );
-
- rbGet = new TQRadioButton( "Get", opButtons );
- opButtons->insert( rbGet, Get );
- hbLayout->addWidget( rbGet, 5 );
-
- rbPut = new TQRadioButton( "Put", opButtons );
- opButtons->insert( rbPut, Put );
- hbLayout->addWidget( rbPut, 5 );
-
- rbCopy = new TQRadioButton( "Copy", opButtons );
- opButtons->insert( rbCopy, Copy );
- hbLayout->addWidget( rbCopy, 5 );
-
- rbMove = new TQRadioButton( "Move", opButtons );
- opButtons->insert( rbMove, Move );
- hbLayout->addWidget( rbMove, 5 );
-
- rbDelete = new TQRadioButton( "Delete", opButtons );
- opButtons->insert( rbDelete, Delete );
- hbLayout->addWidget( rbDelete, 5 );
-
- rbShred = new TQRadioButton( "Shred", opButtons );
- opButtons->insert( rbShred, Shred );
- hbLayout->addWidget( rbShred, 5 );
-
- rbMkdir = new TQRadioButton( "Mkdir", opButtons );
- opButtons->insert( rbMkdir, Mkdir );
- hbLayout->addWidget( rbMkdir, 5 );
-
- rbMimetype = new TQRadioButton( "Mimetype", opButtons );
- opButtons->insert( rbMimetype, Mimetype );
- hbLayout->addWidget( rbMimetype, 5 );
-
- opButtons->setButton( op );
- changeOperation( op );
-
- // Progress groupbox & buttons
- progressButtons = new TQButtonGroup( "Progress dialog mode", main_widget );
- topLayout->addWidget( progressButtons, 10 );
- connect( progressButtons, TQT_SIGNAL(clicked(int)), TQT_SLOT(changeProgressMode(int)) );
-
- hbLayout = new TQHBoxLayout( progressButtons, 15 );
-
- rbProgressNone = new TQRadioButton( "None", progressButtons );
- progressButtons->insert( rbProgressNone, ProgressNone );
- hbLayout->addWidget( rbProgressNone, 5 );
-
- rbProgressDefault = new TQRadioButton( "Default", progressButtons );
- progressButtons->insert( rbProgressDefault, ProgressDefault );
- hbLayout->addWidget( rbProgressDefault, 5 );
-
- rbProgressStatus = new TQRadioButton( "Status", progressButtons );
- progressButtons->insert( rbProgressStatus, ProgressStatus );
- hbLayout->addWidget( rbProgressStatus, 5 );
-
- progressButtons->setButton( pr );
- changeProgressMode( pr );
-
- // statusbar progress widget
- statusProgress = new StatusbarProgress( statusBar() );
- statusBar()->addWidget( statusProgress, 0, true );
-
- // run & stop butons
- hbLayout = new TQHBoxLayout( topLayout, 15 );
-
- pbStart = new TQPushButton( "&Start", main_widget );
- pbStart->setFixedSize( pbStart->sizeHint() );
- connect( pbStart, TQT_SIGNAL(clicked()), TQT_SLOT(startJob()) );
- hbLayout->addWidget( pbStart, 5 );
-
- pbStop = new TQPushButton( "Sto&p", main_widget );
- pbStop->setFixedSize( pbStop->sizeHint() );
- pbStop->setEnabled( false );
- connect( pbStop, TQT_SIGNAL(clicked()), TQT_SLOT(stopJob()) );
- hbLayout->addWidget( pbStop, 5 );
-
- // close button
- close = new TQPushButton( "&Close", main_widget );
- close->setFixedSize( close->sizeHint() );
- connect(close, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotQuit()));
-
- topLayout->addWidget( close, 5 );
-
- main_widget->setMinimumSize( main_widget->sizeHint() );
- setCentralWidget( main_widget );
-
- slave = 0;
-// slave = TDEIO::Scheduler::getConnectedSlave(KURL("ftp://ftp.kde.org"));
- TDEIO::Scheduler::connect(TQT_SIGNAL(slaveConnected(TDEIO::Slave*)),
- this, TQT_SLOT(slotSlaveConnected()));
- TDEIO::Scheduler::connect(TQT_SIGNAL(slaveError(TDEIO::Slave*,int,const TQString&)),
- this, TQT_SLOT(slotSlaveError()));
-}
-
-
-void KioslaveTest::closeEvent( TQCloseEvent * ){
- slotQuit();
-}
-
-
-void KioslaveTest::slotQuit(){
- if ( job ) {
- job->kill( true ); // kill the job quietly
- }
- if (slave)
- TDEIO::Scheduler::disconnectSlave(slave);
- kapp->quit();
-}
-
-
-void KioslaveTest::changeOperation( int id ) {
- // only two urls for copy and move
- bool enab = rbCopy->isChecked() || rbMove->isChecked();
-
- le_dest->setEnabled( enab );
-
- selectedOperation = id;
-}
-
-
-void KioslaveTest::changeProgressMode( int id ) {
- progressMode = id;
-
- if ( progressMode == ProgressStatus ) {
- statusBar()->show();
- } else {
- statusBar()->hide();
- }
-}
-
-
-void KioslaveTest::startJob() {
- TQString sCurrent = TQDir::currentDirPath()+"/";
- KURL::encode_string(sCurrent);
- TQString sSrc( le_source->text() );
- KURL src( sCurrent, sSrc );
-
- if ( !src.isValid() ) {
- TQMessageBox::critical(this, "Kioslave Error Message", "Source URL is malformed" );
- return;
- }
-
- TQString sDest( le_dest->text() );
- KURL dest( sCurrent, sDest );
-
- if ( !dest.isValid() &&
- ( selectedOperation == Copy || selectedOperation == Move ) ) {
- TQMessageBox::critical(this, "Kioslave Error Message",
- "Destination URL is malformed" );
- return;
- }
-
- pbStart->setEnabled( false );
-
- bool observe = true;
- if (progressMode != ProgressDefault) {
- observe = false;
- }
-
- SimpleJob *myJob = 0;
-
- switch ( selectedOperation ) {
- case List:
- myJob = TDEIO::listDir( src );
- connect(myJob, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList&)),
- TQT_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList&)));
- break;
-
- case ListRecursive:
- myJob = TDEIO::listRecursive( src );
- connect(myJob, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList&)),
- TQT_SLOT( slotEntries( TDEIO::Job*, const TDEIO::UDSEntryList&)));
- break;
-
- case Stat:
- myJob = TDEIO::stat( src, false, 2 );
- break;
-
- case Get:
- myJob = TDEIO::get( src, true );
- connect(myJob, TQT_SIGNAL( data( TDEIO::Job*, const TQByteArray &)),
- TQT_SLOT( slotData( TDEIO::Job*, const TQByteArray &)));
- break;
-
- case Put:
- putBuffer = 0;
- myJob = TDEIO::put( src, -1, true, false);
- connect(myJob, TQT_SIGNAL( dataReq( TDEIO::Job*, TQByteArray &)),
- TQT_SLOT( slotDataReq( TDEIO::Job*, TQByteArray &)));
- break;
-
- case Copy:
- job = TDEIO::copy( src, dest, observe );
- break;
-
- case Move:
- job = TDEIO::move( src, dest, observe );
- break;
-
- case Delete:
- job = TDEIO::del( src, false, observe );
- break;
-
- case Shred:
- job = TDEIO::del(src, true, observe);
- break;
-
- case Mkdir:
- myJob = TDEIO::mkdir( src );
- break;
-
- case Mimetype:
- myJob = TDEIO::mimetype( src );
- break;
- }
- if (myJob)
- {
- if (slave)
- TDEIO::Scheduler::assignJobToSlave(slave, myJob);
- job = myJob;
- }
-
- connect( job, TQT_SIGNAL( result( TDEIO::Job * ) ),
- TQT_SLOT( slotResult( TDEIO::Job * ) ) );
-
- connect( job, TQT_SIGNAL( canceled( TDEIO::Job * ) ),
- TQT_SLOT( slotResult( TDEIO::Job * ) ) );
-
- if (progressMode == ProgressStatus) {
- statusProgress->setJob( job );
- }
-
- pbStop->setEnabled( true );
-}
-
-
-void KioslaveTest::slotResult( TDEIO::Job * _job )
-{
- if ( _job->error() )
- {
- _job->showErrorDialog();
- }
- else if ( selectedOperation == Stat )
- {
- UDSEntry entry = ((TDEIO::StatJob*)_job)->statResult();
- printUDSEntry( entry );
- }
- else if ( selectedOperation == Mimetype )
- {
- kdDebug() << "mimetype is " << ((TDEIO::MimetypeJob*)_job)->mimetype() << endl;
- }
-
- if (job == _job)
- job = 0L;
- pbStart->setEnabled( true );
- pbStop->setEnabled( false );
-}
-
-void KioslaveTest::slotSlaveConnected()
-{
- kdDebug() << "Slave connected." << endl;
-}
-
-void KioslaveTest::slotSlaveError()
-{
- kdDebug() << "Error connected." << endl;
- slave = 0;
-}
-
-static void printACL( const TQString& acl )
-{
- KACL kacl( acl );
- kdDebug() << "According to KACL: " << endl << kacl.asString() << endl;
- kdDebug() << "Owner: " << kacl.ownerPermissions() << endl;
- kdDebug() << "Owning group: " << kacl.owningGroupPermissions() << endl;
- kdDebug() << "Others: " << kacl.othersPermissions() << endl;
-}
-
-
-void KioslaveTest::printUDSEntry( const TDEIO::UDSEntry & entry )
-{
- TDEIO::UDSEntry::ConstIterator it = entry.begin();
- for( ; it != entry.end(); it++ ) {
- switch ((*it).m_uds) {
- case TDEIO::UDS_FILE_TYPE:
- kdDebug() << "File Type : " << (mode_t)((*it).m_long) << endl;
- if ( S_ISDIR( (mode_t)((*it).m_long) ) )
- {
- kdDebug() << "is a dir" << endl;
- }
- break;
- case TDEIO::UDS_ACCESS:
- kdDebug() << "Access permissions : " << (*it).m_long << endl;
- break;
- case TDEIO::UDS_EXTENDED_ACL:
- if( (*it).m_long == 1 )
- kdDebug() << "Has extended ACL information." << endl;
- break;
- case TDEIO::UDS_ACL_STRING:
- kdDebug() << "ACL: " << ( (*it).m_str.ascii() ) << endl;
- printACL( (*it).m_str );
- break;
- case TDEIO::UDS_DEFAULT_ACL_STRING:
- kdDebug() << "Default ACL: " << ( (*it).m_str.ascii() ) << endl;
- printACL( (*it).m_str );
- break;
- case TDEIO::UDS_USER:
- kdDebug() << "User : " << ((*it).m_str.ascii() ) << endl;
- break;
- case TDEIO::UDS_GROUP:
- kdDebug() << "Group : " << ((*it).m_str.ascii() ) << endl;
- break;
- case TDEIO::UDS_NAME:
- kdDebug() << "Name : " << ((*it).m_str.ascii() ) << endl;
- //m_strText = decodeFileName( (*it).m_str );
- break;
- case TDEIO::UDS_URL:
- kdDebug() << "URL : " << ((*it).m_str.ascii() ) << endl;
- break;
- case TDEIO::UDS_MIME_TYPE:
- kdDebug() << "MimeType : " << ((*it).m_str.ascii() ) << endl;
- break;
- case TDEIO::UDS_LINK_DEST:
- kdDebug() << "LinkDest : " << ((*it).m_str.ascii() ) << endl;
- break;
- case TDEIO::UDS_SIZE:
- kdDebug() << "Size: " << TDEIO::convertSize((*it).m_long) << endl;
- break;
- }
- }
-}
-
-void KioslaveTest::slotEntries(TDEIO::Job* job, const TDEIO::UDSEntryList& list) {
-
- KURL url = static_cast<TDEIO::ListJob*>( job )->url();
- KProtocolInfo::ExtraFieldList extraFields = KProtocolInfo::extraFields(url);
- UDSEntryListConstIterator it=list.begin();
- for (; it != list.end(); ++it) {
- // For each file...
- KProtocolInfo::ExtraFieldList::Iterator extraFieldsIt = extraFields.begin();
- UDSEntry::ConstIterator it2 = (*it).begin();
- for( ; it2 != (*it).end(); it2++ ) {
- if ((*it2).m_uds == UDS_NAME)
- kdDebug() << "" << ( *it2 ).m_str << endl;
- else if ( (*it2).m_uds == UDS_EXTRA) {
- Q_ASSERT( extraFieldsIt != extraFields.end() );
- TQString column = (*extraFieldsIt).name;
- //TQString type = (*extraFieldsIt).type;
- kdDebug() << " Extra data (" << column << ") :" << ( *it2 ).m_str << endl;
- ++extraFieldsIt;
- }
- }
- }
-}
-
-void KioslaveTest::slotData(TDEIO::Job*, const TQByteArray &data)
-{
- if (data.size() == 0)
- {
- kdDebug(0) << "Data: <End>" << endl;
- }
- else
- {
- kdDebug(0) << "Data: \"" << TQCString(data, data.size()+1) << "\"" << endl;
- }
-}
-
-void KioslaveTest::slotDataReq(TDEIO::Job*, TQByteArray &data)
-{
- const char *fileDataArray[] =
- {
- "Hello world\n",
- "This is a test file\n",
- "You can safely delete it.\n",
- "BIG\n",
- 0
- };
- const char *fileData = fileDataArray[putBuffer++];
-
- if (!fileData)
- {
- kdDebug(0) << "DataReq: <End>" << endl;
- return;
- }
- if (!strcmp(fileData, "BIG\n"))
- data.fill(0, 29*1024*1024);
- else
- data.duplicate(fileData, strlen(fileData));
- kdDebug(0) << "DataReq: \"" << fileData << "\"" << endl;
-}
-
-void KioslaveTest::stopJob() {
- kdDebug() << "KioslaveTest::stopJob()" << endl;
- job->kill();
- job = 0L;
-
- pbStop->setEnabled( false );
- pbStart->setEnabled( true );
-}
-
-static const char version[] = "v0.0.0 0000"; // :-)
-static const char description[] = "Test for kioslaves";
-static KCmdLineOptions options[] =
-{
- { "s", 0, 0 },
- { "src <src>", "Source URL", "" },
- { "d", 0, 0 },
- { "dest <dest>", "Destination URL", "" },
- { "o", 0, 0 },
- { "operation <operation>", "Operation (list,listrecursive,stat,get,put,copy,move,del,shred,mkdir)", "copy" },
- { "p", 0, 0 },
- { "progress <progress>", "Progress Type (none,default,status)", "default" },
- KCmdLineLastOption
-};
-
-int main(int argc, char **argv) {
- TDECmdLineArgs::init( argc, argv, "kioslavetest", description, version );
- TDECmdLineArgs::addCmdLineOptions( options );
- TDEApplication app;
-
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
-
- TQString src = args->getOption("src");
- TQString dest = args->getOption("dest");
-
- uint op = 0;
- uint pr = 0;
-
- TQString tmps;
-
- tmps = args->getOption("operation");
- if ( tmps == "list") {
- op = KioslaveTest::List;
- } else if ( tmps == "listrecursive") {
- op = KioslaveTest::ListRecursive;
- } else if ( tmps == "stat") {
- op = KioslaveTest::Stat;
- } else if ( tmps == "get") {
- op = KioslaveTest::Get;
- } else if ( tmps == "put") {
- op = KioslaveTest::Put;
- } else if ( tmps == "copy") {
- op = KioslaveTest::Copy;
- } else if ( tmps == "move") {
- op = KioslaveTest::Move;
- } else if ( tmps == "del") {
- op = KioslaveTest::Delete;
- } else if ( tmps == "shred") {
- op = KioslaveTest::Shred;
- } else if ( tmps == "mkdir") {
- op = KioslaveTest::Mkdir;
- } else TDECmdLineArgs::usage("unknown operation");
-
- tmps = args->getOption("progress");
- if ( tmps == "none") {
- pr = KioslaveTest::ProgressNone;
- } else if ( tmps == "default") {
- pr = KioslaveTest::ProgressDefault;
- } else if ( tmps == "status") {
- pr = KioslaveTest::ProgressStatus;
- } else TDECmdLineArgs::usage("unknown progress mode");
-
- args->clear(); // Free up memory
-
- KioslaveTest test( src, dest, op, pr );
- test.show();
- // Bug in KTMW / Qt / layouts ?
- test.resize( test.sizeHint() );
-
- app.setMainWidget(&test);
- app.exec();
-}
-
-
-#include "kioslavetest.moc"
diff --git a/kio/tests/kioslavetest.h b/kio/tests/kioslavetest.h
deleted file mode 100644
index 79533bbc5..000000000
--- a/kio/tests/kioslavetest.h
+++ /dev/null
@@ -1,108 +0,0 @@
- /*
- This file is or will be part of KDE desktop environment
-
- Copyright 1999 Matt Koss <koss@miesto.sk>
-
- 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 <tqlabel.h>
-#include <tqlineedit.h>
-#include <tqradiobutton.h>
-#include <tqpushbutton.h>
-#include <tqbuttongroup.h>
-#include <tqwidget.h>
-
-#include <kmainwindow.h>
-
-#include "kio/job.h"
-#include "kio/global.h"
-#include "kio/statusbarprogress.h"
-#include "kio/slave.h"
-
-class KioslaveTest : public KMainWindow {
- Q_OBJECT
-
-public:
- KioslaveTest( TQString src, TQString dest, uint op, uint pr );
- ~KioslaveTest() {}
-
- enum Operations { List, ListRecursive, Stat, Get, Put, Copy, Move, Delete, Shred, Mkdir, Mimetype };
-
- enum ProgressModes { ProgressNone, ProgressDefault, ProgressStatus };
-
-protected:
-
- void closeEvent( TQCloseEvent * );
-
- void printUDSEntry( const TDEIO::UDSEntry & entry );
-
- // info stuff
- TQLabel *lb_from;
- TQLineEdit *le_source;
-
- TQLabel *lb_to;
- TQLineEdit *le_dest;
-
- // operation stuff
- TQButtonGroup *opButtons;
-
- TQRadioButton *rbList;
- TQRadioButton *rbListRecursive;
- TQRadioButton *rbStat;
- TQRadioButton *rbGet;
- TQRadioButton *rbPut;
- TQRadioButton *rbCopy;
- TQRadioButton *rbMove;
- TQRadioButton *rbDelete;
- TQRadioButton *rbShred;
- TQRadioButton *rbMkdir;
- TQRadioButton *rbMimetype;
-
- // progress stuff
- TQButtonGroup *progressButtons;
-
- TQRadioButton *rbProgressNone;
- TQRadioButton *rbProgressDefault;
- TQRadioButton *rbProgressStatus;
-
- TQPushButton *pbStart;
- TQPushButton *pbStop;
-
- TQPushButton *close;
-
-protected slots:
- void changeOperation( int id );
- void changeProgressMode( int id );
-
- void startJob();
- void stopJob();
-
- void slotResult( TDEIO::Job * );
- void slotEntries( TDEIO::Job *, const TDEIO::UDSEntryList& );
- void slotData( TDEIO::Job *, const TQByteArray &data );
- void slotDataReq( TDEIO::Job *, TQByteArray &data );
-
- void slotQuit();
- void slotSlaveConnected();
- void slotSlaveError();
-
-private:
- TDEIO::Job *job;
- TQWidget *main_widget;
-
- TDEIO::StatusbarProgress *statusProgress;
-
- int selectedOperation;
- int progressMode;
- int putBuffer;
- TDEIO::Slave *slave;
-};
-
-#endif // _KIOSLAVETEST_H
diff --git a/kio/tests/kmfitest.cpp b/kio/tests/kmfitest.cpp
deleted file mode 100644
index 40530184d..000000000
--- a/kio/tests/kmfitest.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdio.h>
-#include <tqdir.h>
-#include <tqfile.h>
-#include <kinstance.h>
-#include <kurl.h>
-#include <kfilemetainfo.h>
-#include <kmimetype.h>
-
-int main (int argc, char **argv)
-{
- TDEInstance ins("kmfitest");
-
- if (argc < 2) {
- printf("usage: %s <file>\n", argv[0]);
- return 1;
- }
-
- for (int i = 1; i < argc; i++) {
- TQString file = TQFile::decodeName(argv[i]);
- tqWarning("File: %s", file.local8Bit().data());
- KMimeType::Ptr p;
- p = KMimeType::findByPath(file);
- tqWarning("Mime type (findByPath): %s", p->name().latin1());
- KFileMetaInfo meta(file, TQString::null, KFileMetaInfo::TechnicalInfo | KFileMetaInfo::ContentInfo);
- }
-
- return 0;
-}
diff --git a/kio/tests/kmimefromext.cpp b/kio/tests/kmimefromext.cpp
deleted file mode 100644
index 026d4173b..000000000
--- a/kio/tests/kmimefromext.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2002 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <ktrader.h>
-#include <kmimetype.h>
-#include <kcmdlineargs.h>
-#include <kapplication.h>
-
-#include <stdio.h>
-
-static KCmdLineOptions options[] =
-{
- { "+filename", "the filename to test", 0 },
- KCmdLineLastOption
-};
-
-int main(int argc, char *argv[])
-{
- TDECmdLineArgs::init( argc, argv, "kmimefromext", "A mimetype testing tool, gives the mimetype for a given filename", "0.0" );
-
- TDECmdLineArgs::addCmdLineOptions( options );
-
- TDEApplication app;
-
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
- TQString fileName = args->arg( 0 );
-
- // The "true" here means only the filename will be looked at.
- // "Mime-magic" will not interfer. The file doesn't exist.
- // TODO: a cmd line parameter for controlling this bool ;)
- KMimeType::Ptr mime = KMimeType::findByPath( fileName, 0, true );
- if ( mime && mime->name() != KMimeType::defaultMimeType() )
- printf( "%s\n", mime->name().latin1());
- else
- return 1; // error
-
- return 0;
-}
diff --git a/kio/tests/kmimemagictest.cpp b/kio/tests/kmimemagictest.cpp
deleted file mode 100644
index 00c545c3c..000000000
--- a/kio/tests/kmimemagictest.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2002 David Faure <faure@kde.org>
- * Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 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 <kmimetype.h>
-#include <kmimemagic.h>
-#include <kinstance.h>
-#include <stdio.h>
-
-int main( int argc, char** argv )
-{
- if (argc != 2)
- {
- printf("\n"
- "Usage : ./kmimemagictest file\n");
- return 1;
- }
- TDEInstance blah("kmimemagictest");
-
- TQString file = TQString::fromLocal8Bit( argv[1] );
-
- KMimeMagicResult * result = KMimeMagic::self()->findFileType( file );
-
- if ( result->isValid() )
- printf( "Found %s, accuracy %d\n", result->mimeType().latin1(), result->accuracy() );
- else
- printf( "Invalid result\n");
-
- KMimeType::Format f = KMimeType::findFormatByFileContent( file );
- if (f.text)
- printf("Text\n");
- else
- printf("Binary\n");
-
- if (f.compression == KMimeType::Format::GZipCompression)
- printf("GZipped\n");
-
- return 0;
-}
diff --git a/kio/tests/kmimetypetest.cpp b/kio/tests/kmimetypetest.cpp
deleted file mode 100644
index 5d963c81c..000000000
--- a/kio/tests/kmimetypetest.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2005 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <kmimetype.h>
-#include <kinstance.h>
-#include <ktempdir.h>
-#include <kprotocolinfo.h>
-#include <tqdir.h>
-#include <assert.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-static void checkIcon( const KURL& url, const TQString& expectedIcon )
-{
- TQString icon = KMimeType::iconForURL( url );
- if ( icon == expectedIcon )
- tqDebug( "icon for %s is %s, OK", url.prettyURL().latin1(), icon.latin1() );
- else {
- tqDebug( "ERROR: icon for %s is %s, expected %s!", url.prettyURL().latin1(), icon.latin1(), expectedIcon.latin1() );
- exit(1);
- }
-}
-
-int main( int argc, char** argv )
-{
- TDEInstance blah("kmimetypetest");
-
- // Obviously those tests will need to be fixed if we ever change the name of the icons
- // but at least they unit-test KMimeType::iconForURL.
- KURL url;
-
- // safely check a "regular" folder
- url.setPath( TQDir::homeDirPath() );
- checkIcon( url, "folder" );
-
- // safely check a non-readable folder
- if (0 != geteuid()) { // can't do this test if we're root
- KTempDir tmp( TQString::null, 0 );
- tmp.setAutoDelete( true );
- url.setPath( tmp.name() );
- checkIcon( url, "folder_locked" );
- chmod( TQFile::encodeName( tmp.name() ), 0500 ); // so we can 'rm -rf' it
- }
-
- // safely check the trash folder
- if ( KProtocolInfo::isKnownProtocol( TQString("trash") ) ) {
- checkIcon( "trash:/", "trashcan_full" ); // #100321
- checkIcon( "trash:/foo/", "folder" );
- }
-
- TQString pdf;
- KMimeType::diagnoseFileName("foo.pdf", pdf);
- tqDebug("extension: '%s'", pdf.latin1());
- assert(pdf == TQString("*.pdf"));
- TQString ps;
- KMimeType::diagnoseFileName("foo.ps", ps);
- tqDebug("extension: '%s'", ps.latin1());
- assert(ps == TQString("*.ps"));
-
- return 0;
-}
diff --git a/kio/tests/kpropsdlgtest.cpp b/kio/tests/kpropsdlgtest.cpp
deleted file mode 100644
index 811f03923..000000000
--- a/kio/tests/kpropsdlgtest.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <kapplication.h>
-#include <klocale.h>
-#include <kaboutdata.h>
-#include <kpropertiesdialog.h>
-#include <kcmdlineargs.h>
-
-
-static KCmdLineOptions options[] =
-{
- { "+url", "the path or url to the file/dir for which to show properties", 0 },
- KCmdLineLastOption
-};
-
-int main ( int argc, char** argv )
-{
- TDEAboutData aboutData("kpropertiesdialogtest", "KIO Properties Dialog Test", "1.0");
- TDECmdLineArgs::init(argc, argv, &aboutData);
- TDECmdLineArgs::addCmdLineOptions( options );
-
- TDEApplication app;
-
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
- if ( args->count() < 1 )
- TDECmdLineArgs::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 TDEIO::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 = new KPropertiesDialog( u, 0, 0, true /*modal*/, false /*we do exec ourselves*/ );
- dlg->exec();
-
- return 0;
-}
diff --git a/kio/tests/kprotocolinfotest.cpp b/kio/tests/kprotocolinfotest.cpp
deleted file mode 100644
index 845f3367c..000000000
--- a/kio/tests/kprotocolinfotest.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2002 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <kprotocolinfo.h>
-#include <kprotocolmanager.h>
-#include <kapplication.h>
-#include <kglobalsettings.h>
-#include <kcmdlineargs.h>
-#include <kaboutdata.h>
-#include <kdebug.h>
-#include <assert.h>
-
-int main(int argc, char **argv) {
- TDEAboutData aboutData("kprotocolinfotest", "KProtocolinfo Test",
- "1.0");
-
- TDECmdLineArgs::init(argc, argv, &aboutData);
- TDEApplication app;
-
- KURL url;
- url.setPath("/tmp");
- assert( KProtocolInfo::supportsListing( KURL( "ftp://10.1.1.10") ) );
- assert( KProtocolInfo::inputType(url) == KProtocolInfo::T_NONE );
- assert( KProtocolInfo::outputType(url) == KProtocolInfo::T_FILESYSTEM );
- assert( KProtocolInfo::supportsReading(url) == true );
- KProtocolInfo::ExtraFieldList extraFields = KProtocolInfo::extraFields(url);
- KProtocolInfo::ExtraFieldList::Iterator extraFieldsIt = extraFields.begin();
- for ( ; extraFieldsIt != extraFields.end() ; ++extraFieldsIt )
- kdDebug() << (*extraFieldsIt).name << " " << (*extraFieldsIt).type << endl;
-
- assert( KProtocolInfo::showFilePreview( "file" ) == true );
- assert( KProtocolInfo::showFilePreview( "audiocd" ) == false );
- assert( TDEGlobalSettings::showFilePreview( "audiocd:/" ) == false );
-
- TQString proxy;
- TQString protocol = KProtocolManager::slaveProtocol( "http://bugs.kde.org", proxy );
- assert( protocol == "http" );
-
- TQStringList capabilities = KProtocolInfo::capabilities( "imap" );
- kdDebug() << "kio_imap capabilities: " << capabilities << endl;
- //assert(capabilities.contains("ACL"));
-
- return 0;
-}
diff --git a/kio/tests/kruntest.cpp b/kio/tests/kruntest.cpp
deleted file mode 100644
index d8f47859b..000000000
--- a/kio/tests/kruntest.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright (C) 2002 David Faure <faure@kde.org>
- * Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 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.
- */
-
-// ------ this test works only if your terminal application is set to "x-term" ------
-
-#include "kruntest.h"
-
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kshell.h>
-#include <kservice.h>
-#include <kde_file.h>
-
-#include <tqpushbutton.h>
-#include <tqlayout.h>
-#include <tqdir.h>
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-const int MAXKRUNS = 100;
-
-testKRun * myArray[MAXKRUNS];
-
-void testKRun::foundMimeType( const TQString& _type )
-{
- kdDebug() << "testKRun::foundMimeType " << _type << endl;
- kdDebug() << "testKRun::foundMimeType URL=" << m_strURL.url() << endl;
- m_bFinished = true;
- m_timer.start( 0, true );
- return;
-}
-
-Receiver::Receiver()
-{
- TQVBoxLayout *lay = new TQVBoxLayout(this);
- lay->setAutoAdd(true);
- TQPushButton * h = new TQPushButton( "Press here to terminate", this );
- start = new TQPushButton( "Launch KRuns", this );
- stop = new TQPushButton( "Stop those KRuns", this );
- stop->setEnabled(false);
- TQObject::connect( h, TQT_SIGNAL(clicked()), kapp, TQT_SLOT(quit()) );
- TQObject::connect( start, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotStart()) );
- TQObject::connect( stop, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotStop()) );
-
- adjustSize();
- show();
-}
-
-void Receiver::slotStop()
-{
- for (int i = 0 ; i < MAXKRUNS ; i++ )
- {
- kdDebug() << " deleting krun " << i << endl;
- delete myArray[i];
- }
- start->setEnabled(true);
- stop->setEnabled(false);
-}
-
-
-void Receiver::slotStart()
-{
- for (int i = 0 ; i < MAXKRUNS ; i++ )
- {
- kdDebug() << "creating testKRun " << i << endl;
- myArray[i] = new testKRun( KURL("file:/tmp"), 0, true, false /* no autodelete */ );
- }
- start->setEnabled(false);
- stop->setEnabled(true);
-}
-
-void check(TQString txt, TQString a, TQString b)
-{
- if (a.isEmpty())
- a = TQString::null;
- if (b.isEmpty())
- b = TQString::null;
- if (a == b)
- kdDebug() << txt << " : '" << a << "' - ok" << endl;
- else {
- kdDebug() << txt << " : '" << a << "' but expected '" << b << "' - KO!" << endl;
- exit(1);
- }
-}
-
-const char *bt(bool tr) { return tr?"true":"false"; }
-
-void checkBN(TQString a, bool tr, TQString b)
-{
- check( TQString().sprintf("binaryName('%s', %s)", a.latin1(), bt(tr)), KRun::binaryName(a, tr), b);
-}
-
-void checkPDE(const KService &service, const KURL::List &urls, bool hs, bool tf, TQString b)
-{
- check(
- TQString().sprintf("processDesktopExec( "
- "service = {\nexec = %s\nterminal = %s, terminalOptions = %s\nsubstituteUid = %s, user = %s },"
- "\nURLs = { %s },\nhas_shell = %s, temp_files = %s )",
- service.exec().latin1(), bt(service.terminal()), service.terminalOptions().latin1(), bt(service.substituteUid()), service.username().latin1(),
- KShell::joinArgs(urls.toStringList()).latin1(), bt(hs), bt(tf)),
- KShell::joinArgs(KRun::processDesktopExec(service,urls,hs,tf)), b);
-}
-
-int main(int argc, char **argv)
-{
- TDEApplication app( argc, argv, "kruntest", true /* it _has_ a GUI ! */);
-
- // First some non-interactive tests
- checkBN( "/usr/bin/ls", true, "ls");
- checkBN( "/usr/bin/ls", false, "/usr/bin/ls");
- checkBN( "/path/to/wine \"long argument with path\"", true, "wine" );
- checkBN( "/path/with/a/sp\\ ace/exe arg1 arg2", true, "exe" );
- checkBN( "\"progname\" \"arg1\"", true, "progname" );
- checkBN( "'quoted' \"arg1\"", true, "quoted" );
- checkBN( " 'leading space' arg1", true, "leading space" );
-
- KURL::List l0;
- KURL::List l1; l1 << "file:/tmp";
- KURL::List l2; l2 << "http://localhost/foo";
- KURL::List l3; l3 << "file:/local/file" << "http://remotehost.org/bar";
-
- static const char
- *execs[] = { "Exec=date -u", "Exec=echo $$PWD" },
- *terms[] = { "Terminal=false", "Terminal=true\nTerminalOptions=-T \"%f - %c\"" },
- *sus[] = { "X-TDE-SubstituteUID=false", "X-TDE-SubstituteUID=true\nX-TDE-Username=sprallo" },
- *rslts[] = {
-"'date' '-u'", // 0
-"'/bin/sh' '-c' 'echo $PWD '", // 1
-"'x-term' '-T' ' - just_a_test' '-e' 'date' '-u'", // 2
-"'x-term' '-T' ' - just_a_test' '-e' '/bin/sh' '-c' 'echo $PWD '", // 3
-"'tdesu' '-u' 'sprallo' '-c' 'date -u '", // 4
-"'tdesu' '-u' 'sprallo' '-c' '/bin/sh -c '\\''echo $PWD '\\'''", // 5
-"'x-term' '-T' ' - just_a_test' '-e' 'su' 'sprallo' '-c' 'date -u '", // 6
-"'x-term' '-T' ' - just_a_test' '-e' 'su' 'sprallo' '-c' '/bin/sh -c '\\''echo $PWD '\\'''", // 7
-"'date -u '", // 8
-"'echo $PWD '", // 9
-"'x-term -T \" - just_a_test\"' '-e' 'date -u '", // a
-"'x-term -T \" - just_a_test\"' '-e' '/bin/sh -c '\\''echo $PWD '\\'''", // b
-"'tdesu' '-u' 'sprallo' '-c' ''\\''date -u '\\'''", // c
-"'tdesu' '-u' 'sprallo' '-c' ''\\''/bin/sh -c '\\''\\'\\'''\\''echo $PWD '\\''\\'\\'''\\'''\\'''", // d
-"'x-term -T \" - just_a_test\"' '-e' 'su' 'sprallo' '-c' ''\\''date -u '\\'''", // e
-"'x-term -T \" - just_a_test\"' '-e' 'su' 'sprallo' '-c' ''\\''/bin/sh -c '\\''\\'\\'''\\''echo $PWD '\\''\\'\\'''\\'''\\'''", // f
- };
- for (int hs = 0; hs < 2; hs++)
- for (int su = 0; su < 2; su++)
- for (int te = 0; te < 2; te++)
- for (int ex = 0; ex < 2; ex++) {
- int fd = creat("kruntest.desktop", 0666);
- FILE *f;
- if (fd < 0) abort();
- f = KDE_fdopen(fd, "w");
- fprintf(f, "[Desktop Entry]\n"
- "Type=Application\n"
- "Name=just_a_test\n"
- "Icon=~/icon.png\n"
- "%s\n%s\n%s\n",execs[ex],terms[te],sus[su]);
- close(fd);
- fclose(f);
- KService s(TQDir::currentDirPath() + "/kruntest.desktop");
- unlink("kruntest.desktop");
- checkPDE( s, l0, hs, false, rslts[ex+te*2+su*4+hs*8]);
- }
-
- KService s1("dummy", "kate %U", "app");
- checkPDE( s1, l0, false, false, "'kate'");
- checkPDE( s1, l1, false, false, "'kate' '/tmp'");
- checkPDE( s1, l2, false, false, "'kate' 'http://localhost/foo'");
- checkPDE( s1, l3, false, false, "'kate' '/local/file' 'http://remotehost.org/bar'");
- KService s2("dummy", "kate %u", "app");
- checkPDE( s2, l0, false, false, "'kate'");
- checkPDE( s2, l1, false, false, "'kate' '/tmp'");
- checkPDE( s2, l2, false, false, "'kate' 'http://localhost/foo'");
- checkPDE( s2, l3, false, false, "'kate'");
- KService s3("dummy", "kate %F", "app");
- checkPDE( s3, l0, false, false, "'kate'");
- checkPDE( s3, l1, false, false, "'kate' '/tmp'");
- checkPDE( s3, l2, false, false, "'kfmexec' 'kate %F' 'http://localhost/foo'");
- checkPDE( s3, l3, false, false, "'kfmexec' 'kate %F' 'file:/local/file' 'http://remotehost.org/bar'");
-
- checkPDE( s3, l1, false, true, "'kfmexec' '--tempfiles' 'kate %F' 'file:/tmp'");
- checkPDE( s3, l1, true, true, "''\\''kfmexec'\\'' '\\''--tempfiles'\\'' '\\''kate %F'\\'' '\\''file:/tmp'\\'''");
-
- KService s4("dummy", "sh -c \"kate \"'\\\"'\"%F\"'\\\"'", "app");
- checkPDE( s4, l1, false, false, "'kate' '\"/tmp\"'");
-
- Receiver receiver;
- app.setMainWidget(&receiver);
- return app.exec();
-}
-
-#include "kruntest.moc"
diff --git a/kio/tests/kruntest.h b/kio/tests/kruntest.h
deleted file mode 100644
index 68e7a7280..000000000
--- a/kio/tests/kruntest.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2002 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _kruntest_h
-#define _kruntest_h
-
-#include <krun.h>
-
-#include <tqwidget.h>
-
-class testKRun : public KRun
-{
- Q_OBJECT
-public:
-
- testKRun( const KURL& _url, mode_t _mode = 0,
- bool _is_local_file = false, bool _auto_delete = true )
- : KRun( _url, _mode, _is_local_file, _auto_delete ) {}
-
- virtual ~testKRun() {}
-
- virtual void foundMimeType( const TQString& _type );
-
-};
-
-
-class TQPushButton;
-class Receiver : public TQWidget
-{
- Q_OBJECT
-public:
- Receiver();
- ~Receiver() {}
-public slots:
- void slotStart();
- void slotStop();
-private:
- TQPushButton * start;
- TQPushButton * stop;
-
-};
-
-#endif
diff --git a/kio/tests/kscantest.cpp b/kio/tests/kscantest.cpp
deleted file mode 100644
index 14abd1b33..000000000
--- a/kio/tests/kscantest.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <kapplication.h>
-#include <kscan.h>
-
-int main( int argc, char **argv )
-{
- TDEApplication app( argc, argv, "kscantest" );
- KScanDialog *dlg = KScanDialog::getScanDialog();
- if ( !dlg ) {
- tqDebug("*** EEK, no Scan-service available, aborting!");
- return 0;
- }
-
- dlg->show();
-
- return app.exec();
-}
diff --git a/kio/tests/kshredtest.cpp b/kio/tests/kshredtest.cpp
deleted file mode 100644
index 76e87fca4..000000000
--- a/kio/tests/kshredtest.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*--------------------------------------------------------------------------*
- KShred.h Copyright (c) 2000 MieTerra LLC.
- Credits: Andreas F. Pour <bugs@mieterra.com>
-
-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 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 "kshred.h"
-#include <tqstring.h>
-
-int main(int argc, char **argv)
-
-{
- if (argc < 3)
- {
- fprintf(stderr, "Error, usage is '%s FILE MODE'\n", argv[0]);
- exit(-1);
- }
-
- //if (!shred(argv[1]))
- //printf("ERROR shredding %s\n", argv[1]);
- //exit(1);
-
- KShred::shred(argv[1]);
- printf("Done\n");
- exit(1);
-
- KShred *shredder = new KShred(argv[1]);
-
- switch (argv[2][0])
- {
- case '0':
- if (!shredder->fill0s())
- fprintf(stderr, "ERROR in filling 0s\n");
- break;
- case '1':
- if (!shredder->fill1s())
- fprintf(stderr, "ERROR in filling 1s\n");
- break;
- case 'r':
- if (!shredder->fillrandom())
- fprintf(stderr, "ERROR in filling random\n");
- break;
- case 'b':
- if (!shredder->fillbyte((uint) argv[2][1]))
- fprintf(stderr, "ERROR in filling byte '%c'\n", argv[2][1]);
- break;
- case 's':
- if (!shredder->shred())
- fprintf(stderr, "ERROR in shredding\n");
- break;
- default:
- if (!shredder->fillpattern((unsigned char*)(argv[2]), strlen(argv[2])))
- fprintf(stderr, "ERROR in filling with pattern '%s'\n", argv[2]);
- break;
- }
- fprintf(stdout, "Done\n");
- return 0;
-}
diff --git a/kio/tests/ktartest.cpp b/kio/tests/ktartest.cpp
deleted file mode 100644
index 2c470f6e4..000000000
--- a/kio/tests/ktartest.cpp
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2002, 2003 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "ktar.h"
-#include <stdio.h>
-#include <kinstance.h>
-#include <tqfile.h>
-
-#include <assert.h>
-
-void recursive_print( const KTarDirectory * dir, const TQString & path )
-{
- TQStringList l = dir->entries();
- TQStringList::Iterator it = l.begin();
- for( ; it != l.end(); ++it )
- {
- const KTarEntry* entry = dir->entry( (*it) );
- printf("mode=%07o %s %s %s%s %d isdir=%d\n", entry->permissions(), entry->user().latin1(), entry->group().latin1(), path.latin1(), (*it).latin1(),
- entry->isFile() ? static_cast<const KArchiveFile *>(entry)->size() : 0,
- entry->isDirectory());
- if (entry->isDirectory())
- recursive_print( (KTarDirectory *)entry, path+(*it)+"/" );
- }
-}
-
-int main( int argc, char** argv )
-{
- if (argc != 3)
- {
- printf("\n"
- " Usage :\n"
- " ./ktartest list /path/to/existing_file.tar.gz tests listing an existing tar.gz\n"
- " ./ktartest readwrite newfile.tar.gz will create the tar.gz, then close and reopen it.\n"
- " ./ktartest maxlength newfile.tar.gz tests the maximum filename length allowed.\n"
- " ./ktartest iodevice /path/to/existing_file.tar.gz tests KArchiveFile::device()\n");
- return 1;
- }
- TDEInstance instance("ktartest");
- TQString command = argv[1];
- if ( command == "list" )
- {
- KTarGz tar( argv[2] );
-
- if ( !tar.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
-
- const KTarDirectory* dir = tar.directory();
-
- //printf("calling recursive_print\n");
- recursive_print( dir, "" );
- //printf("recursive_print called\n");
-
- tar.close();
-
- return 0;
- }
- else if (command == "readwrite" )
- {
- KTarGz tar( argv[2] );
-
- if ( !tar.open( IO_WriteOnly ) )
- {
- printf("Could not open %s for writing\n", argv[1]);
- return 1;
- }
-
- tar.writeFile( "empty", "weis", "users", 0, "" );
- tar.writeFile( "test1", "weis", "users", 5, "Hallo" );
- tar.writeFile( "test2", "weis", "users", 8, "Hallo Du" );
- tar.writeFile( "mydir/test3", "weis", "users", 13, "Noch so einer" );
- tar.writeFile( "my/dir/test3", "dfaure", "hackers", 29, "I don't speak German (David)" );
-
-#define SIZE1 100
- // Now a medium file : 100 null bytes
- char medium[ SIZE1 ];
- memset( medium, 0, SIZE1 );
- tar.writeFile( "mediumfile", "user", "group", SIZE1, medium );
- // Another one, with an absolute path
- tar.writeFile( "/dir/subdir/mediumfile2", "user", "group", SIZE1, medium );
-
- // Now a huge file : 20000 null bytes
- int n = 20000;
- char * huge = new char[ n ];
- memset( huge, 0, n );
- tar.writeFile( "hugefile", "user", "group", n, huge );
- delete [] huge;
-
- tar.close();
-
- printf("-----------------------\n");
-
- if ( !tar.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[1] );
- return 1;
- }
-
- const KTarDirectory* dir = tar.directory();
- recursive_print(dir, "");
-
- const KTarEntry* e = dir->entry( "mydir/test3" );
- Q_ASSERT( e && e->isFile() );
- const KTarFile* f = (KTarFile*)e;
-
- TQByteArray arr( f->data() );
- printf("SIZE=%i\n",arr.size() );
- TQString str( arr );
- printf("DATA=%s\n", str.latin1());
-
- tar.close();
-
- return 0;
- }
- else if ( command == "maxlength" )
- {
- KTarGz tar( argv[2] );
-
- if ( !tar.open( IO_WriteOnly ) )
- {
- printf("Could not open %s for writing\n", argv[1]);
- return 1;
- }
- // Generate long filenames of each possible length bigger than 98...
- // Also exceed 512 byte block size limit to see how well the ././@LongLink
- // implementation fares
- for (int i = 98; i < 514 ; i++ )
- {
- TQString str, num;
- str.fill( 'a', i-10 );
- num.setNum( i );
- num = num.rightJustify( 10, '0' );
- tar.writeFile( str+num, "testu", "testg", 3, "hum" );
- }
- // Result of this test : works perfectly now (failed at 482 formerly and
- // before that at 154).
- tar.close();
- printf("Now run 'tar tvzf %s'\n", argv[2]);
- return 0;
- }
- else if ( command == "iodevice" )
- {
- KTarGz tar( argv[2] );
- if ( !tar.open( IO_ReadOnly ) )
- return 1;
- const KTarDirectory* dir = tar.directory();
- assert(dir);
- const KTarEntry* entry = dir->entry( "my/dir/test3" );
- if ( entry && entry->isFile() )
- {
- TQIODevice *dev = static_cast<const KTarFile *>(entry)->device();
- TQByteArray contents = dev->readAll();
- printf("contents='%s'\n", TQCString(contents, contents.size()+1 ).data());
- } else
- printf("entry=%p - not found if 0, otherwise not a file\n", (void*)entry);
- return 0;
- }
- else
- printf("Unknown command\n");
-}
-
diff --git a/kio/tests/ktradertest.cpp b/kio/tests/ktradertest.cpp
deleted file mode 100644
index b05444dfd..000000000
--- a/kio/tests/ktradertest.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2002, 2003 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <kcmdlineargs.h>
-#include <ktrader.h>
-#include <kmimetype.h>
-#include <kapplication.h>
-#include <stdio.h>
-
-static KCmdLineOptions options[] =
-{
- { "+query", "the query", 0 },
- { "+[genericServiceType]", "Application (default), or KParts/ReadOnlyPart", 0 },
- { "+[constraint]", "constraint", 0 },
- { "+[preference]", "preference", 0 },
- KCmdLineLastOption
-};
-
-int main( int argc, char **argv )
-{
- TDECmdLineArgs::init( argc, argv, "ktradertest", "KTradertest", "A KTrader testing tool", "0.0" );
-
- TDECmdLineArgs::addCmdLineOptions( options );
-
- TDEApplication app( false, false ); // no GUI
-
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
-
- if ( args->count() < 1 )
- TDECmdLineArgs::usage();
-
- TQString query = TQString::fromLocal8Bit( args->arg( 0 ) );
-
- TQString genericServiceType, constraint, preference;
-
- if ( args->count() >= 2 )
- genericServiceType = TQString::fromLocal8Bit( args->arg( 1 ) );
-
- if ( args->count() >= 3 )
- constraint = TQString::fromLocal8Bit( args->arg( 2 ) );
-
- if ( args->count() == 4 )
- preference = TQString::fromLocal8Bit( args->arg( 3 ) );
-
- printf( "query is : %s\n", query.local8Bit().data() );
- printf( "genericServiceType is : %s\n", genericServiceType.local8Bit().data() );
- printf( "constraint is : %s\n", constraint.local8Bit().data() );
- printf( "preference is : %s\n", preference.local8Bit().data() );
-
- KTrader::OfferList offers = KTrader::self()->query( query, genericServiceType, constraint, preference );
-
- printf("got %d offers.\n", offers.count());
-
- int i = 0;
- KTrader::OfferList::ConstIterator it = offers.begin();
- KTrader::OfferList::ConstIterator end = offers.end();
- for (; it != end; ++it, ++i )
- {
- printf("---- Offer %d ----\n", i);
- TQStringList props = (*it)->propertyNames();
- TQStringList::ConstIterator propIt = props.begin();
- TQStringList::ConstIterator propEnd = props.end();
- for (; propIt != propEnd; ++propIt )
- {
- TQVariant prop = (*it)->property( *propIt );
-
- if ( !prop.isValid() )
- {
- printf("Invalid property %s\n", (*propIt).local8Bit().data());
- continue;
- }
-
- TQString outp = *propIt;
- outp += " : '";
-
- switch ( prop.type() )
- {
- case TQVariant::StringList:
- outp += prop.toStringList().join(" - ");
- break;
- case TQVariant::Bool:
- outp += prop.toBool() ? "TRUE" : "FALSE";
- break;
- default:
- outp += prop.toString();
- break;
- }
-
- if ( !outp.isEmpty() )
- printf("%s'\n", outp.local8Bit().data());
- }
- }
-}
diff --git a/kio/tests/kurifiltertest.cpp b/kio/tests/kurifiltertest.cpp
deleted file mode 100644
index 820f97403..000000000
--- a/kio/tests/kurifiltertest.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (C) 2002, 2003 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "kurifilter.h"
-
-#include <config.h>
-#include <iostream>
-#include <stdlib.h>
-
-#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kcmdlineargs.h>
-#include <kstandarddirs.h>
-#include <ksimpleconfig.h>
-
-#include <tqdir.h>
-#include <tqregexp.h>
-#include <kio/netaccess.h>
-
-static const char * const s_uritypes[] = { "NET_PROTOCOL", "LOCAL_FILE", "LOCAL_DIR", "EXECUTABLE", "HELP", "SHELL", "BLOCKED", "ERROR", "UNKNOWN" };
-#define NO_FILTERING -2
-
-void filter( const char* u, const char * expectedResult = 0, int expectedUriType = -1, TQStringList list = TQStringList(), const char * abs_path = 0, bool checkForExecutables = true )
-{
- TQString a = TQString::fromUtf8( u );
- KURIFilterData * m_filterData = new KURIFilterData;
- m_filterData->setData( a );
- m_filterData->setCheckForExecutables( checkForExecutables );
-
- if( abs_path )
- {
- m_filterData->setAbsolutePath( TQString::fromLatin1( abs_path ) );
- kdDebug() << "Filtering: " << a << " with abs_path=" << abs_path << endl;
- }
- else
- kdDebug() << "Filtering: " << a << endl;
-
- if (KURIFilter::self()->filterURI(*m_filterData, list))
- {
- // Copied from minicli...
- TQString cmd;
- KURL uri = m_filterData->uri();
-
- if ( uri.isLocalFile() && !uri.hasRef() && uri.query().isEmpty() )
- cmd = uri.path();
- else
- cmd = uri.url();
-
- switch( m_filterData->uriType() )
- {
- case KURIFilterData::LOCAL_FILE:
- case KURIFilterData::LOCAL_DIR:
- case KURIFilterData::HELP:
- kdDebug() << "*** Result: Local Resource => '"
- << m_filterData->uri().url() << "'" << endl;
- break;
- case KURIFilterData::NET_PROTOCOL:
- kdDebug() << "*** Result: Network Resource => '"
- << m_filterData->uri().url() << "'" << endl;
- break;
- case KURIFilterData::SHELL:
- case KURIFilterData::EXECUTABLE:
- if( m_filterData->hasArgsAndOptions() )
- cmd += m_filterData->argsAndOptions();
- kdDebug() << "*** Result: Executable/Shell => '" << cmd << "'"<< endl;
- break;
- case KURIFilterData::ERROR:
- kdDebug() << "*** Result: Encountered error. See reason below." << endl;
- break;
- default:
- kdDebug() << "*** Result: Unknown or invalid resource." << endl;
- }
-
- if ( expectedUriType != -1 && expectedUriType != m_filterData->uriType() )
- {
- kdError() << " Got URI type " << s_uritypes[m_filterData->uriType()]
- << " expected " << s_uritypes[expectedUriType] << endl;
- ::exit(1);
- }
-
- if ( expectedResult )
- {
- // Hack for other locales than english, normalize google hosts to google.com
- cmd = cmd.replace( TQRegExp( "www\\.google\\.[^/]*/" ), "www.google.com/" );
- if ( cmd != TQString::fromLatin1( expectedResult ) )
- {
- kdError() << " Got " << cmd << " expected " << expectedResult << endl;
- ::exit(1);
- }
- }
- }
- else
- {
- if ( expectedUriType == NO_FILTERING )
- kdDebug() << "*** No filtering required." << endl;
- else
- {
- kdDebug() << "*** Could not be filtered." << endl;
- if( expectedUriType != m_filterData->uriType() )
- {
- kdError() << " Got URI type " << s_uritypes[m_filterData->uriType()]
- << " expected " << s_uritypes[expectedUriType] << endl;
- ::exit(1);
- }
- }
- }
-
- delete m_filterData;
- kdDebug() << "-----" << endl;
-}
-
-void testLocalFile( const TQString& filename )
-{
- TQFile tmpFile( filename ); // Yeah, I know, security risk blah blah. This is a test prog!
-
- if ( tmpFile.open( IO_ReadWrite ) )
- {
- TQCString fname = TQFile::encodeName( tmpFile.name() );
- filter(fname, fname, KURIFilterData::LOCAL_FILE);
- tmpFile.close();
- tmpFile.remove();
- }
- else
- kdDebug() << "Couldn't create " << tmpFile.name() << ", skipping test" << endl;
-}
-
-static const char appName[] = "kurifiltertest";
-static const char programName[] = I18N_NOOP("kurifiltertest");
-static const char description[] = I18N_NOOP("Unit test for the URI filter plugin framework.");
-static const char version[] = "1.5";
-
-static const KCmdLineOptions options[] =
-{
- { "s", I18N_NOOP("Use space as keyword delimeter for web shortcuts"), 0},
- KCmdLineLastOption
-};
-
-int main(int argc, char **argv)
-{
- // Ensure that user configuration doesn't change the results of those tests
- // TDEHOME needs to be writable though, for a tdesycoca database
- setenv( "TDEHOME", TQFile::encodeName( TQDir::homeDirPath() + "/.tde-kurifiltertest" ), true );
- setenv( "TDE_FORK_SLAVES", "yes", true ); // simpler, for the final cleanup
-
- TDEAboutData aboutData(appName, programName, version, description);
- TDECmdLineArgs::init(argc, argv, &aboutData);
- TDECmdLineArgs::addCmdLineOptions( options );
-
- TDEApplication app;
- app.disableAutoDcopRegistration();
-
- // Allow testing of the search engine using both delimiters...
- char delimiter = TDECmdLineArgs::parsedArgs()->isSet("s") ? ' ' : ':';
-
- // Many tests check the "default search engine" feature.
- // There is no default search engine by default (since it was annoying when making typos),
- // so the user has to set it up, which we do here.
- {
- KSimpleConfig cfg( "kuriikwsfilterrc" );
- cfg.setGroup( "General" );
- cfg.writeEntry( "DefaultSearchEngine", "google" );
- cfg.writeEntry( "Verbose", true );
- cfg.writeEntry( "KeywordDelimiter", delimiter );
- cfg.sync();
- }
-
- // Enable verbosity for debugging
- {
- KSimpleConfig cfg( "kshorturifilterrc" );
- cfg.writeEntry( "Verbose", true );
- cfg.sync();
- }
-
- TQStringList minicliFilters;
- minicliFilters << "kshorturifilter" << "kurisearchfilter" << "localdomainurifilter";
-
- // URI that should require no filtering
- filter( "http://www.kde.org", "http://www.kde.org", KURIFilterData::NET_PROTOCOL );
- filter( "http://www.kde.org/developer//index.html", "http://www.kde.org/developer//index.html", KURIFilterData::NET_PROTOCOL );
- // URL with reference
- filter( "http://www.kde.org/index.html#q8", "http://www.kde.org/index.html#q8", KURIFilterData::NET_PROTOCOL );
- // local file with reference
- filter( "file:/etc/passwd#q8", "file:///etc/passwd#q8", KURIFilterData::LOCAL_FILE );
- filter( "file:///etc/passwd#q8", "file:///etc/passwd#q8", KURIFilterData::LOCAL_FILE );
- filter( "/etc/passwd#q8", "file:///etc/passwd#q8", KURIFilterData::LOCAL_FILE );
- // local file with query (can be used by javascript)
- filter( "file:/etc/passwd?foo=bar", "file:///etc/passwd?foo=bar", KURIFilterData::LOCAL_FILE );
- testLocalFile( "/tmp/kurifiltertest?foo" ); // local file with ? in the name (#58990)
- testLocalFile( "/tmp/kurlfiltertest#foo" ); // local file with '#' in the name
- testLocalFile( "/tmp/kurlfiltertest#foo?bar" ); // local file with both
- testLocalFile( "/tmp/kurlfiltertest?foo#bar" ); // local file with both, the other way round
-
- // hostnames are lowercased by KURL
- filter( "http://www.myDomain.commyPort/ViewObjectRes//Default:name=hello",
- "http://www.mydomain.commyport/ViewObjectRes//Default:name=hello", KURIFilterData::NET_PROTOCOL);
- filter( "ftp://ftp.kde.org", "ftp://ftp.kde.org", KURIFilterData::NET_PROTOCOL );
- filter( "ftp://username@ftp.kde.org:500", "ftp://username@ftp.kde.org:500", KURIFilterData::NET_PROTOCOL );
-
- // ShortURI/LocalDomain filter tests. NOTE: any of these tests can fail
- // if you have specified your own patterns in kshorturifilterrc. For
- // examples, see $TDEDIR/share/config/kshorturifilterrc .
- filter( "linuxtoday.com", "http://linuxtoday.com", KURIFilterData::NET_PROTOCOL );
- filter( "LINUXTODAY.COM", "http://linuxtoday.com", KURIFilterData::NET_PROTOCOL );
- filter( "kde.org", "http://kde.org", KURIFilterData::NET_PROTOCOL );
- filter( "ftp.kde.org", "ftp://ftp.kde.org", KURIFilterData::NET_PROTOCOL );
- filter( "ftp.kde.org:21", "ftp://ftp.kde.org:21", KURIFilterData::NET_PROTOCOL );
- filter( "cr.yp.to", "http://cr.yp.to", KURIFilterData::NET_PROTOCOL );
- filter( "user@192.168.1.0:3128", "http://user@192.168.1.0:3128", KURIFilterData::NET_PROTOCOL );
- filter( "127.0.0.1", "http://127.0.0.1", KURIFilterData::NET_PROTOCOL );
- filter( "127.0.0.1:3128", "http://127.0.0.1:3128", KURIFilterData::NET_PROTOCOL );
- filter( "foo@bar.com", "mailto:foo@bar.com", KURIFilterData::NET_PROTOCOL );
- filter( "firstname.lastname@x.foo.bar", "mailto:firstname.lastname@x.foo.bar", KURIFilterData::NET_PROTOCOL );
- filter( "www.123.foo", "http://www.123.foo", KURIFilterData::NET_PROTOCOL );
- filter( "user@www.123.foo:3128", "http://user@www.123.foo:3128", KURIFilterData::NET_PROTOCOL );
-
- // Exotic IPv4 address formats...
- filter( "127.1", "http://127.1", KURIFilterData::NET_PROTOCOL );
- filter( "127.0.1", "http://127.0.1", KURIFilterData::NET_PROTOCOL );
-
- // Local domain filter - If you uncomment these test, make sure you
- // you adjust it based on the localhost entry in your /etc/hosts file.
- // filter( "localhost:3128", "http://localhost.localdomain:3128", KURIFilterData::NET_PROTOCOL );
- // filter( "localhost", "http://localhost.localdomain", KURIFilterData::NET_PROTOCOL );
- // filter( "localhost/~blah", "http://localhost.localdomain/~blah", KURIFilterData::NET_PROTOCOL );
-
- filter( "/", "/", KURIFilterData::LOCAL_DIR );
- filter( "/", "/", KURIFilterData::LOCAL_DIR, "kshorturifilter" );
- filter( "~/.bashrc", TQDir::homeDirPath().local8Bit()+"/.bashrc", KURIFilterData::LOCAL_FILE, "kshorturifilter" );
- filter( "~", TQDir::homeDirPath().local8Bit(), KURIFilterData::LOCAL_DIR, "kshorturifilter", "/tmp" );
- filter( "~foobar", 0, KURIFilterData::ERROR, "kshorturifilter" );
- filter( "user@host.domain", "mailto:user@host.domain", KURIFilterData::NET_PROTOCOL ); // new in KDE-3.2
-
- // Windows style SMB (UNC) URL. Should be converted into the valid smb format...
- filter( "\\\\mainserver\\share\\file", "smb://mainserver/share/file" , KURIFilterData::NET_PROTOCOL );
-
- // Should not be filtered at all. All valid protocols of this form will be ignored.
- filter( "ftp:" , "ftp:", KURIFilterData::UNKNOWN );
- filter( "http:" , "http:", KURIFilterData::UNKNOWN );
-
- /*
- Automatic searching tests. NOTE: If the Default search engine is set to 'None',
- this stuff will fail as the status returned will then be KURIFilterData::UNKNOWN.
- */
- filter( "gg:", 0 , KURIFilterData::NET_PROTOCOL );
- filter( "KDE", 0 , KURIFilterData::NET_PROTOCOL );
- filter( "FTP", 0 , KURIFilterData::NET_PROTOCOL );
-
- // If your default search engine is set to 'Google', you can uncomment the test below.
- filter( "gg:", "http://www.google.com/search?q=gg%3A&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
- filter( "KDE", "http://www.google.com/search?q=KDE&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
- filter( "FTP", "http://www.google.com/search?q=FTP&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
-
- // Typing 'cp' or any other valid unix command in konq's location bar should result in
- // a search using the default search engine
- // 'ls' is a bit of a special case though, due to the toplevel domain called 'ls'
- filter( "cp", "http://www.google.com/search?q=cp&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL,
- TQStringList(), 0, false /* don't check for executables, see konq_misc.cc */ );
-
- // Executable tests - No IKWS in minicli
- filter( "cp", "cp", KURIFilterData::EXECUTABLE, minicliFilters );
- filter( "kfmclient", "kfmclient", KURIFilterData::EXECUTABLE, minicliFilters );
- filter( "xwininfo", "xwininfo", KURIFilterData::EXECUTABLE, minicliFilters );
- filter( "KDE", "KDE", NO_FILTERING, minicliFilters );
- filter( "I/dont/exist", "I/dont/exist", NO_FILTERING, minicliFilters );
- filter( "/I/dont/exist", 0, KURIFilterData::ERROR, minicliFilters );
- filter( "/I/dont/exist#a", 0, KURIFilterData::ERROR, minicliFilters );
- filter( "kfmclient --help", "kfmclient --help", KURIFilterData::EXECUTABLE, minicliFilters ); // the args are in argsAndOptions()
- filter( "/usr/bin/gs", "/usr/bin/gs", KURIFilterData::EXECUTABLE, minicliFilters );
- filter( "/usr/bin/gs -q -option arg1", "/usr/bin/gs -q -option arg1", KURIFilterData::EXECUTABLE, minicliFilters ); // the args are in argsAndOptions()
-
- // ENVIRONMENT variable
- setenv( "SOMEVAR", "/somevar", 0 );
- setenv( "ETC", "/etc", 0 );
-
- TQCString qtdir=getenv("QTDIR");
- TQCString home = getenv("HOME");
- TQCString tdehome = getenv("TDEHOME");
-
- filter( "$SOMEVAR/tdelibs/kio", 0, KURIFilterData::ERROR ); // note: this dir doesn't exist...
- filter( "$ETC/passwd", "/etc/passwd", KURIFilterData::LOCAL_FILE );
- filter( "$QTDIR/doc/html/functions.html#s", TQCString("file://")+qtdir+"/doc/html/functions.html#s", KURIFilterData::LOCAL_FILE );
- filter( "http://www.kde.org/$USER", "http://www.kde.org/$USER", KURIFilterData::NET_PROTOCOL ); // no expansion
-
- // Assume the default (~/.trinity) if
- if (tdehome.isEmpty())
- {
- tdehome += "$HOME/.trinity";
- setenv("TDEHOME", tdehome.data(), 0);
- }
-
- filter( "$TDEHOME/share", tdehome+"/share", KURIFilterData::LOCAL_DIR );
- KStandardDirs::makeDir( tdehome+"/a+plus" );
- filter( "$TDEHOME/a+plus", tdehome+"/a+plus", KURIFilterData::LOCAL_DIR );
-
- // BR 27788
- KStandardDirs::makeDir( tdehome+"/share/Dir With Space" );
- filter( "$TDEHOME/share/Dir With Space", tdehome+"/share/Dir With Space", KURIFilterData::LOCAL_DIR );
-
- // support for name filters (BR 93825)
- filter( "$TDEHOME/*.txt", tdehome+"/*.txt", KURIFilterData::LOCAL_DIR );
- filter( "$TDEHOME/[a-b]*.txt", tdehome+"/[a-b]*.txt", KURIFilterData::LOCAL_DIR );
- filter( "$TDEHOME/a?c.txt", tdehome+"/a?c.txt", KURIFilterData::LOCAL_DIR );
- filter( "$TDEHOME/?c.txt", tdehome+"/?c.txt", KURIFilterData::LOCAL_DIR );
- // but let's check that a directory with * in the name still works
- KStandardDirs::makeDir( tdehome+"/share/Dir*With*Stars" );
- filter( "$TDEHOME/share/Dir*With*Stars", tdehome+"/share/Dir*With*Stars", KURIFilterData::LOCAL_DIR );
- KStandardDirs::makeDir( tdehome+"/share/Dir?QuestionMark" );
- filter( "$TDEHOME/share/Dir?QuestionMark", tdehome+"/share/Dir?QuestionMark", KURIFilterData::LOCAL_DIR );
- KStandardDirs::makeDir( tdehome+"/share/Dir[Bracket" );
- filter( "$TDEHOME/share/Dir[Bracket", tdehome+"/share/Dir[Bracket", KURIFilterData::LOCAL_DIR );
-
- filter( "$HOME/$TDEDIR/tdebase/kcontrol/ebrowsing", 0, KURIFilterData::ERROR );
- filter( "$1/$2/$3", "http://www.google.com/search?q=$1/$2/$3&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL ); // can be used as bogus or valid test. Currently triggers default search, i.e. google
- filter( "$$$$", "http://www.google.com/search?q=$$$$&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL ); // worst case scenarios.
-
- // Replaced the match testing with a 0 since
- // the shortURI filter will return the string
- // itself if the requested environment variable
- // is not already set.
- filter( "$QTDIR", 0, KURIFilterData::LOCAL_DIR, "kshorturifilter" ); //use specific filter.
- filter( "$HOME", home, KURIFilterData::LOCAL_DIR, "kshorturifilter" ); //use specific filter.
-
-
- TQCString sc;
- filter( sc.sprintf("gg%cfoo bar",delimiter), "http://www.google.com/search?q=foo+bar&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
- filter( sc.sprintf("bug%c55798", delimiter), "http://bugs.kde.org/show_bug.cgi?id=55798", KURIFilterData::NET_PROTOCOL );
-
- filter( sc.sprintf("gg%cC++", delimiter), "http://www.google.com/search?q=C%2B%2B&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
- filter( sc.sprintf("ya%cfoo bar was here", delimiter), 0, -1 ); // this triggers default search, i.e. google
- filter( sc.sprintf("gg%cwww.kde.org", delimiter), "http://www.google.com/search?q=www.kde.org&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
- filter( sc.sprintf("av%c+rock +sample", delimiter), "http://www.altavista.com/cgi-bin/query?pg=q&kl=XX&stype=stext&q=%2Brock+%2Bsample", KURIFilterData::NET_PROTOCOL );
- filter( sc.sprintf("gg%cé", delimiter) /*eaccent in utf8*/, "http://www.google.com/search?q=%C3%A9&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
- filter( sc.sprintf("gg%cпрйвет", delimiter) /* greetings in russian utf-8*/, "http://www.google.com/search?q=%D0%BF%D1%80%D0%B9%D0%B2%D0%B5%D1%82&ie=UTF-8&oe=UTF-8", KURIFilterData::NET_PROTOCOL );
-
- // Absolute Path tests for kshorturifilter
- filter( "./", tdehome+"/share", KURIFilterData::LOCAL_DIR, "kshorturifilter", tdehome+"/share/" ); // cleanDirPath removes the trailing slash
- filter( "../", tdehome, KURIFilterData::LOCAL_DIR, "kshorturifilter", tdehome+"/share" );
- filter( "config", tdehome+"/share/config", KURIFilterData::LOCAL_DIR, "kshorturifilter", tdehome+"/share" );
-
- // Clean up
- TDEIO::NetAccess::del( tdehome, 0 );
-
- kdDebug() << "All tests done. Go home..." << endl;
- return 0;
-}
diff --git a/kio/tests/kurlcompletiontest.cpp b/kio/tests/kurlcompletiontest.cpp
deleted file mode 100644
index c8dc99595..000000000
--- a/kio/tests/kurlcompletiontest.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2004 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <kapplication.h>
-#include <kurlcompletion.h>
-#include <kdebug.h>
-#include <tqdir.h>
-#include <assert.h>
-#include <tqfile.h>
-#include <ktempdir.h>
-#include <kcmdlineargs.h>
-#include <unistd.h>
-
-class KURLCompletionTest
-{
-public:
- KURLCompletionTest() {}
- ~KURLCompletionTest() { teardown(); }
- void setup( bool setDirAsURL );
- void teardown();
- void testLocalRelativePath();
- void testLocalAbsolutePath();
- void testLocalURL();
-
-private:
- void waitForCompletion();
- KURLCompletion* m_completion;
- KTempDir* m_tempDir;
- KURL m_dirURL;
- TQString m_dir;
-};
-
-void KURLCompletionTest::setup( bool setDirAsURL )
-{
- kdDebug() << k_funcinfo << endl;
- m_completion = new KURLCompletion;
- m_tempDir = new KTempDir;
- m_tempDir->setAutoDelete( true );
- m_dir = m_tempDir->name();
- kdDebug() << "m_dir=" << m_dir << endl;
- Q_ASSERT( m_dir.endsWith( "/" ) );
- if ( setDirAsURL ) {
- KURL d; d.setPath( m_dir );
- m_completion->setDir( d.url() );
- } else {
- m_completion->setDir( m_dir );
- }
- m_dirURL.setPath( m_dir );
-
- TQFile f1( m_dir + "/file1" );
- bool ok = f1.open( IO_WriteOnly );
- assert( ok );
- f1.close();
-
- TQFile f2( m_dir + "/file#a" );
- ok = f2.open( IO_WriteOnly );
- assert( ok );
- f2.close();
-}
-
-void KURLCompletionTest::teardown()
-{
- delete m_completion;
- m_completion = 0;
- delete m_tempDir;
- m_tempDir = 0;
-}
-void KURLCompletionTest::waitForCompletion()
-{
- while ( m_completion->isRunning() ) {
- kdDebug() << "waiting for thread..." << endl;
- usleep( 10 );
- }
-}
-
-void KURLCompletionTest::testLocalRelativePath()
-{
- kdDebug() << k_funcinfo << endl;
- // Completion from relative path, with two matches
- m_completion->makeCompletion( "f" );
- waitForCompletion();
- TQStringList comp1all = m_completion->allMatches();
- assert( comp1all.count() == 2 );
- assert( comp1all.find( "file1" ) != comp1all.end() );
- assert( comp1all.find( "file#a" ) != comp1all.end() );
- TQString comp1 = m_completion->replacedPath( "file1" ); // like KURLRequester does
- assert( comp1 == "file1" );
-
- // Completion from relative path
- kdDebug() << endl << k_funcinfo << "now completing on 'file#'" << endl;
- m_completion->makeCompletion( "file#" );
- waitForCompletion();
- TQStringList compall = m_completion->allMatches();
- kdDebug() << compall << endl;
- assert( compall.count() == 1 );
- assert( compall.first() == "file#a" );
- TQString comp2 = m_completion->replacedPath( compall.first() ); // like KURLRequester does
- assert( comp2 == "file#a" );
-}
-
-void KURLCompletionTest::testLocalAbsolutePath()
-{
- // Completion from absolute path
- kdDebug() << k_funcinfo << m_dir+"file#" << endl;
- m_completion->makeCompletion( m_dir + "file#" );
- waitForCompletion();
- TQStringList compall = m_completion->allMatches();
- kdDebug() << compall << endl;
- assert( compall.count() == 1 );
- TQString comp = compall.first();
- assert( comp == m_dir + "file#a" );
- comp = m_completion->replacedPath( comp ); // like KURLRequester does
- assert( comp == m_dir + "file#a" );
-}
-
-void KURLCompletionTest::testLocalURL()
-{
- // Completion from URL
- kdDebug() << k_funcinfo << endl;
- KURL url = KURL::fromPathOrURL( m_dirURL.path() + "file" );
- m_completion->makeCompletion( url.prettyURL() );
- waitForCompletion();
- TQStringList comp1all = m_completion->allMatches();
- kdDebug() << comp1all << endl;
- assert( comp1all.count() == 2 );
- assert( comp1all.find( m_dirURL.url() + "file1" ) != comp1all.end() );
- TQString filehash = m_dirURL.url() + "file%23a";
- assert( comp1all.find( filehash ) != comp1all.end() );
- TQString filehashPath = m_completion->replacedPath( filehash ); // note that it returns a path!!
- kdDebug() << filehashPath << endl;
- assert( filehashPath == m_dirURL.path() + "file#a" );
-
- // Completion from URL with no match
- url = KURL::fromPathOrURL( m_dirURL.path() + "foobar" );
- kdDebug() << k_funcinfo << "makeCompletion(" << url << ")" << endl;
- TQString comp2 = m_completion->makeCompletion( url.prettyURL() );
- assert( comp2.isEmpty() );
- waitForCompletion();
- assert( m_completion->allMatches().isEmpty() );
-
- // Completion from URL with a ref -> no match
- url = KURL::fromPathOrURL( m_dirURL.path() + "f" );
- url.setRef( "ref" );
- kdDebug() << k_funcinfo << "makeCompletion(" << url << ")" << endl;
- m_completion->makeCompletion( url.prettyURL() );
- waitForCompletion();
- assert( m_completion->allMatches().isEmpty() );
-}
-
-int main( int argc, char **argv )
-{
- TDEApplication::disableAutoDcopRegistration();
- TDECmdLineArgs::init(argc,argv,"kurlcompletiontest", 0, 0, 0, 0);
- TDEApplication app;
-
- {
- KURLCompletionTest test;
- test.setup( false );
- test.testLocalRelativePath();
- test.testLocalAbsolutePath();
- test.testLocalURL();
- test.teardown();
-
- // Try again, with another KTempDir (to check that the caching doesn't give us wrong results)
- test.setup( true );
- test.testLocalRelativePath();
- test.testLocalAbsolutePath();
- test.testLocalURL();
- test.teardown();
- }
- tqDebug( "All tests OK." );
-
- return 0;
-}
diff --git a/kio/tests/kziptest.cpp b/kio/tests/kziptest.cpp
deleted file mode 100644
index 84d38d134..000000000
--- a/kio/tests/kziptest.cpp
+++ /dev/null
@@ -1,435 +0,0 @@
-/*
- * Copyright (C) 2002, 2003 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "kzip.h"
-#include <stdio.h>
-#include <kinstance.h>
-#include <kdebug.h>
-#include <tqfile.h>
-
-#include <assert.h>
-
-void recursive_print( const KArchiveDirectory * dir, const TQString & path )
-{
- TQStringList l = dir->entries();
- TQStringList::Iterator it = l.begin();
- for( ; it != l.end(); ++it )
- {
- const KArchiveEntry* entry = dir->entry( (*it) );
- printf("mode=%07o %s %s size: %d pos: %d %s%s isdir=%d%s", entry->permissions(),
- entry->user().latin1(), entry->group().latin1(),
- entry->isDirectory() ? 0 : ((KArchiveFile*)entry)->size(),
- entry->isDirectory() ? 0 : ((KArchiveFile*)entry)->position(),
- path.latin1(), (*it).latin1(), entry->isDirectory(),
- !entry->symlink() ? "" : TQString(" symlink: %1").arg(entry->symlink()).latin1() );
-
-// if (!entry->isDirectory()) printf("%d", ((KArchiveFile*)entry)->size());
- printf("\n");
- if (entry->isDirectory())
- recursive_print( (KArchiveDirectory *)entry, path+(*it)+"/" );
- }
-}
-
-
-void recursive_transfer(const KArchiveDirectory * dir,
- const TQString & path, KZip * zip)
-{
- TQStringList l = dir->entries();
- TQStringList::Iterator it = l.begin();
- for( ; it != l.end(); ++it )
- {
- const KArchiveEntry* e = dir->entry( (*it) );
- kdDebug() << "actual file: " << e->name() << endl;
- if (e->isFile())
- {
- Q_ASSERT( e && e->isFile() );
- const KArchiveFile* f = (KArchiveFile*)e;
- printf("FILE=%s\n", e->name().latin1());
-
- TQByteArray arr( f->data() );
- printf("SIZE=%i\n",arr.size() );
- TQString str( arr );
- printf("DATA=%s\n", str.latin1());
-
- if (e->symlink().isEmpty()) {
- zip->writeFile( path+e->name().latin1(),
- "holgi", "holgrp",
- arr.size() , f->data() );
- } else
- zip->writeSymLink(path+e->name(), e->symlink(), "leo", "leo",
- 0120777, 1000000000l, 1000000000l, 1000000000l);
- }
- else if (e->isDirectory())
- {
- recursive_transfer((KArchiveDirectory *)e ,
- path+e->name()+"/", zip);
- }
- }
-}
-
-int main( int argc, char** argv )
-{
- if (argc < 3)
- {
- printf("\n"
- " Usage :\n"
- " ./kziptest list /path/to/existing_file.zip tests listing an existing zip\n"
- " ./kziptest readwrite newfile.zip will create the zip, then close and reopen it.\n"
- " ./kziptest maxlength newfile.zip tests the maximum filename length allowed.\n"
- " ./kziptest print file.zip prints contents of all files.\n"
- " ./kziptest print2 file.zip filename prints contents of one file.\n"
- " ./kziptest update file.zip filename updates contents of one file.\n"
- " ./kziptest transfer file.zip newfile.zip complete transfer.\n"
- " ./kziptest iodevice /path/to/existing_file.zip tests KArchiveFile::device()\n");
- return 1;
- }
- TDEInstance instance("kziptest");
- TQString command = argv[1];
- if ( command == "list" )
- {
- KZip zip( argv[2] );
-
- if ( !zip.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
-
- const KArchiveDirectory* dir = zip.directory();
-
- //printf("calling recursive_print\n");
- recursive_print( dir, "" );
- //printf("recursive_print called\n");
-
- zip.close();
-
- return 0;
- }
- else if (command == "readwrite" )
- {
- KZip zip( argv[2] );
-
- if ( !zip.open( IO_WriteOnly ) )
- {
- printf("Could not open %s for writing\n", argv[2]);
- return 1;
- }
-
- zip.setCompression( KZip::NoCompression );
- zip.writeFile( "typeid", "", "", 19, "application/x-kword" );
- zip.setCompression( KZip::DeflateCompression );
- zip.writeFile( "empty", "weis", "users", 0, "" );
- zip.writeFile( "test1", "weis", "users", 5, "Hallo" );
- zip.writeFile( "test2", "weis", "users", 8, "Hallo Du" );
- zip.writeFile( "mydir/test3", "weis", "users", 13, "Noch so einer" );
- zip.writeFile( "my/dir/test3", "dfaure", "hackers", 29, "I don't speak German (David)" );
- zip.writeSymLink( "a_link", "mydir/test3", "leo", "leo", 0120777,
- 1000000000l, 1000000000l, 1000000000l);
-
-#define SIZE1 100
- // Now a medium file : 100 null bytes
- char medium[ SIZE1 ];
- memset( medium, 0, SIZE1 );
- zip.writeFile( "mediumfile", "user", "group", SIZE1, medium );
- // Another one, with an absolute path
- zip.writeFile( "/dir/subdir/mediumfile2", "user", "group", SIZE1, medium );
-
- // Now a huge file : 20000 null bytes
- int n = 20000;
- char * huge = new char[ n ];
- memset( huge, 0, n );
- zip.writeFile( "hugefile", "user", "group", n, huge );
- delete [] huge;
-
- // Now a file from the harddisk
- zip.addLocalFile( ".libs/lt-kziptest", "lt-kziptest" );
-
- printf( "calling close\n" );
-
- zip.close();
-
- printf("-----------------------\n");
-
- if ( !zip.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
-
- const KArchiveDirectory* dir = zip.directory();
- recursive_print(dir, "");
-
- const KArchiveEntry* e = dir->entry( "mydir/test3" );
- Q_ASSERT( e && e->isFile() );
- const KArchiveFile* f = (KArchiveFile*)e;
-
- TQByteArray arr( f->data() );
- Q_ASSERT( arr.size() == 13 );
- printf("SIZE=%i\n",arr.size() );
- TQString str( arr );
- Q_ASSERT( str == "Noch so einer" );
- printf("DATA=%s\n", str.latin1());
-
- e = dir->entry( "mediumfile" );
- Q_ASSERT( e && e->isFile() );
- f = (KArchiveFile*)e;
- Q_ASSERT( f->data().size() == SIZE1 );
-
- e = dir->entry( "hugefile" );
- Q_ASSERT( e && e->isFile() );
- f = (KArchiveFile*)e;
- Q_ASSERT( f->data().size() == 20000 );
-
- zip.close();
-
- return 0;
- }
- else if ( command == "maxlength" )
- {
- KZip zip( argv[2] );
-
- if ( !zip.open( IO_WriteOnly ) )
- {
- printf("Could not open %s for writing\n", argv[2]);
- return 1;
- }
- // Generate long filenames of each possible length bigger than 98...
- for (int i = 98; i < 500 ; i++ )
- {
- TQString str, num;
- str.fill( 'a', i-10 );
- num.setNum( i );
- num = num.rightJustify( 10, '0' );
- zip.writeFile( str+num, "testu", "testg", 3, "hum" );
- }
- // Result of this test : it fails at 482 (instead of 154 previously).
- // Ok, I think we can do with that :)
- zip.close();
- printf("Now run 'unzip -l %s'\n", argv[2]);
- return 0;
- }
- else if ( command == "iodevice" )
- {
- KZip zip( argv[2] );
- if ( !zip.open( IO_ReadOnly ) )
- return 1;
- const KArchiveDirectory* dir = zip.directory();
- assert(dir);
- const KArchiveEntry* entry = dir->entry( "my/dir/test3" );
- if ( entry && entry->isFile() )
- {
- TQIODevice *dev = static_cast<const KZipFileEntry *>(entry)->device();
- if ( dev ) {
- TQByteArray contents = dev->readAll();
- printf("contents='%s'\n", TQCString(contents, contents.size()+1).data());
- }
- } else
- printf("entry=%p - not found if 0, otherwise not a file\n", (void*)entry);
- return 0;
- }
- else if (command == "print" )
- {
- KZip zip( argv[2] );
- kdDebug() << "Opening zip file" << endl;
- if ( !zip.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
- const KArchiveDirectory* dir = zip.directory();
- kdDebug() << "Listing toplevel of zip file" << endl;
- TQStringList l = dir->entries();
- TQStringList::Iterator it = l.begin();
- for( ; it != l.end(); ++it )
- {
- const KArchiveEntry* e = dir->entry( (*it) );
- kdDebug() << "Printing " << (*it) << endl;
- if (e->isFile())
- {
- Q_ASSERT( e && e->isFile() );
- const KArchiveFile* f = (KArchiveFile*)e;
-
- TQByteArray arr( f->data() );
- printf("SIZE=%i\n",arr.size() );
- TQString str( arr );
- printf("DATA=%s\n", str.latin1());
- }
- }
- zip.close();
- return 0;
- }
- else if (command == "print2" )
- {
- if (argc != 4)
- {
- printf("usage: kziptest print2 archivename filename");
- return 1;
- }
- KZip zip( argv[2] );
- if ( !zip.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
- const KArchiveDirectory* dir = zip.directory();
- const KArchiveEntry* e = dir->entry( argv[3] );
- Q_ASSERT( e && e->isFile() );
- const KArchiveFile* f = (KArchiveFile*)e;
-
- TQByteArray arr( f->data() );
- printf("SIZE=%i\n",arr.size() );
- TQString str( arr );
-// printf("DATA=%s\n", str.latin1());
- printf("%s", str.latin1());
- zip.close();
-
- return 0;
-
- }
- else if (command == "update" )
- {
- if (argc != 4)
- {
- printf("usage: kziptest update archivename filename");
- return 1;
- }
- KZip zip( argv[2] );
- if ( !zip.open( IO_ReadWrite ) )
- {
- printf("Could not open %s for read/write\n", argv[2] );
- return 1;
- }
- const KArchiveEntry* e = zip.directory()->entry( argv[3] );
-// Q_ASSERT( e && e->isFile() );
-// const KArchiveFile* f = (KArchiveFile*)e;
-
-// TQCString data( "This is some new data that goes into " );
- // data += argv[3];
- TQFile f ( argv[3] );
- if (!f.open( IO_ReadOnly ))
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
-
- TQDataStream s( &f );
-
-
-// zip.writeFile( argv[3], "", "", data.size(), data.data() );
- zip.writeFile( argv[3], "", "", f.size(), f.readAll() );
- zip.close();
-
- return 0;
-
- }
- else if (command == "transfer" )
- {
- if (argc != 4)
- {
- printf("usage: kziptest transfer sourcefile destfile");
- return 1;
- }
- KZip zip1( argv[2] );
- KZip zip2( argv[3] );
- if ( !zip1.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
- if ( !zip2.open( IO_WriteOnly ) )
- {
- printf("Could not open %s for writing\n", argv[3] );
- return 1;
- }
- const KArchiveDirectory* dir1 = zip1.directory();
-
- recursive_transfer(dir1, "", &zip2 );
-
- zip1.close();
- zip2.close();
-
-/*
- zip.writeFile( "empty", "weis", "users", 0, "" );
- zip.writeFile( "test1", "weis", "users", 5, "Hallo" );
- zip.writeFile( "test2", "weis", "users", 8, "Hallo Du" );
- zip.writeFile( "mydir/test3", "weis", "users", 13, "Noch so einer" );
- zip.writeFile( "my/dir/test3", "dfaure", "hackers", 29, "I don't speak German (David)" );
-
-#define SIZE1 100
- // Now a medium file : 100 null bytes
- char medium[ SIZE1 ];
- memset( medium, 0, SIZE1 );
- zip.writeFile( "mediumfile", "user", "group", SIZE1, medium );
- // Another one, with an absolute path
- zip.writeFile( "/dir/subdir/mediumfile2", "user", "group", SIZE1, medium );
-
- // Now a huge file : 20000 null bytes
- int n = 20000;
- char * huge = new char[ n ];
- memset( huge, 0, n );
- zip.writeFile( "hugefile", "user", "group", n, huge );
- delete [] huge;
-
- zip.close();
-
- printf("-----------------------\n");
-
- if ( !zip.open( IO_ReadOnly ) )
- {
- printf("Could not open %s for reading\n", argv[2] );
- return 1;
- }
-
- const KArchiveDirectory* dir = zip.directory();
- recursive_print(dir, "");
-
- const KArchiveEntry* e = dir->entry( "mydir/test3" );
- Q_ASSERT( e && e->isFile() );
- const KArchiveFile* f = (KArchiveFile*)e;
-
- TQByteArray arr( f->data() );
- printf("SIZE=%i\n",arr.size() );
- TQString str( arr );
- printf("DATA=%s\n", str.latin1());
-
- zip.close();
-
- return 0;
-
-
-
-
-
- const KArchiveEntry* e = dir1->entry( argv[3] );
- Q_ASSERT( e && e->isFile() );
- const KArchiveFile* f = (KArchiveFile*)e;
-
- TQByteArray arr( f->data() );
-// printf("SIZE=%i\n",arr.size() );
- TQString str( arr );
-// printf("DATA=%s\n", str.latin1());
- printf("%s", str.latin1());
- zip.close();
-
-*/
- return 0;
-
- }
- else
- printf("Unknown command\n");
-}
diff --git a/kio/tests/metatest.cpp b/kio/tests/metatest.cpp
deleted file mode 100644
index 034d740ed..000000000
--- a/kio/tests/metatest.cpp
+++ /dev/null
@@ -1,321 +0,0 @@
-#include <kapplication.h>
-#include <kfilemetainfo.h>
-#include <kcmdlineargs.h>
-#include <tqstringlist.h>
-#include <tqimage.h>
-#include <kdebug.h>
-#include <tqlabel.h>
-#include <tqvalidator.h>
-
-#define I18N_NOOP
-
- static KCmdLineOptions options[] =
- {
- { "+file", "File name", 0 },
- { "addgroup ", "Add a group to a file", 0},
- { "removegroup ", "Remove a group from a file", 0},
- { "removeitem ", "Remove the item from --group from a file", 0},
- { "group ", "Specify a group to work on", 0},
- { "validator", "Create a validator for an item and show its class", 0},
- { "item ", "Specify an item to work on", 0},
- { "add ", "Add the --item to the --group and set the value", 0},
- { "autogroupadd", "Automatically add a group if none is found", 0},
- { "set ", "Set the value of --item in --group", 0},
- { "groups", "list the groups of this file", 0 },
- { "mimetypeinfo ", "the mimetype info for a mimetype", 0 },
- KCmdLineLastOption
- };
-
-void printKeyValues(KFileMetaInfo& info)
-{
- TQStringList l = info.preferredKeys();
- kdDebug() << "found " << l.size() << " keys\n";
-
- TQString s;
- TQStringList::Iterator it;
- for (it = l.begin(); it!=l.end(); ++it)
- {
- s +=" - " + *it;
- }
- kdDebug() << "keys: " << s << endl;
-
- for (it = l.begin(); it!=l.end(); ++it)
- {
- KFileMetaInfoItem item = info.item(*it);
- if ( item.isValid() && item.value().canCast(TQVariant::String)) {
- kdDebug() << item.key() << "(" << item.translatedKey() << ") -> "
- << item.string() << endl;
- }
- }
-}
-
-void printMimeTypeInfo(TQString mimetype)
-{
- const KFileMimeTypeInfo* info = KFileMetaInfoProvider::self()->mimeTypeInfo(mimetype);
-
- if (!info) return;
- kdDebug() << "Preferred groups:\n";
- kdDebug() << "=================\n";
- TQStringList groups = info->preferredGroups();
-
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- {
- kdDebug() << *it << endl;
- }
-
- kdDebug() << endl;
- kdDebug() << "Supported groups:\n";
- kdDebug() << "=================\n";
- groups = info->supportedGroups();
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- {
- kdDebug() << *it << endl;
- }
-
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- {
- const KFileMimeTypeInfo::GroupInfo* groupinfo = info->groupInfo(*it);
-
- kdDebug() << endl;
- kdDebug() << "Group \"" << *it << "\"\n";
- kdDebug() << "==================\n";
-
- if (!groupinfo) kdDebug() << "argh! no group info\n";
-
- kdDebug() << endl;
- kdDebug() << " Supported keys:\n";
- TQStringList keys = groupinfo->supportedKeys();
- if (!keys.count()) kdDebug() << " none\n";
- for (TQStringList::Iterator kit=keys.begin(); kit!=keys.end(); ++kit)
- {
- kdDebug() << " " << *kit << endl;
-
- const KFileMimeTypeInfo::ItemInfo* iti = groupinfo->itemInfo(*kit);
- kdDebug() << " Key: " << iti->key() << endl;
- kdDebug() << " Translated: " << iti->key() << endl;
- kdDebug() << " Type: " << TQVariant::typeToName(iti->type()) << endl;
- kdDebug() << " Unit: " << iti->unit() << endl;
- kdDebug() << " Hint: " << iti->hint() << endl;
- kdDebug() << " Attributes: " << iti->attributes() << endl;
- kdDebug() << " Prefix: " << iti->prefix() << endl;
- kdDebug() << " Suffix: " << iti->suffix() << endl;
- }
-
- kdDebug() << " name: " << groupinfo->name() << endl;
- kdDebug() << " translated: " << groupinfo->translatedName() << endl;
- kdDebug() << " attributes: " << groupinfo->attributes() << endl;
- kdDebug() << " variable keys: " << (groupinfo->supportsVariableKeys() ? "Yes" : "No") << endl;
- if (groupinfo->supportsVariableKeys())
- {
- const KFileMimeTypeInfo::ItemInfo* iti = groupinfo->variableItemInfo();
- kdDebug() << " variable key type/attr: " << TQVariant::typeToName(iti->type()) << " / " << iti->attributes() << endl;
- }
- }
-
- kdDebug() << endl;
- kdDebug() << "Preferred keys:\n";
- kdDebug() << "===============\n";
- TQStringList prefKeys = info->preferredKeys();
- if (!prefKeys.count()) kdDebug() << " none\n";
- for (TQStringList::Iterator kit=prefKeys.begin(); kit!=prefKeys.end(); ++kit)
- {
- kdDebug() << *kit << endl;
- }
-
- kdDebug() << endl;
- kdDebug() << "Supported keys:\n";
- kdDebug() << "===============\n";
- TQStringList supKeys = info->supportedKeys();
- if (!supKeys.count()) kdDebug() << " none\n";
- for (TQStringList::Iterator kit=supKeys.begin(); kit!=supKeys.end(); ++kit)
- {
- kdDebug() << *kit << endl;
- }
-}
-
-void addGroup(KFileMetaInfo& info, TQString group)
-{
- kdDebug() << "trying to add group " << group << endl;
-
- kdDebug() << "groups before: \n";
- TQStringList groups = info.groups();
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- kdDebug() << " " << *it << endl;
-
- if (info.addGroup(group))
- kdDebug() << "addGroup succeeded\n";
- else
- kdDebug() << "addGroup failed\n";
-
- kdDebug() << "trying another addGroup to see what happens\n";
-
- if (info.addGroup(group))
- kdDebug() << "addGroup succeeded\n";
- else
- kdDebug() << "addGroup failed\n";
-
-
- kdDebug() << "and afterwards: \n";
- groups = info.groups();
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- kdDebug() << " " << *it << endl;
-}
-
-void removeGroup(KFileMetaInfo& info, TQString group)
-{
- kdDebug() << "trying to remove group " << group << endl;
-
- kdDebug() << "groups before: \n";
- TQStringList groups = info.groups();
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- kdDebug() << " " << *it << endl;
-
- info.removeGroup(group);
-
- kdDebug() << "and afterwards: \n";
- groups = info.groups();
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- kdDebug() << " " << *it << endl;
-}
-
-int main( int argc, char **argv )
-{
- // Initialize command line args
- TDECmdLineArgs::init(argc, argv, "kfilemetatest", "testing kfilmetainfo", "X");
-
- // Tell which options are supported
- TDECmdLineArgs::addCmdLineOptions( options );
-
- // Add options from other components
- TDEApplication::addCmdLineOptions();
-
- TDEApplication app;
-
- TDECmdLineArgs* args = TDECmdLineArgs::parsedArgs();
-
- TQCString ov;
- ov = args->getOption("mimetypeinfo");
- if (ov)
- {
- printMimeTypeInfo(ov);
- return 0;
- }
-
- if (!args->count()) return 1;
-
- KFileMetaInfo info( args->url(0), TQString::null, KFileMetaInfo::Everything);
-
- if (args->isSet("groups"))
- {
- TQStringList groups = info.groups();
- for (TQStringList::Iterator it=groups.begin() ; it!=groups.end(); ++it)
- {
- kdDebug() << "group " << *it << endl;
- }
- return 0;
- }
-
- TQString group, item;
-
- ov = args->getOption("addgroup");
- if (ov) addGroup(info, ov);
-
- ov = args->getOption("removegroup");
- if (ov) removeGroup(info, ov);
-
- ov = args->getOption("group");
- if (ov) group = ov;
-
- ov = args->getOption("item");
- if (ov) item = ov;
-
- ov = args->getOption("add");
- if (ov && !group.isNull() && !item.isNull())
- {
- KFileMetaInfoGroup g = info[group];
- if (!g.isValid() && args->isSet("autogroupadd"))
- {
- kdDebug() << "group is not there, adding it\n";
- info.addGroup(group);
- }
- // add the item
- KFileMetaInfoItem i = info[group].addItem(item);
- if (i.isValid())
- kdDebug() << "additem success\n";
- else
- kdDebug() << "additem failed\n";
-
- if (i.setValue(ov))
- kdDebug() << "setValue success\n";
- else
- kdDebug() << "setValue failed\n";
- }
-
- ov = args->getOption("set");
- if (ov && !group.isNull() && !item.isNull())
- {
- if (info[group][item].setValue(TQString(ov)))
- kdDebug() << "setValue success\n";
- else
- kdDebug() << "setValue failed\n";
- }
-
- ov = args->getOption("removeitem");
- if (ov && !group.isNull())
- {
- if (info[group].removeItem(ov))
- kdDebug() << "removeitem success\n";
- else
- kdDebug() << "removeitem failed\n";
- }
-
- if (args->isSet("validator") && !group.isNull() && !item.isNull())
- {
- const KFileMimeTypeInfo* kfmti = KFileMetaInfoProvider::self()->mimeTypeInfo(info.mimeType());
- TQValidator* v = kfmti->createValidator(group, item);
- if (!v)
- kdDebug() << "got no validator\n";
- else
- {
- kdDebug() << "validator is a " << v->className() << endl;
- delete v;
- }
-
- }
-
- kdDebug() << "is it valid?\n";
-
- if (!info.isValid()) return 1;
-
- kdDebug() << "it is!\n";
-
- printKeyValues(info);
-
-
- kdDebug() << "========= again after applyChanges() =========\n";
-
- info.applyChanges();
-
- printKeyValues(info);
-
- KFileMetaInfoItem thumbitem = info.item(KFileMimeTypeInfo::Thumbnail);
-// KFileMetaInfoItem thumbitem = info.item("Thumbnail");
-
- if (!thumbitem.isValid()) kdDebug() << "no thumbnail\n";
- else
- kdDebug() << "type of thumbnail is " << thumbitem.value().typeName() << endl;
-
-
- if (thumbitem.isValid() && thumbitem.value().canCast(TQVariant::Image))
- {
- TQLabel* label = new TQLabel(0);
- app.setMainWidget(label);
- TQPixmap pix;
- pix.convertFromImage(thumbitem.value().toImage());
- label->setPixmap(pix);
- label->show();
- app.exec();
- }
-
- return 0;
-}
diff --git a/kio/tests/netaccesstest.cpp b/kio/tests/netaccesstest.cpp
deleted file mode 100644
index c83f45aae..000000000
--- a/kio/tests/netaccesstest.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2004 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <kapplication.h>
-#include <kdebug.h>
-#include <kurl.h>
-#include <kio/netaccess.h>
-#include <tqfile.h>
-
-int main(int argc, char **argv)
-{
- TDEApplication app( argc, argv, "netaccesstest", true /* it _has_ a GUI ! */);
-
- KURL srcURL( "ftp://ftp.kde.org/pub/kde/README" );
- KURL tmpURL( "file:/tmp/netaccesstest_README" );
-
- for ( uint i = 0; i < 4 ; ++i ) {
- kdDebug() << "file_copy" << endl;
- if ( !TDEIO::NetAccess::file_copy(srcURL, tmpURL, -1, true, false, 0) )
- kdError() << "file_copy failed: " << TDEIO::NetAccess::lastErrorString() << endl;
- else {
- TQFile f( tmpURL.path() );
- if (!f.open(IO_ReadOnly))
- kdFatal() << "Cannot open: " << f.name() << ". The error was: " << f.errorString() << endl;
- else {
- f.close();
- }
- }
- }
-
- return 0;
-}
-
diff --git a/kio/tests/previewtest.cpp b/kio/tests/previewtest.cpp
deleted file mode 100644
index 62f6c3d62..000000000
--- a/kio/tests/previewtest.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-
-#include <tqlabel.h>
-#include <tqlayout.h>
-#include <tqpushbutton.h>
-
-#include <kapplication.h>
-#include <kdebug.h>
-#include <klineedit.h>
-
-#include <kio/previewjob.h>
-
-#include "previewtest.moc"
-
-PreviewTest::PreviewTest()
- :TQWidget()
-{
- TQGridLayout *layout = new TQGridLayout(this, 2, 2);
- m_url = new KLineEdit(this);
- m_url->setText("/home/malte/gore_bush.jpg");
- layout->addWidget(m_url, 0, 0);
- TQPushButton *btn = new TQPushButton("Generate", this);
- connect(btn, TQT_SIGNAL(clicked()), TQT_SLOT(slotGenerate()));
- layout->addWidget(btn, 0, 1);
- m_preview = new TQLabel(this);
- m_preview->setMinimumSize(400, 300);
- layout->addMultiCellWidget(m_preview, 1, 1, 0, 1);
-}
-
-void PreviewTest::slotGenerate()
-{
- KURL::List urls;
- urls.append(m_url->text());
- TDEIO::PreviewJob *job = TDEIO::filePreview(urls, m_preview->width(), m_preview->height(), true, 48);
- connect(job, TQT_SIGNAL(result(TDEIO::Job*)), TQT_SLOT(slotResult(TDEIO::Job*)));
- connect(job, TQT_SIGNAL(gotPreview(const KFileItem *, const TQPixmap &)), TQT_SLOT(slotPreview(const KFileItem *, const TQPixmap &)));
- connect(job, TQT_SIGNAL(failed(const KFileItem *)), TQT_SLOT(slotFailed()));
-}
-
-void PreviewTest::slotResult(TDEIO::Job*)
-{
- kdDebug() << "PreviewTest::slotResult(...)" << endl;
-}
-
-void PreviewTest::slotPreview(const KFileItem *, const TQPixmap &pix)
-{
- kdDebug() << "PreviewTest::slotPreview()" << endl;
- m_preview->setPixmap(pix);
-}
-
-void PreviewTest::slotFailed()
-{
- kdDebug() << "PreviewTest::slotFailed()" << endl;
- m_preview->setText("failed");
-}
-
-int main(int argc, char **argv)
-{
- TDEApplication app(argc, argv, "previewtest");
- PreviewTest *w = new PreviewTest;
- w->show();
- app.setMainWidget(w);
- return app.exec();
-}
-
diff --git a/kio/tests/previewtest.h b/kio/tests/previewtest.h
deleted file mode 100644
index a749e95a3..000000000
--- a/kio/tests/previewtest.h
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#include <tqwidget.h>
-#include <kio/job.h>
-
-class KLineEdit;
-class TQLabel;
-class KFileItem;
-
-class PreviewTest : public TQWidget
-{
- Q_OBJECT
-public:
- PreviewTest();
-
-private slots:
- void slotGenerate();
- void slotResult(TDEIO::Job *);
- void slotPreview( const KFileItem *, const TQPixmap & );
- void slotFailed();
-
-private:
- KLineEdit *m_url;
- TQLabel *m_preview;
-};
-
diff --git a/kio/tests/speed.cpp b/kio/tests/speed.cpp
deleted file mode 100644
index 44a7d9330..000000000
--- a/kio/tests/speed.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (C) 2002, 2003 Stephan Kulow <coolo@kde.org>
- * Copyright (C) 2003 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-#include <kdebug.h>
-#include <kapplication.h>
-#include <time.h>
-#include "speed.h"
-#include <kio/job.h>
-#include <kcmdlineargs.h>
-#include <tqdir.h>
-#include <kio/global.h>
-
-using namespace TDEIO;
-
-SpeedTest::SpeedTest( const KURL & url )
- : TQObject(0, "speed")
-{
- Job *job = listRecursive( url );
- //Job *job = del( KURL("file:" + TQDir::currentDirPath()) ); DANGEROUS !
- connect(job, TQT_SIGNAL( result( TDEIO::Job*)),
- TQT_SLOT( finished( TDEIO::Job* ) ));
- /*connect(job, TQT_SIGNAL( entries( TDEIO::Job*, const TDEIO::UDSEntryList&)),
- TQT_SLOT( entries( TDEIO::Job*, const TDEIO::UDSEntryList&)));
- */
-}
-
-void SpeedTest::entries(TDEIO::Job*, const UDSEntryList& list) {
-
- UDSEntryListConstIterator it=list.begin();
- for (; it != list.end(); ++it) {
- UDSEntry::ConstIterator it2 = (*it).begin();
- for( ; it2 != (*it).end(); it2++ ) {
- if ((*it2).m_uds == UDS_NAME)
- kdDebug() << ( *it2 ).m_str << endl;
- }
- }
-}
-
-
-void SpeedTest::finished(Job*) {
- kdDebug() << "job finished" << endl;
- kapp->quit();
-}
-
-static KCmdLineOptions options[] =
-{
- { "+[URL]", "the URL to list", 0 },
- KCmdLineLastOption
-};
-
-int main(int argc, char **argv) {
-
- TDECmdLineArgs::init( argc, argv, "speedapp", "A TDEIO::listRecursive testing tool", "0.0" );
-
- TDECmdLineArgs::addCmdLineOptions( options );
-
- TDEApplication app;
-
- TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
-
- KURL url;
- if ( args->count() == 1 )
- url = args->url(0);
- else
- url = "file:" + TQDir::currentDirPath();
-
- kdDebug() << url.url() << " is probably " << (TDEIO::probably_slow_mounted(url.path()) ? "slow" : "normal") << " mounted\n";
- kdDebug() << url.url() << " is " << (TDEIO::manually_mounted(url.path()) ? "manually" : "system") << " mounted\n";
- TQString mp = TDEIO::findDeviceMountPoint(url.path());
- if (mp.isEmpty()) {
- kdDebug() << "no mount point for device " << url.url() << " found\n";
- } else
- kdDebug() << mp << " is the mount point for device " << url.url() << endl;
-
- mp = TDEIO::findPathMountPoint(url.path());
- if (mp.isEmpty()) {
- kdDebug() << "no mount point for path " << url.url() << " found\n";
- } else
- kdDebug() << mp << " is the mount point for path " << url.url() << endl;
- // SpeedTest test( url );
- // app.exec();
-
- mp = TDEIO::findPathMountPoint(url.path());
- if (mp.isEmpty()) {
- kdDebug() << "no mount point for path " << url.url() << " found\n";
- } else
- kdDebug() << mp << " is the mount point for path " << url.url() << endl;
- // SpeedTest test( url );
- // app.exec();
-
- url.setPath(TQDir::homeDirPath());
-
- mp = TDEIO::findPathMountPoint(url.path());
- if (mp.isEmpty()) {
- kdDebug() << "no mount point for path " << url.url() << " found\n";
- } else
- kdDebug() << mp << " is the mount point for path " << url.url() << endl;
- // SpeedTest test( url );
- // app.exec();
-
- mp = TDEIO::findPathMountPoint(url.path());
- if (mp.isEmpty()) {
- kdDebug() << "no mount point for path " << url.url() << " found\n";
- } else
- kdDebug() << mp << " is the mount point for path " << url.url() << endl;
- // SpeedTest test( url );
- // app.exec();
-
- if ( args->count() == 1 )
- url = args->url(0);
- else
- url = "file:" + TQDir::currentDirPath();
-
- mp = TDEIO::findPathMountPoint(url.path());
- if (mp.isEmpty()) {
- kdDebug() << "no mount point for path " << url.url() << " found\n";
- } else
- kdDebug() << mp << " is the mount point for path " << url.url() << endl;
- // SpeedTest test( url );
- // app.exec();
-
-}
-
-#include "speed.moc"
diff --git a/kio/tests/speed.h b/kio/tests/speed.h
deleted file mode 100644
index 5b928a18e..000000000
--- a/kio/tests/speed.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// -*- c++ -*-
-#ifndef _SPEED_H
-#define _SPEED_H
-
-#include <kio/global.h>
-#include <kurl.h>
-
-namespace TDEIO {
- class Job;
-}
-
-class SpeedTest : public TQObject {
- Q_OBJECT
-
-public:
- SpeedTest(const KURL & url);
-
-private slots:
- void entries( TDEIO::Job *, const TDEIO::UDSEntryList& );
- void finished( TDEIO::Job *job );
-
-};
-
-#endif
diff --git a/kio/tests/tdesycocatest.cpp b/kio/tests/tdesycocatest.cpp
deleted file mode 100644
index 45f94ac3c..000000000
--- a/kio/tests/tdesycocatest.cpp
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Copyright (C) 2002, 2003 David Faure <faure@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License version 2 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include <kdebug.h>
-#include <kuserprofile.h>
-#include <ktrader.h>
-#include <kservice.h>
-#include <kmimetype.h>
-#include <assert.h>
-#include <kstandarddirs.h>
-#include <kservicegroup.h>
-#include <kimageio.h>
-#include <kprotocolinfo.h>
-#include <kiconloader.h>
-
-#include <kapplication.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-bool check(TQString txt, TQString a, TQString b)
-{
- if (a.isEmpty())
- a = TQString::null;
- if (b.isEmpty())
- b = TQString::null;
- if (a == b) {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
- }
- else {
- kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl
-;
- exit(1);
- }
- return true;
-}
-
-void debug(TQString txt)
-{
- fprintf(stderr, "%s\n", txt.ascii());
-}
-
-void debug(const char *txt)
-{
- fprintf(stderr, "%s\n", txt);
-}
-void debug(const char *format, const char *txt)
-{
- fprintf(stderr, format, txt);
- fprintf(stderr, "\n");
-}
-
-int main(int argc, char *argv[])
-{
- TDEApplication k(argc,argv,"whatever",false/*noGUI*/); // KMessageBox needs KApp for makeStdCaption
-
- TQCString instname = "kword";
- TQString desktopPath = TQString::fromLatin1( "Office/%1.desktop" ).arg( instname );
- tqDebug( "Looking for %s", desktopPath.latin1() );
- KService::Ptr service = KService::serviceByDesktopPath( desktopPath );
- if ( service )
- tqDebug( "found: %s", service->desktopEntryPath().latin1() );
- else
- tqDebug( "not found" );
-
- tqDebug( "Looking for desktop name = %s", instname.data() );
- service = KService::serviceByDesktopName( instname );
- if ( service )
- tqDebug( "found: %s", service->desktopEntryPath().latin1() );
- else
- tqDebug( "not found" );
-
- debug("Trying to look for text/plain");
- KMimeType::Ptr s1 = KMimeType::mimeType("text/plain");
- if ( s1 )
- {
- debug("Found it !");
- debug(TQString("Comment is %1").arg(s1->comment(KURL(),false)));
- }
- else
- {
- debug("Not found !");
- exit(1);
- }
-
- debug("Trying to look for application/x-zerosize");
- KMimeType::Ptr s0 = KMimeType::mimeType("application/x-zerosize");
- if ( s0 )
- {
- debug("Found it !");
- debug(TQString("Comment is %1").arg(s0->comment(KURL(),false)));
- }
- else
- {
- debug("Not found !");
- exit(1);
- }
-
- debug("Trying to look for Desktop Pager");
- KService::Ptr se = KService::serviceByName("Desktop Pager");
- if ( se )
- {
- debug("Found it !");
- debug(TQString("Comment is %1").arg(se->comment()));
- }
- else
- {
- debug("Not found !");
- }
-
- debug("Trying to look for kpager");
- se = KService::serviceByDesktopName("kpager");
- if ( se )
- {
- debug("Found it !");
- debug(TQString("Comment is %1").arg(se->comment()));
- TQVariant qv = se->property("DocPath");
- debug(TQString("Property type is %1").arg(qv.typeName()));
- debug(TQString("Property value is %1").arg(qv.toString()));
- }
- else
- {
- debug("Not found !");
- }
-
- debug("Trying to look for System/kpager.desktop");
- se = KService::serviceByDesktopPath("System/kpager.desktop");
- if ( se )
- {
- debug("Found it !");
- debug(TQString("Comment is %1").arg(se->comment()));
- }
- else
- {
- debug("Not found !");
- }
-
- debug("Trying to look for System/fake-entry.desktop");
- se = KService::serviceByDesktopPath("System/fake-entry.desktop");
- if ( se )
- {
- debug("Found it !");
- debug(TQString("Comment is %1").arg(se->comment()));
- }
- else
- {
- debug("Not found !");
- }
-
-#if 1
- debug("Querying userprofile for services associated with text/plain");
- KServiceTypeProfile::OfferList offers = KServiceTypeProfile::offers("text/plain");
- debug(TQString("got %1 offers").arg(offers.count()));
- KServiceTypeProfile::OfferList::Iterator it = offers.begin();
- for ( ; it != offers.end() ; it++ )
- {
- debug((*it).service()->name());
- }
-
- debug("Querying userprofile for services associated with KOfficeFilter");
- offers = KServiceTypeProfile::offers("KOfficeFilter");
- debug(TQString("got %1 offers").arg(offers.count()));
- it = offers.begin();
- for ( ; it != offers.end() ; it++ )
- {
- debug((*it).service()->name());
- }
-
- debug("Querying trader for Konqueror/Plugin");
- KTrader::OfferList traderoffers = KTrader::self()->query("Konqueror/Plugin");
- debug(TQString("got %1 offers").arg(traderoffers.count()));
- KTrader::OfferList::Iterator trit = traderoffers.begin();
- for ( ; trit != traderoffers.end() ; trit++ )
- {
- debug((*trit)->name());
- }
-#endif
-
-
- //
- debug("\nTrying findByURL for $TDEDIR/bin/kdesktop");
- KMimeType::Ptr mf = KMimeType::findByURL( KStandardDirs::findExe( "kdesktop" ), 0,
- true, false );
- assert( mf );
- check( "A binary's mimetype", mf->name(), "application/x-executable" );
-
- //
- debug("\nTrying findByURL for folder_home.png");
- TQString fh;
- (void)k.iconLoader()->loadIcon("folder_home.png",KIcon::Desktop,0,KIcon::DefaultState,&fh);
- mf = KMimeType::findByURL( fh, 0, true, false );
- assert( mf );
- check( "A PNG's mimetype", mf->name(), "image/png" );
-
- //
- //debug("\nTrying findByURL for Makefile.am");
- //mf = KMimeType::findByURL( KURL("/tmp/Makefile.am"), 0, true, false );
- //assert( mf );
- //debug(TQString("Name is %1").arg(mf->name()));
- //debug(TQString("Comment is %1").arg(mf->comment(KURL(),false)));
-
- debug("\nTrying findByURL for man:/ls");
- mf = KMimeType::findByURL( KURL("man:/ls") );
- assert( mf );
- check( "man:/ls", mf->name(), "text/html" );
- check( "man:/ls/", mf->name(), "text/html" );
-
- mf = KMimeType::findByURL( KURL("http://foo/bar.png") );
- check( "HTTP URL", mf->name(), "application/octet-stream" ); // HTTP can't know before downloading
-
-#if 1
- KMimeType::List mtl;
-
- mtl = KMimeType::allMimeTypes( );
- assert( mtl.count() );
- debug(TQString("Found %1 mime types.").arg(mtl.count()));
- for(int i = 0; i < (int)mtl.count(); i++)
- {
- debug(TQString("Mime type %1: %2.").arg(i).arg(mtl[i]->name()));
- }
-
- KService::List sl;
-
- sl = KService::allServices( );
- assert( sl.count() );
- debug(TQString("Found %1 services.").arg(sl.count()));
-
- 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;
-
- debug(TQString("Found %1 entries").arg(list.count()));
- for( KServiceGroup::List::ConstIterator it = list.begin();
- it != list.end(); it++)
- {
- KSycocaEntry *p = (*it);
- if (p->isType(KST_KService))
- {
- KService *service = static_cast<KService *>(p);
- debug(service->name());
- debug(service->desktopEntryPath());
- }
- else if (p->isType(KST_KServiceGroup))
- {
- KServiceGroup *serviceGroup = static_cast<KServiceGroup *>(p);
- debug(TQString(" %1 -->").arg(serviceGroup->caption()));
- if (!first) first = serviceGroup;
- }
- else
- {
- debug("KServiceGroup: Unexpected object in list!");
- }
- }
-
- if (first)
- {
- list = first->entries();
- debug(TQString("Found %1 entries").arg(list.count()));
- for( KServiceGroup::List::ConstIterator it = list.begin();
- it != list.end(); it++)
- {
- KSycocaEntry *p = (*it);
- if (p->isType(KST_KService))
- {
- KService *service = static_cast<KService *>(p);
- debug(TQString(" %1").arg(service->name()));
- }
- else if (p->isType(KST_KServiceGroup))
- {
- KServiceGroup *serviceGroup = static_cast<KServiceGroup *>(p);
- debug(TQString(" %1 -->").arg(serviceGroup->caption()));
- }
- else
- {
- debug("KServiceGroup: Unexpected object in list!");
- }
- }
- }
-
- debug("--services that require initialisation--");
- sl = KService::allInitServices();
- for( KService::List::ConstIterator it = sl.begin();
- it != sl.end(); it++)
- {
- KService *service = static_cast<KService *>(*it);
- debug(service->name());
- }
- debug("--End of list--");
-
- debug("--protocols--");
- TQStringList stringL = KProtocolInfo::protocols();
- for( TQStringList::ConstIterator it = stringL.begin();
- it != stringL.end(); it++)
- {
- debug((*it).ascii());
- }
- debug("--End of list--");
-#endif
-
-#if 0
- KImageIO::registerFormats();
-
- TQStringList types;
- types = KImageIO::types(KImageIO::Reading);
- debug("Can read:");
- for(TQStringList::ConstIterator it = types.begin();
- it != types.end(); ++it)
- debug(TQString(" %1").arg((*it)));
-
- types = KImageIO::types(KImageIO::Writing);
- debug("Can write:");
- for(TQStringList::ConstIterator it = types.begin();
- it != types.end(); ++it)
- debug(TQString(" %1").arg((*it)));
-
-
- TQString rPattern = KImageIO::pattern( KImageIO::Reading );
- debug("Read pattern:\n%s", rPattern.ascii());
-
- TQString wPattern = KImageIO::pattern( KImageIO::Writing );
- debug("Write pattern:\n%s", wPattern.ascii());
-
- TQString suffix = KImageIO::suffix("JPEG");
- debug("Standard suffix for JPEG: %s", suffix.ascii());
-
- types = KImageIO::mimeTypes(KImageIO::Reading);
- debug("Can read (mimetypes):");
- for(TQStringList::ConstIterator it = types.begin();
- it != types.end(); ++it)
- debug(" %s", (*it).ascii());
-
- types = KImageIO::mimeTypes(KImageIO::Writing);
- debug("Can write (mimetypes):");
- for(TQStringList::ConstIterator it = types.begin();
- it != types.end(); ++it)
- debug(" %s", (*it).ascii());
-
- debug("done");
-#endif
- return 0;
-}
diff --git a/kio/tests/tdesycocaupdatetest.cpp b/kio/tests/tdesycocaupdatetest.cpp
deleted file mode 100644
index e7778e056..000000000
--- a/kio/tests/tdesycocaupdatetest.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <kservice.h>
-
-#include <kapplication.h>
-
-int main(int argc, char *argv[])
-{
- TDEApplication k(argc,argv,"whatever"); // KMessageBox needs KApp for makeStdCaption
-
- KService::rebuildKSycoca(0);
- return 0;
-}
diff --git a/kio/tests/wronglocalsizes.zip b/kio/tests/wronglocalsizes.zip
deleted file mode 100644
index 3f76738ba..000000000
--- a/kio/tests/wronglocalsizes.zip
+++ /dev/null
Binary files differ