diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 90825e2392b2d70e43c7a25b8a3752299a933894 (patch) | |
tree | e33aa27f02b74604afbfd0ea4f1cfca8833d882a /kdejava/koala/test/khelpers/KHelpers.java | |
download | tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdejava/koala/test/khelpers/KHelpers.java')
-rw-r--r-- | kdejava/koala/test/khelpers/KHelpers.java | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/kdejava/koala/test/khelpers/KHelpers.java b/kdejava/koala/test/khelpers/KHelpers.java new file mode 100644 index 00000000..3ab345c0 --- /dev/null +++ b/kdejava/koala/test/khelpers/KHelpers.java @@ -0,0 +1,103 @@ +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 KMainWindow + * @see KApplication + * + * @author java translation Kenneth J. Pouncey, kjpou@hotmail.com + * @version 0.1 + */ + +public class KHelpers extends KMainWindow { + + // File menu item id's + protected int idfilenew; + protected int idfileopen; + protected int idfilesave; + protected int idfilequit; + + // reference to the application + KApplication kapp; + + // time to display the message in the status bar + int HelpMessageTime = 200; + + public KHelpers () { + + // get a reference to the application + kapp = KApplication.kApplication(); + + QPopupMenu file = new QPopupMenu(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); + + QPopupMenu 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(); + + QLabel clientarea = new QLabel(this); + clientarea.setBackgroundColor(Qt.white()); + + QToolTip.add(clientarea, "Functionless client area"); + QWhatsThis.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,""); + } + +} |