mobilemain.cpp
00001
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 "mobilegui.h"
00043
00044 #include "mobilemain.h"
00045 #include <kstatusbar.h>
00046 #include "mobilemain.moc"
00047
00048 MobileMain::MobileMain(CommandScheduler *scheduler)
00049 : KMainWindow( 0, "MobileMain" )
00050 {
00051 mView = new MobileGui(scheduler,this);
00052
00053 setCentralWidget(mView);
00054 setupActions();
00055
00056
00057
00058 statusBar()->insertItem(i18n(" Disconnected "),1,0,true);
00059 connect(mView,SIGNAL(statusMessage(const QString &)),
00060 SLOT(showStatusMessage(const QString &)));
00061 connect(mView,SIGNAL(transientStatusMessage(const QString &)),
00062 SLOT(showTransientStatusMessage(const QString &)));
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 new KAction(i18n("Connect"),0,this,SIGNAL(modemConnect()),
00087 actionCollection(),"modem_connect");
00088 new KAction(i18n("Disconnect"),0,this,SIGNAL(modemDisconnect()),
00089 actionCollection(),"modem_disconnect");
00090
00091 createGUI("kandymobileui.rc");
00092 }
00093
00094 void MobileMain::saveProperties(KConfig *)
00095 {
00096
00097
00098
00099 }
00100
00101 void MobileMain::readProperties(KConfig *)
00102 {
00103
00104
00105
00106
00107 }
00108
00109 void MobileMain::dragEnterEvent(QDragEnterEvent *event)
00110 {
00111
00112 KMainWindow::dragEnterEvent(event);
00113
00114
00115
00116 }
00117
00118 void MobileMain::dropEvent(QDropEvent *event)
00119 {
00120
00121
00122
00123
00124
00125 KMainWindow::dropEvent(event);
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 }
00142
00143 void MobileMain::optionsConfigureKeys()
00144 {
00145 KKeyDialog::configure( actionCollection(), this );
00146 }
00147
00148 void MobileMain::optionsConfigureToolbars()
00149 {
00150
00151 saveMainWindowSettings( KGlobal::config(), autoSaveGroup() );
00152 KEditToolbar dlg(actionCollection());
00153 connect(&dlg, SIGNAL(newToolbarConfig()), this, SLOT(newToolbarConfig()));
00154 dlg.exec();
00155 }
00156
00157 void MobileMain::newToolbarConfig()
00158 {
00159
00160 createGUI("kandymobileui.rc");
00161 applyMainWindowSettings( KGlobal::config(), autoSaveGroup() );
00162 }
00163
00164 void MobileMain::optionsPreferences()
00165 {
00166 emit showPreferencesWin();
00167 }
00168
00169 void MobileMain::showStatusMessage(const QString& text)
00170 {
00171
00172 statusBar()->message(text);
00173 }
00174
00175 void MobileMain::showTransientStatusMessage(const QString& text)
00176 {
00177
00178 statusBar()->message(text,2000);
00179 }
00180
00181 void MobileMain::changeCaption(const QString& text)
00182 {
00183
00184 setCaption(text);
00185 }
00186
00187 bool MobileMain::queryClose()
00188 {
00189 #if 0
00190 if (m_view->isModified()) {
00191 switch (KMessageBox::warningYesNoCancel(this,
00192 i18n("Save changes to profile %1?").arg(mFilename))) {
00193 case KMessageBox::Yes :
00194 fileSave();
00195 return true;
00196 case KMessageBox::No :
00197 return true;
00198 default:
00199 return false;
00200 }
00201 } else {
00202 return true;
00203 }
00204 #endif
00205 return true;
00206 }
00207
00208 void MobileMain::showTerminal()
00209 {
00210 emit showTerminalWin();
00211 }
00212
00213 void MobileMain::setConnected(bool connected)
00214 {
00215 if (connected) {
00216 statusBar()->changeItem(i18n(" Connected "),1);
00217 mView->readModelInformation();
00218 mView->refreshStatus();
00219
00220 } else {
00221 statusBar()->changeItem(i18n(" Disconnected "),1);
00222 }
00223 }
This file is part of the documentation for kandy Library Version 3.2.2.