summaryrefslogtreecommitdiffstats
path: root/tdeio/tdefile/tests
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:04:16 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-27 01:04:16 -0600
commit5159cd2beb2e87806a5b54e9991b7895285c9d3e (patch)
tree9b70e8be47a390f8f4d56ead812ab0c9dad88709 /tdeio/tdefile/tests
parentc17cb900dcf52b8bd6dc300d4f103392900ec2b4 (diff)
downloadtdelibs-5159cd2beb2e87806a5b54e9991b7895285c9d3e.tar.gz
tdelibs-5159cd2beb2e87806a5b54e9991b7895285c9d3e.zip
Rename a number of libraries and executables to avoid conflicts with KDE4
Diffstat (limited to 'tdeio/tdefile/tests')
-rw-r--r--tdeio/tdefile/tests/Makefile.am41
-rw-r--r--tdeio/tdefile/tests/kcustommenueditortest.cpp19
-rw-r--r--tdeio/tdefile/tests/kdirselectdialogtest.cpp17
-rw-r--r--tdeio/tdefile/tests/kfdtest.cpp34
-rw-r--r--tdeio/tdefile/tests/kfdtest.h28
-rw-r--r--tdeio/tdefile/tests/kfstest.cpp183
-rw-r--r--tdeio/tdefile/tests/kicondialogtest.cpp19
-rw-r--r--tdeio/tdefile/tests/knotifytest.cpp10
-rw-r--r--tdeio/tdefile/tests/kopenwithtest.cpp67
-rw-r--r--tdeio/tdefile/tests/kurlrequestertest.cpp16
-rw-r--r--tdeio/tdefile/tests/tdefiletreeviewtest.cpp165
-rw-r--r--tdeio/tdefile/tests/tdefiletreeviewtest.h42
12 files changed, 641 insertions, 0 deletions
diff --git a/tdeio/tdefile/tests/Makefile.am b/tdeio/tdefile/tests/Makefile.am
new file mode 100644
index 000000000..d869f11f5
--- /dev/null
+++ b/tdeio/tdefile/tests/Makefile.am
@@ -0,0 +1,41 @@
+# This file is part of the KDE libraries
+# Copyright (C) 1996-1997 Matthias Kalle Dalheimer (kalle@kde.org)
+# (C) 1997-1998 Stephan Kulow (coolo@kde.org)
+
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public License
+# along with this library; see the file COPYING.LIB. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+INCLUDES = $(all_includes)
+
+AM_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS) $(KDE_RPATH)
+
+check_PROGRAMS = kfstest kurlrequestertest tdefiletreeviewtest \
+ kopenwithtest kdirselectdialogtest kicondialogtest \
+ knotifytest kcustommenueditortest
+
+# noinst_HEADERS =
+
+METASOURCES = AUTO
+
+LDADD = $(LIB_KIO)
+kcustommenueditortest_SOURCES = kcustommenueditortest.cpp
+kurlrequestertest_SOURCES = kurlrequestertest.cpp
+kfstest_SOURCES = kfstest.cpp kfdtest.cpp
+tdefiletreeviewtest_SOURCES = tdefiletreeviewtest.cpp
+kopenwithtest_SOURCES = kopenwithtest.cpp
+kdirselectdialogtest_SOURCES = kdirselectdialogtest.cpp
+kicondialogtest_SOURCES = kicondialogtest.cpp
+knotifytest_SOURCES = knotifytest.cpp
+
diff --git a/tdeio/tdefile/tests/kcustommenueditortest.cpp b/tdeio/tdefile/tests/kcustommenueditortest.cpp
new file mode 100644
index 000000000..df2c692f6
--- /dev/null
+++ b/tdeio/tdefile/tests/kcustommenueditortest.cpp
@@ -0,0 +1,19 @@
+#include "kcustommenueditor.h"
+#include <kapplication.h>
+#include <klocale.h>
+#include <tdeconfig.h>
+
+int main(int argc, char** argv)
+{
+ KLocale::setMainCatalogue("tdelibs");
+ TDEApplication app(argc, argv, "KCustomMenuEditorTest");
+ KCustomMenuEditor editor(0);
+ TDEConfig *cfg = new TDEConfig("kdesktop_custom_menu2");
+ editor.load(cfg);
+ if (editor.exec())
+ {
+ editor.save(cfg);
+ cfg->sync();
+ }
+}
+
diff --git a/tdeio/tdefile/tests/kdirselectdialogtest.cpp b/tdeio/tdefile/tests/kdirselectdialogtest.cpp
new file mode 100644
index 000000000..3d15c47d0
--- /dev/null
+++ b/tdeio/tdefile/tests/kdirselectdialogtest.cpp
@@ -0,0 +1,17 @@
+#include <kapplication.h>
+#include <kdirselectdialog.h>
+#include <kmessagebox.h>
+#include <kurl.h>
+
+int main( int argc, char **argv )
+{
+ TDEApplication app(argc, argv, "kdirselectdialogtest");
+
+ KURL u = KDirSelectDialog::selectDirectory( (argc >= 1) ? argv[1] : TQString::null );
+ if ( u.isValid() )
+ KMessageBox::information( 0L,
+ TQString::fromLatin1("You selected the url: %1")
+ .arg( u.prettyURL() ), "Selected URL" );
+
+ return 0;
+}
diff --git a/tdeio/tdefile/tests/kfdtest.cpp b/tdeio/tdefile/tests/kfdtest.cpp
new file mode 100644
index 000000000..60c8b6d70
--- /dev/null
+++ b/tdeio/tdefile/tests/kfdtest.cpp
@@ -0,0 +1,34 @@
+#include "kfdtest.h"
+
+#include <tqstringlist.h>
+#include <tdefiledialog.h>
+#include <kapplication.h>
+#include <kmessagebox.h>
+#include <tqtimer.h>
+
+KFDTest::KFDTest( const TQString& startDir, TQObject *parent, const char *name )
+ : TQObject( parent, name ),
+ m_startDir( startDir )
+{
+ TQTimer::singleShot( 1000, this, TQT_SLOT( doit() ));
+}
+
+void KFDTest::doit()
+{
+ KFileDialog *dlg = new KFileDialog( m_startDir, TQString::null, 0L,
+ "file dialog", true );
+ dlg->setMode( KFile::File);
+ dlg->setOperationMode( KFileDialog::Saving );
+ TQStringList filter;
+ filter << "all/allfiles" << "text/plain";
+ dlg->setMimeFilter( filter, "all/allfiles" );
+
+ if ( dlg->exec() == KDialog::Accepted )
+ {
+ KMessageBox::information(0, TQString::fromLatin1("You selected the file: %1").arg( dlg->selectedURL().prettyURL() ));
+ }
+
+// tqApp->quit();
+}
+
+#include "kfdtest.moc"
diff --git a/tdeio/tdefile/tests/kfdtest.h b/tdeio/tdefile/tests/kfdtest.h
new file mode 100644
index 000000000..6c59550b8
--- /dev/null
+++ b/tdeio/tdefile/tests/kfdtest.h
@@ -0,0 +1,28 @@
+/****************************************************************************
+** $Id$
+**
+** Copyright (C) 2003 Carsten Pfeiffer <pfeiffer@kde.org>
+**
+****************************************************************************/
+
+#ifndef KFDTEST_H
+#define KFDTEST_H
+
+#include <tqobject.h>
+
+class KFDTest : public TQObject
+{
+ Q_OBJECT
+
+public:
+ KFDTest( const TQString& startDir, TQObject *parent = 0, const char *name = 0);
+
+public slots:
+ void doit();
+
+private:
+ TQString m_startDir;
+};
+
+
+#endif // KFDTEST_H
diff --git a/tdeio/tdefile/tests/kfstest.cpp b/tdeio/tdefile/tests/kfstest.cpp
new file mode 100644
index 000000000..f6ee69687
--- /dev/null
+++ b/tdeio/tdefile/tests/kfstest.cpp
@@ -0,0 +1,183 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 1997, 1998 Richard Moore <rich@kde.org>
+ 1998 Stephan Kulow <coolo@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <tqdir.h>
+#include <tqlayout.h>
+#include <tqstringlist.h>
+#include <tqwidget.h>
+
+#include <tdefiledialog.h>
+#include <tdefileiconview.h>
+#include <kmessagebox.h>
+#include <tdeconfig.h>
+#include <kapplication.h>
+#include <kurl.h>
+#include <kurlbar.h>
+#include <kdiroperator.h>
+#include <tdefile.h>
+#include <kdebug.h>
+#include <kicondialog.h>
+
+#include "kfdtest.h"
+
+int main(int argc, char **argv)
+{
+ TDEApplication a(argc, argv, "kfstest");
+ TQString name1;
+ TQStringList names;
+
+ TQString argv1;
+ TQString startDir;
+ if (argc > 1)
+ argv1 = TQString::fromLatin1(argv[1]);
+ if ( argc > 2 )
+ startDir = TQString::fromLatin1( argv[2]);
+
+ if (argv1 == TQString::fromLatin1("diroperator")) {
+ KDirOperator *op = new KDirOperator(startDir, 0, "operator");
+ op->setViewConfig( TDEGlobal::config(), "TestGroup" );
+ op->setView(KFile::Simple);
+ op->show();
+ a.setMainWidget(op);
+ a.exec();
+ }
+
+ else if (argv1 == TQString::fromLatin1("justone")) {
+ TQString name = KFileDialog::getOpenFileName(startDir);
+ tqDebug("filename=%s",name.latin1());
+ }
+
+ else if (argv1 == TQString::fromLatin1("existingURL")) {
+ KURL url = KFileDialog::getExistingURL();
+ tqDebug("URL=%s",url.url().latin1());
+ name1 = url.url();
+ }
+
+ else if (argv1 == TQString::fromLatin1("preview")) {
+ KURL u = KFileDialog::getImageOpenURL();
+ tqDebug("filename=%s", u.url().latin1());
+ }
+
+ else if (argv1 == TQString::fromLatin1("preselect")) {
+ names = KFileDialog::getOpenFileNames(TQString::fromLatin1("/etc/passwd"));
+ TQStringList::Iterator it = names.begin();
+ while ( it != names.end() ) {
+ tqDebug("selected file: %s", (*it).latin1());
+ ++it;
+ }
+ }
+
+ else if (argv1 == TQString::fromLatin1("dirs"))
+ name1 = KFileDialog::getExistingDirectory();
+
+ else if (argv1 == TQString::fromLatin1("heap")) {
+ KFileDialog *dlg = new KFileDialog( startDir, TQString::null, 0L,
+ "file dialog", true );
+ dlg->setMode( KFile::File);
+ dlg->setOperationMode( KFileDialog::Saving );
+ TQStringList filter;
+ filter << "all/allfiles" << "text/plain";
+ dlg->setMimeFilter( filter, "all/allfiles" );
+ KURLBar *urlBar = dlg->speedBar();
+ if ( urlBar )
+ {
+ urlBar->insertDynamicItem( KURL("ftp://ftp.kde.org"),
+ TQString::fromLatin1("KDE FTP Server") );
+ }
+
+ if ( dlg->exec() == KDialog::Accepted )
+ name1 = dlg->selectedURL().url();
+ }
+
+ else if ( argv1 == TQString::fromLatin1("eventloop") )
+ {
+ KFDTest *test = new KFDTest( startDir );
+ return a.exec();
+ }
+
+ else if (argv1 == TQString::fromLatin1("save")) {
+ KURL u = KFileDialog::getSaveURL();
+// TQString(TQDir::homeDirPath() + TQString::fromLatin1("/testfile")),
+// TQString::null, 0L);
+ name1 = u.url();
+ }
+
+ else if (argv1 == TQString::fromLatin1("icon")) {
+ KIconDialog dlg;
+ TQString icon = dlg.selectIcon();
+ kdDebug() << icon << endl;
+ }
+
+// else if ( argv1 == TQString::fromLatin1("dirselect") ) {
+// KURL url;
+// url.setPath( "/" );
+// KURL selected = KDirSelectDialog::selectDirectory( url );
+// name1 = selected.url();
+// tqDebug("*** selected: %s", selected.url().latin1());
+// }
+
+ else {
+ KFileDialog dlg(startDir,
+ TQString::fromLatin1("*|All Files\n"
+ "*.lo *.o *.la|All libtool Files"),
+ 0, 0, true);
+// dlg.setFilter( "*.tdevelop" );
+ dlg.setMode( (KFile::Mode) (KFile::Files |
+ KFile::Directory |
+ KFile::ExistingOnly |
+ KFile::LocalOnly) );
+// TQStringList filter;
+// filter << "text/plain" << "text/html" << "image/png";
+// dlg.setMimeFilter( filter );
+// KMimeType::List types;
+// types.append( KMimeType::mimeType( "text/plain" ) );
+// types.append( KMimeType::mimeType( "text/html" ) );
+// dlg.setFilterMimeType( "Filetypes:", types, types.first() );
+ if ( dlg.exec() == TQDialog::Accepted ) {
+ KURL::List list = dlg.selectedURLs();
+ KURL::List::ConstIterator it = list.begin();
+ tqDebug("*** selectedURLs(): ");
+ while ( it != list.end() ) {
+ name1 = (*it).url();
+ tqDebug(" -> %s", name1.latin1());
+ ++it;
+ }
+ tqDebug("*** selectedFile: %s", dlg.selectedFile().latin1());
+ tqDebug("*** selectedURL: %s", dlg.selectedURL().url().latin1());
+ tqDebug("*** selectedFiles: ");
+ TQStringList l = dlg.selectedFiles();
+ TQStringList::Iterator it2 = l.begin();
+ while ( it2 != l.end() ) {
+ tqDebug(" -> %s", (*it2).latin1());
+ ++it2;
+ }
+ }
+ }
+
+ if (!(name1.isNull()))
+ KMessageBox::information(0, TQString::fromLatin1("You selected the file " ) + name1,
+ TQString::fromLatin1("Your Choice"));
+ return 0;
+}
diff --git a/tdeio/tdefile/tests/kicondialogtest.cpp b/tdeio/tdefile/tests/kicondialogtest.cpp
new file mode 100644
index 000000000..b2c56e159
--- /dev/null
+++ b/tdeio/tdefile/tests/kicondialogtest.cpp
@@ -0,0 +1,19 @@
+#include <kapplication.h>
+#include <kicondialog.h>
+
+int main( int argc, char **argv )
+{
+ TDEApplication app( argc, argv, "kicondialogtest" );
+
+// KIconDialog::getIcon();
+
+ KIconButton button;
+ app.setMainWidget( &button );
+ button.show();
+
+
+ return app.exec();
+}
+
+/* vim: et sw=4
+ */
diff --git a/tdeio/tdefile/tests/knotifytest.cpp b/tdeio/tdefile/tests/knotifytest.cpp
new file mode 100644
index 000000000..0493b59b4
--- /dev/null
+++ b/tdeio/tdefile/tests/knotifytest.cpp
@@ -0,0 +1,10 @@
+#include <kapplication.h>
+#include <knotifydialog.h>
+
+int main( int argc, char **argv )
+{
+ TDEApplication app( argc, argv, "knotifytest" );
+ KNotifyDialog *dlg = new KNotifyDialog();
+ dlg->addApplicationEvents( "twin" );
+ return dlg->exec();
+}
diff --git a/tdeio/tdefile/tests/kopenwithtest.cpp b/tdeio/tdefile/tests/kopenwithtest.cpp
new file mode 100644
index 000000000..f78b1830b
--- /dev/null
+++ b/tdeio/tdefile/tests/kopenwithtest.cpp
@@ -0,0 +1,67 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2002 Dirk Mueller <mueller@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 as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <kapplication.h>
+#include <tqwidget.h>
+#include <tqstringlist.h>
+#include <tqdir.h>
+#include <kopenwith.h>
+#include <kurl.h>
+#include <kdebug.h>
+
+int main(int argc, char **argv)
+{
+ TDEApplication app(argc, argv, "kopenwithtest");
+ KURL::List list;
+
+ list += KURL("file:///tmp/testfile.txt");
+
+ // Test with one URL
+ KOpenWithDlg* dlg = new KOpenWithDlg(list, "OpenWith_Text", "OpenWith_Value", 0);
+ if(dlg->exec()) {
+ kdDebug() << "Dialog ended successfully\ntext: " << dlg->text() << endl;
+ }
+ else
+ kdDebug() << "Dialog was canceled." << endl;
+ delete dlg;
+
+ // Test with two URLs
+ list += KURL("http://www.kde.org/index.html");
+ dlg = new KOpenWithDlg(list, "OpenWith_Text", "OpenWith_Value", 0);
+ if(dlg->exec()) {
+ kdDebug() << "Dialog ended successfully\ntext: " << dlg->text() << endl;
+ }
+ else
+ kdDebug() << "Dialog was canceled." << endl;
+ delete dlg;
+
+ // Test with a mimetype
+ TQString mimetype = "text/plain";
+ dlg = new KOpenWithDlg( mimetype, "kedit", 0);
+ if(dlg->exec()) {
+ kdDebug() << "Dialog ended successfully\ntext: " << dlg->text() << endl;
+ }
+ else
+ kdDebug() << "Dialog was canceled." << endl;
+ delete dlg;
+
+ return 0;
+}
+
diff --git a/tdeio/tdefile/tests/kurlrequestertest.cpp b/tdeio/tdefile/tests/kurlrequestertest.cpp
new file mode 100644
index 000000000..0e4851cfb
--- /dev/null
+++ b/tdeio/tdefile/tests/kurlrequestertest.cpp
@@ -0,0 +1,16 @@
+#include <kapplication.h>
+#include <keditlistbox.h>
+#include <kurlrequester.h>
+#include <kurlrequesterdlg.h>
+
+int main( int argc, char **argv )
+{
+ TDEApplication app( argc, argv, "kurlrequestertest" );
+ KURL url = KURLRequesterDlg::getURL( "ftp://ftp.kde.org" );
+ tqDebug( "Selected url: %s", url.url().latin1());
+
+ KURLRequester *req = new KURLRequester();
+ KEditListBox *el = new KEditListBox( TQString::fromLatin1("Test"), req->customEditor() );
+ el->show();
+ return app.exec();
+}
diff --git a/tdeio/tdefile/tests/tdefiletreeviewtest.cpp b/tdeio/tdefile/tests/tdefiletreeviewtest.cpp
new file mode 100644
index 000000000..b74468fda
--- /dev/null
+++ b/tdeio/tdefile/tests/tdefiletreeviewtest.cpp
@@ -0,0 +1,165 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2001 Klaas Freitag <freitag@suse.de>
+
+ 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 <tqdir.h>
+
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <kmainwindow.h>
+#include <kapplication.h>
+#include <kurl.h>
+#include <kdebug.h>
+#include <kstatusbar.h>
+
+#include <tdefiletreeview.h>
+#include "tdefiletreeviewtest.h"
+
+
+#include "tdefiletreeviewtest.moc"
+
+testFrame::testFrame():KMainWindow(0,"Test FileTreeView"),
+ dirOnlyMode(false)
+
+{
+ treeView = new KFileTreeView( this );
+ treeView->setDragEnabled( true );
+ treeView->setAcceptDrops( true );
+ treeView->setDropVisualizer( true );
+
+
+ /* Connect to see the status bar */
+ KStatusBar* sta = statusBar();
+ connect( treeView, TQT_SIGNAL( onItem( const TQString& )),
+ sta, TQT_SLOT( message( const TQString& )));
+
+ connect( treeView, TQT_SIGNAL( dropped( TQWidget*, TQDropEvent*, KURL::List& )),
+ this, TQT_SLOT( urlsDropped( TQWidget*, TQDropEvent*, KURL::List& )));
+
+ connect( treeView, TQT_SIGNAL( dropped( KURL::List&, KURL& )), this,
+ TQT_SLOT( copyURLs( KURL::List&, KURL& )));
+
+ treeView->addColumn( "File" );
+ treeView->addColumn( "ChildCount" );
+ setCentralWidget( treeView );
+ resize( 600, 400 );
+
+ showPath( KURL::fromPathOrURL( TQDir::homeDirPath() ));
+}
+
+void testFrame::showPath( const KURL &url )
+{
+ TQString fname = "TestBranch"; // url.fileName ();
+ /* try a user icon */
+ KIconLoader *loader = TDEGlobal::iconLoader();
+ TQPixmap pix = loader->loadIcon( "contents2", KIcon::Small );
+ TQPixmap pixOpen = loader->loadIcon( "contents", KIcon::Small );
+
+ KFileTreeBranch *nb = treeView->addBranch( url, fname, pix );
+
+ if( nb )
+ {
+ if( dirOnlyMode ) treeView->setDirOnlyMode( nb, true );
+ nb->setOpenPixmap( pixOpen );
+
+ connect( nb, TQT_SIGNAL(populateFinished(KFileTreeViewItem*)),
+ this, TQT_SLOT(slotPopulateFinished(KFileTreeViewItem*)));
+ connect( nb, TQT_SIGNAL( directoryChildCount( KFileTreeViewItem *, int )),
+ this, TQT_SLOT( slotSetChildCount( KFileTreeViewItem*, int )));
+ // nb->setChildRecurse(false );
+
+ nb->setOpen(true);
+ }
+
+
+}
+
+void testFrame::urlsDropped( TQWidget* , TQDropEvent* , KURL::List& list )
+{
+ KURL::List::ConstIterator it = list.begin();
+ for ( ; it != list.end(); ++it ) {
+ kdDebug() << "Url dropped: " << (*it).prettyURL() << endl;
+ }
+}
+
+void testFrame::copyURLs( KURL::List& list, KURL& to )
+{
+ KURL::List::ConstIterator it = list.begin();
+ kdDebug() << "Copy to " << to.prettyURL() << endl;
+ for ( ; it != list.end(); ++it ) {
+ kdDebug() << "Url: " << (*it).prettyURL() << endl;
+ }
+
+}
+
+
+void testFrame::slotPopulateFinished(KFileTreeViewItem *item )
+{
+ if( item )
+ {
+#if 0
+ int cc = item->childCount();
+
+ kdDebug() << "setting column 2 of treeview with count " << cc << endl;
+
+ item->setText( 1, TQString::number( cc ));
+#endif
+ }
+ else
+ {
+ kdDebug() << "slotPopFinished for uninitalised item" << endl;
+ }
+}
+
+void testFrame::slotSetChildCount( KFileTreeViewItem *item, int c )
+{
+ if( item )
+ item->setText(1, TQString::number( c ));
+}
+
+int main(int argc, char **argv)
+{
+ TDEApplication a(argc, argv, "tdefiletreeviewtest");
+ TQString name1;
+ TQStringList names;
+
+ TQString argv1;
+ testFrame *tf;
+
+ tf = new testFrame();
+ a.setMainWidget( tf );
+
+ if (argc > 1)
+ {
+ for( int i = 1; i < argc; i++ )
+ {
+ argv1 = TQString::fromLatin1(argv[i]);
+ kdDebug() << "Opening " << argv1 << endl;
+ if( argv1 == "-d" )
+ tf->setDirOnly();
+ else
+ {
+ KURL u( argv1 );
+ tf->showPath( u );
+ }
+ }
+ }
+ tf->show();
+ int ret = a.exec();
+ return( ret );
+}
diff --git a/tdeio/tdefile/tests/tdefiletreeviewtest.h b/tdeio/tdefile/tests/tdefiletreeviewtest.h
new file mode 100644
index 000000000..4ae791ce5
--- /dev/null
+++ b/tdeio/tdefile/tests/tdefiletreeviewtest.h
@@ -0,0 +1,42 @@
+/* This file is part of the KDE libraries
+ Copyright (C) 2001 Klaas Freitag <freitag@suse.de>
+
+ 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 KFILETREEVIEWTEST
+#define KFILETREEVIEWTEST
+
+class testFrame: public KMainWindow
+{
+ Q_OBJECT
+public:
+ testFrame();
+ void showPath( const KURL & );
+ void setDirOnly( ) { dirOnlyMode = true; }
+public slots:
+ void slotPopulateFinished(KFileTreeViewItem *);
+ void slotSetChildCount( KFileTreeViewItem *item, int c );
+
+ void urlsDropped( TQWidget*, TQDropEvent*, KURL::List& );
+ void copyURLs( KURL::List& list, KURL& to );
+private:
+ KFileTreeView *treeView;
+ bool dirOnlyMode;
+};
+
+
+#endif