mobilemain.cpp
00001
00002
00003
00004 #include <qdragobject.h>
00005
00006 #include <kglobal.h>
00007 #include <klocale.h>
00008 #include <kiconloader.h>
00009 #include <kmenubar.h>
00010 #include <kkeydialog.h>
00011 #include <kaccel.h>
00012 #include <kconfig.h>
00013 #include <kdebug.h>
00014 #include <kmessagebox.h>
00015 #include <kstddirs.h>
00016 #include <kedittoolbar.h>
00017
00018 #include <kstdaccel.h>
00019 #include <kaction.h>
00020 #include <kstdaction.h>
00021
00022 #include "mobilegui.h"
00023
00024 #include "mobilemain.h"
00025 #include <kstatusbar.h>
00026 #include "mobilemain.moc"
00027
00028 MobileMain::MobileMain(CommandScheduler *scheduler)
00029 : KMainWindow( 0, "MobileMain" )
00030 {
00031 mView = new MobileGui(scheduler,this);
00032
00033 setCentralWidget(mView);
00034 setupActions();
00035
00036
00037
00038 statusBar()->insertItem(i18n(" Disconnected "),1,0,true);
00039 connect(mView,SIGNAL(statusMessage(const QString &)),
00040 SLOT(showStatusMessage(const QString &)));
00041 connect(mView,SIGNAL(transientStatusMessage(const QString &)),
00042 SLOT(showTransientStatusMessage(const QString &)));
00043 statusBar()->show();
00044 }
00045
00046 MobileMain::~MobileMain()
00047 {
00048 }
00049
00050 void MobileMain::setupActions()
00051 {
00052 KStdAction::quit(this, SLOT(close()), actionCollection());
00053
00054 new KAction(i18n("Terminal"),0,this,SLOT(showTerminal()),
00055 actionCollection(),"show_terminal");
00056
00057 m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection());
00058 m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection());
00059
00060 KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection());
00061 KStdAction::configureToolbars(this, SLOT(optionsConfigureToolbars()), actionCollection());
00062 KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection());
00063
00064 new KAction(i18n("Connect"),0,this,SIGNAL(modemConnect()),
00065 actionCollection(),"modem_connect");
00066 new KAction(i18n("Disconnect"),0,this,SIGNAL(modemDisconnect()),
00067 actionCollection(),"modem_disconnect");
00068
00069 createGUI("kandymobileui.rc");
00070 }
00071
00072 void MobileMain::saveProperties(KConfig *)
00073 {
00074
00075
00076
00077 }
00078
00079 void MobileMain::readProperties(KConfig *)
00080 {
00081
00082
00083
00084
00085 }
00086
00087 void MobileMain::dragEnterEvent(QDragEnterEvent *event)
00088 {
00089
00090 KMainWindow::dragEnterEvent(event);
00091
00092
00093
00094 }
00095
00096 void MobileMain::dropEvent(QDropEvent *event)
00097 {
00098
00099
00100
00101
00102
00103 KMainWindow::dropEvent(event);
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 }
00119
00120
00121 void MobileMain::optionsShowToolbar()
00122 {
00123
00124
00125 if (m_toolbarAction->isChecked())
00126 toolBar()->show();
00127 else
00128 toolBar()->hide();
00129 }
00130
00131 void MobileMain::optionsShowStatusbar()
00132 {
00133
00134
00135 if (m_statusbarAction->isChecked())
00136 statusBar()->show();
00137 else
00138 statusBar()->hide();
00139 }
00140
00141 void MobileMain::optionsConfigureKeys()
00142 {
00143 KKeyDialog::configureKeys(actionCollection(),"kandymobileui.rc");
00144 }
00145
00146 void MobileMain::optionsConfigureToolbars()
00147 {
00148
00149 KEditToolbar dlg(actionCollection());
00150 if (dlg.exec())
00151 {
00152
00153 createGUI("kandymobileui.rc");
00154 }
00155 }
00156
00157 void MobileMain::optionsPreferences()
00158 {
00159 emit showPreferencesWin();
00160 }
00161
00162 void MobileMain::showStatusMessage(const QString& text)
00163 {
00164
00165 statusBar()->message(text);
00166 }
00167
00168 void MobileMain::showTransientStatusMessage(const QString& text)
00169 {
00170
00171 statusBar()->message(text,2000);
00172 }
00173
00174 void MobileMain::changeCaption(const QString& text)
00175 {
00176
00177 setCaption(text);
00178 }
00179
00180 bool MobileMain::queryClose()
00181 {
00182 #if 0
00183 if (m_view->isModified()) {
00184 switch (KMessageBox::warningYesNoCancel(this,
00185 i18n("Save changes to profile %1?").arg(mFilename))) {
00186 case KMessageBox::Yes :
00187 fileSave();
00188 return true;
00189 case KMessageBox::No :
00190 return true;
00191 default:
00192 return false;
00193 }
00194 } else {
00195 return true;
00196 }
00197 #endif
00198 return true;
00199 }
00200
00201 void MobileMain::showTerminal()
00202 {
00203 emit showTerminalWin();
00204 }
00205
00206 void MobileMain::setConnected(bool connected)
00207 {
00208 if (connected) {
00209 statusBar()->changeItem(i18n(" Connected "),1);
00210 mView->readModelInformation();
00211 mView->refreshStatus();
00212
00213 } else {
00214 statusBar()->changeItem(i18n(" Disconnected "),1);
00215 }
00216 }
This file is part of the documentation for kdelibs Version 3.1.4.