kandy
mobilemain.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <kglobal.h>
00026 #include <klocale.h>
00027 #include <kiconloader.h>
00028 #include <kmenubar.h>
00029 #include <kkeydialog.h>
00030 #include <kaccel.h>
00031 #include <kconfig.h>
00032 #include <kdebug.h>
00033 #include <kmessagebox.h>
00034 #include <kstandarddirs.h>
00035 #include <kedittoolbar.h>
00036 #include <kurldrag.h>
00037
00038 #include <kstdaccel.h>
00039 #include <kaction.h>
00040 #include <kstdaction.h>
00041
00042 #include <qpushbutton.h>
00043
00044 #include "mobilegui.h"
00045
00046 #include "mobilemain.h"
00047 #include <kstatusbar.h>
00048 #include "mobilemain.moc"
00049
00050 MobileMain::MobileMain(CommandScheduler *scheduler, KandyPrefs *prefs)
00051 : KMainWindow( 0, "MobileMain" )
00052 {
00053 mView = new MobileGui(scheduler, prefs, this);
00054 setCentralWidget(mView);
00055 setupActions();
00056
00057 statusBar()->insertItem(i18n(" Disconnected "),1,0,true);
00058 connect(mView,SIGNAL(statusMessage(const QString &)),
00059 SLOT(showStatusMessage(const QString &)));
00060 connect(mView,SIGNAL(transientStatusMessage(const QString &)),
00061 SLOT(showTransientStatusMessage(const QString &)));
00062
00063 statusBar()->show();
00064
00065 setAutoSaveSettings();
00066 }
00067
00068 MobileMain::~MobileMain()
00069 {
00070 }
00071
00072 void MobileMain::setupActions()
00073 {
00074 KStdAction::quit(this, SLOT(close()), actionCollection());
00075
00076 new KAction(i18n("Terminal"),0,this,SLOT(showTerminal()),
00077 actionCollection(),"show_terminal");
00078
00079 createStandardStatusBarAction();
00080 setStandardToolBarMenuEnabled(true);
00081
00082 KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
00083 KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
00084 KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
00085
00086 createGUI("kandymobileui.rc");
00087 }
00088
00089 void MobileMain::saveProperties(KConfig *)
00090 {
00091
00092
00093
00094 }
00095
00096 void MobileMain::readProperties(KConfig *)
00097 {
00098
00099
00100
00101
00102 }
00103
00104 void MobileMain::dragEnterEvent(QDragEnterEvent *event)
00105 {
00106
00107 KMainWindow::dragEnterEvent(event);
00108
00109
00110
00111 }
00112
00113 void MobileMain::dropEvent(QDropEvent *event)
00114 {
00115
00116
00117
00118
00119
00120 KMainWindow::dropEvent(event);
00121 }
00122
00123 void MobileMain::optionsConfigureKeys()
00124 {
00125 KKeyDialog::configure( actionCollection(), this );
00126 }
00127
00128 void MobileMain::optionsConfigureToolbars()
00129 {
00130
00131 saveMainWindowSettings( KGlobal::config(), autoSaveGroup() );
00132 KEditToolbar dlg(actionCollection());
00133 connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(newToolbarConfig()));
00134 dlg.exec();
00135 }
00136
00137 void MobileMain::newToolbarConfig()
00138 {
00139
00140 createGUI("kandymobileui.rc");
00141 applyMainWindowSettings( KGlobal::config(), autoSaveGroup() );
00142 }
00143
00144 void MobileMain::optionsPreferences()
00145 {
00146 emit showPreferencesWin();
00147 }
00148
00149 void MobileMain::showStatusMessage(const QString& text)
00150 {
00151
00152 statusBar()->message(text);
00153 }
00154
00155 void MobileMain::showTransientStatusMessage(const QString& text)
00156 {
00157
00158 statusBar()->message(text,2000);
00159 }
00160
00161 void MobileMain::changeCaption(const QString& text)
00162 {
00163
00164 setCaption(text);
00165 }
00166
00167 bool MobileMain::queryClose()
00168 {
00169 #if 0
00170 if (m_view->isModified()) {
00171 switch (KMessageBox::warningYesNoCancel(this,
00172 i18n("Save changes to profile %1?").arg(mFilename))) {
00173 case KMessageBox::Yes :
00174 fileSave();
00175 return true;
00176 case KMessageBox::No :
00177 return true;
00178 default:
00179 return false;
00180 }
00181 } else {
00182 return true;
00183 }
00184 #endif
00185 return true;
00186 }
00187
00188 void MobileMain::showTerminal()
00189 {
00190 emit showTerminalWin();
00191 }
|