[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdenetwork/kppp
From: Carsten Wolff <wolff () kde ! org>
Date: 2005-01-27 22:09:43
Message-ID: 20050127220943.934171CEC4 () office ! kde ! org
[Download RAW message or body]
CVS commit by wolff:
- add a "-m" cmdl parameter for directly connecting to a specified modem.
the cmdl does not change the default selection, just like the account-
parameter. I don't know if this is really the better choice, but at least
it's consistent with existing behaviour.
- implement functionality of the "--dev" cmdl parameter for overriding
the device when connecting via cmdl
M +26 -2 kpppwidget.cpp 1.42
M +3 -1 kpppwidget.h 1.11
M +1 -0 main.cpp 1.222
M +18 -4 modem.cpp 1.55
M +4 -1 modem.h 1.18
--- kdenetwork/kppp/kpppwidget.cpp #1.41:1.42
@@ -79,4 +79,5 @@ KPPPWidget::KPPPWidget( QWidget *parent,
, acct(0)
, m_bCmdlAccount (false)
+ , m_bCmdlModem (false)
{
tabWindow = 0;
@@ -288,4 +289,5 @@ KPPPWidget::KPPPWidget( QWidget *parent,
m_strCmdlAccount = args->getOption("c");
+ m_strCmdlModem = args->getOption("m");
m_bQuitOnDisconnect = args->isSet("q");
@@ -295,4 +297,19 @@ KPPPWidget::KPPPWidget( QWidget *parent,
}
+ if(!m_strCmdlModem.isEmpty()) {
+ m_bCmdlModem = true;
+ kdDebug(5002) << "cmdl_modem: " << m_bCmdlModem << endl;
+ }
+
+ if(m_bCmdlModem){
+ bool result = gpppdata.setModem(m_strCmdlModem);
+ if (!result){
+ QString string;
+ string = i18n("No such Modem:\n%1\nFalling back to default").arg(m_strCmdlModem);
+ KMessageBox::error(this, string);
+ m_bCmdlModem = false;
+ }
+ }
+
if(m_bCmdlAccount){
bool result = gpppdata.setAccount(m_strCmdlAccount);
@@ -705,5 +722,12 @@ void KPPPWidget::beginConnect() {
#endif
- QFileInfo info2(gpppdata.modemDevice());
+ KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
+ QString device = "";
+ if (args->isSet("dev"))
+ device = args->getOption("dev");
+ else
+ device = gpppdata.modemDevice();
+
+ QFileInfo info2(device);
if(!info2.exists()){
@@ -713,5 +737,5 @@ void KPPPWidget::beginConnect() {
"and/or adjust the location of the modem device on "
"the modem tab of "
- "the setup dialog.").arg(gpppdata.modemDevice());
+ "the setup dialog.").arg(device);
KMessageBox::error(this, string);
return;
--- kdenetwork/kppp/kpppwidget.h #1.10:1.11
@@ -160,6 +160,8 @@ private:
QString m_strCmdlAccount;
+ QString m_strCmdlModem;
bool m_bQuitOnDisconnect;
bool m_bCmdlAccount;
+ bool m_bCmdlModem;
bool m_bModemCShown;
--- kdenetwork/kppp/main.cpp #1.221:1.222
@@ -69,4 +69,5 @@ static const KCmdLineOptions options[] =
{
{ "c <account_name>", I18N_NOOP("Connect using 'account_name'"), 0 },
+ { "m <modem_name>", I18N_NOOP("Connect using 'modem_name'"), 0 },
{ "k", I18N_NOOP("Terminate an existing connection"), 0 },
{ "q", I18N_NOOP("Quit after end of connection"), 0 },
--- kdenetwork/kppp/modem.cpp #1.54:1.55
@@ -39,4 +39,5 @@
#include <klocale.h>
#include <kdebug.h>
+#include <kcmdlineargs.h>
#include <config.h>
@@ -53,4 +54,5 @@ Modem::Modem() :
assert(modem==0);
modem = this;
+ args = KCmdLineArgs::parsedArgs();
}
@@ -113,6 +115,12 @@ speed_t Modem::modemspeed() {
bool Modem::opentty() {
// int flags;
+ QString device = "";
+ if (args->isSet("dev"))
+ device = args->getOption("dev");
+ else
+ device = gpppdata.modemDevice();
+ kdDebug() << "Opening Device: " << device << endl;
- if((modemfd = Requester::rq->openModem(gpppdata.modemDevice()))<0) {
+ if((modemfd = Requester::rq->openModem(device))<0) {
errmsg = i18n("Unable to open modem.");
return false;
@@ -528,6 +536,12 @@ int Modem::lockdevice() {
return 1;
+ QString device = "";
+ if (args->isSet("dev"))
+ device = args->getOption("dev");
+ else
+ device = gpppdata.modemDevice();
+
QString lockfile = LOCK_DIR"/LCK..";
- lockfile += gpppdata.modemDevice().mid(5); // append everything after /dev/
+ lockfile += device.mid(5); // append everything after /dev/
if(access(QFile::encodeName(lockfile), F_OK) == 0) {
@@ -559,5 +573,5 @@ int Modem::lockdevice() {
}
- fd = Requester::rq->openLockfile(gpppdata.modemDevice(),
+ fd = Requester::rq->openLockfile(device,
O_WRONLY|O_TRUNC|O_CREAT);
if(fd >= 0) {
--- kdenetwork/kppp/modem.h #1.17:1.18
@@ -38,4 +38,6 @@
#include <config.h>
+class KCmdLineArgs;
+
void alarm_handler(int);
@@ -76,4 +78,5 @@ private slots:
private:
void escape_to_command_mode();
+ KCmdLineArgs *args;
private:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic