27 #include <tdeapplication.h>
28 #include <dcopclient.h>
29 #include <tdeaboutdata.h>
30 #include <tdecmdlineargs.h>
31 #include <tdelocale.h>
33 #include <tdemessagebox.h>
37 #include "mobilemain.h"
38 #include "mobilegui.h"
39 #include "commandscheduler.h"
40 #include "kandyprefs.h"
42 static const char description[] =
43 I18N_NOOP( "Communicating with your mobile phone.");
45 static const char version[] = "0.5.1";
47 static TDECmdLineOptions options[] =
49 { "terminal", I18N_NOOP( "Show terminal window"), 0 },
50 { "mobilegui", I18N_NOOP( "Show mobile GUI"), 0 },
51 { "nogui", I18N_NOOP( "Do not show GUI"), 0 },
52 { "+[profile]", I18N_NOOP( "Filename of command profile file"), 0 },
56 void initModem(Modem *modem)
58 kdDebug() << "Opening serial Device: "
59 << KandyPrefs::serialDevice()
62 modem->setSpeed( KandyPrefs::baudRate().toUInt() );
64 modem->setParity( 'N');
68 if (!modem->dsrOn()) {
69 KMessageBox::sorry( this, i18n( "Modem is off."), i18n( "Modem Error"));
73 if (!modem->ctsOn()) {
74 KMessageBox::sorry( this, i18n( "Modem is busy."), i18n( "Modem Error"));
84 modem->writeLine( "ATZ");
88 int main( int argc, char **argv)
90 TDEAboutData about( "kandy", I18N_NOOP( "Kandy"), version, description,
91 TDEAboutData::License_GPL, "(C) 2001 Cornelius Schumacher",0,
92 "http://kandy.kde.org/");
93 about.addAuthor( "Cornelius Schumacher", 0, "schumacher@kde.org" );
94 about.addAuthor( "Heiko Falk", 0, "hf2@ls12.cs.uni-dortmund.de" );
95 TDECmdLineArgs::init(argc,argv,&about);
96 TDECmdLineArgs::addCmdLineOptions(options);
99 TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
102 app.dcopClient()->registerAs(app.name(), false);
104 Modem *modem = new Modem(KandyPrefs::self());
105 CommandScheduler *scheduler = new CommandScheduler(modem);
108 if (app.isRestored()) {
118 if (!args->isSet( "gui")) {
120 if (KandyPrefs::startupTerminalWin() ||
121 args->isSet( "terminal")) {
124 if (KandyPrefs::startupMobileWin() ||
125 args->isSet( "mobilegui")) {
130 if (args->count() == 1) {
131 k-> load(TQFile::decodeName(args->arg(0)));
132 } else if (args->count() > 1) {
138 TQObject::connect(k,TQ_SIGNAL(showMobileWin()),m,TQ_SLOT(show()));
139 TQObject::connect(m,TQ_SIGNAL(showTerminalWin()),k,TQ_SLOT(show()));
140 TQObject::connect(m,TQ_SIGNAL(showPreferencesWin()),
141 k,TQ_SLOT(optionsPreferences()));
143 TQObject::connect( m->view(), TQ_SIGNAL( connectModem() ), k,
144 TQ_SLOT( modemConnect() ) );
145 TQObject::connect( m->view(), TQ_SIGNAL( disconnectModem() ), k,
146 TQ_SLOT( modemDisconnect() ) );
148 TQObject::connect( modem, TQ_SIGNAL( errorMessage( const TQString & ) ),
149 k, TQ_SLOT( showErrorMessage( const TQString & ) ) );
153 if ( KandyPrefs::startupModem() )
154 m->view()->toggleConnection();
This class serves as the main window for Kandy.
void load(const TQString &url) Use this method to load whatever file/URL you have.
This class serves as the main window for MobileMain.
|