diff options
Diffstat (limited to 'kopete/protocols')
-rw-r--r-- | kopete/protocols/configure.in.in | 2 | ||||
-rw-r--r-- | kopete/protocols/sms/serviceloader.cpp | 6 | ||||
-rw-r--r-- | kopete/protocols/sms/services/CMakeLists.txt | 8 | ||||
-rw-r--r-- | kopete/protocols/sms/services/ConfigureChecks.cmake | 30 | ||||
-rw-r--r-- | kopete/protocols/sms/services/config.h.cmake | 1 | ||||
-rw-r--r-- | kopete/protocols/sms/services/gsmlib.cpp | 3 | ||||
-rw-r--r-- | kopete/protocols/sms/services/gsmlib.h | 2 | ||||
-rw-r--r-- | kopete/protocols/sms/services/kopete_unix_serial.cpp | 17 | ||||
-rw-r--r-- | kopete/protocols/sms/services/kopete_unix_serial.h | 16 | ||||
-rw-r--r-- | kopete/protocols/sms/services/smssendprovider.cpp | 2 | ||||
-rw-r--r-- | kopete/protocols/sms/smsaccount.cpp | 36 | ||||
-rw-r--r-- | kopete/protocols/sms/smseditaccountwidget.cpp | 16 |
12 files changed, 56 insertions, 83 deletions
diff --git a/kopete/protocols/configure.in.in b/kopete/protocols/configure.in.in index 7a96cc9a..0e201dc7 100644 --- a/kopete/protocols/configure.in.in +++ b/kopete/protocols/configure.in.in @@ -157,5 +157,5 @@ AC_MSG_RESULT($compile_smsgsm) AM_CONDITIONAL(include_smsgsm, [test "x$compile_smsgsm" = "xyes"]) if test "x$compile_smsgsm" = "xyes"; then - AC_DEFINE(INCLUDE_SMSGSM, 1, [Define to compile with GSM SMS support]) + AC_DEFINE(HAVE_GSMLIB, 1, [Define to compile with GSM SMS support]) fi diff --git a/kopete/protocols/sms/serviceloader.cpp b/kopete/protocols/sms/serviceloader.cpp index d242e300..0e2c60a8 100644 --- a/kopete/protocols/sms/serviceloader.cpp +++ b/kopete/protocols/sms/serviceloader.cpp @@ -23,7 +23,7 @@ #include "serviceloader.h" #include "smssend.h" #include "smsclient.h" -#ifdef INCLUDE_SMSGSM +#ifdef HAVE_GSMLIB # include "gsmlib.h" #endif #include "kopeteuiglobal.h" @@ -37,7 +37,7 @@ SMSService* ServiceLoader::loadService(const TQString& name, Kopete::Account* ac s = new SMSSend(account); else if (name == "SMSClient") s = new SMSClient(account); -#ifdef INCLUDE_SMSGSM +#ifdef HAVE_GSMLIB else if (name == "GSMLib") s = new GSMLib(account); #endif @@ -56,7 +56,7 @@ TQStringList ServiceLoader::services() TQStringList toReturn; toReturn.append("SMSSend"); toReturn.append("SMSClient"); -#ifdef INCLUDE_SMSGSM +#ifdef HAVE_GSMLIB toReturn.append("GSMLib"); #endif return toReturn; diff --git a/kopete/protocols/sms/services/CMakeLists.txt b/kopete/protocols/sms/services/CMakeLists.txt index c9942bd6..2be778ad 100644 --- a/kopete/protocols/sms/services/CMakeLists.txt +++ b/kopete/protocols/sms/services/CMakeLists.txt @@ -11,22 +11,24 @@ # FIXME KDE_CXXFLAGS = $(USE_EXCEPTIONS) -include( ConfigureChecks.cmake ) - include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. + ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/kopete/libkopete ${TDE_INCLUDE_DIR} ${TQT_INCLUDE_DIRS} ) +if( WITH_GSM ) + set( GSM_SOURCES gsmlib.cpp gsmlibprefs.ui kopete_unix_serial.cpp ) +endif( ) ##### kopetesmsservices (static) ################ tde_add_library( kopetesmsservices STATIC_PIC AUTOMOC SOURCES smssend.cpp smssendprefs.ui smssendprovider.cpp smsclient.cpp - smsclientprefs.ui gsmlib.cpp gsmlibprefs.ui kopete_unix_serial.cpp + smsclientprefs.ui ${GSM_SOURCES} LINK ${GSM_LIBRARY} ) diff --git a/kopete/protocols/sms/services/ConfigureChecks.cmake b/kopete/protocols/sms/services/ConfigureChecks.cmake deleted file mode 100644 index 4ed454b4..00000000 --- a/kopete/protocols/sms/services/ConfigureChecks.cmake +++ /dev/null @@ -1,30 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -if( WITH_GSM ) - - tde_save( CMAKE_REQUIRED_INCLUDES ) - set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} ) - check_include_file_cxx( gsmlib/gsm_util.h HAVE_GSMLIB_GSM_UTIL_H ) - tde_restore( CMAKE_REQUIRED_INCLUDES ) - - if( HAVE_GSMLIB_GSM_UTIL_H ) - set( INCLUDE_SMSGSM 1 ) - find_library( GSM_LIBRARY gsmme ) - endif( ) - - if( NOT (HAVE_GSMLIB_GSM_UTIL_H AND GSM_LIBRARY) ) - tde_message_fatal( "gsmlib is required, but was not found on your system" ) - endif( ) - -endif( ) - -configure_file( config.h.cmake config.h @ONLY ) diff --git a/kopete/protocols/sms/services/config.h.cmake b/kopete/protocols/sms/services/config.h.cmake deleted file mode 100644 index 9555d535..00000000 --- a/kopete/protocols/sms/services/config.h.cmake +++ /dev/null @@ -1 +0,0 @@ -#cmakedefine INCLUDE_SMSGSM 1 diff --git a/kopete/protocols/sms/services/gsmlib.cpp b/kopete/protocols/sms/services/gsmlib.cpp index 6c4b3289..55bdecac 100644 --- a/kopete/protocols/sms/services/gsmlib.cpp +++ b/kopete/protocols/sms/services/gsmlib.cpp @@ -13,7 +13,6 @@ ************************************************************************* */ #include "config.h" -#ifdef INCLUDE_SMSGSM #include <tqcombobox.h> #include <tqlayout.h> @@ -449,5 +448,3 @@ const TQString& GSMLib::description() } #include "gsmlib.moc" - -#endif diff --git a/kopete/protocols/sms/services/gsmlib.h b/kopete/protocols/sms/services/gsmlib.h index aa1bea5f..608c1f4c 100644 --- a/kopete/protocols/sms/services/gsmlib.h +++ b/kopete/protocols/sms/services/gsmlib.h @@ -17,7 +17,6 @@ #define GSMLIB_H_039562406 #include "config.h" -#ifdef INCLUDE_SMSGSM #include <unistd.h> @@ -148,5 +147,4 @@ protected: TQMutex m_outMessagesMutex; }; -#endif #endif //GSMLIB_H_039562406 diff --git a/kopete/protocols/sms/services/kopete_unix_serial.cpp b/kopete/protocols/sms/services/kopete_unix_serial.cpp index fc532ffd..84dfd839 100644 --- a/kopete/protocols/sms/services/kopete_unix_serial.cpp +++ b/kopete/protocols/sms/services/kopete_unix_serial.cpp @@ -11,7 +11,6 @@ // * Created: 10.5.1999 // ************************************************************************* #include "config.h" -#ifdef INCLUDE_SMSGSM #include <gsmlib/gsm_util.h> #include <termios.h> @@ -88,7 +87,7 @@ static void stopTimer() // KopeteUnixSerialPort members -void KopeteUnixSerialPort::throwModemException(string message) throw(GsmException) +void KopeteUnixSerialPort::throwModemException(string message) { ostringstream os; os << message << " (errno: " << errno << "/" << strerror(errno) << ")"; @@ -101,7 +100,7 @@ void KopeteUnixSerialPort::putBack(unsigned char c) _oldChar = c; } -int KopeteUnixSerialPort::readByte() throw(GsmException) +int KopeteUnixSerialPort::readByte() { if (_oldChar != -1) { @@ -166,8 +165,7 @@ int KopeteUnixSerialPort::readByte() throw(GsmException) } KopeteUnixSerialPort::KopeteUnixSerialPort(string device, speed_t lineSpeed, - string initString, bool swHandshake) - throw(GsmException) : + string initString, bool swHandshake) : _oldChar(-1), _timeoutVal(TIMEOUT_SECS) { _readNotifier = NULL; @@ -326,7 +324,7 @@ KopeteUnixSerialPort::KopeteUnixSerialPort(string device, speed_t lineSpeed, throwModemException("reset modem failed"); } -string KopeteUnixSerialPort::getLine() throw(GsmException) +string KopeteUnixSerialPort::getLine() { string result; int c; @@ -349,8 +347,7 @@ string KopeteUnixSerialPort::getLine() throw(GsmException) return result; } -void KopeteUnixSerialPort::putLine(string line, - bool carriageReturn) throw(GsmException) +void KopeteUnixSerialPort::putLine(string line, bool carriageReturn) { #ifndef NDEBUG if (debugLevel() >= 1) @@ -418,7 +415,7 @@ void KopeteUnixSerialPort::putLine(string line, // in order to properly handle unsolicited result codes from the ME/TA } -bool KopeteUnixSerialPort::wait(GsmTime timeout) throw(GsmException) +bool KopeteUnixSerialPort::wait(GsmTime timeout) { fd_set fds; FD_ZERO(&fds); @@ -441,5 +438,3 @@ KopeteUnixSerialPort::~KopeteUnixSerialPort() } #include "kopete_unix_serial.moc" - -#endif diff --git a/kopete/protocols/sms/services/kopete_unix_serial.h b/kopete/protocols/sms/services/kopete_unix_serial.h index fd8ed74c..9da7a9ce 100644 --- a/kopete/protocols/sms/services/kopete_unix_serial.h +++ b/kopete/protocols/sms/services/kopete_unix_serial.h @@ -15,7 +15,6 @@ #define GSM_UNIX_SERIAL_KOPETE_H #include "config.h" -#ifdef INCLUDE_SMSGSM #include <string> #include <gsmlib/gsm_error.h> @@ -43,23 +42,21 @@ protected: TQSocketNotifier* _readNotifier; // throw GsmException include UNIX errno - void throwModemException(std::string message) throw(GsmException); + void throwModemException(std::string message); public: // create Port given the UNIX device name KopeteUnixSerialPort(std::string device, speed_t lineSpeed = DEFAULT_BAUD_RATE, std::string initString = DEFAULT_INIT_STRING, - bool swHandshake = false) - throw(GsmException); + bool swHandshake = false); virtual ~KopeteUnixSerialPort(); // inherited from Port void putBack(unsigned char c); - int readByte() throw(GsmException); - std::string getLine() throw(GsmException); - void putLine(std::string line, - bool carriageReturn = true) throw(GsmException); - bool wait(GsmTime timeout) throw(GsmException); + int readByte(); + std::string getLine(); + void putLine(std::string line, bool carriageReturn = true); + bool wait(GsmTime timeout); void setTimeOut(unsigned int timeout); signals: @@ -67,5 +64,4 @@ signals: }; } -#endif #endif // GSM_UNIX_SERIAL_KOPETE_H diff --git a/kopete/protocols/sms/services/smssendprovider.cpp b/kopete/protocols/sms/services/smssendprovider.cpp index 24ea8bdc..6eac2e14 100644 --- a/kopete/protocols/sms/services/smssendprovider.cpp +++ b/kopete/protocols/sms/services/smssendprovider.cpp @@ -150,7 +150,7 @@ void SMSSendProvider::setAccount(Kopete::Account *account) const TQString& SMSSendProvider::name(int i) { if ( telPos == i || messagePos == i) - return TQString(); + return TQString::null; else return names[i]; } diff --git a/kopete/protocols/sms/smsaccount.cpp b/kopete/protocols/sms/smsaccount.cpp index eddf3508..34ad48fc 100644 --- a/kopete/protocols/sms/smsaccount.cpp +++ b/kopete/protocols/sms/smsaccount.cpp @@ -35,25 +35,11 @@ #include "smscontact.h" SMSAccount::SMSAccount( SMSProtocol *parent, const TQString &accountID, const char *name ) - : Kopete::Account( parent, accountID, name ) + : Kopete::Account( parent, accountID, name ), theService(nullptr) { setMyself( new SMSContact(this, accountID, accountID, Kopete::ContactList::self()->myself()) ); loadConfig(); myself()->setOnlineStatus( SMSProtocol::protocol()->SMSOffline ); - - TQString sName = configGroup()->readEntry("ServiceName", TQString()); - theService = ServiceLoader::loadService(sName, this); - - if( theService ) - { - TQObject::connect (theService, TQ_SIGNAL(messageSent(const Kopete::Message &)), - this, TQ_SLOT(slotSendingSuccess(const Kopete::Message &))); - TQObject::connect (theService, TQ_SIGNAL(messageNotSent(const Kopete::Message &, const TQString &)), - this, TQ_SLOT(slotSendingFailure(const Kopete::Message &, const TQString &))); - TQObject::connect (theService, TQ_SIGNAL(connected()), this, TQ_SLOT(slotConnected())); - TQObject::connect (theService, TQ_SIGNAL(disconnected()), this, TQ_SLOT(slotDisconnected())); - } - } SMSAccount::~SMSAccount() @@ -64,9 +50,29 @@ SMSAccount::~SMSAccount() void SMSAccount::loadConfig() { + TQString serviceName = configGroup()->readEntry("ServiceName", TQString()); theSubEnable = configGroup()->readBoolEntry("SubEnable", false); theSubCode = configGroup()->readEntry("SubCode", TQString()); theLongMsgAction = (SMSMsgAction)configGroup()->readNumEntry("MsgAction", 0); + + if( theService && theService->name() != serviceName ) + { + delete theService; + theService = nullptr; + } + + if( !theService && !serviceName.isEmpty() ) + theService = ServiceLoader::loadService(serviceName, this); + + if( theService ) + { + TQObject::connect (theService, TQ_SIGNAL(messageSent(const Kopete::Message &)), + this, TQ_SLOT(slotSendingSuccess(const Kopete::Message &))); + TQObject::connect (theService, TQ_SIGNAL(messageNotSent(const Kopete::Message &, const TQString &)), + this, TQ_SLOT(slotSendingFailure(const Kopete::Message &, const TQString &))); + TQObject::connect (theService, TQ_SIGNAL(connected()), this, TQ_SLOT(slotConnected())); + TQObject::connect (theService, TQ_SIGNAL(disconnected()), this, TQ_SLOT(slotDisconnected())); + } } void SMSAccount::translateNumber(TQString &theNumber) diff --git a/kopete/protocols/sms/smseditaccountwidget.cpp b/kopete/protocols/sms/smseditaccountwidget.cpp index 5994534d..6283c2dd 100644 --- a/kopete/protocols/sms/smseditaccountwidget.cpp +++ b/kopete/protocols/sms/smseditaccountwidget.cpp @@ -92,18 +92,28 @@ bool SMSEditAccountWidget::validateData() Kopete::Account* SMSEditAccountWidget::apply() { - if (!account()) - setAccount( new SMSAccount( m_protocol, preferencesDialog->accountId->text() ) ); + SMSAccount *smsAccount; + + if (account()) { + smsAccount = dynamic_cast<SMSAccount*>(account()); + } else { + smsAccount = new SMSAccount( m_protocol, + preferencesDialog->accountId->text() ); + setAccount( smsAccount ); + } + Q_ASSERT( smsAccount ); if (service) service->setAccount(account()); - + TDEConfigGroup *c = account()->configGroup(); c->writeEntry("ServiceName", preferencesDialog->serviceName->currentText()); c->writeEntry("SubEnable", preferencesDialog->subEnable->isChecked() ? "true" : "false"); c->writeEntry("SubCode", preferencesDialog->subCode->text()); c->writeEntry("MsgAction", preferencesDialog->ifMessageTooLong->currentItem()); + smsAccount->loadConfig(); + emit saved(); return account(); } |