summaryrefslogtreecommitdiffstats
path: root/tdevdesigner/src/tdevdesigner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tdevdesigner/src/tdevdesigner.cpp')
-rw-r--r--tdevdesigner/src/tdevdesigner.cpp216
1 files changed, 0 insertions, 216 deletions
diff --git a/tdevdesigner/src/tdevdesigner.cpp b/tdevdesigner/src/tdevdesigner.cpp
deleted file mode 100644
index bcc9423d..00000000
--- a/tdevdesigner/src/tdevdesigner.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/***************************************************************************
- * Copyright (C) 2004 by Alexander Dymo *
- * cloudtemple@mksat.net *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the *
- * Free Software Foundation, Inc., *
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
- ***************************************************************************/
-
-#include "tdevdesigner.h"
-
-#include <kxmlguiclient.h>
-#include <kkeydialog.h>
-#include <tdefiledialog.h>
-#include <tdeconfig.h>
-#include <kurl.h>
-#include <kdebug.h>
-
-#include <kedittoolbar.h>
-
-#include <tdeaction.h>
-#include <kstdaction.h>
-
-#include <klibloader.h>
-#include <tdemessagebox.h>
-#include <kstatusbar.h>
-#include <tdelocale.h>
-
-TDevDesigner::TDevDesigner()
- : KParts::MainWindow( 0L, "TDevDesigner" )
-{
- // set the shell's ui resource file
- setXMLFile("tdevdesigner_shell.rc");
-
- // then, setup our actions
- setupActions();
-
- // and a status bar
- statusBar()->show();
-
- // this routine will find and load our Part. it finds the Part by
- // name which is a bad idea usually.. but it's alright in this
- // case since our Part is made for this Shell
- KLibFactory *factory = KLibLoader::self()->factory("libtdevdesignerpart");
- if (factory)
- {
- // now that the Part is loaded, we cast it to a Part to get
- // our hands on it
- TQStringList args;
- args.append("in shell");
- m_part = static_cast<KParts::ReadWritePart *>(factory->create(TQT_TQOBJECT(this),
- "tdevdesigner_part", "KParts::ReadWritePart", args));
-
- if (m_part)
- {
- // tell the KParts::MainWindow that this is indeed the main widget
- setCentralWidget(m_part->widget());
-
- // and integrate the part's GUI with the shell's
- createGUI(m_part);
- }
- }
- else
- {
- // if we couldn't find our Part, we exit since the Shell by
- // itself can't do anything useful
- KMessageBox::error(this, i18n("Could not find the TDevDesigner part."));
- kapp->quit();
- // we return here, cause kapp->quit() only means "exit the
- // next time we enter the event loop...
- return;
- }
-
- // apply the saved mainwindow settings, if any, and ask the mainwindow
- // to automatically save settings if changed: window size, toolbar
- // position, icon size, etc.
- setAutoSaveSettings();
-}
-
-TDevDesigner::~TDevDesigner()
-{
-}
-
-void TDevDesigner::load(const KURL& url)
-{
- m_part->openURL( url );
-}
-
-void TDevDesigner::setupActions()
-{
-/* KStdAction::openNew(TQT_TQOBJECT(this), TQT_SLOT(fileNew()), actionCollection());
- KStdAction::open(TQT_TQOBJECT(this), TQT_SLOT(fileOpen()), actionCollection());*/
-
- KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), actionCollection());
-
- m_toolbarAction = KStdAction::showToolbar(TQT_TQOBJECT(this), TQT_SLOT(optionsShowToolbar()), actionCollection());
- m_statusbarAction = KStdAction::showStatusbar(TQT_TQOBJECT(this), TQT_SLOT(optionsShowStatusbar()), actionCollection());
-
- KStdAction::keyBindings(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureKeys()), actionCollection());
- KStdAction::configureToolbars(TQT_TQOBJECT(this), TQT_SLOT(optionsConfigureToolbars()), actionCollection());
-}
-
-void TDevDesigner::saveProperties(TDEConfig* /*config*/)
-{
- // the 'config' object points to the session managed
- // config file. anything you write here will be available
- // later when this app is restored
-}
-
-void TDevDesigner::readProperties(TDEConfig* /*config*/)
-{
- // the 'config' object points to the session managed
- // config file. this function is automatically called whenever
- // the app is being restored. read in here whatever you wrote
- // in 'saveProperties'
-}
-
-void TDevDesigner::fileNew()
-{
- // this slot is called whenever the File->New menu is selected,
- // the New shortcut is pressed (usually CTRL+N) or the New toolbar
- // button is clicked
-
- // About this function, the style guide (
- // http://developer.kde.org/documentation/standards/kde/style/basics/index.html )
- // says that it should open a new window if the document is _not_
- // in its initial state. This is what we do here..
- if ( ! m_part->url().isEmpty() || m_part->isModified() )
- {
- (new TDevDesigner)->show();
- };
-}
-
-
-void TDevDesigner::optionsShowToolbar()
-{
- // this is all very cut and paste code for showing/hiding the
- // toolbar
- if (m_toolbarAction->isChecked())
- toolBar()->show();
- else
- toolBar()->hide();
-}
-
-void TDevDesigner::optionsShowStatusbar()
-{
- // this is all very cut and paste code for showing/hiding the
- // statusbar
- if (m_statusbarAction->isChecked())
- statusBar()->show();
- else
- statusBar()->hide();
-}
-
-void TDevDesigner::optionsConfigureKeys()
-{
- KKeyDialog::configureKeys(m_part->actionCollection(), "tdevdesigner_part.rc");
-}
-
-void TDevDesigner::optionsConfigureToolbars()
-{
- saveMainWindowSettings(TDEGlobal::config(), autoSaveGroup());
-
- // use the standard toolbar editor
- KEditToolbar dlg(factory());
- connect(&dlg, TQT_SIGNAL(newToolbarConfig()),
- this, TQT_SLOT(applyNewToolbarConfig()));
- dlg.exec();
-}
-
-void TDevDesigner::applyNewToolbarConfig()
-{
- applyMainWindowSettings(TDEGlobal::config(), autoSaveGroup());
-}
-
-void TDevDesigner::fileOpen()
-{
- // this slot is called whenever the File->Open menu is selected,
- // the Open shortcut is pressed (usually CTRL+O) or the Open toolbar
- // button is clicked
- KURL url =
- KFileDialog::getOpenURL( TQString(), TQString(), this );
-
- if (url.isEmpty() == false)
- {
- // About this function, the style guide (
- // http://developer.kde.org/documentation/standards/kde/style/basics/index.html )
- // says that it should open a new window if the document is _not_
- // in its initial state. This is what we do here..
- if ( m_part->url().isEmpty() && ! m_part->isModified() )
- {
- // we open the file in this window...
- load( url );
- }
- else
- {
- // we open the file in a new window...
- TDevDesigner* newWin = new TDevDesigner;
- newWin->load( url );
- newWin->show();
- }
- }
-}
-
-#include "tdevdesigner.moc"