summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/test
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2014-01-08 20:06:00 +0100
committerSlávek Banko <slavek.banko@axis.cz>2014-01-08 20:06:00 +0100
commit636f509299122d02087c6fd62e1e4a46dbd22026 (patch)
tree70e43efceeb5b00e7f19cdac8da44928bd2fb459 /kdejava/koala/test
parent719b61750c08343f530068ed4127623aeac71cf0 (diff)
downloadtdebindings-636f509299122d02087c6fd62e1e4a46dbd22026.tar.gz
tdebindings-636f509299122d02087c6fd62e1e4a46dbd22026.zip
Rename many classes to avoid conflicts with KDE
Diffstat (limited to 'kdejava/koala/test')
-rw-r--r--kdejava/koala/test/dcop/JavaDCOPObject.java45
-rw-r--r--kdejava/koala/test/dcop/README28
-rw-r--r--kdejava/koala/test/dcop/Test.java30
-rw-r--r--kdejava/koala/test/kbase/KBase.java596
-rw-r--r--kdejava/koala/test/kbase/KBaseDoc.java198
-rw-r--r--kdejava/koala/test/kbase/KBaseView.java36
-rw-r--r--kdejava/koala/test/kbase/kbase.desktop10
-rw-r--r--kdejava/koala/test/kbase/kbaseui.rc8
-rw-r--r--kdejava/koala/test/kblend/KBlendTest.java130
-rw-r--r--kdejava/koala/test/kblend/testimage.pngbin38127 -> 0 bytes
-rw-r--r--kdejava/koala/test/kcharselect/KCharSelectTest.java31
-rw-r--r--kdejava/koala/test/kcombobox/KComboBoxTest.java122
-rw-r--r--kdejava/koala/test/kdatepicker/KDatePickTest.java26
-rw-r--r--kdejava/koala/test/khelpers/KHelpers.java103
-rw-r--r--kdejava/koala/test/khelpers/Main.java52
-rw-r--r--kdejava/koala/test/kmenu/KdeMenuSample.java142
-rw-r--r--kdejava/koala/test/kprogress/KProgressTest.java88
-rw-r--r--kdejava/koala/test/ksystemtray/Test.java28
-rw-r--r--kdejava/koala/test/simplebrowser/KSimpleBrowser.java65
-rw-r--r--kdejava/koala/test/simplebrowser/Main.java40
-rw-r--r--kdejava/koala/test/tdefontdialog/TDEFontDialogTest.java164
-rw-r--r--kdejava/koala/test/tdeioslave/KioslaveTest.java589
22 files changed, 0 insertions, 2531 deletions
diff --git a/kdejava/koala/test/dcop/JavaDCOPObject.java b/kdejava/koala/test/dcop/JavaDCOPObject.java
deleted file mode 100644
index babb1056..00000000
--- a/kdejava/koala/test/dcop/JavaDCOPObject.java
+++ /dev/null
@@ -1,45 +0,0 @@
-import org.kde.koala.*;
-import org.kde.qt.*;
-import java.util.*;
-import java.io.*;
-
-public class JavaDCOPObject extends DCOPObject{
- public JavaDCOPObject(){
- super("JavaDCOPObject");
- }
- public ArrayList functions(){
- ArrayList operations = new ArrayList();
- operations.add("TQString myOperation()");
- return operations;
- }
- public ArrayList interfaces(){
- ArrayList list = new ArrayList();
- list.add("JavaDCOPObject");
- return list;
- }
- public DCOPAnswer javaProcess( String fun, byte[] data){
- DCOPAnswer answer = new DCOPAnswer();
- try{
- if("myOperation()".equals(fun)){
- answer.setReplyType("TQString");
- answer.setSucces(true);
-
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- DataOutputStream os = new DataOutputStream(stream);
- Marchaller.write_QString(os, this.myOperation());
- answer.setReplyData(stream.toByteArray());
- return answer;
- } else{
- return answer;
- }
- }catch(IOException ioe){
- ioe.printStackTrace();
- return answer;
- }
- }
-
- public String myOperation(){
- return "test from Java";
- }
-
-}
diff --git a/kdejava/koala/test/dcop/README b/kdejava/koala/test/dcop/README
deleted file mode 100644
index 1fb7fac7..00000000
--- a/kdejava/koala/test/dcop/README
+++ /dev/null
@@ -1,28 +0,0 @@
-This directory contains a test for using a DCOPObject written Java.
-
-The java DCOP object is in JavaDCOPObject.java
-The test app is in Test.java
-
-
-To test it, you should do the following:
-
-set your CLASSPATH (qtjava.jar & koala.jar)
-set your LD_LIBRARY_PATH (${TDEDIR}/lib
-
-compile it (javac *.java)
-$javac *.java
-
-run it
-$java Test
-
-open kdcop and look voor a program called "JavaTest"
-open it and the JavaDCOPObjet appears. The JavaDCOPObject contains one
-operation called myOperation. If you select it and run it, you should see 'test from Java'
-
-You can quit the java program by calling quit() on the application dcop object! (or just hit ctrl-c)
-
-
-Note that the JavaDCOPObject implements javaProcess(), interfaces() and functions().
-These should be generated, but for the timebeing this is done manually.
-
-
diff --git a/kdejava/koala/test/dcop/Test.java b/kdejava/koala/test/dcop/Test.java
deleted file mode 100644
index 3e6a087a..00000000
--- a/kdejava/koala/test/dcop/Test.java
+++ /dev/null
@@ -1,30 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-public class Test{
- static String description = "DCOP test application for Java";
-
-
- /**
- * test the DCOP stuff.
- *
- * This test doesn't simply construct a DCOPClient, because
- * dcop needs the eventloop (app.exec())
- */
- public static void main(String[] argv){
- TDEAboutData aboutData = new TDEAboutData( "test", "Test",
- "0.1", description, TDEAboutData.License_GPL,
- "(C) 2002 Gert-Jan van der Heiden");
- TDECmdLineArgs.init( argv, aboutData );
-
- TDEApplication app = new TDEApplication();
- app.dcopClient().registerAs("JavaTest", false);
- JavaDCOPObject object = new JavaDCOPObject();
- app.exec();
- }
-
- static{
- qtjava.initialize();
- kdejava.initialize();
- }
-}
diff --git a/kdejava/koala/test/kbase/KBase.java b/kdejava/koala/test/kbase/KBase.java
deleted file mode 100644
index 1be572bd..00000000
--- a/kdejava/koala/test/kbase/KBase.java
+++ /dev/null
@@ -1,596 +0,0 @@
-import java.util.*;
-
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/**
- * The base class for JavaApiTest application windows. It sets up the main
- * window and reads the config file as well as providing a menubar, toolbar
- * and statusbar. An instance of KBaseView creates your center view, which is connected
- * to the window's Doc object.
- * KBase reimplements the methods that TDEMainWindow provides for main window handling and supports
- * full session management as well as using TDEActions.
- * @see TDEMainWindow
- * @see TDEApplication
- * @see TDEConfig
- *
- * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
- * @version KDevelop version 1.2 code generation
- */
-public class KBase extends TDEMainWindow
-{
- public static final int ID_STATUS_MSG = 1;
-
- /** the configuration object of the application */
- private TDEConfig config;
- /** view is the main widget which represents your working area. The View
- * class should handle all events of the view widget. It is kept empty so
- * you can create your view according to your application's needs by
- * changing the view class.
- */
- private KBaseView view;
- /** doc represents your actual document and is created only once. It keeps
- * information such as filename and does the serialization of your files.
- */
- private KBaseDoc doc;
-
- // TDEAction references to enable/disable actions
- private TDEAction fileNewWindow;
- private TDEAction fileNew;
- private TDEAction fileOpen;
- private TDERecentFilesAction fileOpenRecent;
- private TDEAction fileSave;
- private TDEAction fileSaveAs;
- private TDEAction fileClose;
- private TDEAction filePrint;
- private TDEAction fileQuit;
- private TDEAction editCut;
- private TDEAction editCopy;
- private TDEAction editPaste;
- private TDEToggleAction viewToolBar;
- private TDEToggleAction viewStatusBar;
-
- /** construtor of KBase, calls all init functions to create the application.
- */
-public KBase(TQWidget parent, String name)
-{
- super(parent, name, 0);
- TDEApplication kapp = TDEApplication.kApplication();
- config=kapp.config();
-
- ///////////////////////////////////////////////////////////////////
- // call inits to invoke all other construction parts
- initStatusBar();
- initActions();
- initDocument();
- initView();
-
- readOptions();
-
- ///////////////////////////////////////////////////////////////////
- // disable actions at startup
- fileSave.setEnabled(false);
- fileSaveAs.setEnabled(false);
- filePrint.setEnabled(false);
- editCut.setEnabled(false);
- editCopy.setEnabled(false);
- }
-
-public KBase()
-{
- this(null, null);
-}
-
- /** initializes the TDEActions of the application */
-protected void initActions()
-{
- fileNewWindow = new TDEAction(tr("New &Window"), "", new TDEShortcut(), this, SLOT("slotFileNewWindow()"), actionCollection(),"file_new_window");
- fileNew = KStdAction.openNew(this, SLOT("slotFileNew()"), actionCollection());
- fileOpen = KStdAction.open(this, SLOT("slotFileOpen()"), actionCollection());
- fileOpenRecent = (TDERecentFilesAction) KStdAction.openRecent(this, SLOT("slotFileOpenRecent(KURL)"), actionCollection());
- fileSave = KStdAction.save(this, SLOT("slotFileSave()"), actionCollection());
- fileSaveAs = KStdAction.saveAs(this, SLOT("slotFileSaveAs()"), actionCollection());
- // this one crashes for me...
-// fileClose = KStdAction.close(this, SLOT(slotFileClose()), actionCollection());
- filePrint = KStdAction.print(this, SLOT("slotFilePrint()"), actionCollection());
- fileQuit = KStdAction.quit(this, SLOT("slotFileQuit()"), actionCollection());
- editCut = KStdAction.cut(this, SLOT("slotEditCut()"), actionCollection());
- editCopy = KStdAction.copy(this, SLOT("slotEditCopy()"), actionCollection());
- editPaste = KStdAction.paste(this, SLOT("slotEditPaste()"), actionCollection());
- createStandardStatusBarAction();
-// viewToolBar = KStdAction.showToolbar(this, SLOT("slotViewToolBar()"), actionCollection());
- viewStatusBar = KStdAction.showStatusbar(this, SLOT("slotViewStatusBar()"), actionCollection());
-
- fileNewWindow.setToolTip(tr("Opens a new application window"));
- fileNew.setToolTip(tr("Creates a new document"));
- fileOpen.setToolTip(tr("Opens an existing document"));
- fileOpenRecent.setToolTip(tr("Opens a recently used file"));
- fileSave.setToolTip(tr("Saves the actual document"));
- fileSaveAs.setToolTip(tr("Saves the actual document as..."));
-// fileClose.setToolTip(tr("Closes the actual document"));
- filePrint .setToolTip(tr("Prints out the actual document"));
- fileQuit.setToolTip(tr("Quits the application"));
- editCut.setToolTip(tr("Cuts the selected section and puts it to the clipboard"));
- editCopy.setToolTip(tr("Copies the selected section to the clipboard"));
- editPaste.setToolTip(tr("Pastes the clipboard contents to actual position"));
-// viewToolBar.setToolTip(tr("Enables/disables the toolbar"));
- viewStatusBar.setToolTip(tr("Enables/disables the statusbar"));
-
- // use the absolute path to your kbaseui.rc file for testing purpose in createGUI();
- createGUI();
-
-}
-
-
-
- /** sets up the kstatusBar for the main window by initialzing a statuslabel.
- */
-protected void initStatusBar()
-{
- ///////////////////////////////////////////////////////////////////
- // STATUSBAR
- // TODO: add your own items you need for displaying current application status.
- kstatusBar().insertItem(tr("Ready."), ID_STATUS_MSG);
-}
-
- /** initializes the document object of the main window that is connected to the view in initView().
- * @see initView();
- */
-public void initDocument()
-{
- doc = new KBaseDoc(this, null);
- doc.newDocument();
-}
-
- /** creates the centerwidget of the KTMainWindow instance and sets it as the view
- */
-protected void initView()
-{
- ////////////////////////////////////////////////////////////////////
- // create the main widget here that is managed by KTMainWindow's view-region and
- // connect the widget to your document to display document contents.
-
- view = new KBaseView(this, null);
- doc.addView(view);
- setCentralWidget(view);
- setCaption(doc.URL().fileName(),false);
-
-}
-
- /** opens a file specified by commandline option
- */
-public void openDocumentFile(KURL url)
-{
- slotStatusMsg(tr("Opening file..."));
-
-// doc.openDocument( url);
- fileOpenRecent.addURL( url );
- slotStatusMsg(tr("Ready."));
-}
-
-public void openDocumentFile()
-{
- openDocumentFile(new KURL(""));
- return;
-}
-
-
- /** returns a pointer to the current document connected to the KTMainWindow instance and is used by
- * the View class to access the document object's methods
- */
-public KBaseDoc getDocument()
-{
- return doc;
-}
-
- /** save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration
- * file
- */
-protected void saveOptions()
-{
- config.setGroup("General Options");
- config.writeEntry("Geometry", size());
-// config.writeEntry("Show Toolbar", viewToolBar.isChecked());
- config.writeEntry("Show Statusbar",viewStatusBar.isChecked());
-// config.writeEntry("ToolBarPos", (int) toolBar("mainToolBar").barPos());
- fileOpenRecent.saveEntries(config,"Recent Files");
-}
-
-
- /** read general Options again and initialize all variables like the recent file list
- */
-protected void readOptions()
-{
-
- config.setGroup("General Options");
-
- // bar status settings
-// boolean bViewToolbar = config.readBoolEntry("Show Toolbar", true);
-// viewToolBar.setChecked(bViewToolbar);
-// slotViewToolBar();
-
- boolean bViewStatusbar = config.readBoolEntry("Show Statusbar", true);
- viewStatusBar.setChecked(bViewStatusbar);
- slotViewStatusBar();
-
-
- // bar position settings
-// int toolBarPos;
- //Pos=(int) config.readNumEntry("ToolBarPos", TDEToolBar.Top);
-// toolBar("mainToolBar").setBarPos(toolBarPos);
-
- // initialize the recent file list
- fileOpenRecent.loadEntries(config,"Recent Files");
-
- TQSize size=config.readSizeEntry("Geometry", null);
- if(!size.isEmpty())
- {
- resize(size);
- }
-}
-
- /** saves the window properties for each open window during session end to the session config file, including saving the currently
- * opened file by a temporary filename provided by TDEApplication.
- * @see KTMainWindow#saveProperties
- */
-protected void saveProperties(TDEConfig _cfg)
-{
- if(doc.URL().fileName()!=tr("Untitled") && !doc.isModified())
- {
- // saving to tempfile not necessary
-
- }
- else
- {
- KURL url=doc.URL();
- _cfg.writeEntry("filename", url.url());
- _cfg.writeEntry("modified", doc.isModified());
- String tempname = TDEApplication.kApplication().tempSaveName(url.url());
- String tempurl= KURL.encode_string(tempname, 0);
- KURL _url = new KURL(tempurl);
- doc.saveDocument(_url);
- }
-}
-
-
- /** reads the session config file and restores the application's state including the last opened files and documents by reading the
- * temporary files saved by saveProperties()
- * @see KTMainWindow#readProperties
- */
-protected void readProperties(TDEConfig _cfg)
-{
- String filename = _cfg.readEntry("filename", "");
- KURL url = new KURL(filename);
- boolean modified = _cfg.readBoolEntry("modified", false);
- if(modified)
- {
- boolean canRecover = false;
- String tempname = TDEApplication.kApplication().checkRecoverFile(filename, canRecover);
- KURL _url = new KURL(tempname);
-
- if(canRecover)
- {
- doc.openDocument(_url);
- doc.setModified();
- setCaption(_url.fileName(),true);
- TQFile.remove(tempname);
- }
- }
- else
- {
- if(filename.length() > 0)
- {
- doc.openDocument(url);
- setCaption(url.fileName(),false);
- }
- }
-}
-
- /** queryClose is called by KTMainWindow on each closeEvent of a window. Against the
- * default implementation (only returns true), this calles saveModified() on the document object to ask if the document shall
- * be saved if Modified; on cancel the closeEvent is rejected.
- * @see KTMainWindow#queryClose
- * @see KTMainWindow#closeEvent
- */
-protected boolean queryClose()
-{
- return doc.saveModified();
-}
-
- /** queryExit is called by KTMainWindow when the last window of the application is going to be closed during the closeEvent().
- * Against the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's
- * properties.
- * @see KTMainWindow#queryExit
- * @see KTMainWindow#closeEvent
- */
-protected boolean queryExit()
-{
- saveOptions();
- return true;
-}
-
-/////////////////////////////////////////////////////////////////////
-// SLOT IMPLEMENTATION
-/////////////////////////////////////////////////////////////////////
-
- /** open a new application window by creating a new instance of KBase */
-public void slotFileNewWindow()
-{
- slotStatusMsg(tr("Opening a new application window..."));
-
- KBase new_window= new KBase();
- new_window.show();
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** clears the document in the actual view to reuse it as the new document */
-public void slotFileNew()
-{
- slotStatusMsg(tr("Creating new document..."));
-
- if(!doc.saveModified())
- {
- // here saving wasn't successful
-
- }
- else
- {
- doc.newDocument();
- setCaption(doc.URL().fileName(), false);
- }
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** open a file and load it into the document*/
-public void slotFileOpen()
-{
-System.out.println("ENTER slotFileOpen()");
- slotStatusMsg(tr("Opening file..."));
-
- if(!doc.saveModified())
- {
- // here saving wasn't successful
-
- }
- else
- {
- KURL url=KFileDialog.getOpenURL("",
- tr("*|All files"), this, tr("Open File..."));
- if(!url.isEmpty())
- {
- doc.openDocument(url);
- setCaption(url.fileName(), false);
- fileOpenRecent.addURL( url );
- }
- }
- slotStatusMsg(tr("Ready."));
-}
-
- /** opens a file from the recent files menu */
-public void slotFileOpenRecent(KURL url)
-{
- slotStatusMsg(tr("Opening file..."));
-
- if(!doc.saveModified())
- {
- // here saving wasn't successful
- }
- else
- {
- doc.openDocument(url);
- setCaption(url.fileName(), false);
- }
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** save a document */
-public void slotFileSave()
-{
- slotStatusMsg(tr("Saving file..."));
-
- doc.saveDocument(doc.URL());
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** save a document by a new filename*/
-public void slotFileSaveAs()
-{
- slotStatusMsg(tr("Saving file with a new filename..."));
-
- KURL url=KFileDialog.getSaveURL(TQDir.currentDirPath(),
- tr("*|All files"), this, tr("Save as..."));
- if(!url.isEmpty())
- {
- doc.saveDocument(url);
- fileOpenRecent.addURL(url);
- setCaption(url.fileName(),doc.isModified());
- }
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** asks for saving if the file is modified, then closes the actual file and window*/
-public void slotFileClose()
-{
- slotStatusMsg(tr("Closing file..."));
-
- close();
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** print the actual file */
-public void slotFilePrint()
-{
- slotStatusMsg(tr("Printing..."));
-
- TQPrinter printer = new TQPrinter();
- if (printer.setup(this))
- {
- view.print(printer);
- }
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** closes all open windows by calling close() on each memberList item until the list is empty, then quits the application.
- * If queryClose() returns false because the user canceled the saveModified() dialog, the closing breaks.
- */
-public void slotFileQuit()
-{
- slotStatusMsg(tr("Exiting..."));
- saveOptions();
- // close the first window, the list makes the next one the first again.
- // This ensures that queryClose() is called on each window to ask for closing
- TDEMainWindow w;
- Iterator it = memberList().iterator();
- while(it.hasNext())
- {
- w=(TDEMainWindow)it.next();
- // only close the window if the closeEvent is accepted. If the user presses Cancel on the saveModified() dialog,
- // the window and the application stay open.
- if(!w.close())
- break;
- }
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** put the marked text/object into the clipboard and remove
- * it from the document
- */
-public void slotEditCut()
-{
- slotStatusMsg(tr("Cutting selection..."));
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** put the marked text/object into the clipboard
- */
-public void slotEditCopy()
-{
- slotStatusMsg(tr("Copying selection to clipboard..."));
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** paste the clipboard into the document
- */
-public void slotEditPaste()
-{
- slotStatusMsg(tr("Inserting clipboard contents..."));
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** toggles the toolbar
- */
-public void slotViewToolBar()
-{
- slotStatusMsg(tr("Toggling toolbar..."));
- ///////////////////////////////////////////////////////////////////
- // turn Toolbar on or off
-// if(!viewToolBar.isChecked())
-// {
-// toolBar("mainToolBar").hide();
-// }
-// else
-// {
-// toolBar("mainToolBar").show();
-// }
-
- slotStatusMsg(tr("Ready."));
-}
-
- /** toggles the statusbar
- */
-public void slotViewStatusBar()
-{
- slotStatusMsg(tr("Toggle the statusbar..."));
- ///////////////////////////////////////////////////////////////////
- //turn Statusbar on or off
- if(!viewStatusBar.isChecked())
- {
- kstatusBar().hide();
- }
- else
- {
- kstatusBar().show();
- }
-
- slotStatusMsg(tr("Ready."));
-}
-
-
- /** changes the statusbar contents for the standard label permanently, used to indicate current actions.
- * @param text the text that is displayed in the statusbar
- */
-public void slotStatusMsg(String text)
-{
- ///////////////////////////////////////////////////////////////////
- // change status message permanently
- kstatusBar().clear();
- kstatusBar().changeItem(text, ID_STATUS_MSG);
-}
-
-static String description =
- "JavaApiTest";
-// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
-
-
-static String[][] options =
-{
- { "+[File]", "file to open", null }
- // INSERT YOUR COMMANDLINE OPTIONS HERE
-};
-
-static String VERSION = "0.1";
-
-public static void main(String[] cmdLineArgs)
-{
-
- TDEAboutData aboutData = new TDEAboutData( "kbase", "JavaApiTest",
- VERSION, description, TDEAboutData.License_GPL,
- "(c) 2001, Richard Dale");
- aboutData.addAuthor("Richard Dale",null, "Lost_Highway@tipitina.demon.co.uk");
- TDECmdLineArgs.init( cmdLineArgs, aboutData );
- TDECmdLineArgs.addCmdLineOptions( options ); // Add our own options.
-
- TDEApplication app = new TDEApplication();
-
- if (app.isRestored())
- {
- RESTORE("KBase");
- }
- else
- {
- KBase kbase = new KBase();
- kbase.show();
- TDECmdLineArgs args = TDECmdLineArgs.parsedArgs();
-
- if (args.count() > 0)
- {
- kbase.openDocumentFile(new KURL(args.arg(0)));
- }
- else
- {
- kbase.openDocumentFile();
- }
- args.clear();
- }
-
- app.exec();
- return;
-}
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/kbase/KBaseDoc.java b/kdejava/koala/test/kbase/KBaseDoc.java
deleted file mode 100644
index 8c42c40d..00000000
--- a/kdejava/koala/test/kbase/KBaseDoc.java
+++ /dev/null
@@ -1,198 +0,0 @@
-import java.util.*;
-
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/** KBaseDoc provides a document object for a document-view model.
- *
- * The KBaseDoc class provides a document object that can be used in conjunction with the classes JavaApiTestApp and KBaseView
- * to create a document-view model for standard KDE applications based on TDEApplication and TDEMainWindow. Thereby, the document object
- * is created by the JavaApiTestApp instance and contains the document structure with the according methods for manipulation of the document
- * data by KBaseView objects. Also, KBaseDoc contains the methods for serialization of the document data from and to files.
- *
- * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
- * @version KDevelop version 1.2 code generation
- */
-public class KBaseDoc extends TQObject {
-
- /** the list of the views currently connected to the document */
- public ArrayList pViewList;
-
- /** the modified flag of the current document */
- private boolean modified;
- private KURL doc_url;
-
- /** Constructor for the fileclass of the application */
-public KBaseDoc(TQWidget parent, String name)
-{
- super(parent, name);
- setURL(new KURL());
-
- if(pViewList == null)
- {
- pViewList = new ArrayList();
- }
-
-// pViewList.setAutoDelete(true);
-}
-
- /** adds a view to the document which represents the document contents. Usually this is your main view. */
-public void addView(KBaseView view)
-{
- pViewList.add(view);
-}
-
- /** removes a view from the list of currently connected views */
-public void removeView(KBaseView view)
-{
- pViewList.remove(view);
-}
-
- /** sets the modified flag for the document after a modifying action on the view connected to the document.*/
-public void setModified(boolean _m){ modified=_m; }
-public void setModified(){ modified=true; }
-
- /** returns if the document is modified or not. Use this to determine if your document needs saving by the user on closing.*/
-public boolean isModified(){ return modified; }
-
- /** sets the URL of the document */
-public void setURL(KURL url)
-{
- doc_url=url;
-}
-
- /** returns the KURL of the document */
-public KURL URL()
-{
- return doc_url;
-}
-
- /** calls repaint() on all views connected to the document object and is called by the view by which the document has been changed.
- * As this view normally repaints itself, it is excluded from the paintEvent.
- */
-public void slotUpdateAllViews(KBaseView sender)
-{
- KBaseView w;
- if(pViewList != null)
- {
- Iterator it = pViewList.iterator();
- while(it.hasNext())
- {
- w=(KBaseView)it.next();
- if(w!=sender)
- w.repaint();
- }
- }
-
-}
-
- /** "save modified" - asks the user for saving if the document is modified */
-public boolean saveModified()
-{
- boolean completed=true;
-
- if(modified)
- {
- KBase win=(KBase ) parent();
- int want_save = KMessageBox.warningYesNoCancel(win, tr("Warning"),
- tr("The current file has been modified.\n"
- + "Do you want to save it?"));
- switch(want_save)
- {
- case 1:
- if (doc_url.fileName() == tr("Untitled"))
- {
- win.slotFileSaveAs();
- }
- else
- {
- saveDocument(URL());
- };
-
- deleteContents();
- completed=true;
- break;
-
- case 2:
- setModified(false);
- deleteContents();
- completed=true;
- break;
-
- case 3:
- completed=false;
- break;
-
- default:
- completed=false;
- break;
- }
- }
-
- return completed;
-}
-
- /** closes the acutal document */
-public void closeDocument()
-{
- deleteContents();
-}
-
- /** initializes the document generally */
-public boolean newDocument()
-{
- /////////////////////////////////////////////////
- // TODO: Add your document initialization code here
- /////////////////////////////////////////////////
- modified=false;
- doc_url.setFileName(tr("Untitled"));
-
- return true;
-}
-
- /** loads the document by filename and format and emits the updateViews() signal */
-public boolean openDocument(KURL url, String format)
-{
- StringBuffer tmpfile = new StringBuffer("");
- NetAccess.download( url, tmpfile, null );
- /////////////////////////////////////////////////
- // TODO: Add your document opening code here
- /////////////////////////////////////////////////
-
- NetAccess.removeTempFile( tmpfile.toString() );
-
- modified=false;
- return true;
-}
-
-public boolean openDocument(KURL url)
-{
- return openDocument(url, null);
-}
-
- /** saves the document under filename and format.*/
-public boolean saveDocument(KURL url, String format)
-{
- /////////////////////////////////////////////////
- // TODO: Add your document saving code here
- /////////////////////////////////////////////////
-
- modified=false;
- return true;
-}
-
-public boolean saveDocument(KURL url)
-{
- return saveDocument(url, null);
-}
-
- /** deletes the document's contents */
-public void deleteContents()
-{
- /////////////////////////////////////////////////
- // TODO: Add implementation to delete the document contents
- /////////////////////////////////////////////////
-
-}
-
-}
diff --git a/kdejava/koala/test/kbase/KBaseView.java b/kdejava/koala/test/kbase/KBaseView.java
deleted file mode 100644
index 59554607..00000000
--- a/kdejava/koala/test/kbase/KBaseView.java
+++ /dev/null
@@ -1,36 +0,0 @@
-import org.kde.qt.*;
-
-/** The KBaseView class provides the view widget for the KBase instance.
- * The View instance inherits TQWidget as a base class and represents the view object of a KTMainWindow. As KBaseView is part of the
- * docuement-view model, it needs a reference to the document object connected with it by the KBase class to manipulate and display
- * the document structure provided by the KBaseDoc class.
- *
- * @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
- * @version KDevelop version 0.4 code generation
- */
-public class KBaseView extends TQWidget {
-
-public KBaseView(TQWidget parent, String name)
-{
- super(parent, name);
- setBackgroundMode(PaletteBase);
-}
-
-public KBaseDoc getDocument()
-{
- KBase theApp=(KBase) parentWidget();
-
- return theApp.getDocument();
-}
-
-public void print(TQPrinter pPrinter)
-{
- TQPainter printpainter = new TQPainter();
- printpainter.begin(pPrinter);
-
- // TODO: add your printing code here
-
- printpainter.end();
-}
-
-}
diff --git a/kdejava/koala/test/kbase/kbase.desktop b/kdejava/koala/test/kbase/kbase.desktop
deleted file mode 100644
index 4d079aec..00000000
--- a/kdejava/koala/test/kbase/kbase.desktop
+++ /dev/null
@@ -1,10 +0,0 @@
-[Desktop Entry]
-Type=Application
-Exec=java -cp ".:/home/duke/src/qt-2.2.1java/javalib:.." KBase KBase -caption "%c" %i %m
-Icon=kbase.xpm
-DocPath=kbase/index.html
-Comment=
-Comment[de]=
-Terminal=false
-Name=KBase
-Name[de]=KBase
diff --git a/kdejava/koala/test/kbase/kbaseui.rc b/kdejava/koala/test/kbase/kbaseui.rc
deleted file mode 100644
index 03958feb..00000000
--- a/kdejava/koala/test/kbase/kbaseui.rc
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE kpartgui>
-<kpartgui name="kbase" version="0.1">
-<MenuBar>
- <Menu name="file"><text>&amp;File</text>
- <Action name="file_new_window"/>
- </Menu>
-</MenuBar>
-</kpartgui>
diff --git a/kdejava/koala/test/kblend/KBlendTest.java b/kdejava/koala/test/kblend/KBlendTest.java
deleted file mode 100644
index 1395f379..00000000
--- a/kdejava/koala/test/kblend/KBlendTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-//
-// Simple little hack to show off blending effects.
-//
-// (C) KDE Artistic Cristian Tibirna <tibirna@kde.org>
-//
-
-/**
- * Class to test KImageEffect blending effects.
- *
- * This is a translation to java from kblendtest.cpp in the tests library
- * of tdeui source.
- *
- * @see TDEApplication
- * @see KImageEffect
- *
- * @author Cristian Tibirna <tibirna@kde.org>, java translation Kenneth J. Pouncey, kjpou@hotmail.com
- * @version 0.1
- */
-
-public class KBlendTest {
-
- public static void main(String[] args) {
- TDECmdLineArgs.init(args, "kblendtest", "KBlendTest", "It blends!", "0.1");
- TDEApplication app = new TDEApplication();
- KBlendWidget w = new KBlendWidget(null,"KBlendTest");
- w.setCaption(app.name());
- app.setMainWidget(w);
- w.show();
- app.exec();
- return;
- }
-
-
- public static class KBlendWidget extends TQWidget {
-
- TQImage image;
- TQColor bgnd;
-
- String testImage = "testimage.png";
-
- public KBlendWidget (TQWidget parent, String name) {
-
- // change the colors to see the effects.
-// bgnd = new TQColor(TQColor.qRgb(255, 255, 255));
- bgnd = Qt.blue();
-// bgnd = Qt.red();
-
- image = new TQImage(testImage);
-
- resize(image.width()*2+60, image.height()*3+80);
- setBackgroundColor(bgnd);
- }
-
- protected void paintEvent(TQPaintEvent pe ) {
-
- long it, ft;
- String say = "";
-
- image = new TQImage(testImage);
-
- TQPainter p = new TQPainter(this);
-
- p.setPen(Qt.black());
-
- // you see here use of anti_dir param (blend from down to up, here)
- it = System.currentTimeMillis();
- KImageEffect.blend(image, 0.2f, bgnd, KImageEffect.VerticalGradient,true);
- ft = System.currentTimeMillis();
- say = (ft - it) + " ms, Vertical";
- p.drawImage(20, 20, image);
- p.drawText(5 , 15, say);
-
- image = new TQImage(testImage);
-
- // here a negative initial intensity is used (1/2 of image is unaffected)
- it = System.currentTimeMillis();
- KImageEffect.blend(image, -0.5f, bgnd, KImageEffect.HorizontalGradient);
- ft = System.currentTimeMillis();
- say = (ft - it) + " ms, Horizontal";
- p.drawImage(40+image.width(), 20, image);
- p.drawText(15+image.width() , 15, say);
-
- image = new TQImage(testImage);
-
- it = System.currentTimeMillis();
- KImageEffect.blend(image, 0.0f, bgnd, KImageEffect.DiagonalGradient,true);
- ft = System.currentTimeMillis();
- say = (ft - it) + " ms, Diagonal";
- p.drawImage(20, 40+image.height(), image);
- p.drawText(5 , 35+image.height(), say);
-
- image = new TQImage(testImage);
-
- it = System.currentTimeMillis();
- KImageEffect.blend(image, 0.1f, bgnd, KImageEffect.CrossDiagonalGradient);
- ft = System.currentTimeMillis();
- say = (ft - it) + " ms, CrossDiagonal";
- p.drawImage(40+image.width(), 40+image.height(), image);
- p.drawText(25+image.width() , 35 + image.height(), say);
-
- image = new TQImage(testImage);
-
- it = System.currentTimeMillis();
- KImageEffect.blend(image, -0.6f, bgnd, KImageEffect.RectangleGradient);
- ft = System.currentTimeMillis();
- say = (ft - it) + " ms, Rectangle";
- p.drawImage(20, 60+2*image.height(), image);
- p.drawText(5 , 55+2*image.height(), say);
-
- image = new TQImage(testImage);
-
- it = System.currentTimeMillis();
- KImageEffect.blend(image, 0.2f, bgnd, KImageEffect.EllipticGradient);
- ft = System.currentTimeMillis();
- say = (ft - it) + " ms, Elliptic";
- p.drawImage(40+image.width(), 60+2*image.height(), image);
- p.drawText(25+image.width(), 55+2*image.height(), say);
- p.end();
- }
- }
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/kblend/testimage.png b/kdejava/koala/test/kblend/testimage.png
deleted file mode 100644
index c6f06474..00000000
--- a/kdejava/koala/test/kblend/testimage.png
+++ /dev/null
Binary files differ
diff --git a/kdejava/koala/test/kcharselect/KCharSelectTest.java b/kdejava/koala/test/kcharselect/KCharSelectTest.java
deleted file mode 100644
index 03c6f66a..00000000
--- a/kdejava/koala/test/kcharselect/KCharSelectTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/**
- *
- * Taken from test program of the tdeui tests
- **/
-public class KCharSelectTest {
-
-
- public static void main (String[] args) {
-
- TDECmdLineArgs.init(args, "kcharselecttest", "KCharSelectTest",
- "A KCharSelect test app", "0.1");
- TDEApplication app = new TDEApplication();
- KCharSelect selector = new KCharSelect(null,"char selector");
- selector.resize( selector.sizeHint() );
- app.setMainWidget(selector);
- selector.show();
- selector.setCaption( "KCharSelect Test");
- app.exec();
- return;
-
- }
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/kcombobox/KComboBoxTest.java b/kdejava/koala/test/kcombobox/KComboBoxTest.java
deleted file mode 100644
index 8cb8ab09..00000000
--- a/kdejava/koala/test/kcombobox/KComboBoxTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-import java.util.*;
-
- import org.kde.qt.*;
- import org.kde.koala.*;
-
- /**
- * Class to text KComboBox widgets.
- *
- * This is a translation to java from kcomboboxtest.cpp in the tests library
- * of tdeui source.
- *
- * Combo boxes tested
- * - Editable ComboBox
- * - Select Only ComboBox
- * @see KComboBox
- * @see TDEApplication
- * @see TDEConfig
- *
- * @author original author unknown, java translation Kenneth J. Pouncey,
- kjpou@hotmail.com
- * @version 0.1
- */
- public class KComboBoxTest {
-
- static String description = "Java KComboBox test program.";
- static String[][] options = { };
- static String VERSION = "0.1";
-
- public static void main(String[] cmdLineArgs) {
-
- TDEAboutData aboutData = new TDEAboutData( "kcomboboxtest", "KComboBoxTest",
- VERSION, description, TDEAboutData.License_GPL,
- "(c) 2002, Kenneth J. Pouncey");
- aboutData.addAuthor("Kenneth J. Pouncey",null, "kjpou@hotmail.com");
- TDECmdLineArgs.init( cmdLineArgs, aboutData );
- TDECmdLineArgs.addCmdLineOptions( options ); // Add our own options.
-
- TDEApplication app = new TDEApplication();
-
- // parse the args
- TDECmdLineArgs args = TDECmdLineArgs.parsedArgs();
-
- // Make a central widget to contain the other widgets
- TQWidget w = new TQWidget();
- // Insert the widget container (parent widget) into
- // a layout manager (VERTICAL).
- TQVBoxLayout vbox = new TQVBoxLayout( w, KDialog.marginHint(),
- KDialog.spacingHint() );
- // Resize the widget
- w.resize( 500, 100 );
-
- String[] list = {"Stone" , "Tree" , "Pebbles" , "Ocean" , "Sand" , "Chips"
- , "Computer" , "Mankind"};
-
- // Create and modify read-write widget
- KComboBox rwc = new KComboBox( true, w, "rwcombobox" );
- TQLabel lblrw = new TQLabel( rwc, "&Editable ComboBox", w, "rwcombolabel",0
- );
- rwc.setDuplicatesEnabled( true );
- rwc.completionObject().setItems( list );
- rwc.setInsertionPolicy( TQComboBox.NoInsertion );
- rwc.insertStringList( list );
- rwc.setEditText( "KDE Java Bindings" );
-
- // Create a read-write combobox and reproduce konqueror's code
- KComboBox konqc = new KComboBox( true, w, "konqc" );
- konqc.setMaxCount( 10 );
- KSimpleConfig historyConfig = new KSimpleConfig("konq_history");
- historyConfig.setGroup( "Location Bar" );
- TDECompletion s_pCompletion = new TDECompletion();
- s_pCompletion.setOrder( TDECompletion.Weighted );
-
- String[] rle = null;
- // historyConfig.readListEntry( "ComboContents" ,rle);
- s_pCompletion.setItems( rle );
- s_pCompletion.setCompletionMode( TDEGlobalSettings.completionMode() );
- konqc.setCompletionObject( s_pCompletion );
-
- TQLabel lblkonq = new TQLabel( konqc, "&Konqueror's ComboBox", w );
- // konqc.insertItem( TDEIconLoader.SmallIcon("www"),
- // "http://www.kde.org" );
- konqc.insertItem( app.iconLoader().loadIcon("www",0 ),
- "http://www.kde.org" );
- konqc.setCurrentItem( konqc.count()-1 );
-
- // Create a read-only widget
- KComboBox soc = new KComboBox( w, "socombobox" );
- TQLabel lblso = new TQLabel( soc, "&Select-Only ComboBox", w, "socombolabel",0 );
- soc.setCompletionMode( TDEGlobalSettings.CompletionAuto );
- soc.completionObject().setItems( list );
- soc.insertStringList( list );
-
- // Create an exit button
- TQPushButton push = new TQPushButton( "E&xit", w );
-
- TQObject.connect( push, Qt.SIGNAL("clicked()"), app, Qt.SLOT("closeAllWindows()" ) );
-
- // Insert the widgets into the layout manager.
- vbox.addWidget( lblrw );
- vbox.addWidget( rwc );
- vbox.addWidget( lblso );
- vbox.addWidget( soc );
- vbox.addWidget( lblkonq );
- vbox.addWidget( konqc );
- vbox.addWidget( push );
-
- app.setMainWidget(w);
- rwc.setFocus();
- w.show();
-
- app.exec();
- return;
- }
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
- }
-
-
diff --git a/kdejava/koala/test/kdatepicker/KDatePickTest.java b/kdejava/koala/test/kdatepicker/KDatePickTest.java
deleted file mode 100644
index 8d6cdca8..00000000
--- a/kdejava/koala/test/kdatepicker/KDatePickTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-public class KDatePickTest {
-
-
- public static void main (String[] args) {
-
- TDELocale.setMainCatalogue("tdelibs");
- TDECmdLineArgs.init(args, "kdatepickertest", "KDatePickTest",
- "A KDatePicker test..", "0.1");
- TDEApplication app = new TDEApplication();
- KDatePicker picker = new KDatePicker();
- app.setMainWidget(picker);
- picker.show();
- app.exec();
- return;
-
- }
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/khelpers/KHelpers.java b/kdejava/koala/test/khelpers/KHelpers.java
deleted file mode 100644
index 47803457..00000000
--- a/kdejava/koala/test/khelpers/KHelpers.java
+++ /dev/null
@@ -1,103 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/**
- * Class KHelpers is the main application window.
- *
- * Taken from KDE 2.0 Development book
- *
- * ToolTips, What's This?, and More
- *
- *
- *
- * @see TDEMainWindow
- * @see TDEApplication
- *
- * @author java translation Kenneth J. Pouncey, kjpou@hotmail.com
- * @version 0.1
- */
-
-public class KHelpers extends TDEMainWindow {
-
- // File menu item id's
- protected int idfilenew;
- protected int idfileopen;
- protected int idfilesave;
- protected int idfilequit;
-
- // reference to the application
- TDEApplication kapp;
-
- // time to display the message in the status bar
- int HelpMessageTime = 200;
-
- public KHelpers () {
-
- // get a reference to the application
- kapp = TDEApplication.kApplication();
-
- TQPopupMenu file = new TQPopupMenu(this);
-
- idfilenew = file.insertItem("&New");
- idfileopen = file.insertItem("&Open...");
- idfilesave = file.insertItem("&Save");
- idfilequit = file.insertItem("&Quit", kapp, SLOT("closeAllWindows()"));
-
- connect ( file, SIGNAL( "highlighted(int)"), this, SLOT( "slotMenuEntryHelp (int)"));
-
- menuBar().insertItem("&File",file);
-
- TQPopupMenu help = helpMenu("KHelpers\n" +
- "Copyright (C) 2000 By Joe Developer\n\n" +
- "KHelpers demonstates a few of the ways " +
- "that your application can provide help to a user");
-
- help.insertSeparator();
- help.insertItem("Help on a special topic", this, SLOT("slotSpecialHelp()"));
-
- menuBar().insertItem("&Help",help);
-
- // Create the statusbar
- statusBar();
-
- TQLabel clientarea = new TQLabel(this);
- clientarea.setBackgroundColor(Qt.white());
-
- TQToolTip.add(clientarea, "Functionless client area");
- TQWhatsThis.add(clientarea,"This client area doesn't do anything.");
-
- setCentralWidget(clientarea);
-
- clientarea.setFocus();
- }
-
- public void slotMenuEntryHelp (int id) {
-
- if (id == idfilenew) {
- statusBar().message("Create a new document.",HelpMessageTime);
- }
- else if (id == idfileopen) {
-
- statusBar().message("Open a file.",HelpMessageTime);
-
- }
- else if (id == idfilesave) {
-
- statusBar().message("Save the current document.",HelpMessageTime);
-
- }
- else if (id == idfilequit) {
-
- statusBar().message("Quit the application.",HelpMessageTime);
-
- }
- }
-
- public void slotSpecialHelp() {
-
- String helpfilename = kapp.name();
- helpfilename += "/specialhelp.html";
- kapp.invokeHelp(helpfilename,"");
- }
-
-}
diff --git a/kdejava/koala/test/khelpers/Main.java b/kdejava/koala/test/khelpers/Main.java
deleted file mode 100644
index ee04d747..00000000
--- a/kdejava/koala/test/khelpers/Main.java
+++ /dev/null
@@ -1,52 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/**
- * Main class.
- *
- * Taken from KDE 2.0 Development book
- *
- * Helping the User Use Your Application
- *
- * ToolTips, What's This?, and More
- *
- * @see TDEApplication
- * @see TDECmdLineArgs
- *
- * @author java translation Kenneth J. Pouncey, kjpou@hotmail.com
- * @version 0.1
- */
-
-public class Main {
-
- static String description = "KDE 2 Development example";
-
-
- static String[][] options = { };
-
-
-static String VERSION = "0.1";
-
- public static void main(String[] cmdLineArgs) {
-
- TDEAboutData aboutData = new TDEAboutData( "KHelpers", "KHelpers",
- VERSION, description, TDEAboutData.License_GPL,
- "KDE 2 Development");
- TDECmdLineArgs.init( cmdLineArgs, aboutData );
- TDECmdLineArgs.addCmdLineOptions( options ); // Add our own options.
-
- TDEApplication app = new TDEApplication();
- KHelpers khelpers = new KHelpers();
-
- khelpers.show();
-
- app.exec();
- return;
- }
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/kmenu/KdeMenuSample.java b/kdejava/koala/test/kmenu/KdeMenuSample.java
deleted file mode 100644
index 3ffbb4d0..00000000
--- a/kdejava/koala/test/kmenu/KdeMenuSample.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * KdeMenuSample.java
- *
- * Created on 8. Marz 2002, 20:31
- */
-
-//package com.werpu.sample3;
-
-//import com.werpu.common.*;
-import org.kde.koala.kdejava;
-import org.kde.qt.qtjava;
-
-import org.kde.koala.TDEMainWindow;
-import org.kde.koala.TDECmdLineArgs;
-import org.kde.qt.TQPopupMenu;
-import org.kde.qt.TQTextView;
-import org.kde.koala.KMenuBar;
-import org.kde.koala.TDEApplication;
-import org.kde.koala.KURL;
-import org.kde.koala.KFileDialog;
-import org.kde.koala.KMessageBox;
-import org.kde.qt.TQColor;
-import org.kde.qt.TQButton;
-import org.kde.koala.KPushButton;
-
-
-
-/**
- * @author Werner Punz werpu@gmx.at
- * To Java translated KDE Menu Example from
- * The kde.org KDE Tutorial from Antonio Larrosa Jimenez
- * http://person.wanadoo.es/antlarr/tutorial
- */
-public class KdeMenuSample extends TDEMainWindow {
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
- TDEApplication kApp = null;
-
- /** Creates a new instance of KdeMenuSample */
- public KdeMenuSample(TDEApplication kApp) {
- super(null,"Menu Sample",1);
- this.kApp = kApp;
- setCaption("TDE Tutorial");
- createMenu();
- TQTextView centralWidget = createTextView();
-
- this.setCentralWidget(centralWidget);
- }
-
-
- /**
- * creates the file menu
- */
- private TQPopupMenu createFileMenu() {
- TQPopupMenu fileMenu = new TQPopupMenu(this);
- fileMenu.insertItem("&Open",this,this.SLOT("fileOpen()"));
- fileMenu.insertItem("&Save",this,this.SLOT("fileSave()"));
- fileMenu.insertItem("&Quit",kApp,kApp.SLOT("quit()"));
- return fileMenu;
- }
-
- /**
- * creates the about menu
- */
- private TQPopupMenu createAboutMenu() {
- StringBuffer aboutText = new StringBuffer();
-
- aboutText.append("Menu Example: \n ");
- aboutText.append("Originally written by Antonio Larrosa Jimenez larossa@kde.org \n");
- aboutText.append("Translated to Java by Werner Punz werpu@gmx.at \n");
- aboutText.append("Simple TDE Tutorial\n");
- aboutText.append("This tutorial comes with ABSOLUTELY NO WARRANTY\n");
- aboutText.append("This is free software, and you are welcome to redistribute it\n");
- aboutText.append("under certain conditions\n");
-
- TQPopupMenu aboutMenu = helpMenu(aboutText.toString(),true);
-
- return aboutMenu;
- }
-
- /**
- * creates the menu
- */
- private void createMenu() {
- KMenuBar mainMenu = kmenuBar();
- mainMenu.insertItem("&File",createFileMenu());
- mainMenu.insertSeparator();
- mainMenu.insertItem("&About",createAboutMenu());
- }
-
- /**
- * creates the textview of the window
- */
- private TQTextView createTextView() {
- StringBuffer textBuf = new StringBuffer();
- textBuf.append("<H2>Hello World !</H2><BR>This is a simple");
- textBuf.append(" window with <I><font size=5><B>R<font color=red");
- textBuf.append(" size=5>ich </font><font color=blue size=5>Text");
- textBuf.append("</font></B></I> capabilities<BR>Try to resize");
- textBuf.append(" this window, all this is automatic !</H2>");
-
- TQTextView mainTextView = new TQTextView(this,"");
- mainTextView.setText(textBuf.toString());
-
-
- return mainTextView;
- }
-
- //--------------------------------------------------------------
- //Slots
- //--------------------------------------------------------------
- public void fileOpen() {
- //System.out.println("File Open");
- KURL filename = KFileDialog.getOpenURL("", "*", this,"Open File" );
- String msg = "Now this app should open the url " + filename.url();
- KMessageBox.information(this , msg, "Information" , "fileOpenInformationDialog" );
- }
-
- public void fileSave() {
- KURL filename = KFileDialog.getSaveURL( "" , "*", this, "Save File" );
- }
-
- //----------------------------------------------------------------
- // main method
- //----------------------------------------------------------------
- public static void main(String [] argv) {
- TDECmdLineArgs.init(argv, "menuapp", "MenuApp",
- "A simple menu example", "0.1");
- TDEApplication menuApp = new TDEApplication();
- KdeMenuSample mainWnd = new KdeMenuSample(menuApp);
-
- mainWnd.resize(100,300);
- menuApp.setMainWidget(mainWnd);
-
- mainWnd.show();
- menuApp.exec();
- }
-}
diff --git a/kdejava/koala/test/kprogress/KProgressTest.java b/kdejava/koala/test/kprogress/KProgressTest.java
deleted file mode 100644
index ccb1d267..00000000
--- a/kdejava/koala/test/kprogress/KProgressTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/**
- * Class to test KProgress widget.
- *
- * This is a translation to java from kprogresstest.cpp in the tests library
- * of tdeui source.
- *
- * @see KProgress
- * @see TDEApplication
- *
- * @author orignal unknown, java translation Kenneth J. Pouncey, kjpou@hotmail.com
- * @version 0.1
- */
-
-public class KProgressTest {
-
- static String description = "Java KProgress test program";
- static String[][] options = { };
- static String VERSION = "0.1";
-
- public static void main(String[] cmdLineArgs) {
-
- TDEAboutData aboutData = new TDEAboutData( "kprogresstest", "KProgressTest",
- VERSION, description, TDEAboutData.License_GPL,
- "(c) 2002, Kenneth J. Pouncey");
- aboutData.addAuthor("Kenneth J. Pouncey",null, "kjpou@hotmail.com");
- TDECmdLineArgs.init( cmdLineArgs, aboutData );
- TDECmdLineArgs.addCmdLineOptions( options ); // Add our own options.
-
- TDEApplication app = new TDEApplication();
-
- // parse the args
- TDECmdLineArgs args = TDECmdLineArgs.parsedArgs();
-
- MyWidget mine = new MyWidget();
-
- mine.setCaption(description);
-
- app.setMainWidget(mine);
- mine.show();
-
- app.exec();
-
- return;
- }
-
- private static class MyWidget extends TQWidget {
-
- private KProgress Progress;
- static int fwd = 0;
- static int back = 1;
- static int direction = fwd;
-
- public MyWidget () {
- super();
- setFixedSize(440, 80);
- Progress = new KProgress(this);
- Progress.resize(400, 40);
- Progress.move(20, 20);
- startTimer(50);
- }
-
- public void timerEvent(TQTimerEvent timer) {
-
- if (direction == fwd) {
- if (Progress.progress() == Progress.totalSteps())
- direction = back;
- else
- Progress.advance(1);
- }
- else {
- if (Progress.progress() == 0) { /*Progress.minValue()*/
- direction = fwd;
- }
- else
- Progress.advance(-1);
- }
- }
- }
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/ksystemtray/Test.java b/kdejava/koala/test/ksystemtray/Test.java
deleted file mode 100644
index e1fd9c7e..00000000
--- a/kdejava/koala/test/ksystemtray/Test.java
+++ /dev/null
@@ -1,28 +0,0 @@
-import org.kde.koala.*;
-import org.kde.qt.*;
-
-public class Test {
- static String description = "Systemtray test application for Java";
- static String[][] options = {{ "+[File]", "image file to open", null }};
-// static String[][] options = new String[0][0];//{{ null, null, null }};
-
- public static void main(String[] argv){
- TDEAboutData aboutData = new TDEAboutData( "test", "Test",
- "0.1", description, TDEAboutData.License_GPL,
- "(C) 2002 Gert-Jan van der Heiden");
- TDECmdLineArgs.init( argv, aboutData );
- TDECmdLineArgs.addCmdLineOptions(options);
- System.out.println("1");
- TDEApplication app = new TDEApplication();
- System.out.println("2");
- KSystemTray systemTrayIcon = new KSystemTray(null, "test");
- System.out.println("3");
- systemTrayIcon.show();
- app.exec();
- System.exit(0);
- }
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-}
diff --git a/kdejava/koala/test/simplebrowser/KSimpleBrowser.java b/kdejava/koala/test/simplebrowser/KSimpleBrowser.java
deleted file mode 100644
index b859f60d..00000000
--- a/kdejava/koala/test/simplebrowser/KSimpleBrowser.java
+++ /dev/null
@@ -1,65 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/**
- * Class KSimpleBrowser is the main application window.
- *
- * Taken from KDE 2.0 Development book
- *
- * Rendering HTML Files
- *
- * A Simple Web Browser - A feature-limited Web Browser.
- *
- * @see TDEMainWindow
- * @see TDEApplication
- * @see TDEHTMLPart
- *
- * @author java translation Kenneth J. Pouncey, kjpou@hotmail.com
- * @version 0.1
- */
-
-public class KSimpleBrowser extends TDEMainWindow {
-
-
- static final int URLLined = 1;
-
- TDEHTMLPart tdehtmlpart;
-
- public KSimpleBrowser (String name) {
-
- super(null,name,0);
-
- toolBar().insertLined( "", URLLined, SIGNAL("returnPressed()"),
- this, SLOT ("slotNewURL()"));
-
-
- toolBar().setItemAutoSized(URLLined);
-
- tdehtmlpart = new TDEHTMLPart(this);
- tdehtmlpart.begin();
-
- tdehtmlpart.write("<HTML><BODY><H1>KSimpleBrowser</H1>" +
- "<P>To load a web page, type its URL in the line " +
- "edit box and press enter,</P>" +
- "</BODY></HTML>");
-
- tdehtmlpart.end();
-
- setCaption("KDE 2 Development book example - KSimpleBrowser");
-
- setCentralWidget(tdehtmlpart.view());
-
- }
-
- public void slotNewURL () {
-
- tdehtmlpart.openURL(new KURL(this.toolBar().getLinedText(URLLined))) ;
- }
-
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/simplebrowser/Main.java b/kdejava/koala/test/simplebrowser/Main.java
deleted file mode 100644
index 2964f45f..00000000
--- a/kdejava/koala/test/simplebrowser/Main.java
+++ /dev/null
@@ -1,40 +0,0 @@
-import org.kde.qt.*;
-import org.kde.koala.*;
-
-/**
- * Main class.
- *
- * Taken from KDE 2.0 Development book
- *
- * Rendering HTML Files
- *
- * A Simple Web Browser
- *
- *
- * @see TDEApplication
- *
- * @author java translation Kenneth J. Pouncey, kjpou@hotmail.com
- * @version 0.1
- */
-
-public class Main {
-
- public static void main(String[] cmdLineArgs) {
-
- TDECmdLineArgs.init(cmdLineArgs, "ksimplebrowser", "KSimpleBrowser",
- "A KDE 3 Development Example - KSimpleBrowser", "0.1");
- TDEApplication app = new TDEApplication();
- KSimpleBrowser kbrowser = new KSimpleBrowser("KSimpleBrowser");
-
- kbrowser.show();
-
- app.exec();
- return;
- }
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/tdefontdialog/TDEFontDialogTest.java b/kdejava/koala/test/tdefontdialog/TDEFontDialogTest.java
deleted file mode 100644
index 22585369..00000000
--- a/kdejava/koala/test/tdefontdialog/TDEFontDialogTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-import java.util.*;
-
-import org.kde.qt.*;
-import org.kde.koala.*;
-/*
- $Id$
-
- Requires the Qt widget libraries, available at no cost at
- http://www.troll.no
-
- Copyright (C) 1996 Bernd Johannes Wuebben
- wuebben@math.cornell.edu
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-*/
-
-/**
- * Class to test TDEFontDialog widgets.
- *
- * This is a translation to java from tdefontdialogtest.cpp in the tests library
- * of tdeui source.
- *
- * @see TDEFontDialog
- * @see TDEApplication
- * @see TDEConfig
- *
- * @author Bernd Johannes Wuebben, java translation Kenneth J. Pouncey, kjpou@hotmail.com
- * @version 0.1
- */
-public class TDEFontDialogTest {
-
- static String description = "Java TDEFontDialog test program.";
- static String[][] options = { };
- static String VERSION = "0.1";
-
- public static void main(String[] cmdLineArgs) {
-
- TDEAboutData aboutData = new TDEAboutData( "tdefontdialogtest", "TDEFontDialogTest",
- VERSION, description, TDEAboutData.License_GPL,
- "(c) 2002, Kenneth J. Pouncey");
- aboutData.addAuthor("Kenneth J. Pouncey",null, "kjpou@hotmail.com");
- TDECmdLineArgs.init( cmdLineArgs, aboutData );
- TDECmdLineArgs.addCmdLineOptions( options ); // Add our own options.
-
- TDEApplication app = new TDEApplication();
-
- // parse the args
- TDECmdLineArgs args = TDECmdLineArgs.parsedArgs();
-
- TDEConfig aConfig = new TDEConfig();
- aConfig.setGroup( "TDEFontDialog-test" );
-
- // parameters are Font name, Font Point Size, Font Style, Font Italic
- app.setFont(new TQFont("Helvetica",12,TQFont.Normal,false));
-// app.setFont(new TQFont("Times",18,TQFont.Bold,true));
-
- TQFont font = aConfig.readFontEntry( "Chosen" );
-
- int nRet = TDEFontDialog.getFont(font);
-
- // return values from TDEFontDialog
- // nRet = 1 for OK Button
- // nRet = 0 for Cancel button
-
- if (nRet == 1) { // print out font values
- System.out.println("Ok Button pressed from TDEFontDialog ");
- System.out.println(" Font name selected: " + font.family());
- System.out.println(" Font Point Size selected: " + font.pointSize());
- System.out.println(" Font Bold?: " + font.bold());
- System.out.println(" Font Italic?: " + font.italic());
- System.out.println(" Font Underline?: " + font.underline());
-// System.out.println(" Font Character Set: " + getCharacterSet(font.charSet()));
- System.out.println(" Font raw name selected: " + font.rawName());
- }
-
- int[] flags = { 0 };
-
- //Static method for TDEFontDialog needs to be generated
- nRet = TDEFontDialog.getFontDiff(font, flags);
- if (nRet == 1) {
- System.out.println("Ok Button pressed from TDEFontDialog diff dialog ");
- System.out.println(" Font diff flags: " + flags[0]);
- System.out.println(" Font name selected: " + font.family());
- System.out.println(" Font Point Size selected: " + font.pointSize());
- System.out.println(" Font Bold?: " + font.bold());
- System.out.println(" Font Italic?: " + font.italic());
- System.out.println(" Font Underline?: " + font.underline());
- System.out.println(" Font raw name selected: " + font.rawName());
- }
-
- // This should save off the font chose in the configuration so it can
- // be read next time.
- aConfig.writeEntry( "Chosen", font,true,false,false );
-
- aConfig.sync();
-
- app.exec();
- return;
- }
-
- /**
- * Returns the string representation of the character set.
- * Others should be added here.
- */
-/* private static String getCharacterSet (int cs) {
-
- switch (cs) {
-
- case TQFont.ISO_8859_1 :
- return "ISO_8859_1";
- case TQFont.ISO_8859_2 :
- return "ISO_8859_2";
- case TQFont.ISO_8859_3 :
- return "ISO_8859_3";
- case TQFont.ISO_8859_4 :
- return "ISO_8859_4";
- case TQFont.ISO_8859_5 :
- return "ISO_8859_5";
- case TQFont.ISO_8859_6 :
- return "ISO_8859_6";
- case TQFont.ISO_8859_7 :
- return "ISO_8859_7";
- case TQFont.ISO_8859_8 :
- return "ISO_8859_8";
- case TQFont.ISO_8859_9 :
- return "ISO_8859_9";
- case TQFont.ISO_8859_10 :
- return "ISO_8859_10";
- case TQFont.ISO_8859_11 :
- return "ISO_8859_11";
- case TQFont.ISO_8859_12 :
- return "ISO_8859_12";
- case TQFont.ISO_8859_13 :
- return "ISO_8859_13";
- case TQFont.ISO_8859_14 :
- return "ISO_8859_14";
- case TQFont.ISO_8859_15 :
- return "ISO_8859_15";
-
- // more should be added
- default :
- return " other ";
-
- }
- } */
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-
-}
diff --git a/kdejava/koala/test/tdeioslave/KioslaveTest.java b/kdejava/koala/test/tdeioslave/KioslaveTest.java
deleted file mode 100644
index 5966430c..00000000
--- a/kdejava/koala/test/tdeioslave/KioslaveTest.java
+++ /dev/null
@@ -1,589 +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.
- */
-
-import org.kde.qt.*;
-import org.kde.koala.*;
-import java.io.ByteArrayOutputStream;
-
-class KioslaveTest extends TDEMainWindow {
-
- static final int List = 0;
- static final int ListRecursive = 1;
- static final int Stat = 2;
- static final int Get = 3;
- static final int Put = 4;
- static final int Copy = 5;
- static final int Move = 6;
- static final int Delete = 7;
- static final int Shred = 8;
- static final int Mkdir = 9;
- static final int Mimetype = 10;
-
- static final int ProgressNone = 0;
- static final int ProgressDefault = 1;
- static final int ProgressStatus = 2;
-
- // 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;
-
-
-private Job job;
-private TQWidget main_widget;
-
-private StatusbarProgress statusProgress;
-
-private int selectedOperation;
-private int progressMode;
-private int putBuffer;
-private Slave slave;
-
- /*
- 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.
- */
-
-
-
-
-
-KioslaveTest( String src, String dest, int op, int pr )
-{
- super(null, "");
- job = null;
-
- 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, SIGNAL("clicked(int)"), 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, SIGNAL("clicked(int)"), 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, SIGNAL("clicked()"), SLOT("startJob()") );
- hbLayout.addWidget( pbStart, 5 );
-
- pbStop = new TQPushButton( "Sto&p", main_widget );
- pbStop.setFixedSize( pbStop.sizeHint() );
- pbStop.setEnabled( false );
- connect( pbStop, SIGNAL("clicked()"), SLOT("stopJob()") );
- hbLayout.addWidget( pbStop, 5 );
-
- // close button
- close = new TQPushButton( "&Close", main_widget );
- close.setFixedSize( close.sizeHint() );
- connect(close, SIGNAL("clicked()"), this, SLOT("slotQuit()"));
-
- topLayout.addWidget( close, 5 );
-
- main_widget.setMinimumSize( main_widget.sizeHint() );
- setCentralWidget( main_widget );
-
- slave = null;
-// slave = Scheduler.getConnectedSlave(new KURL("ftp://ftp.kde.org"));
- Scheduler.connect(SIGNAL("slaveConnected(Slave)"),
- this, SLOT("slotSlaveConnected()"));
- Scheduler.connect(SIGNAL("slaveError(Slave,int,String)"),
- this, SLOT("slotSlaveError()"));
-}
-
-
-protected void closeEvent( TQCloseEvent e ){
- slotQuit();
-}
-
-
-void slotQuit(){
- if ( job != null ) {
- job.kill( true ); // kill the job quietly
- }
- if (slave != null )
- Scheduler.disconnectSlave(slave);
- TDEApplication.kApplication().quit();
-}
-
-
-void changeOperation( int id ) {
- // only two urls for copy and move
- boolean enab = rbCopy.isChecked() || rbMove.isChecked();
-
- le_dest.setEnabled( enab );
-
- selectedOperation = id;
-}
-
-
-void changeProgressMode( int id ) {
- progressMode = id;
-
- if ( progressMode == ProgressStatus ) {
- statusBar().show();
- } else {
- statusBar().hide();
- }
-}
-
-
-void startJob() {
- String sCurrent = TQDir.currentDirPath()+"/";
- KURL.encode_string(sCurrent);
- String sSrc = le_source.text();
- KURL src = new KURL( new KURL(sCurrent), sSrc );
-
- if ( !src.isValid() ) {
- TQMessageBox.critical(this, "Kioslave Error Message", "Source URL is malformed" );
- return;
- }
-
- String sDest = le_dest.text();
- KURL dest = new KURL( new KURL(sCurrent), sDest );
-
- if ( !dest.isValid() &&
- ( selectedOperation == Copy || selectedOperation == Move ) ) {
- TQMessageBox.critical(this, "Kioslave Error Message",
- "Destination URL is malformed" );
- return;
- }
-
- pbStart.setEnabled( false );
-
- boolean observe = true;
- if (progressMode != ProgressDefault) {
- observe = false;
- }
-
- SimpleJob myJob = null;
-
- switch ( selectedOperation ) {
- case List:
- myJob = TDEIO.listDir( src );
-// connect(myJob, SIGNAL(" entries( Job, const TDEIO.UDSEntryList&)"),
-// SLOT(" slotEntries( TDEIO.Job, const TDEIO.UDSEntryList&)"));
- break;
-
- case ListRecursive:
- myJob = TDEIO.listRecursive( src );
-// connect(myJob, SIGNAL(" entries( TDEIO.Job, const TDEIO.UDSEntryList&)"),
- // SLOT(" slotEntries( TDEIO.Job, const TDEIO.UDSEntryList&)"));
- break;
-
- case Stat:
- myJob = TDEIO.stat( src );
- break;
-
- case Get:
- myJob = TDEIO.get( src, true );
- connect(myJob, SIGNAL("data( Job, byte[])"),
- SLOT("slotData( Job, byte[])"));
- break;
-
- case Put:
- putBuffer = 0;
- myJob = TDEIO.put( src, -1, true, false);
- connect(myJob, SIGNAL("dataReq( Job, ByteArrayOutputStream)"),
- SLOT("slotDataReq( Job, ByteArrayOutputStream)"));
- 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 != null)
- {
- if (slave != null)
- Scheduler.assignJobToSlave(slave, myJob);
- job = myJob;
- }
-
- connect( job, SIGNAL(" result( Job )"),
- SLOT(" slotResult( Job )") );
-
- connect( job, SIGNAL(" canceled( Job )"),
- SLOT(" slotResult( Job )") );
-
- if (progressMode == ProgressStatus) {
- statusProgress.setJob( job );
- }
-
- pbStop.setEnabled( true );
-}
-
-
-void slotResult(Job _job )
-{
- if ( _job.error() != 0 )
- {
- _job.showErrorDialog();
- }
- else if ( selectedOperation == Stat )
- {
-// UDSEntry entry = ((TDEIO.StatJob)_job).statResult();
-// printUDSEntry( entry );
- }
- else if ( selectedOperation == Mimetype )
- {
- System.out.println("mimetype is " + ((MimetypeJob)_job).mimetype());
- }
-
- if (job == _job)
- job = null;
- pbStart.setEnabled( true );
- pbStop.setEnabled( false );
-}
-
-void slotSlaveConnected()
-{
- System.out.println("Slave connected.");
-}
-
-void slotSlaveError()
-{
- System.out.println("Error connected.");
- slave = null;
-}
-
-/*
-void 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 : " << (mode_t)((it).m_long) << endl;
- 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;
- }
- }
-}
-
-void 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 slotData(Job job, byte[] data)
-{
- if (data.length == 0)
- {
- System.out.println("Data: <End>");
- }
- else
- {
- String myString = new String(data);
- System.out.println("Data: \"" + myString + "\"");
- }
-}
-
-void slotDataReq(Job job, ByteArrayOutputStream data)
-{
- String[] fileDataArray =
- {
- "Hello world\n",
- "This is a test file\n",
- "You can safely delete it.\n",
- null
- };
- String fileData = fileDataArray[putBuffer++];
-
- if (fileData == null)
- {
- System.out.println("DataReq: <End>");
- return;
- }
-
- try {
- data.write(fileData.getBytes());
- } catch (java.io.IOException e) {
- ;
- }
-
- System.out.println("DataReq: \"" + fileData + "\"");
-}
-
-void stopJob() {
- System.out.println("KioslaveTest.stopJob()");
- job.kill();
- job = null;
-
- pbStop.setEnabled( false );
- pbStart.setEnabled( true );
-}
-
-static String version = "v0.0.0 0000"; // :-)
-static String description = "Test for tdeioslaves";
-static String[][] options =
-{
- { "s", null, null },
- { "src <src>", "Source URL", "" },
- { "d", null, null },
- { "dest <dest>", "Destination URL", "" },
- { "o", null, null },
- { "operation <operation>", "Operation (list,listrecursive,stat,get,copy,move,del,shred,mkdir)", "copy" },
- { "p", null, null },
- { "progress <progress>", "Progress Type (none,default,status)", "default" }
-};
-
-public static void main(String[] argv) {
- TDECmdLineArgs.init( argv, "tdeioslavetest", "KIOSlaveTest", description, version );
- TDECmdLineArgs.addCmdLineOptions( options );
- TDEApplication app = new TDEApplication();
-
- TDECmdLineArgs args = TDECmdLineArgs.parsedArgs();
-
- String src = args.getOption("src");
- String dest = args.getOption("dest");
-
- int op = 0;
- int pr = 0;
-
- String tmps;
-
- tmps = args.getOption("operation");
- if ( tmps.equals("list")) {
- op = KioslaveTest.List;
- } else if ( tmps.equals("listrecursive")) {
- op = KioslaveTest.ListRecursive;
- } else if ( tmps.equals("stat")) {
- op = KioslaveTest.Stat;
- } else if ( tmps.equals("get")) {
- op = KioslaveTest.Get;
- } else if ( tmps.equals("copy")) {
- op = KioslaveTest.Copy;
- } else if ( tmps.equals("move")) {
- op = KioslaveTest.Move;
- } else if ( tmps.equals("del")) {
- op = KioslaveTest.Delete;
- } else if ( tmps.equals("shred")) {
- op = KioslaveTest.Shred;
- } else if ( tmps.equals("mkdir")) {
- op = KioslaveTest.Mkdir;
- } else TDECmdLineArgs.usage("unknown operation");
-
- tmps = args.getOption("progress");
- if ( tmps.equals("none")) {
- pr = KioslaveTest.ProgressNone;
- } else if ( tmps.equals("default")) {
- pr = KioslaveTest.ProgressDefault;
- } else if ( tmps.equals("status")) {
- pr = KioslaveTest.ProgressStatus;
- } else TDECmdLineArgs.usage("unknown progress mode");
-
- args.clear(); // Free up memory
-
- KioslaveTest test = new KioslaveTest( src, dest, op, pr );
- test.show();
- // Bug in KTMW / Qt / layouts ?
- test.resize( test.sizeHint() );
-
- app.setMainWidget(test);
- app.exec();
- return;
-}
-
- static {
- qtjava.initialize();
- kdejava.initialize();
- }
-}
-
-