From 85a753d68eb8900ba94ce89f9638269858645e19 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Thu, 4 Jun 2015 16:42:26 +0200 Subject: Application fully ported to Qt4 (no Qt3Support used any more) --- CMakeLists.txt | 2 +- src/gui/CMakeLists.txt | 3 +- src/gui/addresscardform.cpp | 26 +- src/gui/addresscardform.h | 2 +- src/gui/authenticationform.cpp | 4 +- src/gui/authenticationform.h | 2 +- src/gui/buddyform.cpp | 30 +-- src/gui/buddyform.h | 8 +- src/gui/buddylistview.cpp | 70 +++-- src/gui/buddylistview.h | 15 +- src/gui/diamondcardprofileform.cpp | 23 +- src/gui/diamondcardprofileform.h | 2 +- src/gui/getaddressform.cpp | 10 +- src/gui/getaddressform.h | 2 +- src/gui/getprofilenameform.cpp | 4 +- src/gui/getprofilenameform.h | 2 +- src/gui/gui.cpp | 170 ++++++------ src/gui/historyform.cpp | 19 +- src/gui/historyform.h | 4 +- src/gui/historyform.ui | 1 - src/gui/inviteform.cpp | 22 +- src/gui/inviteform.h | 2 +- src/gui/logviewform.cpp | 8 +- src/gui/logviewform.ui | 1 - src/gui/main.cpp | 38 +-- src/gui/messageform.cpp | 58 +++-- src/gui/messageform.h | 4 +- src/gui/messageform.ui | 7 - src/gui/mphoneform.cpp | 520 +++++++++++++++++++------------------ src/gui/mphoneform.h | 30 +-- src/gui/mphoneform.ui | 219 ++++++++-------- src/gui/numberconversionform.cpp | 8 +- src/gui/qt_translator.h | 4 +- src/gui/redirectform.cpp | 26 +- src/gui/redirectform.h | 2 +- src/gui/selectnicform.cpp | 4 +- src/gui/selectnicform.h | 2 +- src/gui/selectprofileform.cpp | 79 +++--- src/gui/selectprofileform.h | 2 +- src/gui/selectprofileform.ui | 1 - src/gui/selectuserform.cpp | 10 +- src/gui/selectuserform.h | 2 +- src/gui/sendfileform.cpp | 15 +- src/gui/sendfileform.h | 2 +- src/gui/srvredirectform.cpp | 55 ++-- src/gui/srvredirectform.h | 2 +- src/gui/syssettingsform.cpp | 74 +++--- src/gui/syssettingsform.h | 2 +- src/gui/termcapform.cpp | 16 +- src/gui/termcapform.h | 2 +- src/gui/textbrowsernoautolink.h | 4 +- src/gui/transferform.cpp | 21 +- src/gui/transferform.h | 2 +- src/gui/twinkleapplication.cpp | 2 +- src/gui/userprofileform.cpp | 223 ++++++++-------- src/gui/userprofileform.h | 2 +- src/gui/userprofileform.ui | 1 - src/gui/wizardform.cpp | 44 ++-- src/gui/wizardform.h | 2 +- src/gui/yesnodialog.cpp | 16 +- 60 files changed, 978 insertions(+), 955 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e4e3ad..4f77b0e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ OPTION(WITH_DIAMONDCARD "Enable Diamondcard integration" OFF) list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake") include (CheckIncludeFile) -find_package(Qt4 REQUIRED COMPONENTS QTGUI QT3SUPPORT) +find_package(Qt4 REQUIRED COMPONENTS QTGUI) find_package(LibXml2 REQUIRED) find_package(LibMagic REQUIRED) find_package(LibSndfile REQUIRED) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 5d83504..fea57d5 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -1,6 +1,5 @@ project(twinkle-gui) -add_definitions(-DQT3_SUPPORT) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) @@ -144,7 +143,7 @@ add_executable(twinkle ${TWINKLE_GUI-SRCS}) target_link_libraries(twinkle -lpthread -lresolv ${LibMagic_LIBRARY} ${LIBXML2_LIBRARIES} ${Readline_LIBRARY} ${ILBC_LIBRARIES} ${SPEEX_LIBRARIES} ${ZRTPCPP_LIBRARIES} ${CCRTP_LIBRARIES} ${COMMONCPP_LIBRARIES} ${UCOMMON_LIBRARIES} ${LIBSNDFILE_LIBRARY} - ${Boost_LIBRARIES} Qt4::QtGui Qt4::Qt3Support ${ALSA_LIBRARY}) + ${Boost_LIBRARIES} Qt4::QtGui ${ALSA_LIBRARY}) install(TARGETS twinkle DESTINATION bin) install(FILES ${twinkle_LANG} DESTINATION share/twinkle/lang) diff --git a/src/gui/addresscardform.cpp b/src/gui/addresscardform.cpp index 6dcae68..e735b13 100644 --- a/src/gui/addresscardform.cpp +++ b/src/gui/addresscardform.cpp @@ -26,8 +26,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -AddressCardForm::AddressCardForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +AddressCardForm::AddressCardForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -61,11 +61,11 @@ int AddressCardForm::exec(t_address_card &card) { int retval = QDialog::exec(); if (retval == QDialog::Accepted) { - card.name_first = firstNameLineEdit->text().stripWhiteSpace().ascii(); - card.name_infix = infixNameLineEdit->text().stripWhiteSpace().ascii(); - card.name_last = lastNameLineEdit->text().stripWhiteSpace().ascii(); - card.sip_address = phoneLineEdit->text().stripWhiteSpace().ascii(); - card.remark = remarkLineEdit->text().stripWhiteSpace().ascii(); + card.name_first = firstNameLineEdit->text().trimmed().toStdString(); + card.name_infix = infixNameLineEdit->text().trimmed().toStdString(); + card.name_last = lastNameLineEdit->text().trimmed().toStdString(); + card.sip_address = phoneLineEdit->text().trimmed().toStdString(); + card.remark = remarkLineEdit->text().trimmed().toStdString(); } return retval; @@ -73,21 +73,21 @@ int AddressCardForm::exec(t_address_card &card) { void AddressCardForm::validate() { - QString firstName = firstNameLineEdit->text().stripWhiteSpace(); - QString infixName = infixNameLineEdit->text().stripWhiteSpace(); - QString lastName = lastNameLineEdit->text().stripWhiteSpace(); - QString phone = phoneLineEdit->text().stripWhiteSpace(); + QString firstName = firstNameLineEdit->text().trimmed(); + QString infixName = infixNameLineEdit->text().trimmed(); + QString lastName = lastNameLineEdit->text().trimmed(); + QString phone = phoneLineEdit->text().trimmed(); if (firstName.isEmpty() && infixName.isEmpty() && lastName.isEmpty()) { ((t_gui *)ui)->cb_show_msg(this, - tr("You must fill in a name.").ascii(), MSG_CRITICAL); + tr("You must fill in a name.").toStdString(), MSG_CRITICAL); firstNameLineEdit->setFocus(); return; } if (phone.isEmpty()) { ((t_gui *)ui)->cb_show_msg(this, - tr("You must fill in a phone number or SIP address.").ascii(), MSG_CRITICAL); + tr("You must fill in a phone number or SIP address.").toStdString(), MSG_CRITICAL); phoneLineEdit->setFocus(); return; } diff --git a/src/gui/addresscardform.h b/src/gui/addresscardform.h index 391219c..0f8e0d0 100644 --- a/src/gui/addresscardform.h +++ b/src/gui/addresscardform.h @@ -8,7 +8,7 @@ class AddressCardForm : public QDialog, public Ui::AddressCardForm Q_OBJECT public: - AddressCardForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + AddressCardForm(QWidget* parent = 0); ~AddressCardForm(); virtual int exec( t_address_card & card ); diff --git a/src/gui/authenticationform.cpp b/src/gui/authenticationform.cpp index df34a6e..74933d1 100644 --- a/src/gui/authenticationform.cpp +++ b/src/gui/authenticationform.cpp @@ -24,8 +24,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -AuthenticationForm::AuthenticationForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +AuthenticationForm::AuthenticationForm(QWidget* parent) + : QDialog(parent) { setupUi(this); diff --git a/src/gui/authenticationform.h b/src/gui/authenticationform.h index 70b4a93..98ceaf0 100644 --- a/src/gui/authenticationform.h +++ b/src/gui/authenticationform.h @@ -8,7 +8,7 @@ class AuthenticationForm : public QDialog, public Ui::AuthenticationForm Q_OBJECT public: - AuthenticationForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + AuthenticationForm(QWidget* parent = 0); ~AuthenticationForm(); virtual int exec( t_user * user_config, const QString & realm, QString & username, QString & password ); diff --git a/src/gui/buddyform.cpp b/src/gui/buddyform.cpp index a8ae059..fbbf222 100644 --- a/src/gui/buddyform.cpp +++ b/src/gui/buddyform.cpp @@ -28,8 +28,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -BuddyForm::BuddyForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +BuddyForm::BuddyForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -68,7 +68,7 @@ void BuddyForm::destroy() } } -void BuddyForm::showNew(t_buddy_list &_buddy_list, Q3ListViewItem *_profileItem) +void BuddyForm::showNew(t_buddy_list &_buddy_list, QTreeWidgetItem *_profileItem) { user_config = _buddy_list.get_user_profile(); edit_mode = false; @@ -98,21 +98,21 @@ void BuddyForm::showEdit(t_buddy &buddy) void BuddyForm::validate() { - QString name = nameLineEdit->text().stripWhiteSpace(); - QString address = phoneLineEdit->text().stripWhiteSpace(); + QString name = nameLineEdit->text().trimmed(); + QString address = phoneLineEdit->text().trimmed(); if (name.isEmpty()) { ((t_gui *)ui)->cb_show_msg(this, - tr("You must fill in a name.").ascii(), MSG_CRITICAL); + tr("You must fill in a name.").toStdString(), MSG_CRITICAL); nameLineEdit->setFocus(); return; } - string dest = ui->expand_destination(user_config, address.ascii()); + string dest = ui->expand_destination(user_config, address.toStdString()); t_url dest_url(dest); if (!dest_url.is_valid()) { ((t_gui *)ui)->cb_show_msg(this, - tr("Invalid phone.").ascii(), MSG_CRITICAL); + tr("Invalid phone.").toStdString(), MSG_CRITICAL); phoneLineEdit->setFocus(); return; } @@ -131,8 +131,8 @@ void BuddyForm::validate() } } - edit_buddy->set_name(nameLineEdit->text().stripWhiteSpace().ascii()); - edit_buddy->set_sip_address(phoneLineEdit->text().stripWhiteSpace().ascii()); + edit_buddy->set_name(nameLineEdit->text().trimmed().toStdString()); + edit_buddy->set_sip_address(phoneLineEdit->text().trimmed().toStdString()); edit_buddy->set_may_subscribe_presence(subscribeCheckBox->isChecked()); if (must_subscribe) edit_buddy->subscribe_presence(); @@ -140,8 +140,8 @@ void BuddyForm::validate() } else { // Add a new buddy t_buddy buddy; - buddy.set_name(nameLineEdit->text().stripWhiteSpace().ascii()); - buddy.set_sip_address(phoneLineEdit->text().stripWhiteSpace().ascii()); + buddy.set_name(nameLineEdit->text().trimmed().toStdString()); + buddy.set_sip_address(phoneLineEdit->text().trimmed().toStdString()); buddy.set_may_subscribe_presence(subscribeCheckBox->isChecked()); t_buddy *new_buddy = buddy_list->add_buddy(buddy); @@ -152,7 +152,7 @@ void BuddyForm::validate() string err_msg; if (!buddy_list->save(err_msg)) { QString msg = tr("Failed to save buddy list: %1").arg(err_msg.c_str()); - ((t_gui *)ui)->cb_show_msg(this, msg.ascii(), MSG_CRITICAL); + ((t_gui *)ui)->cb_show_msg(this, msg.toStdString(), MSG_CRITICAL); } accept(); @@ -161,8 +161,8 @@ void BuddyForm::validate() void BuddyForm::showAddressBook() { if (!getAddressForm) { - getAddressForm = new GetAddressForm( - this, "select address", true); + getAddressForm = new GetAddressForm(this); + getAddressForm->setModal(true); MEMMAN_NEW(getAddressForm); } diff --git a/src/gui/buddyform.h b/src/gui/buddyform.h index 0df335f..7f63f47 100644 --- a/src/gui/buddyform.h +++ b/src/gui/buddyform.h @@ -2,7 +2,7 @@ #define BUDDYFORM_H #include "getaddressform.h" #include "presence/buddy.h" -#include +#include #include "user.h" #include "ui_buddyform.h" @@ -11,11 +11,11 @@ class BuddyForm : public QDialog, public Ui::BuddyForm Q_OBJECT public: - BuddyForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + BuddyForm(QWidget* parent = 0); ~BuddyForm(); public slots: - virtual void showNew( t_buddy_list & _buddy_list, Q3ListViewItem * _profileItem ); + virtual void showNew( t_buddy_list & _buddy_list, QTreeWidgetItem * _profileItem ); virtual void showEdit( t_buddy & buddy ); virtual void validate(); virtual void showAddressBook(); @@ -30,7 +30,7 @@ private: bool edit_mode; t_buddy_list *buddy_list; t_buddy *edit_buddy; - Q3ListViewItem *profileItem; + QTreeWidgetItem *profileItem; void init(); void destroy(); diff --git a/src/gui/buddylistview.cpp b/src/gui/buddylistview.cpp index 092169f..8cb7629 100644 --- a/src/gui/buddylistview.cpp +++ b/src/gui/buddylistview.cpp @@ -22,43 +22,40 @@ #include "qapplication.h" #include "qfont.h" -#include "q3header.h" #include "qpixmap.h" #include "qrect.h" #include "qsize.h" -#include "q3stylesheet.h" -//Added by qt3to4: -#include +#include void AbstractBLVItem::set_icon(t_presence_state::t_basic_state state) { switch (state) { case t_presence_state::ST_BASIC_UNKNOWN: - setPixmap(0, QPixmap(":/icons/images/presence_unknown.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/presence_unknown.png")); break; case t_presence_state::ST_BASIC_CLOSED: - setPixmap(0, QPixmap(":/icons/images/presence_offline.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/presence_offline.png")); break; case t_presence_state::ST_BASIC_OPEN: - setPixmap(0, QPixmap(":/icons/images/presence_online.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/presence_online.png")); break; case t_presence_state::ST_BASIC_FAILED: - setPixmap(0, QPixmap(":/icons/images/presence_failed.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/presence_failed.png")); break; case t_presence_state::ST_BASIC_REJECTED: - setPixmap(0, QPixmap(":/icons/images/presence_rejected.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/presence_rejected.png")); break; default: - setPixmap(0, QPixmap(":/icons/images/presence_unknown.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/presence_unknown.png")); break; } } -AbstractBLVItem::AbstractBLVItem(Q3ListViewItem *parent, const QString &text) : - Q3ListViewItem(parent, text) +AbstractBLVItem::AbstractBLVItem(QTreeWidgetItem *parent, const QString &text) : + QTreeWidgetItem(parent, QStringList(text)) {} -AbstractBLVItem::AbstractBLVItem(Q3ListView *parent, const QString &text) : - Q3ListViewItem(parent, text) +AbstractBLVItem::AbstractBLVItem(QTreeWidget *parent, const QString &text) : + QTreeWidgetItem(parent, QStringList(text)) {} AbstractBLVItem::~AbstractBLVItem() {} @@ -73,10 +70,10 @@ void BuddyListViewItem::set_icon(void) { string url_str = ui->expand_destination(user_config, buddy->get_sip_address()); tip = ""; - tip += Q3StyleSheet::escape(ui->format_sip_address(user_config, buddy->get_name(), t_url(url_str)).c_str()).replace(' ', " "); + tip += Qt::escape(QString::fromStdString(ui->format_sip_address(user_config, buddy->get_name(), t_url(url_str)))).replace(' ', " "); if (!buddy->get_may_subscribe_presence()) { - setPixmap(0, QPixmap(":/icons/images/buddy.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/buddy.png")); } else { QString failure; t_presence_state::t_basic_state basic_state = buddy-> @@ -100,7 +97,7 @@ void BuddyListViewItem::set_icon(void) { break; case t_presence_state::ST_BASIC_FAILED: tip += qApp->translate("BuddyList", "request failed"); - failure = buddy->get_presence_state()->get_failure_msg().c_str(); + failure = QString::fromStdString(buddy->get_presence_state()->get_failure_msg()); if (!failure.isEmpty()) { tip += QString(" (%1)").arg(failure); } @@ -118,8 +115,8 @@ void BuddyListViewItem::set_icon(void) { tip = tip.replace(' ', " "); } -BuddyListViewItem::BuddyListViewItem(Q3ListViewItem *parent, t_buddy *_buddy) : - AbstractBLVItem(parent, _buddy->get_name().c_str()), +BuddyListViewItem::BuddyListViewItem(QTreeWidgetItem *parent, t_buddy *_buddy) : + AbstractBLVItem(parent, QString::fromStdString(_buddy->get_name())), buddy(_buddy) { set_icon(); @@ -137,8 +134,8 @@ void BuddyListViewItem::update_slot(void) { set_icon(); if (buddy->get_name().c_str() != text(0)) { - setText(0, buddy->get_name().c_str()); - Q3ListViewItem::parent()->sort(); + setText(0, QString::fromStdString(buddy->get_name())); + QTreeWidgetItem::treeWidget()->sortItems(0, Qt::AscendingOrder); } ui->unlock(); } @@ -159,10 +156,10 @@ t_buddy *BuddyListViewItem::get_buddy(void) { void BLViewUserItem::set_icon(void) { t_presence_state::t_basic_state basic_state; QString failure; - QString profile_name = presence_epa->get_user_profile()->get_profile_name().c_str(); + QString profile_name = QString::fromStdString(presence_epa->get_user_profile()->get_profile_name()); tip = ""; - tip += Q3StyleSheet::escape(profile_name); + tip += Qt::escape(profile_name); tip += "
"; tip += ""; tip += qApp->translate("BuddyList", "Availability"); @@ -171,7 +168,7 @@ void BLViewUserItem::set_icon(void) { switch (presence_epa->get_epa_state()) { case t_presence_epa::EPA_UNPUBLISHED: tip += qApp->translate("BuddyList", "not published"); - setPixmap(0, QPixmap(":/icons/images/penguin-small.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/penguin-small.png")); break; case t_presence_epa::EPA_FAILED: tip += qApp->translate("BuddyList", "failed to publish"); @@ -179,7 +176,7 @@ void BLViewUserItem::set_icon(void) { if (!failure.isEmpty()) { tip += QString(" (%1)").arg(failure); } - setPixmap(0, QPixmap(":/icons/images/presence_failed.png")); + setData(0, Qt::DecorationRole, QPixmap(":/icons/images/presence_failed.png")); break; case t_presence_epa::EPA_PUBLISHED: basic_state = presence_epa->get_basic_state(); @@ -208,38 +205,31 @@ void BLViewUserItem::set_icon(void) { tip = tip.replace(' ', " "); } -BLViewUserItem::BLViewUserItem(Q3ListView *parent, t_presence_epa *_presence_epa) : - AbstractBLVItem(parent, _presence_epa->get_user_profile()->get_profile_name().c_str()), +BLViewUserItem::BLViewUserItem(QTreeWidget *parent, t_presence_epa *_presence_epa) : + AbstractBLVItem(parent, QString::fromStdString(_presence_epa->get_user_profile()->get_profile_name())), presence_epa(_presence_epa) { set_icon(); presence_epa->attach(this); QObject::connect(this, SIGNAL(update_signal()), this, SLOT(update_slot())); + + QFont font = this->font(0); + font.setBold(true); + this->setFont(0, font); } BLViewUserItem::~BLViewUserItem() { presence_epa->detach(this); } -void BLViewUserItem::paintCell(QPainter *painter, const QColorGroup &cg, - int column, int width, int align) -{ - painter->save(); - QFont font = painter->font(); - font.setBold(true); - painter->setFont(font); - Q3ListViewItem::paintCell(painter, cg, column, width, align); - painter->restore(); -} - void BLViewUserItem::update_slot(void) { // This method is called directly from the core, so lock the GUI ui->lock(); set_icon(); if (presence_epa->get_user_profile()->get_profile_name().c_str() == text(0)) { - setText(0, presence_epa->get_user_profile()->get_profile_name().c_str()); - Q3ListViewItem::listView()->sort(); + setText(0, QString::fromStdString(presence_epa->get_user_profile()->get_profile_name())); + QTreeWidgetItem::treeWidget()->sortItems(0, Qt::AscendingOrder); } ui->unlock(); } diff --git a/src/gui/buddylistview.h b/src/gui/buddylistview.h index ef1b4cc..8e200c7 100644 --- a/src/gui/buddylistview.h +++ b/src/gui/buddylistview.h @@ -19,14 +19,14 @@ #ifndef BUDDYLISTVIEW_H #define BUDDYLISTVIEW_H -#include "q3listview.h" +#include #include "qpainter.h" #include "qtooltip.h" #include "presence/buddy.h" #include "presence/presence_epa.h" #include "patterns/observer.h" -class AbstractBLVItem : public Q3ListViewItem { +class AbstractBLVItem : public QTreeWidgetItem { protected: // Text to show as a tool tip. QString tip; @@ -35,8 +35,8 @@ protected: virtual void set_icon(t_presence_state::t_basic_state state); public: - AbstractBLVItem(Q3ListViewItem *parent, const QString &text); - AbstractBLVItem(Q3ListView *parent, const QString &text); + AbstractBLVItem(QTreeWidgetItem *parent, const QString &text); + AbstractBLVItem(QTreeWidget *parent, const QString &text); virtual ~AbstractBLVItem(); virtual QString get_tip(void); }; @@ -51,7 +51,7 @@ private: void set_icon(void); public: - BuddyListViewItem(Q3ListViewItem *parent, t_buddy *_buddy); + BuddyListViewItem(QTreeWidgetItem *parent, t_buddy *_buddy); virtual ~BuddyListViewItem(); virtual void update(void); @@ -75,12 +75,9 @@ private: void set_icon(void); public: - BLViewUserItem(Q3ListView *parent, t_presence_epa *_presence_epa); + BLViewUserItem(QTreeWidget *parent, t_presence_epa *_presence_epa); virtual ~BLViewUserItem(); - void paintCell(QPainter *painter, const QColorGroup &cg, - int column, int width, int align); - virtual void update(void); virtual void subject_destroyed(void); diff --git a/src/gui/diamondcardprofileform.cpp b/src/gui/diamondcardprofileform.cpp index f989045..c8d5938 100644 --- a/src/gui/diamondcardprofileform.cpp +++ b/src/gui/diamondcardprofileform.cpp @@ -34,8 +34,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -DiamondcardProfileForm::DiamondcardProfileForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +DiamondcardProfileForm::DiamondcardProfileForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -113,14 +113,14 @@ int DiamondcardProfileForm::exec(t_user *user) void DiamondcardProfileForm::validate() { if (accountIdLineEdit->text().isEmpty()) { - ((t_gui *)ui)->cb_show_msg(this, tr("Fill in your account ID.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Fill in your account ID.").toStdString(), MSG_CRITICAL); accountIdLineEdit->setFocus(); return; } if (pinCodeLineEdit->text().isEmpty()) { - ((t_gui *)ui)->cb_show_msg(this, tr("Fill in your PIN code.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Fill in your PIN code.").toStdString(), MSG_CRITICAL); pinCodeLineEdit->setFocus(); return; @@ -132,13 +132,14 @@ void DiamondcardProfileForm::validate() filename.append(USER_FILE_EXT); // Create a new user config - while (!user_config->set_config(filename.ascii())) { + while (!user_config->set_config(filename.toStdString())) { ((t_gui *)ui)->cb_show_msg(this, - tr("A user profile with name %1 already exists.").arg(profileName).ascii(), + tr("A user profile with name %1 already exists.").arg(profileName).toStdString(), MSG_WARNING); // Ask user for a profile name - GetProfileNameForm getProfileNameForm(this, "get profile name", true); + GetProfileNameForm getProfileNameForm(this); + getProfileNameForm.setModal(true); if (!getProfileNameForm.execNewName()) return; profileName = getProfileNameForm.getProfileName(); @@ -147,9 +148,9 @@ void DiamondcardProfileForm::validate() } diamondcard_set_user_config(*user_config, - nameLineEdit->text().ascii(), - accountIdLineEdit->text().ascii(), - pinCodeLineEdit->text().ascii()); + nameLineEdit->text().toStdString(), + accountIdLineEdit->text().toStdString(), + pinCodeLineEdit->text().toStdString()); string error_msg; if (!user_config->write_config(user_config->get_filename(), error_msg)) { @@ -175,7 +176,7 @@ void DiamondcardProfileForm::mouseReleaseEvent(QMouseEvent *e) void DiamondcardProfileForm::processLeftMouseButtonRelease(QMouseEvent *e) { - if (signUpTextLabel->hasMouse()) { + if (signUpTextLabel->testAttribute(Qt::WA_UnderMouse)) { string url = diamondcard_url(DC_ACT_SIGNUP, "", ""); ((t_gui *)ui)->open_url_in_browser(url.c_str()); } else { diff --git a/src/gui/diamondcardprofileform.h b/src/gui/diamondcardprofileform.h index 48224c9..5d74562 100644 --- a/src/gui/diamondcardprofileform.h +++ b/src/gui/diamondcardprofileform.h @@ -10,7 +10,7 @@ class DiamondcardProfileForm : public QDialog, public Ui::DiamondcardProfileForm Q_OBJECT public: - DiamondcardProfileForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + DiamondcardProfileForm(QWidget* parent = 0); ~DiamondcardProfileForm(); virtual int exec( t_user * user ); diff --git a/src/gui/getaddressform.cpp b/src/gui/getaddressform.cpp index dd45263..a186885 100644 --- a/src/gui/getaddressform.cpp +++ b/src/gui/getaddressform.cpp @@ -40,8 +40,8 @@ #define AB_COL_PHONE 2 #endif -GetAddressForm::GetAddressForm(QWidget *parent, const char *name, bool modal) - : QDialog(parent, name, modal) +GetAddressForm::GetAddressForm(QWidget *parent) + : QDialog(parent) { setupUi(this); init(); @@ -67,8 +67,8 @@ void GetAddressForm::init() sipOnlyCheckBox->setChecked(sys_config->get_ab_show_sip_only()); #else - addressTabWidget->setTabEnabled(tabKABC, false); - addressTabWidget->setCurrentPage(TAB_LOCAL); + addressTabWidget->setTabEnabled(addressTabWidget->indexOf(tabKABC), false); + addressTabWidget->setCurrentIndex(TAB_LOCAL); #endif } @@ -141,7 +141,7 @@ void GetAddressForm::loadAddresses() void GetAddressForm::selectAddress() { - if (addressTabWidget->currentPageIndex() == TAB_KABC) { + if (addressTabWidget->currentIndex() == TAB_KABC) { selectKABCAddress(); } else { selectLocalAddress(); diff --git a/src/gui/getaddressform.h b/src/gui/getaddressform.h index 7c480d1..1c8443e 100644 --- a/src/gui/getaddressform.h +++ b/src/gui/getaddressform.h @@ -9,7 +9,7 @@ class GetAddressForm : public QDialog, public Ui::GetAddressForm { Q_OBJECT public: - GetAddressForm(QWidget *parent, const char *name, bool modal); + GetAddressForm(QWidget *parent); ~GetAddressForm(); private: void init(); diff --git a/src/gui/getprofilenameform.cpp b/src/gui/getprofilenameform.cpp index 8716efb..1319e1d 100644 --- a/src/gui/getprofilenameform.cpp +++ b/src/gui/getprofilenameform.cpp @@ -12,8 +12,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -GetProfileNameForm::GetProfileNameForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +GetProfileNameForm::GetProfileNameForm(QWidget* parent) + : QDialog(parent) { setupUi(this); } diff --git a/src/gui/getprofilenameform.h b/src/gui/getprofilenameform.h index be49368..cfa4132 100644 --- a/src/gui/getprofilenameform.h +++ b/src/gui/getprofilenameform.h @@ -9,7 +9,7 @@ class GetProfileNameForm : public QDialog, private Ui::GetProfileNameForm Q_OBJECT public: - GetProfileNameForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + GetProfileNameForm(QWidget* parent = 0); ~GetProfileNameForm(); QString getProfileName(); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 1399f4b..82d76e7 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -21,8 +21,6 @@ #include #include #include -//Added by qt3to4: -#include #include #ifdef HAVE_KDE @@ -61,10 +59,8 @@ #include "im/msg_session.h" #include "qcombobox.h" -#include "q3hbox.h" #include "qlabel.h" #include "qlayout.h" -#include "q3listbox.h" #include "qmessagebox.h" #include "qpixmap.h" #include @@ -73,10 +69,7 @@ #include "qsizepolicy.h" #include "qstring.h" #include "qtextcodec.h" -#include "q3textedit.h" -#include "q3toolbar.h" #include "qtooltip.h" -#include "q3vbox.h" extern string user_host; extern pthread_t thread_id_main; @@ -96,17 +89,15 @@ QString str2html(const QString &s) } void setDisabledIcon(QAction *action, const QString &icon) { - QIcon i = action->iconSet(); - i.setPixmap(QPixmap(icon), - QIcon::Automatic, QIcon::Disabled); - action->setIconSet(i); + QIcon i = action->icon(); + i.addPixmap(QPixmap(icon), QIcon::Disabled); + action->setIcon(i); } void setDisabledIcon(QToolButton *toolButton, const QString &icon) { - QIcon i = toolButton->iconSet(); - i.setPixmap(QPixmap(icon), - QIcon::Automatic, QIcon::Disabled); - toolButton->setIconSet(i); + QIcon i = toolButton->icon(); + i.addPixmap(QPixmap(icon), QIcon::Disabled); + toolButton->setIcon(i); } ///////////////////////////////////////////////// @@ -134,11 +125,11 @@ void t_gui::clearLineFields(int line) { setLineFields(line); fromLabel->clear(); - QToolTip::remove(fromLabel); + fromLabel->setToolTip(QString()); toLabel->clear(); - QToolTip::remove(toLabel); + toLabel->setToolTip(QString()); subjectLabel->clear(); - QToolTip::remove(subjectLabel); + subjectLabel->setToolTip(QString()); codecLabel->clear(); photoLabel->clear(); photoLabel->hide(); @@ -147,19 +138,19 @@ void t_gui::clearLineFields(int line) { void t_gui::displayTo(const QString &s) { toLabel->setText(s); toLabel->setCursorPosition(0); - QToolTip::add(toLabel, s); + toLabel->setToolTip(s); } void t_gui::displayFrom(const QString &s) { fromLabel->setText(s); fromLabel->setCursorPosition(0); - QToolTip::add(fromLabel, s); + fromLabel->setToolTip(s); } void t_gui::displaySubject(const QString &s) { subjectLabel->setText(s); subjectLabel->setCursorPosition(0); - QToolTip::add(subjectLabel, s); + subjectLabel->setToolTip(s); } void t_gui::displayCodecInfo(int line) { @@ -204,8 +195,8 @@ void t_gui::displayPhoto(const QImage &photo) { photoLabel->hide(); } else { QPixmap pm; - pm.convertFromImage(photo.smoothScale( - photoLabel->width(), photoLabel->height(), Qt::KeepAspectRatio)); + pm.convertFromImage(photo.scaled( + QSize(photoLabel->width(), photoLabel->height()), Qt::KeepAspectRatio, Qt::SmoothTransformation)); photoLabel->setPixmap(pm); photoLabel->show(); } @@ -221,7 +212,7 @@ bool t_gui::do_invite(const string &destination, const string &display, if (mainWindow->callInvite->isEnabled()) { if (immediate) { t_user *user = phone->ref_user_profile( - mainWindow->userComboBox->currentText().ascii()); + mainWindow->userComboBox->currentText().toStdString()); t_url dst_url(expand_destination(user, destination)); if (dst_url.is_valid()) { mainWindow->do_phoneInvite(user, @@ -284,7 +275,7 @@ void t_gui::do_redirect(bool show_status, bool type_present, t_cf_type cf_type, } t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); list dest_list; for (list::const_iterator i = dest_strlist.begin(); @@ -346,13 +337,13 @@ void t_gui::do_dnd(bool show_status, bool toggle, bool enable) { lock(); if (phone->ref_users().size() == 1) { if (toggle) { - enable = !mainWindow->serviceDnd->isOn(); + enable = !mainWindow->serviceDnd->isChecked(); } mainWindow->srvDnd(enable); - mainWindow->serviceDnd->setOn(enable); + mainWindow->serviceDnd->setChecked(enable); } else { t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); list l; l.push_back(user); if (toggle) { @@ -377,13 +368,13 @@ void t_gui::do_auto_answer(bool show_status, bool toggle, bool enable) { lock(); if (phone->ref_users().size() == 1) { if (toggle) { - enable = !mainWindow->serviceAutoAnswer->isOn(); + enable = !mainWindow->serviceAutoAnswer->isChecked(); } mainWindow->srvAutoAnswer(enable); - mainWindow->serviceAutoAnswer->setOn(enable); + mainWindow->serviceAutoAnswer->setChecked(enable); } else { t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); list l; l.push_back(user); if (toggle) { @@ -410,7 +401,7 @@ void t_gui::do_bye(void) { void t_gui::do_hold(void) { lock(); - if (mainWindow->callHold->isEnabled() && !mainWindow->callHold->isOn()) { + if (mainWindow->callHold->isEnabled() && !mainWindow->callHold->isChecked()) { mainWindow->phoneHold(true); } unlock(); @@ -418,7 +409,7 @@ void t_gui::do_hold(void) { void t_gui::do_retrieve(void) { lock(); - if (mainWindow->callHold->isEnabled() && mainWindow->callHold->isOn()) { + if (mainWindow->callHold->isEnabled() && mainWindow->callHold->isChecked()) { mainWindow->phoneHold(false); } unlock(); @@ -427,12 +418,12 @@ void t_gui::do_retrieve(void) { bool t_gui::do_refer(const string &destination, t_transfer_type transfer_type, bool immediate) { lock(); if (mainWindow->callTransfer->isEnabled() && - !mainWindow->callTransfer->isOn()) + !mainWindow->callTransfer->isChecked()) { if (immediate) { t_display_url du; t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); du.url = expand_destination(user, destination); if (du.is_valid() || transfer_type == TRANSFER_OTHER_LINE) { @@ -442,7 +433,7 @@ bool t_gui::do_refer(const string &destination, t_transfer_type transfer_type, b mainWindow->phoneTransfer(destination, transfer_type); } } else if(mainWindow->callTransfer->isEnabled() && - mainWindow->callTransfer->isOn()) + mainWindow->callTransfer->isChecked()) { if (transfer_type != TRANSFER_CONSULT) { mainWindow->do_phoneTransferLine(); @@ -491,7 +482,7 @@ void t_gui::do_register(bool reg_all_profiles) { l = phone->ref_users(); } else { t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); l.push_back(user); } @@ -507,7 +498,7 @@ void t_gui::do_deregister(bool dereg_all_profiles, bool dereg_all_devices) { l = phone->ref_users(); } else { t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); l.push_back(user); } @@ -536,7 +527,7 @@ bool t_gui::do_options(bool dest_set, const string &destination, bool immediate) if (immediate) { t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); t_url dst_url(expand_destination(user, destination)); if (dst_url.is_valid()) { @@ -561,9 +552,9 @@ void t_gui::do_line(int line) { void t_gui::do_user(const string &profile_name) { lock(); for (int i = 0; i < mainWindow->userComboBox->count(); i++) { - if (mainWindow->userComboBox->text(i) == profile_name.c_str()) + if (mainWindow->userComboBox->itemText(i) == profile_name.c_str()) { - mainWindow->userComboBox->setCurrentItem(i); + mainWindow->userComboBox->setCurrentIndex(i); } } unlock(); @@ -573,7 +564,7 @@ bool t_gui::do_message(const string &destination, const string &display, const im::t_msg &msg) { t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); t_url dest_url(expand_destination(user, destination)); @@ -586,7 +577,7 @@ bool t_gui::do_message(const string &destination, const string &display, void t_gui::do_presence(t_presence_state::t_basic_state basic_state) { t_user *user = phone->ref_user_profile(mainWindow-> - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); phone->pub_publish_presence(user, basic_state); } @@ -636,8 +627,11 @@ t_gui::t_gui(t_phone *_phone) : t_userintf(_phone), timerUpdateMessageSessions(N { use_stdout = false; lastFileBrowsePath = DIR_HOME; + + qRegisterMetaType("t_user*"); + qRegisterMetaType("t_register_type"); - mainWindow = new MphoneForm(0, 0, Qt::WType_TopLevel | Qt::WStyle_ContextHelp); + mainWindow = new MphoneForm; #ifdef HAVE_KDE sys_tray_popup = NULL; #endif @@ -648,7 +642,7 @@ t_gui::t_gui(t_phone *_phone) : t_userintf(_phone), timerUpdateMessageSessions(N } MEMMAN_NEW(mainWindow); - qApp->setMainWidget(mainWindow); + connect(this, SIGNAL(update_reg_status()), mainWindow, SLOT(updateRegStatus())); connect(this, SIGNAL(update_mwi()), mainWindow, SLOT(updateMwi())); connect(this, SIGNAL(update_state()), mainWindow, SLOT(updateState())); @@ -680,11 +674,11 @@ void t_gui::run(void) { // NOTE: the t_gui::lock() method cannot be used as this method // will not lock from the main thread and we are running in the // main thread (a bit of a kludge). - qApp->lock(); + //qApp->lock(); // Set configuration file name in titlebar s = PRODUCT_NAME; - mainWindow->setCaption(s); + mainWindow->setWindowTitle(s); // Set user combo box mainWindow->updateUserComboBox(); @@ -727,7 +721,7 @@ void t_gui::run(void) { // Start QApplication/KApplication if (qApp->isSessionRestored() && - sys_config->get_ui_session_id() == qApp->sessionId().ascii()) + sys_config->get_ui_session_id() == qApp->sessionId().toStdString()) { // Restore previous session restore_session_state(); @@ -745,23 +739,23 @@ void t_gui::run(void) { // line. if (!g_cmd_args.cmd_set_profile.isEmpty()) { cmdsocket::cmd_cli(string("user ") + - g_cmd_args.cmd_set_profile.ascii(), true); + g_cmd_args.cmd_set_profile.toStdString(), true); } // Execute the call command if a callto destination was specified on the // command line if (!g_cmd_args.callto_destination.isEmpty()) { - cmdsocket::cmd_call(g_cmd_args.callto_destination.ascii(), + cmdsocket::cmd_call(g_cmd_args.callto_destination.toStdString(), g_cmd_args.cmd_immediate_mode); } // Execute a CLI command if one was given on the command line if (!g_cmd_args.cli_command.isEmpty()) { - cmdsocket::cmd_cli(g_cmd_args.cli_command.ascii(), + cmdsocket::cmd_cli(g_cmd_args.cli_command.toStdString(), g_cmd_args.cmd_immediate_mode); } - qApp->unlock(); + //qApp->unlock(); // Start Qt application qApp->exec(); @@ -777,11 +771,11 @@ void t_gui::save_state(void) { lock(); sys_config->set_last_used_profile( - mainWindow->userComboBox->currentText().ascii()); + mainWindow->userComboBox->currentText().toStdString()); list history; for (int i = 0; i < mainWindow->callComboBox->count(); i++) { - history.push_back(mainWindow->callComboBox->text(i).ascii()); + history.push_back(mainWindow->callComboBox->itemText(i).toStdString()); } sys_config->set_dial_history(history); @@ -846,17 +840,17 @@ void t_gui::lock(void) { // main thread. // If the Qt event loop has not been started yet, then the lock // should also be taken from the main thread. - t_userintf::lock(); - if (!t_thread::is_self(thread_id_main)) { - qApp->lock(); - } + t_userintf::lock(); + //if (!t_thread::is_self(thread_id_main)) { + // qApp->lock(); + //} } void t_gui::unlock(void) { t_userintf::lock(); - if (!t_thread::is_self(thread_id_main)) { - qApp->unlock(); - } + //if (!t_thread::is_self(thread_id_main)) { + // qApp->unlock(); + //} } string t_gui::select_network_intf(void) { @@ -870,7 +864,7 @@ string t_gui::select_network_intf(void) { "Cannot find a network interface. Twinkle will use " "127.0.0.1 as the local IP address. When you connect to " "the network you have to restart Twinkle to use the correct " - "IP address.").ascii(), + "IP address.").toStdString(), MSG_WARNING); MEMMAN_DELETE(l); @@ -883,7 +877,8 @@ string t_gui::select_network_intf(void) { ip = l->front().get_ip_addr(); } else { // There are multiple interfaces - SelectNicForm *sf = new SelectNicForm(NULL, "nic", true); + SelectNicForm *sf = new SelectNicForm(NULL); + sf->setModal(true); MEMMAN_NEW(sf); QString item; for (list::iterator i = l->begin(); i != l->end(); i++) { @@ -916,7 +911,8 @@ string t_gui::select_network_intf(void) { } bool t_gui::select_user_config(list &config_files) { - SelectProfileForm f(0, "select user profile", true); + SelectProfileForm f(nullptr); + f.setModal(true); if (f.execForm()) { config_files = f.selectedProfiles; @@ -1582,20 +1578,20 @@ void t_gui::cb_notify_call(int line, const QString &from_party, const QString &o if (tray && !sys_tray_popup && !phone->is_line_auto_answered(line)) { QString presFromParty(""); if (!from_party.isEmpty()) { - presFromParty = dotted_truncate(from_party.ascii(), 50).c_str(); + presFromParty = dotted_truncate(from_party.toStdString(), 50).c_str(); } QString presOrganization(""); if (!organization.isEmpty()) { - presOrganization = dotted_truncate(organization.ascii(), 50).c_str(); + presOrganization = dotted_truncate(organization.toStdString(), 50).c_str(); } QString presSubject(""); if (!subject.isEmpty()) { - presSubject = dotted_truncate(subject.ascii(), 50).c_str(); + presSubject = dotted_truncate(subject.toStdString(), 50).c_str(); } QString presReferredByParty(""); if (!referred_by_party.isEmpty()) { presReferredByParty = qApp->translate("GUI", "Transferred by: %1").arg( - dotted_truncate(referred_by_party.ascii(), 40).c_str()); + dotted_truncate(referred_by_party.toStdString(), 40).c_str()); } // Create photo pixmap. If no photo is available, then use @@ -1680,8 +1676,10 @@ void t_gui::cb_notify_call(int line, const QString &from_party, const QString &o // Show main window after a few seconds if (sys_config->get_gui_auto_show_incoming()) { - autoShowTimer[line].start( - sys_config->get_gui_auto_show_timeout() * 1000, true); + + autoShowTimer[line].setSingleShot(true); + autoShowTimer[line].start( + sys_config->get_gui_auto_show_timeout() * 1000); } unlock(); @@ -2060,8 +2058,8 @@ bool t_gui::do_cb_ask_credentials(t_user *user_config, const string &realm, stri QString user(username.c_str()); QString passwd(password.c_str()); - AuthenticationForm *af = new AuthenticationForm(mainWindow, "authentication", - true); + AuthenticationForm *af = new AuthenticationForm(mainWindow); + af->setModal(true); MEMMAN_NEW(af); if (!af->exec(user_config, QString(realm.c_str()), user, passwd)) { MEMMAN_DELETE(af); @@ -2069,8 +2067,8 @@ bool t_gui::do_cb_ask_credentials(t_user *user_config, const string &realm, stri return false; } - username = user.ascii(); - password = passwd.ascii(); + username = user.toStdString(); + password = passwd.toStdString(); MEMMAN_DELETE(af); delete af; @@ -2322,7 +2320,7 @@ void t_gui::cb_nat_discovery_progress_start(int num_steps) { qApp->translate("GUI", "Abort"), 0, num_steps, mainWindow); MEMMAN_NEW(natDiscoveryProgressDialog); - natDiscoveryProgressDialog->setCaption(PRODUCT_NAME); + natDiscoveryProgressDialog->setWindowTitle(PRODUCT_NAME); natDiscoveryProgressDialog->setMinimumDuration(200); } @@ -2371,9 +2369,9 @@ void t_gui::cb_zrtp_confirm_go_clear(int line) { QString msg(qApp->translate("GUI", "The remote user on line %1 disabled the encryption.") .arg(line + 1)); if (user_config->get_zrtp_goclear_warning()) { - cb_show_msg(msg.ascii(), MSG_WARNING); + cb_show_msg(msg.toStdString(), MSG_WARNING); } else { - cb_display_msg(msg.ascii(), MSG_WARNING); + cb_display_msg(msg.toStdString(), MSG_WARNING); } action_zrtp_go_clear_ok(line); @@ -2499,7 +2497,7 @@ bool t_gui::cb_message_request(t_user *user_config, t_request *r) { // Try to decode the text QTextCodec *c = QTextCodec::codecForName(charset.c_str()); if (c) { - text = c->toUnicode(text.c_str()).ascii(); + text = c->toUnicode(text.c_str()).toStdString(); } else { log_file->write_header( "t_gui::cb_message_request", @@ -2565,7 +2563,7 @@ bool t_gui::cb_message_request(t_user *user_config, t_request *r) { if (failed_to_save_attachment) { QString s = qApp->translate("GUI", "Failed to save message attachment: %1"); s.arg(attachment_error_msg.c_str()); - session->set_error(s.ascii()); + session->set_error(s.toStdString()); } unlock(); @@ -2589,7 +2587,7 @@ void t_gui::cb_message_response(t_user *user_config, t_response *r, t_request *r if (r->code == R_202_ACCEPTED) { string s; if (r->reason == REASON_202) { - s = qApp->translate("GUI", "Accepted by network").ascii(); + s = qApp->translate("GUI", "Accepted by network").toStdString(); } else { s = r->reason; } @@ -2642,7 +2640,7 @@ void t_gui::cmd_call(const string &destination, bool immediate) { t_display_url du; t_user *user = phone->ref_user_profile( - mainWindow->userComboBox->currentText().ascii()); + mainWindow->userComboBox->currentText().toStdString()); expand_destination(user, destination, du, subject, dst_no_headers); if (!du.is_valid()) return; @@ -2670,7 +2668,7 @@ void t_gui::cmd_show(void) { } else { mainWindow->show(); mainWindow->raise(); - mainWindow->setActiveWindow(); + mainWindow->activateWindow(); } unlock(); } @@ -2931,10 +2929,10 @@ void t_gui::fill_user_combo(QComboBox *cb) { for (list::iterator i = user_list.begin(); i != user_list.end(); i++) { // OLD code: used display uri // cb->insertItem((*i)->get_display_uri().c_str()); - cb->insertItem((*i)->get_profile_name().c_str()); + cb->addItem((*i)->get_profile_name().c_str()); } - cb->setCurrentItem(0); + cb->setCurrentIndex(0); } QString t_gui::get_last_file_browse_path(void) const { @@ -3030,7 +3028,7 @@ string t_gui::mime2file_extension(t_media media) { const QStringList &patterns = pMime->patterns(); if (!patterns.empty()) { - extension = patterns.front().ascii(); + extension = patterns.front().toStdString(); } else { log_file->write_header("t_gui::mime2file_extension", LOG_NORMAL, LOG_DEBUG); log_file->write_raw("Cannot find file extension for mime type "); @@ -3080,6 +3078,6 @@ void t_gui::open_url_in_browser(const QString &url) { QString msg = qApp->translate("GUI", "Cannot open web browser: %1").arg(url); msg += "\n\n"; msg += qApp->translate("GUI", "Configure your web browser in the system settings."); - cb_show_msg(msg.ascii(), MSG_CRITICAL); + cb_show_msg(msg.toStdString(), MSG_CRITICAL); } } diff --git a/src/gui/historyform.cpp b/src/gui/historyform.cpp index b418f63..d188255 100644 --- a/src/gui/historyform.cpp +++ b/src/gui/historyform.cpp @@ -24,7 +24,6 @@ #include "call_history.h" #include "util.h" #include "gui.h" -#include "q3listview.h" #include "qicon.h" #include "audits/memman.h" #include "historyform.h" @@ -42,8 +41,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -HistoryForm::HistoryForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +HistoryForm::HistoryForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -94,8 +93,8 @@ void HistoryForm::init() QIcon deleteIcon(QPixmap(":/icons/images/editdelete.png")); histPopupMenu = new QMenu(this); - itemCall = histPopupMenu->insertItem(inviteIcon, tr("Call..."), this, SLOT(call())); - histPopupMenu->insertItem(deleteIcon, tr("Delete"), this, SLOT(deleteEntry())); + itemCall = histPopupMenu->addAction(inviteIcon, tr("Call..."), this, SLOT(call())); + histPopupMenu->addAction(deleteIcon, tr("Delete"), this, SLOT(deleteEntry())); m_pixmapIn = QPixmap(":/icons/images/1leftarrow-yellow.png"); m_pixmapOut = QPixmap(":/icons/images/1rightarrow.png"); @@ -241,14 +240,14 @@ void HistoryForm::update() { // There is no need to update the history when the window is // hidden. - if (isShown()) loadHistory(); + if (isVisible()) loadHistory(); } void HistoryForm::show() { - if (isShown()) { + if (isVisible()) { raise(); - setActiveWindow(); + activateWindow(); return; } @@ -387,7 +386,7 @@ void HistoryForm::popupMenu(QPoint pos) bool canCall = !(cr.direction == t_call_record::DIR_IN && cr.from_uri.encode() == ANONYMOUS_URI); - histPopupMenu->setItemEnabled(itemCall, canCall); + itemCall->setEnabled(canCall); histPopupMenu->popup(pos); } @@ -406,7 +405,7 @@ void HistoryForm::call(QModelIndex index) QString subject; if (cr.direction == t_call_record::DIR_IN) { if (!cr.subject.empty()) { - if (cr.subject.substr(0, tr("Re:").length()) != tr("Re:").ascii()) { + if (cr.subject.substr(0, tr("Re:").length()) != tr("Re:").toStdString()) { subject = tr("Re:").append(" "); subject += cr.subject.c_str(); } else { diff --git a/src/gui/historyform.h b/src/gui/historyform.h index d6b06c0..76ea161 100644 --- a/src/gui/historyform.h +++ b/src/gui/historyform.h @@ -12,7 +12,7 @@ class HistoryForm : public QDialog, public Ui::HistoryForm Q_OBJECT public: - HistoryForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + HistoryForm(QWidget* parent = 0); ~HistoryForm(); public slots: @@ -37,7 +37,7 @@ private: time_t timeLastViewed; QMenu *histPopupMenu; QStandardItemModel *m_model; - int itemCall; + QAction* itemCall; QPixmap m_pixmapIn, m_pixmapOut; QPixmap m_pixmapOk, m_pixmapCancel; QList m_history; diff --git a/src/gui/historyform.ui b/src/gui/historyform.ui index 4cb3356..859c496 100644 --- a/src/gui/historyform.ui +++ b/src/gui/historyform.ui @@ -279,7 +279,6 @@ user.h phone.h - q3popupmenu.h diff --git a/src/gui/inviteform.cpp b/src/gui/inviteform.cpp index 0ec1ddd..204c5cd 100644 --- a/src/gui/inviteform.cpp +++ b/src/gui/inviteform.cpp @@ -26,8 +26,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -InviteForm::InviteForm(QWidget *parent, const char *name, bool modal) - : QDialog(parent, name, modal) +InviteForm::InviteForm(QWidget *parent) + : QDialog(parent) { setupUi(this); init(); @@ -60,7 +60,7 @@ void InviteForm::destroy() void InviteForm::clear() { - inviteComboBox->clearEdit(); + inviteComboBox->clearEditText(); subjectLineEdit->clear(); hideUserCheckBox->setChecked(false); inviteComboBox->setFocus(); @@ -74,10 +74,10 @@ void InviteForm::show(t_user *user_config, const QString &dest, const QString &s // Select from user if (user_config) { for (int i = 0; i < fromComboBox->count(); i++) { - if (fromComboBox->text(i) == + if (fromComboBox->itemText(i) == user_config->get_profile_name().c_str()) { - fromComboBox->setCurrentItem(i); + fromComboBox->setCurrentIndex(i); break; } } @@ -93,10 +93,10 @@ void InviteForm::validate() { string display, dest_str; t_user *from_user = phone->ref_user_profile( - fromComboBox->currentText().ascii()); + fromComboBox->currentText().toStdString()); ui->expand_destination(from_user, - inviteComboBox->currentText().stripWhiteSpace().ascii(), + inviteComboBox->currentText().trimmed().toStdString(), display, dest_str); t_url dest(dest_str); @@ -115,7 +115,7 @@ void InviteForm::validate() // Add a destination to the history list of inviteComboBox void InviteForm::addToInviteComboBox(const QString &destination) { - inviteComboBox->insertItem(destination, 0); + inviteComboBox->insertItem(0, destination); if (inviteComboBox->count() > SIZE_REDIAL_LIST) { inviteComboBox->removeItem(inviteComboBox->count() - 1); } @@ -137,8 +137,8 @@ void InviteForm::closeEvent(QCloseEvent *) void InviteForm::showAddressBook() { if (!getAddressForm) { - getAddressForm = new GetAddressForm( - this, "select address", true); + getAddressForm = new GetAddressForm(this); + getAddressForm->setModal(true); MEMMAN_NEW(getAddressForm); } @@ -160,7 +160,7 @@ void InviteForm::warnHideUser(void) { QString msg = tr("Not all SIP providers support identity hiding. Make sure your SIP provider " "supports it if you really need it."); - ((t_gui *)ui)->cb_show_msg(this, msg.ascii(), MSG_WARNING); + ((t_gui *)ui)->cb_show_msg(this, msg.toStdString(), MSG_WARNING); // Do not warn again sys_config->set_warn_hide_user(false); diff --git a/src/gui/inviteform.h b/src/gui/inviteform.h index 337667b..3d46198 100644 --- a/src/gui/inviteform.h +++ b/src/gui/inviteform.h @@ -14,7 +14,7 @@ class InviteForm : public QDialog, public Ui::InviteForm { Q_OBJECT public: - InviteForm(QWidget *parent, const char *name, bool modal); + InviteForm(QWidget *parent); ~InviteForm(); public slots: void clear(); diff --git a/src/gui/logviewform.cpp b/src/gui/logviewform.cpp index 834496b..110d645 100644 --- a/src/gui/logviewform.cpp +++ b/src/gui/logviewform.cpp @@ -39,7 +39,7 @@ void LogViewForm::scrollToBottom() void LogViewForm::show() { - if (isShown()) { + if (isVisible()) { raise(); return; } @@ -51,7 +51,7 @@ void LogViewForm::show() if (logfile->open(QIODevice::ReadOnly)) { logstream = new QTextStream(logfile); MEMMAN_NEW(logstream); - logTextEdit->setPlainText(logstream->read()); + logTextEdit->setPlainText(logstream->readAll()); } log_file->enable_inform_user(true); @@ -81,7 +81,7 @@ void LogViewForm::closeEvent(QCloseEvent* ev) void LogViewForm::update(bool log_zapped) { - if (!isShown()) return; + if (!isVisible()) return; if (log_zapped) { close(); @@ -90,7 +90,7 @@ void LogViewForm::update(bool log_zapped) } if (logstream) { - QString s = logstream->read(); + QString s = logstream->readAll(); if (!s.isNull() && !s.isEmpty()) { bool bottom = isOnBottom(); logTextEdit->appendPlainText(s); diff --git a/src/gui/logviewform.ui b/src/gui/logviewform.ui index c52ee45..6c90cc7 100644 --- a/src/gui/logviewform.ui +++ b/src/gui/logviewform.ui @@ -80,7 +80,6 @@ qfile.h - q3textstream.h diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 2a89d5d..a43c9bb 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -288,7 +288,7 @@ void parse_main_args(int argc, char **argv, bool &cli_mode, bool &override_lock_ } else if (strcmp(argv[i], "--version") == 0) { // Get version QString s = sys_config->about(false).c_str(); - cout << s.ascii(); + cout << s.toStdString(); exit(0); } else if (strcmp(argv[i], "-c") == 0) { // CLI mode @@ -312,7 +312,7 @@ void parse_main_args(int argc, char **argv, bool &cli_mode, bool &override_lock_ { config_file += USER_FILE_EXT; } - config_files.push_back(config_file.ascii()); + config_files.push_back(config_file.toStdString()); } } else { cout << argv[0] << ": "; @@ -456,11 +456,11 @@ bool open_sip_socket(bool cli_mode) { if (cli_mode) { msg = QString("Failed to create a %1 socket (SIP) on port %2") .arg(sock_type) - .arg(sys_config->get_sip_port()).ascii(); + .arg(sys_config->get_sip_port()).toStdString(); } else { msg = qApp->translate("GUI", "Failed to create a %1 socket (SIP) on port %2") .arg(sock_type) - .arg(sys_config->get_sip_port()).ascii(); + .arg(sys_config->get_sip_port()).toStdString(); } msg += "\n"; msg += get_error_str(err); @@ -617,7 +617,7 @@ int main( int argc, char ** argv ) // Activate a profile in the running Twinkle process. if (already_running && !g_cmd_args.cmd_set_profile.isEmpty()) { - cmdsocket::cmd_cli(string("user ") + g_cmd_args.cmd_set_profile.ascii(), true); + cmdsocket::cmd_cli(string("user ") + g_cmd_args.cmd_set_profile.toStdString(), true); // Do not exit now as this option may be used in conjuction // with --call or --cmd must_exit = true; @@ -627,7 +627,7 @@ int main( int argc, char ** argv ) // is present, then send the call destination to the running // Twinkle process. if (already_running && !g_cmd_args.callto_destination.isEmpty()) { - cmdsocket::cmd_call(g_cmd_args.callto_destination.ascii(), + cmdsocket::cmd_call(g_cmd_args.callto_destination.toStdString(), g_cmd_args.cmd_immediate_mode); exit(0); } @@ -635,7 +635,7 @@ int main( int argc, char ** argv ) // If the --cmd parameter is present, send the cli command // to the running Twinkle process if (already_running && !g_cmd_args.cli_command.isEmpty()) { - cmdsocket::cmd_cli(g_cmd_args.cli_command.ascii(), + cmdsocket::cmd_cli(g_cmd_args.cli_command.toStdString(), g_cmd_args.cmd_immediate_mode); exit(0); } @@ -677,7 +677,7 @@ int main( int argc, char ** argv ) if (!cli_mode) { msg += "\n\n"; msg += qApp->translate("GUI", - "Override lock file and start anyway?").ascii(); + "Override lock file and start anyway?").toStdString(); } if (override_lock_file || ui->cb_ask_msg(msg, MSG_WARNING)) { sys_config->delete_lock_file(); @@ -716,9 +716,9 @@ int main( int argc, char ** argv ) // shutdow and now gets restored. if (qa && qa->isSessionRestored()) { QString msg = "Restore session: " + qa->sessionId(); - log_file->write_report(msg.ascii(), "::main"); + log_file->write_report(msg.toStdString(), "::main"); - if (sys_config->get_ui_session_id() == qa->sessionId().ascii()) { + if (sys_config->get_ui_session_id() == qa->sessionId().toStdString()) { config_files = sys_config->get_ui_session_active_profiles(); // Note: the GUI state is restore in t_gui::run() } else { @@ -739,7 +739,7 @@ int main( int argc, char ** argv ) { QString config_file = (*i).c_str(); config_file += USER_FILE_EXT; - config_files.push_back(config_file.ascii()); + config_files.push_back(config_file.toStdString()); } } @@ -767,9 +767,9 @@ int main( int argc, char ** argv ) profile_selected = true; } else { if (cli_mode) { - error_msg = QString("The following profiles are both for user %1").arg(user_config.get_name().c_str()).ascii(); + error_msg = QString("The following profiles are both for user %1").arg(user_config.get_name().c_str()).toStdString(); } else { - error_msg = qApp->translate("GUI", "The following profiles are both for user %1").arg(user_config.get_name().c_str()).ascii(); + error_msg = qApp->translate("GUI", "The following profiles are both for user %1").arg(user_config.get_name().c_str()).toStdString(); } error_msg += ":\n\n"; error_msg += user_config.get_profile_name(); @@ -777,17 +777,17 @@ int main( int argc, char ** argv ) error_msg += dup_user->get_profile_name(); error_msg += "\n\n"; if (cli_mode) { - error_msg += QString("You can only run multiple profiles for different users.").ascii(); + error_msg += QString("You can only run multiple profiles for different users.").toStdString(); error_msg += "\n"; - error_msg += QString("If these are users for different domains, then enable the following option in your user profile (SIP protocol):").ascii(); + error_msg += QString("If these are users for different domains, then enable the following option in your user profile (SIP protocol):").toStdString(); error_msg += "\n"; - error_msg += QString("Use domain name to create a unique contact header").ascii(); + error_msg += QString("Use domain name to create a unique contact header").toStdString(); } else { - error_msg += qApp->translate("GUI", "You can only run multiple profiles for different users.").ascii(); + error_msg += qApp->translate("GUI", "You can only run multiple profiles for different users.").toStdString(); error_msg += "\n"; - error_msg += qApp->translate("GUI", "If these are users for different domains, then enable the following option in your user profile (SIP protocol)").ascii(); + error_msg += qApp->translate("GUI", "If these are users for different domains, then enable the following option in your user profile (SIP protocol)").toStdString(); error_msg += ":\n"; - error_msg += qApp->translate("GUI", "Use domain name to create a unique contact header").ascii(); + error_msg += qApp->translate("GUI", "Use domain name to create a unique contact header").toStdString(); } ui->cb_show_msg(error_msg, MSG_CRITICAL); profile_selected = false; diff --git a/src/gui/messageform.cpp b/src/gui/messageform.cpp index 1f615af..f4afec8 100644 --- a/src/gui/messageform.cpp +++ b/src/gui/messageform.cpp @@ -59,8 +59,8 @@ using namespace utils; #define IMG_SCALE_FACTOR(width, height) (std::min( float(MAX_WIDTH_IMG_INLINE) / (width), float(MAX_HEIGHT_IMG_INLINE) / (height) ) ) -MessageForm::MessageForm(QWidget* parent, const char* name, Qt::WindowFlags fl) - : QMainWindow(parent, name, fl) +MessageForm::MessageForm(QWidget* parent) + : QMainWindow(parent) { setupUi(this); @@ -89,7 +89,7 @@ void MessageForm::languageChange() void MessageForm::init() { - setWindowFlags(windowFlags() | Qt::WDestructiveClose); + this->setAttribute(Qt::WA_DeleteOnClose); _getAddressForm = 0; _remotePartyComplete = false; @@ -105,8 +105,8 @@ void MessageForm::init() attachmentPopupMenu = new QMenu(this); MEMMAN_NEW(attachmentPopupMenu); - connect(attachmentPopupMenu, SIGNAL(activated(int)), - this, SLOT(attachmentPopupActivated(int))); + connect(attachmentPopupMenu, SIGNAL(triggered(QAction*)), + this, SLOT(attachmentPopupActivated(QAction*))); _serviceMap = NULL; _saveAsDialog = NULL; @@ -176,10 +176,10 @@ void MessageForm::show() void MessageForm::selectUserConfig(t_user *user_config) { for (int i = 0; i < fromComboBox->count(); i++) { - if (fromComboBox->text(i) == + if (fromComboBox->itemText(i) == user_config->get_profile_name().c_str()) { - fromComboBox->setCurrentItem(i); + fromComboBox->setCurrentIndex(i); break; } } @@ -188,8 +188,8 @@ void MessageForm::selectUserConfig(t_user *user_config) void MessageForm::showAddressBook() { if (!_getAddressForm) { - _getAddressForm = new GetAddressForm( - this, "select address", true); + _getAddressForm = new GetAddressForm(this); + _getAddressForm->setModal(true); MEMMAN_NEW(_getAddressForm); } @@ -213,14 +213,14 @@ bool MessageForm::updateMessageSession() { string display, dest_str; t_user *from_user = phone->ref_user_profile( - fromComboBox->currentText().ascii()); + fromComboBox->currentText().toStdString()); if (!from_user) { // The user profile is not active anymore fromComboBox->setFocus(); return false; } - ui->expand_destination(from_user, toLineEdit->text().stripWhiteSpace().ascii(), + ui->expand_destination(from_user, toLineEdit->text().trimmed().toStdString(), display, dest_str); t_url dest(dest_str); @@ -277,7 +277,7 @@ void MessageForm::sendMessage() { return; } - _msgSession->send_msg(msgLineEdit->text().ascii(), im::TXT_PLAIN); + _msgSession->send_msg(msgLineEdit->text().toStdString(), im::TXT_PLAIN); } /** @@ -297,13 +297,13 @@ void MessageForm::sendFile(const QString &filename, const QString &subject) { KMimeType::Ptr pMime = KMimeType::findByURL(filename); media = t_media(pMime->name().ascii()); #else - string mime_type = mime_database->get_mimetype(filename.ascii()); + string mime_type = mime_database->get_mimetype(filename.toStdString()); if (!mime_type.empty()) { media = t_media(mime_type); } #endif - _msgSession->send_file(filename.ascii(), media, subject.ascii()); + _msgSession->send_file(filename.toStdString(), media, subject.toStdString()); } /** @@ -426,7 +426,7 @@ void MessageForm::displayError(const QString &errorMsg) { QString s = ""; s += ""; - s += tr("Delivery failure").ascii(); + s += tr("Delivery failure"); s += ": "; s += Qt::escape(errorMsg); s += ""; @@ -438,7 +438,7 @@ void MessageForm::displayDeliveryNotification(const QString ¬ification) { QString s = ""; s += ""; - s += tr("Delivery notification").ascii(); + s += tr("Delivery notification"); s += ": "; s += Qt::escape(notification); s += ""; @@ -450,7 +450,7 @@ void MessageForm::setRemotePartyCaption(void) { if (!_msgSession) return; t_user *user = _msgSession->get_user(); t_display_url remote_party = _msgSession->get_remote_party(); - setCaption(ui->format_sip_address(user, + setWindowTitle(ui->format_sip_address(user, remote_party.display, remote_party.url).c_str()); } @@ -476,7 +476,7 @@ void MessageForm::showAttachmentPopupMenu(const QString &attachment) { attachmentPopupMenu->clear(); QIcon saveIcon(QPixmap(":/icons/images/save_as.png")); - attachmentPopupMenu->insertItem(saveIcon, "Save as...", id++); + attachmentPopupMenu->addAction(saveIcon, "Save as...")->setData(id++); #ifdef HAVE_KDE // Get mime type for the attachment @@ -504,7 +504,9 @@ void MessageForm::showAttachmentPopupMenu(const QString &attachment) { attachmentPopupMenu->popup(QCursor::pos(), 0); } -void MessageForm::attachmentPopupActivated(int id) { +void MessageForm::attachmentPopupActivated(QAction* act) { + int id = act->data().toInt(); + #ifdef HAVE_KDE vector *serviceMap = (vector *)_serviceMap; assert(serviceMap); @@ -525,8 +527,8 @@ void MessageForm::attachmentPopupActivated(int id) { connect(d, SIGNAL(fileSelected(const QString &)), this, SLOT(saveAttachment())); #endif - d->selectFile(QString::fromStdString(_filenameMap[clickedAttachment.ascii()])); - d->setCaption(tr("Save attachment as...")); + d->selectFile(QString::fromStdString(_filenameMap[clickedAttachment.toStdString()])); + d->setWindowTitle(tr("Save attachment as...")); if (_saveAsDialog) { MEMMAN_DELETE(_saveAsDialog); @@ -554,18 +556,22 @@ void MessageForm::saveAttachment() { #else QFileDialog *d = dynamic_cast(_saveAsDialog); #endif - QString filename = d->selectedFile(); + QStringList files = d->selectedFiles(); + QString filename; + + if (!files.empty()) + filename = files[0]; if (QFile::exists(filename)) { bool overwrite = ((t_gui *)ui)->cb_ask_msg(this, - tr("File already exists. Do you want to overwrite this file?").ascii(), + tr("File already exists. Do you want to overwrite this file?").toStdString(), MSG_WARNING); if (!overwrite) return; } - if (!filecopy(clickedAttachment.ascii(), filename.ascii())) { - ((t_gui *)ui)->cb_show_msg(this, tr("Failed to save attachment.").ascii(), + if (!filecopy(clickedAttachment.toStdString(), filename.toStdString())) { + ((t_gui *)ui)->cb_show_msg(this, tr("Failed to save attachment.").toStdString(), MSG_CRITICAL); } } @@ -608,7 +614,7 @@ void MessageForm::clearComposingIndication() { if (_isComposingLabel) { statusBar()->removeWidget(_isComposingLabel); - statusBar()->clear(); + statusBar()->clearMessage(); MEMMAN_DELETE(_isComposingLabel); delete _isComposingLabel; diff --git a/src/gui/messageform.h b/src/gui/messageform.h index 323c099..b95da81 100644 --- a/src/gui/messageform.h +++ b/src/gui/messageform.h @@ -20,7 +20,7 @@ class MessageForm : public QMainWindow, public Ui::MessageForm Q_OBJECT public: - MessageForm(QWidget* parent = 0, const char* name = 0, Qt::WindowFlags fl = Qt::WType_TopLevel); + MessageForm(QWidget* parent = 0); ~MessageForm(); virtual bool updateMessageSession(); @@ -39,7 +39,7 @@ public slots: virtual void displayDeliveryNotification( const QString & notification ); virtual void setRemotePartyCaption( void ); virtual void showAttachmentPopupMenu( const QString & attachment ); - virtual void attachmentPopupActivated( int id ); + virtual void attachmentPopupActivated( QAction* action ); virtual void saveAttachment(); virtual void chooseFileToSend(); virtual void setComposingIndication( const QString & name ); diff --git a/src/gui/messageform.ui b/src/gui/messageform.ui index d0ecf17..9893980 100644 --- a/src/gui/messageform.ui +++ b/src/gui/messageform.ui @@ -133,15 +133,9 @@ - - Instant message toolbar - - - sendFileAction - :/icons/images/attach.png @@ -182,7 +176,6 @@ user.h im/msg_session.h phone.h - q3popupmenu.h qlabel.h textbrowsernoautolink.h diff --git a/src/gui/mphoneform.cpp b/src/gui/mphoneform.cpp index a31b846..f4b4392 100644 --- a/src/gui/mphoneform.cpp +++ b/src/gui/mphoneform.cpp @@ -25,18 +25,17 @@ */ #include "mphoneform.h" #include "twinkle_config.h" -//Added by qt3to4: +#include #include #include #include #include #include #include -#include -#include +#include #include "../audits/memman.h" #include "user.h" -#include +#include #include #include #include "gui.h" @@ -47,10 +46,9 @@ #include "line.h" #include "stun/stun_transaction.h" #include "log.h" -#include +#include #include "util.h" #include -#include #include #include #include @@ -62,8 +60,8 @@ // a call has ended #define HIDE_LINE_TIMER_AFTER 5 -MphoneForm::MphoneForm(QWidget* parent, const char * name, Qt::WindowFlags f) - : Q3MainWindow(parent, name, f) +MphoneForm::MphoneForm(QWidget* parent) + : QMainWindow(parent) { setupUi(this); init(); @@ -97,31 +95,29 @@ void MphoneForm::init() QIcon messageIcon(QPixmap(":/icons/images/message.png")); QIcon editIcon(QPixmap(":/icons/images/edit16.png")); QIcon deleteIcon(QPixmap(":/icons/images/editdelete.png")); - buddyPopupMenu = new Q3PopupMenu(this); + buddyPopupMenu = new QMenu(this); MEMMAN_NEW(buddyPopupMenu); - buddyPopupMenu->insertItem(inviteIcon, tr("&Call..."), this, SLOT(doCallBuddy())); - buddyPopupMenu->insertItem(messageIcon, tr("Instant &message..."), this, SLOT(doMessageBuddy())); - buddyPopupMenu->insertItem(editIcon, tr("&Edit..."), this, SLOT(doEditBuddy())); - buddyPopupMenu->insertItem(deleteIcon, tr("&Delete"), this, SLOT(doDeleteBuddy())); - - // Change availibility sub popup menu - changeAvailabilityPopupMenu = new Q3PopupMenu(this); - MEMMAN_NEW(changeAvailabilityPopupMenu); - QIcon availOnlineIcon(QPixmap(":/icons/images/presence_online.png")); - QIcon availOfflineIcon(QPixmap(":/icons/images/presence_offline.png")); - changeAvailabilityPopupMenu->insertItem(availOfflineIcon, tr("O&ffline"), this, - SLOT(doAvailabilityOffline())); - changeAvailabilityPopupMenu->insertItem(availOnlineIcon, tr("&Online"), this, - SLOT(doAvailabilityOnline())); + buddyPopupMenu->addAction(inviteIcon, tr("&Call..."), this, SLOT(doCallBuddy())); + buddyPopupMenu->addAction(messageIcon, tr("Instant &message..."), this, SLOT(doMessageBuddy())); + buddyPopupMenu->addAction(editIcon, tr("&Edit..."), this, SLOT(doEditBuddy())); + buddyPopupMenu->addAction(deleteIcon, tr("&Delete"), this, SLOT(doDeleteBuddy())); // Popup menu for a buddy list (click on profile name) QIcon changeAvailabilityIcon(QPixmap(":/icons/images/presence_online.png")); QIcon addIcon(QPixmap(":/icons/images/buddy.png")); - buddyListPopupMenu = new Q3PopupMenu(this); + buddyListPopupMenu = new QMenu(this); MEMMAN_NEW(buddyListPopupMenu); - buddyListPopupMenu->insertItem(changeAvailabilityIcon, tr("&Change availability"), - changeAvailabilityPopupMenu); - buddyListPopupMenu->insertItem(addIcon, tr("&Add buddy..."), this, SLOT(doAddBuddy())); + changeAvailabilityPopupMenu = buddyListPopupMenu->addMenu(changeAvailabilityIcon, tr("&Change availability")); + + // Change availibility sub popup menu + QIcon availOnlineIcon(QPixmap(":/icons/images/presence_online.png")); + QIcon availOfflineIcon(QPixmap(":/icons/images/presence_offline.png")); + changeAvailabilityPopupMenu->addAction(availOfflineIcon, tr("O&ffline"), this, + SLOT(doAvailabilityOffline())); + changeAvailabilityPopupMenu->addAction(availOnlineIcon, tr("&Online"), this, + SLOT(doAvailabilityOnline())); + + buddyListPopupMenu->addAction(addIcon, tr("&Add buddy..."), this, SLOT(doAddBuddy())); // ToDo: Tool tip for buddy list @@ -163,12 +159,12 @@ void MphoneForm::init() // does not fit. The background of a QLineEdit is static however, it does not // automatically take a background color passed by the -bg parameter. // Set the background color of these QLineEdit objects here. - from1Label->setPaletteBackgroundColor(paletteBackgroundColor()); - to1Label->setPaletteBackgroundColor(paletteBackgroundColor()); - subject1Label->setPaletteBackgroundColor(paletteBackgroundColor()); - from2Label->setPaletteBackgroundColor(paletteBackgroundColor()); - to2Label->setPaletteBackgroundColor(paletteBackgroundColor()); - subject2Label->setPaletteBackgroundColor(paletteBackgroundColor()); + //from1Label->setPaletteBackgroundColor(paletteBackgroundColor()); + //to1Label->setPaletteBackgroundColor(paletteBackgroundColor()); + //subject1Label->setPaletteBackgroundColor(paletteBackgroundColor()); + //from2Label->setPaletteBackgroundColor(paletteBackgroundColor()); + //to2Label->setPaletteBackgroundColor(paletteBackgroundColor()); + //subject2Label->setPaletteBackgroundColor(paletteBackgroundColor()); // A QComboBox accepts a new line through copy/paste. QRegExp rxNoNewLine("[^\\n\\r]*"); @@ -189,55 +185,55 @@ void MphoneForm::init() sysTray->setContextMenu(menu); // Call menu - callInvite->addTo(menu); - callAnswer->addTo(menu); - callBye->addTo(menu); - callReject->addTo(menu); - callRedirect->addTo(menu); - callTransfer->addTo(menu); - callHold->addTo(menu); - callConference->addTo(menu); - callMute->addTo(menu); - callDTMF->addTo(menu); - callRedial->addTo(menu); - - menu->insertSeparator(); + menu->addAction(callInvite); + menu->addAction(callAnswer); + menu->addAction(callBye); + menu->addAction(callReject); + menu->addAction(callRedirect); + menu->addAction(callTransfer); + menu->addAction(callHold); + menu->addAction(callConference); + menu->addAction(callMute); + menu->addAction(callDTMF); + menu->addAction(callRedial); + + menu->addSeparator(); // Messaging - actionSendMsg->addTo(menu); + menu->addAction(actionSendMsg); - menu->insertSeparator(); + menu->addSeparator(); // Line activation - actgrActivateLine->addTo(menu); + menu->addActions(actgrActivateLine->actions()); - menu->insertSeparator(); + menu->addSeparator(); // Service menu - serviceDnd->addTo(menu); - serviceRedirection->addTo(menu); - serviceAutoAnswer->addTo(menu); - servicesVoice_mailAction->addTo(menu); + menu->addAction(serviceDnd); + menu->addAction(serviceRedirection); + menu->addAction(serviceAutoAnswer); + menu->addAction(servicesVoice_mailAction); - menu->insertSeparator(); + menu->addSeparator(); // View menu - viewCall_HistoryAction->addTo(menu); + menu->addAction(viewCall_HistoryAction); - menu->insertSeparator(); + menu->addSeparator(); -#ifdef ENABLE_DIAMONCARD +#ifdef WITH_DIAMONDCARD // Diamondcard menu menu->insertItem("Diamondcard", Diamondcard); - menu->insertSeparator(); + menu->addSeparator(); #endif - fileExitAction->addTo(menu); + menu->addAction(fileExitAction); sysTray->show(); } -#ifndef ENABLE_DIAMONDCARD +#ifndef WITH_DIAMONDCARD Diamondcard->menuAction()->setVisible(false); #endif } @@ -277,12 +273,12 @@ void MphoneForm::destroy() delete sysSettingsForm; } if (logViewForm) { - if (logViewForm->isShown()) logViewForm->close(); + if (logViewForm->isVisible()) logViewForm->close(); MEMMAN_DELETE(logViewForm); delete logViewForm; } if (historyForm) { - if (historyForm->isShown()) historyForm->close(); + if (historyForm->isVisible()) historyForm->close(); MEMMAN_DELETE(historyForm); delete historyForm; } @@ -317,8 +313,6 @@ void MphoneForm::destroy() delete hideLineTimer2; MEMMAN_DELETE(buddyPopupMenu); delete buddyPopupMenu; - MEMMAN_DELETE(changeAvailabilityPopupMenu); - delete changeAvailabilityPopupMenu; MEMMAN_DELETE(buddyListPopupMenu); delete buddyListPopupMenu; } @@ -383,7 +377,10 @@ void MphoneForm::display( const QString &s ) displayTextEdit->setText(displayContents.join("\n")); // Set cursor position at the end of text - displayTextEdit->setCursorPosition(displayTextEdit->paragraphs() - 1, 0); + QTextCursor cursor; + cursor = displayTextEdit->textCursor(); + cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor); + displayTextEdit->setTextCursor(cursor); } // Print message header on display @@ -482,14 +479,16 @@ void MphoneForm::updateLineTimer(int line) } // Update timer every 1s - (*timer)->start(1000, false); + (*timer)->setSingleShot(false); + (*timer)->start(1000); } break; default: // Hide call duration timer if (*timer != NULL) { // Hide the timer after a few seconds - hideLineTimer->start(HIDE_LINE_TIMER_AFTER * 1000, true); + hideLineTimer->setSingleShot(true); + hideLineTimer->start(HIDE_LINE_TIMER_AFTER * 1000); (*timer)->stop(); MEMMAN_DELETE(*timer); *timer = NULL; @@ -515,7 +514,7 @@ void MphoneForm::updateLineEncryptionState(int line) bool zrtp_sas_confirmed = as->get_zrtp_sas_confirmed(); string srtp_cipher_mode = as->get_srtp_cipher_mode(); - QToolTip::remove(cryptLabel); + cryptLabel->setToolTip(QString()); QString toolTip = tr("Voice is encrypted") + " ("; toolTip.append(srtp_cipher_mode.c_str()).append(")"); @@ -533,17 +532,17 @@ void MphoneForm::updateLineEncryptionState(int line) if (!zrtp_sas_confirmed) { toolTip.append("\n").append(tr("Click to confirm SAS.")); - cryptLabel->setFrameStyle(Q3Frame::Panel | Q3Frame::Raised); + cryptLabel->setFrameStyle(QFrame::Panel | QFrame::Raised); cryptLabel->setPixmap( QPixmap(":/icons/images/encrypted.png")); } else { toolTip.append("\n").append(tr("Click to clear SAS verification.")); - cryptLabel->setFrameStyle(Q3Frame::NoFrame); + cryptLabel->setFrameStyle(QFrame::NoFrame); cryptLabel->setPixmap( QPixmap(":/icons/images/encrypted_verified.png")); } - QToolTip::add(cryptLabel, toolTip); + cryptLabel->setToolTip(toolTip); cryptLabel->show(); } else { cryptLabel->hide(); @@ -605,7 +604,7 @@ void MphoneForm::updateLineStatus(int line) to_be_transferred = phone->line_to_be_transferred(line, dummy); if (refer_state != REFST_NULL || is_transfer_consult || to_be_transferred) { QString toolTip; - QToolTip::remove(referLabel); + referLabel->setToolTip(QString()); referLabel->show(); if (is_transfer_consult) { referLabel->setPixmap( @@ -616,7 +615,7 @@ void MphoneForm::updateLineStatus(int line) QPixmap(":/icons/images/cf.png")); toolTip = tr("Transferring call"); } - QToolTip::add(referLabel, toolTip); + referLabel->setToolTip(toolTip); } else { referLabel->hide(); } @@ -705,21 +704,21 @@ void MphoneForm::updateState() // The active line may change when one of the parties in a conference // releases the call. If this happens, then update the state of the // line radio buttons. - if (line == 0 && line2RadioButton->isOn()) + if (line == 0 && line2RadioButton->isChecked()) { line1RadioButton->setChecked(true); - } else if (line == 1 && line1RadioButton->isOn()) + } else if (line == 1 && line1RadioButton->isChecked()) { line2RadioButton->setChecked(true); } // Same logic for the activate line menu items - if (line == 0 && actionLine2->isOn()) + if (line == 0 && actionLine2->isChecked()) { - actionLine1->setOn(true); - } else if (line == 1 && actionLine1->isOn()) + actionLine1->setChecked(true); + } else if (line == 1 && actionLine1->isChecked()) { - actionLine2->setOn(true); + actionLine2->setChecked(true); } switch(line_substate) { @@ -841,13 +840,13 @@ void MphoneForm::updateState() } // Set hold action in correct state - callHold->setOn(on_hold); + callHold->setChecked(on_hold); // Set mute action in correct state - callMute->setOn(is_muted); + callMute->setChecked(is_muted); // Set transfer action in correct state - callTransfer->setOn(is_transfer_consult); + callTransfer->setChecked(is_transfer_consult); // Hide redirect form if it is still visible, but not applicable anymore if (!callRedirect->isEnabled() && redirectForm && @@ -966,12 +965,12 @@ void MphoneForm::updateRegStatus() } // Set tool tip with detailed info. - QToolTip::remove(statRegLabel); + statRegLabel->setToolTip(QString()); if (num_registered > 0 || num_failed > 0) { - QToolTip::add(statRegLabel, toolTip); + statRegLabel->setToolTip(toolTip); } else { - QToolTip::add(statRegLabel, tr("No users are registered.")); + statRegLabel->setToolTip(tr("No users are registered.")); } updateSysTrayStatus(); @@ -1118,8 +1117,7 @@ void MphoneForm::updateMwi() } // Set tool tip - QToolTip::remove(statMWILabel); - QToolTip::add(statMWILabel, toolTip); + statMWILabel->setToolTip(toolTip); updateSysTrayStatus(); } @@ -1212,50 +1210,48 @@ void MphoneForm::updateServicesStatus() } // Set tool tip with detailed info for multiple users. - QToolTip::remove(statDndLabel); - QToolTip::remove(statCfLabel); - QToolTip::remove(statAaLabel); + statDndLabel->setToolTip(QString()); + statCfLabel->setToolTip(QString()); + statAaLabel->setToolTip(QString()); QString clickToActivate(""); clickToActivate += tr("Click to activate").replace(' ', " "); clickToActivate += ""; if (num_dnd > 0) { - QToolTip::add(statDndLabel, tipDnd); + statDndLabel->setToolTip(tipDnd); } else { QString status("

"); status += tr("Do not disturb is not active.").replace(' ', " "); status += "

"; status += clickToActivate; - QToolTip::add(statDndLabel, status); + statDndLabel->setToolTip(status); } if (num_cf > 0) { - QToolTip::add(statCfLabel, tipCf); + statCfLabel->setToolTip(tipCf); } else { QString status("

"); status += tr("Redirection is not active.").replace(' ', " "); status += "

"; status += clickToActivate; - QToolTip::add(statCfLabel, status); + statCfLabel->setToolTip(status); } if (num_auto_answer > 0) { - QToolTip::add(statAaLabel, tipAa); + statAaLabel->setToolTip(tipAa); } else { QString status("

"); status += tr("Auto answer is not active.").replace(' ', " "); status += "

"; status += clickToActivate; - QToolTip::add(statAaLabel, status); + statAaLabel->setToolTip(status); } updateSysTrayStatus(); } void MphoneForm::updateMissedCallStatus(int num_missed_calls) -{ - QToolTip::remove(statMissedLabel); - +{ QString clickDetails(""); clickDetails += tr("Click to see call history for details.").replace(' ', " "); clickDetails += ""; @@ -1265,7 +1261,7 @@ void MphoneForm::updateMissedCallStatus(int num_missed_calls) status += tr("You have no missed calls.").replace(' ', " "); status += "

"; status += clickDetails; - QToolTip::add(statMissedLabel, status); + statMissedLabel->setToolTip(status); } else { statMissedLabel->setPixmap( QPixmap(":/icons/images/missed.png")); @@ -1279,7 +1275,7 @@ void MphoneForm::updateMissedCallStatus(int num_missed_calls) } tip += "

"; tip += clickDetails; - QToolTip::add(statMissedLabel, tip); + statMissedLabel->setToolTip(tip); } updateSysTrayStatus(); @@ -1412,28 +1408,28 @@ void MphoneForm::updateMenuStatus() if (phone->ref_users().size() == 1) { t_service *srv = phone->ref_service(phone->ref_users().front()); - serviceDnd->setToggleAction(true); - serviceDnd->setOn(srv->is_dnd_active()); + serviceDnd->setCheckable(true); + serviceDnd->setChecked(srv->is_dnd_active()); connect(serviceDnd, SIGNAL(toggled(bool)), this, SLOT(srvDnd(bool))); - serviceAutoAnswer->setToggleAction(true); - serviceAutoAnswer->setOn(srv->is_auto_answer_active()); + serviceAutoAnswer->setCheckable(true); + serviceAutoAnswer->setChecked(srv->is_auto_answer_active()); connect(serviceAutoAnswer, SIGNAL(toggled(bool)), this, SLOT(srvAutoAnswer(bool))); } else { - serviceDnd->setOn(false); - serviceDnd->setToggleAction(false); + serviceDnd->setChecked(false); + serviceDnd->setCheckable(false); connect(serviceDnd, SIGNAL(activated()), this, SLOT(srvDnd())); - serviceAutoAnswer->setOn(false); - serviceAutoAnswer->setToggleAction(false); + serviceAutoAnswer->setChecked(false); + serviceAutoAnswer->setCheckable(false); connect(serviceAutoAnswer, SIGNAL(activated()), this, SLOT(srvAutoAnswer())); } -#ifdef ENABLE_DIAMONDCARD +#ifdef WITH_DIAMONDCARD updateDiamondcardMenu(); #endif } @@ -1450,16 +1446,16 @@ void MphoneForm::updateDiamondcardMenu() list diamondcard_users = diamondcard_get_users(phone); // Menu item identifiers - static int rechargeId = -1; - static int balanceHistoryId = -1; - static int callHistoryId = -1; - static int adminCenterId = -1; + static QAction* rechargeId = nullptr; + static QAction* balanceHistoryId = nullptr; + static QAction* callHistoryId = nullptr; + static QAction* adminCenterId = nullptr; // Sub menu's - static Q3PopupMenu *rechargeMenu = NULL; - static Q3PopupMenu *balanceHistoryMenu = NULL; - static Q3PopupMenu *callHistoryMenu = NULL; - static Q3PopupMenu *adminCenterMenu = NULL; + static QMenu *rechargeMenu = NULL; + static QMenu *balanceHistoryMenu = NULL; + static QMenu *callHistoryMenu = NULL; + static QMenu *adminCenterMenu = NULL; // Clear old menu removeDiamondcardAction(rechargeId); @@ -1473,29 +1469,32 @@ void MphoneForm::updateDiamondcardMenu() if (diamondcard_users.size() <= 1) { - rechargeId = Diamondcard->insertItem(tr("Recharge..."), this, SLOT(DiamondcardRecharge(int))); - Diamondcard->setItemParameter(rechargeId, 0); - balanceHistoryId = Diamondcard->insertItem(tr("Balance history..."), this, SLOT(DiamondcardBalanceHistory(int))); - Diamondcard->setItemParameter(balanceHistoryId, 0); - callHistoryId = Diamondcard->insertItem(tr("Call history..."), this, SLOT(DiamondcardCallHistory(int))); - Diamondcard->setItemParameter(callHistoryId, 0); - adminCenterId = Diamondcard->insertItem(tr("Admin center..."), this, SLOT(DiamondcardAdminCenter(int))); - Diamondcard->setItemParameter(adminCenterId, 0); + rechargeId = Diamondcard->addAction(tr("Recharge..."), this, SLOT(DiamondcardRecharge())); + rechargeId->setData(0); + balanceHistoryId = Diamondcard->addAction(tr("Balance history..."), this, SLOT(DiamondcardBalanceHistory())); + balanceHistoryId->setData(0); + callHistoryId = Diamondcard->addAction(tr("Call history..."), this, SLOT(DiamondcardCallHistory())); + callHistoryId->setData(0); + adminCenterId = Diamondcard->addAction(tr("Admin center..."), this, SLOT(DiamondcardAdminCenter())); + adminCenterId->setData(0); // Disable actions as there is no active Diamondcard users. if (diamondcard_users.empty()) { - Diamondcard->setItemEnabled(rechargeId, false); - Diamondcard->setItemEnabled(balanceHistoryId, false); - Diamondcard->setItemEnabled(callHistoryId, false); - Diamondcard->setItemEnabled(adminCenterId, false); + rechargeId->setEnabled(false); + balanceHistoryId->setEnabled(false); + callHistoryId->setEnabled(false); + adminCenterId->setEnabled(false); } } else { - rechargeMenu = new Q3PopupMenu(this); - balanceHistoryMenu = new Q3PopupMenu(this); - callHistoryMenu = new Q3PopupMenu(this); - adminCenterMenu = new Q3PopupMenu(this); + // Add the Diamondcard popup menus to the main Diamondcard menu. + rechargeMenu = Diamondcard->addMenu(tr("Recharge")); + balanceHistoryMenu = Diamondcard->addMenu(tr("Balance history")); + callHistoryMenu = Diamondcard->addMenu(tr("Call history")); + adminCenterMenu = Diamondcard->addMenu(tr("Admin center")); + + // No MEMMAN registration as the popup menu may be automatically // deleted by Qt on application close down. This would show up as // a memory leak in MEMMAN. @@ -1505,7 +1504,7 @@ void MphoneForm::updateDiamondcardMenu() for (list::const_iterator it = diamondcard_users.begin(); it != diamondcard_users.end(); ++it) { - int menuId; + QAction* menuId; t_user *user = *it; // Set the index in the user list as parameter to the menu item. @@ -1513,39 +1512,35 @@ void MphoneForm::updateDiamondcardMenu() // received this parameter and can use it as an index in the user list // to find the user. - menuId = rechargeMenu->insertItem(user->get_profile_name().c_str(), this, - SLOT(DiamondcardRecharge(int))); - rechargeMenu->setItemParameter(menuId, idx); - menuId = balanceHistoryMenu->insertItem(user->get_profile_name().c_str(), this, - SLOT(DiamondcardBalanceHistory(int))); - balanceHistoryMenu->setItemParameter(menuId, idx); - menuId = callHistoryMenu->insertItem(user->get_profile_name().c_str(), this, - SLOT(DiamondcardCallHistory(int))); - callHistoryMenu->setItemParameter(menuId, idx); - menuId = adminCenterMenu->insertItem(user->get_profile_name().c_str(), this, - SLOT(DiamondcardAdminCenter(int))); - adminCenterMenu->setItemParameter(menuId, idx); + menuId = rechargeMenu->addAction(user->get_profile_name().c_str(), this, + SLOT(DiamondcardRecharge())); + menuId->setData(idx); + menuId = balanceHistoryMenu->addAction(user->get_profile_name().c_str(), this, + SLOT(DiamondcardBalanceHistory())); + menuId->setData(idx); + menuId = callHistoryMenu->addAction(user->get_profile_name().c_str(), this, + SLOT(DiamondcardCallHistory())); + menuId->setData(idx); + menuId = adminCenterMenu->addAction(user->get_profile_name().c_str(), this, + SLOT(DiamondcardAdminCenter())); + menuId->setData(idx); ++idx; } - // Add the Diamondcard popup menus to the main Diamondcard menu. - Diamondcard->insertItem(tr("Recharge"), rechargeMenu); - Diamondcard->insertItem(tr("Balance history"), balanceHistoryMenu); - Diamondcard->insertItem(tr("Call history"), callHistoryMenu); - Diamondcard->insertItem(tr("Admin center"), adminCenterMenu); + } } -void MphoneForm::removeDiamondcardAction(int &id) +void MphoneForm::removeDiamondcardAction(QAction*& act) { - if (id != -1) { - Diamondcard->removeItem(id); - id = -1; + if (act != nullptr) { + Diamondcard->removeAction(act); + act = nullptr; } } -void MphoneForm::removeDiamondcardMenu(Q3PopupMenu* &menu) +void MphoneForm::removeDiamondcardMenu(QMenu* &menu) { if (menu) { delete menu; @@ -1564,7 +1559,8 @@ void MphoneForm::phoneRegister() delete (selectUserForm); } - selectUserForm = new SelectUserForm(this, "register", true); + selectUserForm = new SelectUserForm(this); + selectUserForm->setModal(true); MEMMAN_NEW(selectUserForm); connect(selectUserForm, SIGNAL(selection(list)), this, @@ -1591,7 +1587,8 @@ void MphoneForm::phoneDeregister() delete (selectUserForm); } - selectUserForm = new SelectUserForm(this, "deregister", true); + selectUserForm = new SelectUserForm(this); + selectUserForm->setModal(true); MEMMAN_NEW(selectUserForm); connect(selectUserForm, SIGNAL(selection(list)), this, @@ -1618,7 +1615,8 @@ void MphoneForm::phoneDeregisterAll() delete (selectUserForm); } - selectUserForm = new SelectUserForm(this, "deregister all", true); + selectUserForm = new SelectUserForm(this); + selectUserForm->setModal(true); MEMMAN_NEW(selectUserForm); connect(selectUserForm, SIGNAL(selection(list)), this, @@ -1651,12 +1649,13 @@ void MphoneForm::phoneInvite(t_user * user_config, if (inviteForm) { inviteForm->clear(); } else { - inviteForm = new InviteForm(this, "invite", true); + inviteForm = new InviteForm(this); + inviteForm->setModal(true); MEMMAN_NEW(inviteForm); // Initialize the destination history list for (int i = callComboBox->count() - 1; i >= 0; i--) { - inviteForm->addToInviteComboBox(callComboBox->text(i)); + inviteForm->addToInviteComboBox(callComboBox->itemText(i)); } connect(inviteForm, @@ -1676,7 +1675,7 @@ void MphoneForm::phoneInvite(t_user * user_config, void MphoneForm::phoneInvite(const QString &dest, const QString &subject, bool anonymous) { - t_user *user = phone->ref_user_profile(userComboBox->currentText().ascii()); + t_user *user = phone->ref_user_profile(userComboBox->currentText().toStdString()); if (!user) { log_file->write_report("Cannot find user profile.", "MphoneForm::phoneInvite", @@ -1688,7 +1687,7 @@ void MphoneForm::phoneInvite(const QString &dest, const QString &subject, bool a void MphoneForm::phoneInvite() { - t_user *user = phone->ref_user_profile(userComboBox->currentText().ascii()); + t_user *user = phone->ref_user_profile(userComboBox->currentText().toStdString()); if (!user) { log_file->write_report("Cannot find user profile.", "MphoneForm::phoneInvite", @@ -1704,7 +1703,7 @@ void MphoneForm::do_phoneInvite(t_user *user_config, const QString &display, const t_url &destination, const QString &subject, bool anonymous) { - ((t_gui *)ui)->action_invite(user_config, destination, display.ascii(), subject.ascii(), + ((t_gui *)ui)->action_invite(user_config, destination, display.toStdString(), subject.toStdString(), anonymous); updateState(); } @@ -1784,7 +1783,8 @@ void MphoneForm::phoneRedirect(const list &contacts) delete (redirectForm); } - redirectForm = new RedirectForm(this, "redirect", true); + redirectForm = new RedirectForm(this); + redirectForm->setModal(true); MEMMAN_NEW(redirectForm); connect(redirectForm, SIGNAL(destinations(const list &)), this, SLOT(do_phoneRedirect(const list &))); @@ -1821,7 +1821,8 @@ void MphoneForm::phoneTransfer(const string &dest, t_transfer_type transfer_type delete transferForm; } - transferForm = new TransferForm(this, "transfer", true); + transferForm = new TransferForm(this); + transferForm->setModal(true); MEMMAN_NEW(transferForm); connect(transferForm, SIGNAL(destination(const t_display_url &, t_transfer_type)), this, SLOT(do_phoneTransfer(const t_display_url &, t_transfer_type))); @@ -1942,12 +1943,13 @@ void MphoneForm::phoneTermCap(const QString &dest) delete (termCapForm); } - termCapForm = new TermCapForm(this, "termcap", true); + termCapForm = new TermCapForm(this); + termCapForm->setModal(true); MEMMAN_NEW(termCapForm); connect(termCapForm, SIGNAL(destination(t_user *, const t_url &)), this, SLOT(do_phoneTermCap(t_user *, const t_url &))); - t_user *user = phone->ref_user_profile(userComboBox->currentText().ascii()); + t_user *user = phone->ref_user_profile(userComboBox->currentText().toStdString()); if (!user) { log_file->write_report("Cannot find user profile.", "MphoneForm::phoneTermcap", @@ -1981,12 +1983,12 @@ void MphoneForm::phoneDTMF() void MphoneForm::sendDTMF(const QString &digits) { - ((t_gui *)ui)->action_dtmf(digits.ascii()); + ((t_gui *)ui)->action_dtmf(digits.toStdString()); } void MphoneForm::startMessageSession(void) { - t_user *user = phone->ref_user_profile(userComboBox->currentText().ascii()); + t_user *user = phone->ref_user_profile(userComboBox->currentText().toStdString()); if (!user) { log_file->write_report("Cannot find user profile.", "MphoneForm::startMessageSession", @@ -2109,7 +2111,8 @@ void MphoneForm::srvDnd() delete (selectUserForm); } - selectUserForm = new SelectUserForm(this, "dnd", true); + selectUserForm = new SelectUserForm(this); + selectUserForm->setModal(true); MEMMAN_NEW(selectUserForm); connect(selectUserForm, SIGNAL(selection(list)), this, @@ -2145,7 +2148,8 @@ void MphoneForm::srvAutoAnswer() delete (selectUserForm); } - selectUserForm = new SelectUserForm(this, "auto answer", true); + selectUserForm = new SelectUserForm(this); + selectUserForm->setModal(true); MEMMAN_NEW(selectUserForm); connect(selectUserForm, SIGNAL(selection(list)), this, @@ -2169,7 +2173,9 @@ void MphoneForm::do_srvAutoAnswer_disable(list user_list) { void MphoneForm::srvRedirect() { if (!srvRedirectForm) { - srvRedirectForm = new SrvRedirectForm(this, "call redirection", true); + srvRedirectForm = new SrvRedirectForm(this); + srvRedirectForm->setModal(true); + MEMMAN_NEW(srvRedirectForm); connect(srvRedirectForm, SIGNAL(destinations(t_user *, @@ -2241,7 +2247,8 @@ void MphoneForm::manual() void MphoneForm::editUserProfile() { if (!userProfileForm) { - userProfileForm = new UserProfileForm(this, "user profile", true); + userProfileForm = new UserProfileForm(this); + userProfileForm->setModal(true); MEMMAN_NEW(userProfileForm); connect(userProfileForm, @@ -2274,7 +2281,8 @@ void MphoneForm::editUserProfile() void MphoneForm::editSysSettings() { if (!sysSettingsForm) { - sysSettingsForm = new SysSettingsForm(this, "system settings", true); + sysSettingsForm = new SysSettingsForm(this); + sysSettingsForm->setModal(true); MEMMAN_NEW(sysSettingsForm); connect(sysSettingsForm, SIGNAL(sipUdpPortChanged()), this, SLOT(updateSipUdpPort())); @@ -2288,7 +2296,8 @@ void MphoneForm::editSysSettings() void MphoneForm::selectProfile() { if (!selectProfileForm) { - selectProfileForm = new SelectProfileForm(this, "select profile", true); + selectProfileForm = new SelectProfileForm(this); + selectProfileForm->setModal(true); MEMMAN_NEW(selectProfileForm); connect(selectProfileForm, SIGNAL(selection(const list &)), this, SLOT(newUsers(const list &))); @@ -2352,22 +2361,22 @@ void MphoneForm::newUsers(const list &profiles) // Strip off the .cfg extension profile.truncate(profile.length() - 4); - if (!phone->ref_user_profile(profile.ascii())) { + if (!phone->ref_user_profile(profile.toStdString())) { add_profile_list.push_back(*i); } } // Add new phone users - Q3ProgressDialog progress(tr("Starting user profiles..."), "Abort", add_profile_list.size(), this, - "starting user profiles", true); - progress.setCaption(PRODUCT_NAME); + QProgressDialog progress(tr("Starting user profiles..."), "Abort", 0, add_profile_list.size(), this); + progress.setModal(true); + progress.setWindowTitle(PRODUCT_NAME); progress.setMinimumDuration(200); int progressStep = 0; for (list::iterator i = add_profile_list.begin(); i != add_profile_list.end(); i++) { - progress.setProgress(progressStep); + progress.setValue(progressStep); qApp->processEvents(); - if (progress.wasCancelled()) { + if (progress.wasCanceled()) { log_file->write_report("User aborted startup of new users.", "MphoneForm::newUsers"); break; @@ -2408,7 +2417,7 @@ void MphoneForm::newUsers(const list &profiles) // Extension initialization will be done after // registration succeeded. } else { - error_msg = tr("The following profiles are both for user %1").arg(user_config.get_name().c_str()).ascii(); + error_msg = tr("The following profiles are both for user %1").arg(QString::fromStdString(user_config.get_name())).toStdString(); error_msg += '@'; error_msg += user_config.get_domain(); error_msg += ":\n\n"; @@ -2416,7 +2425,7 @@ void MphoneForm::newUsers(const list &profiles) error_msg += "\n"; error_msg += dup_user->get_profile_name(); error_msg += "\n\n"; - error_msg += tr("You can only run multiple profiles for different users.").ascii(); + error_msg += tr("You can only run multiple profiles for different users.").toStdString(); log_file->write_report(error_msg, "MphoneForm::newUsers", @@ -2432,7 +2441,7 @@ void MphoneForm::newUsers(const list &profiles) progressStep++; } - progress.setProgress(add_profile_list.size()); + progress.setValue(add_profile_list.size()); populateBuddyList(); updateUserComboBox(); @@ -2462,8 +2471,8 @@ void MphoneForm::updateUserComboBox() // If previous selected user is still active, make it the current user for (int i = 0; i < userComboBox->count(); i++) { - if (userComboBox->text(i) == current_user) { - userComboBox->setCurrentItem(i); + if (userComboBox->itemText(i) == current_user) { + userComboBox->setCurrentIndex(i); } } } @@ -2472,7 +2481,7 @@ void MphoneForm::updateSipUdpPort() { ((t_gui *)ui)->cb_show_msg(sysSettingsForm, tr("You have changed the SIP UDP port. This setting will only become "\ - "active when you restart Twinkle.").ascii(), + "active when you restart Twinkle.").toStdString(), MSG_INFO); } @@ -2558,7 +2567,7 @@ void MphoneForm::quickCall() string display, dest_str; t_user *from_user = phone->ref_user_profile( - userComboBox->currentText().ascii()); + userComboBox->currentText().toStdString()); if (!from_user) { log_file->write_report("Cannot find user profile.", "MphoneForm::quickCall", @@ -2567,7 +2576,7 @@ void MphoneForm::quickCall() } ui->expand_destination(from_user, - callComboBox->currentText().stripWhiteSpace().ascii(), + callComboBox->currentText().trimmed().toStdString(), display, dest_str); t_url dest(dest_str); @@ -2585,14 +2594,14 @@ void MphoneForm::addToCallComboBox(const QString &destination) { // Remove duplicate entries for (int i = callComboBox->count() - 1; i >= 0; i--) { - if (callComboBox->text(i) == destination) { + if (callComboBox->itemText(i) == destination) { callComboBox->removeItem(i); } } // Add entry - callComboBox->insertItem(destination, 0); - callComboBox->setCurrentItem(0); + callComboBox->insertItem(0, destination); + callComboBox->setCurrentIndex(0); // Remove last entry is list exceeds maximum size if (callComboBox->count() > SIZE_REDIAL_LIST) { @@ -2603,14 +2612,14 @@ void MphoneForm::addToCallComboBox(const QString &destination) // also called when a call is made through the inviteForm. // The insertItem puts the text also in the edit field. So it must // be cleared here. - callComboBox->clearEdit(); + callComboBox->clearEditText(); } void MphoneForm::showAddressBook() { if (!getAddressForm) { - getAddressForm = new GetAddressForm( - this, "select address", true); + getAddressForm = new GetAddressForm(this); + getAddressForm->setModal(true); MEMMAN_NEW(getAddressForm); } @@ -2743,36 +2752,36 @@ void MphoneForm::mouseReleaseEvent(QMouseEvent *e) void MphoneForm::processLeftMouseButtonRelease(QMouseEvent *e) { - if (statAaLabel->hasMouse()) { + if (statAaLabel->testAttribute(Qt::WA_UnderMouse)) { if (phone->ref_users().size() == 1) { - bool enable = !serviceAutoAnswer->isOn(); + bool enable = !serviceAutoAnswer->isChecked(); srvAutoAnswer(enable); - serviceAutoAnswer->setOn(enable); + serviceAutoAnswer->setChecked(enable); } else { srvAutoAnswer(); } - } else if (statDndLabel->hasMouse()) { + } else if (statDndLabel->testAttribute(Qt::WA_UnderMouse)) { if (phone->ref_users().size() == 1) { - bool enable = !serviceDnd->isOn(); + bool enable = !serviceDnd->isChecked(); srvDnd(enable); - serviceDnd->setOn(enable); + serviceDnd->setChecked(enable); } else { srvDnd(); } - } else if (statCfLabel->hasMouse()) { + } else if (statCfLabel->testAttribute(Qt::WA_UnderMouse)) { srvRedirect(); - } else if (statMWILabel->hasMouse()) { + } else if (statMWILabel->testAttribute(Qt::WA_UnderMouse)) { popupMenuVoiceMail(e->globalPos()); - } else if (statMissedLabel->hasMouse()) { + } else if (statMissedLabel->testAttribute(Qt::WA_UnderMouse)) { // Open the history form, when the user clicks on the // missed calls indication. viewHistory(); - } else if (statRegLabel->hasMouse()) { + } else if (statRegLabel->testAttribute(Qt::WA_UnderMouse)) { // Fetch registration status phoneShowRegistrations(); - } else if (crypt1Label->hasMouse()) { + } else if (crypt1Label->testAttribute(Qt::WA_UnderMouse)) { processCryptLabelClick(0); - } else if (crypt2Label->hasMouse()) { + } else if (crypt2Label->testAttribute(Qt::WA_UnderMouse)) { processCryptLabelClick(1); } else { e->ignore(); @@ -2799,13 +2808,12 @@ void MphoneForm::processCryptLabelClick(int line) // Show popup menu to access voice mail void MphoneForm::popupMenuVoiceMail(const QPoint &pos) { - Q3PopupMenu menu(this); + QMenu menu(this); QIcon vmIcon(QPixmap(":/icons/images/mwi_none16.png")); - vmIcon.setPixmap(QPixmap(":/icons/images/mwi_none16_dis.png"), - QIcon::Automatic, QIcon::Disabled); + vmIcon.addPixmap(QPixmap(":/icons/images/mwi_none16_dis.png"), QIcon::Disabled); listuser_list = phone->ref_users(); - map vm; + map vm; for (list::iterator i = user_list.begin(); i != user_list.end(); ++i) { QString address = (*i)->get_mwi_vm_address().c_str(); QString entry = (*i)->get_profile_name().c_str(); @@ -2816,26 +2824,26 @@ void MphoneForm::popupMenuVoiceMail(const QPoint &pos) entry += address; } - int id = menu.insertItem(vmIcon, entry); + QAction* act = menu.addAction(vmIcon, entry); if (address.isEmpty()) { - menu.setItemEnabled(id, false); + act->setEnabled(false); } - vm.insert(make_pair(id, *i)); + vm.insert(make_pair(act, *i)); } - int selected; + QAction* selected; // If multiple profiles are active, then show the popup menu. // If one profile is active, then call voice mail immediately. if (user_list.size() > 1) { selected = menu.exec(pos); - if (selected == -1) return; + if (selected == nullptr) return; } else { if (vm.begin()->second->get_mwi_vm_address().empty()) { ui->cb_show_msg( tr("You must provision your voice mail address in your " - "user profile, before you can access it.").ascii(), + "user profile, before you can access it.").toStdString(), MSG_INFO); return; } @@ -2845,7 +2853,7 @@ void MphoneForm::popupMenuVoiceMail(const QPoint &pos) // Call can only be made if line is idle int line = phone->get_active_line(); if (phone->get_line_state(line) == LS_BUSY) { - ui->cb_show_msg(tr("The line is busy. Cannot access voice mail.").ascii(), + ui->cb_show_msg(tr("The line is busy. Cannot access voice mail.").toStdString(), MSG_WARNING); return; } @@ -2866,7 +2874,7 @@ void MphoneForm::popupMenuVoiceMail(const QPoint &pos) } else { QString msg(tr("The voice mail address %1 is an invalid address. " "Please provision a valid address in your user profile.")); - ui->cb_show_msg(msg.arg(selectedUser->get_mwi_vm_address().c_str()).ascii(), + ui->cb_show_msg(msg.arg(selectedUser->get_mwi_vm_address().c_str()).toStdString(), MSG_CRITICAL); } } @@ -2891,7 +2899,7 @@ void MphoneForm::showDisplay(bool on) } viewDisplay = on; - viewDisplayAction->setOn(on); + viewDisplayAction->setChecked(on); } void MphoneForm::showBuddyList(bool on) @@ -2903,7 +2911,7 @@ void MphoneForm::showBuddyList(bool on) } viewBuddyList = on; - viewBuddyListAction->setOn(on); + viewBuddyListAction->setChecked(on); } void MphoneForm::showCompactLineStatus(bool on) @@ -2987,25 +2995,27 @@ void MphoneForm::populateBuddyList() new BuddyListViewItem(profileItem, &(*bit)); } - profileItem->setOpen(true); + // profileItem->setOpen(true); } + buddyListView->expandAll(); } -void MphoneForm::showBuddyListPopupMenu(Q3ListViewItem *item, const QPoint &pos) +void MphoneForm::showBuddyListPopupMenu(const QPoint &pos) { + QTreeWidgetItem* item = buddyListView->currentItem(); if (!item) return; BuddyListViewItem *buddyItem = dynamic_cast(item); if (buddyItem) { - buddyPopupMenu->popup(pos); + buddyPopupMenu->popup(buddyListView->mapToGlobal(pos)); } else { - buddyListPopupMenu->popup(pos); + buddyListPopupMenu->popup(buddyListView->mapToGlobal(pos)); } } void MphoneForm::doCallBuddy() { - Q3ListViewItem *qitem = buddyListView->currentItem(); + QTreeWidgetItem *qitem = buddyListView->currentItem(); BuddyListViewItem *item = dynamic_cast(qitem); if (!item) return; @@ -3015,7 +3025,7 @@ void MphoneForm::doCallBuddy() phoneInvite(user_config, buddy->get_sip_address().c_str(), "", false); } -void MphoneForm::doMessageBuddy(Q3ListViewItem *qitem) +void MphoneForm::doMessageBuddy(QTreeWidgetItem *qitem) { BuddyListViewItem *item = dynamic_cast(qitem); if (!item) return; @@ -3027,26 +3037,28 @@ void MphoneForm::doMessageBuddy(Q3ListViewItem *qitem) void MphoneForm::doMessageBuddy() { - Q3ListViewItem *item = buddyListView->currentItem(); + QTreeWidgetItem *item = buddyListView->currentItem(); doMessageBuddy(item); } void MphoneForm::doEditBuddy() { - Q3ListViewItem *qitem = buddyListView->currentItem(); + QTreeWidgetItem *qitem = buddyListView->currentItem(); BuddyListViewItem *item = dynamic_cast(qitem); if (!item) return; t_buddy *buddy = item->get_buddy(); - BuddyForm *form = new BuddyForm(this, "new_buddy", true, Qt::WDestructiveClose); + BuddyForm *form = new BuddyForm(this); + form->setModal(true); + form->setAttribute(Qt::WA_DeleteOnClose, true); // Do not call MEMMAN as this form will be deleted automatically. form->showEdit(*buddy); } void MphoneForm::doDeleteBuddy() { - Q3ListViewItem *qitem = buddyListView->currentItem(); + QTreeWidgetItem *qitem = buddyListView->currentItem(); BuddyListViewItem *item = dynamic_cast(qitem); if (!item) return; @@ -3066,13 +3078,13 @@ void MphoneForm::doDeleteBuddy() string err_msg; if (!buddy_list->save(err_msg)) { QString msg = tr("Failed to save buddy list: %1").arg(err_msg.c_str()); - ((t_gui *)ui)->cb_show_msg(this, msg.ascii(), MSG_CRITICAL); + ((t_gui *)ui)->cb_show_msg(this, msg.toStdString(), MSG_CRITICAL); } } void MphoneForm::doAddBuddy() { - Q3ListViewItem *qitem = buddyListView->currentItem(); + QTreeWidgetItem *qitem = buddyListView->currentItem(); BLViewUserItem *item = dynamic_cast(qitem); if (!item) return; @@ -3081,14 +3093,16 @@ void MphoneForm::doAddBuddy() t_buddy_list *buddy_list = pu->get_buddy_list(); if (!buddy_list) return; - BuddyForm *form = new BuddyForm(this, "new_buddy", true, Qt::WDestructiveClose); + BuddyForm *form = new BuddyForm(this); + form->setModal(true); + form->setAttribute( Qt::WA_DeleteOnClose, true ); // Do not call MEMMAN as this form will be deleted automatically. form->showNew(*buddy_list, item); } void MphoneForm::doAvailabilityOffline() { - Q3ListViewItem *qitem = buddyListView->currentItem(); + QTreeWidgetItem *qitem = buddyListView->currentItem(); BLViewUserItem *item = dynamic_cast(qitem); if (!item) return; @@ -3100,7 +3114,7 @@ void MphoneForm::doAvailabilityOffline() void MphoneForm::doAvailabilityOnline() { - Q3ListViewItem *qitem = buddyListView->currentItem(); + QTreeWidgetItem *qitem = buddyListView->currentItem(); BLViewUserItem *item = dynamic_cast(qitem); if (!item) return; @@ -3112,9 +3126,10 @@ void MphoneForm::doAvailabilityOnline() void MphoneForm::DiamondcardSignUp() { - DiamondcardProfileForm *f = new DiamondcardProfileForm(this, "select profile", true, - Qt::WDestructiveClose); + DiamondcardProfileForm *f = new DiamondcardProfileForm(this); + f->setModal(true); + f->setAttribute( Qt::WA_DeleteOnClose, true ); connect(f, SIGNAL(newDiamondcardProfile(const QString&)), this, SLOT(newDiamondcardUser(const QString &))); @@ -3131,7 +3146,7 @@ void MphoneForm::newDiamondcardUser(const QString &filename) profileFilenames.push_back(user->get_filename()); } - profileFilenames.push_back(filename.ascii()); + profileFilenames.push_back(filename.toStdString()); newUsers(profileFilenames); } @@ -3147,22 +3162,27 @@ void MphoneForm::DiamondcardAction(t_dc_action action, int userIdx) ((t_gui *)ui)->open_url_in_browser(url); } -void MphoneForm::DiamondcardRecharge(int userIdx) +void MphoneForm::DiamondcardRecharge() +{ + DiamondcardAction(DC_ACT_RECHARGE, static_cast(sender())->data().toInt()); +} + +void MphoneForm::DiamondcardBalanceHistory() { - DiamondcardAction(DC_ACT_RECHARGE, userIdx); + DiamondcardAction(DC_ACT_BALANCE_HISTORY, static_cast(sender())->data().toInt()); } -void MphoneForm::DiamondcardBalanceHistory(int userIdx) +void MphoneForm::DiamondcardCallHistory() { - DiamondcardAction(DC_ACT_BALANCE_HISTORY, userIdx); + DiamondcardAction(DC_ACT_CALL_HISTORY, static_cast(sender())->data().toInt()); } -void MphoneForm::DiamondcardCallHistory(int userIdx) +void MphoneForm::DiamondcardAdminCenter() { - DiamondcardAction(DC_ACT_CALL_HISTORY, userIdx); + DiamondcardAction(DC_ACT_ADMIN_CENTER, static_cast(sender())->data().toInt()); } -void MphoneForm::DiamondcardAdminCenter(int userIdx) +void MphoneForm::whatsThis() { - DiamondcardAction(DC_ACT_ADMIN_CENTER, userIdx); + QWhatsThis::enterWhatsThisMode(); } diff --git a/src/gui/mphoneform.h b/src/gui/mphoneform.h index 23adacb..5be738e 100644 --- a/src/gui/mphoneform.h +++ b/src/gui/mphoneform.h @@ -16,8 +16,7 @@ #include "selectuserform.h" #include "selectprofileform.h" #include -#include -#include +#include #include #include "im/msg_session.h" #include "messageformview.h" @@ -27,11 +26,11 @@ class t_phone; extern t_phone *phone; -class MphoneForm : public Q3MainWindow, public Ui::MphoneForm +class MphoneForm : public QMainWindow, public Ui::MphoneForm { Q_OBJECT public: - MphoneForm(QWidget* parent, const char * name, Qt::WindowFlags f); + MphoneForm(QWidget* parent = 0); ~MphoneForm(); public: @@ -60,8 +59,8 @@ public slots: void updateSysTrayStatus(); void updateMenuStatus(); void updateDiamondcardMenu(); - void removeDiamondcardAction( int & id ); - void removeDiamondcardMenu( Q3PopupMenu * & menu ); + void removeDiamondcardAction( QAction* & id ); + void removeDiamondcardMenu( QMenu * & menu ); void phoneRegister(); void do_phoneRegister( list user_list ); void phoneDeregister(); @@ -150,9 +149,9 @@ public slots: void showBuddyList( bool on ); void showCompactLineStatus( bool on ); void populateBuddyList(); - void showBuddyListPopupMenu( Q3ListViewItem * item, const QPoint & pos ); + void showBuddyListPopupMenu( const QPoint & pos ); void doCallBuddy(); - void doMessageBuddy( Q3ListViewItem * qitem ); + void doMessageBuddy( QTreeWidgetItem * qitem ); void doMessageBuddy(); void doEditBuddy(); void doDeleteBuddy(); @@ -162,10 +161,11 @@ public slots: void DiamondcardSignUp(); void newDiamondcardUser( const QString & filename ); void DiamondcardAction( t_dc_action action, int userIdx ); - void DiamondcardRecharge( int userIdx ); - void DiamondcardBalanceHistory( int userIdx ); - void DiamondcardCallHistory( int userIdx ); - void DiamondcardAdminCenter( int userIdx ); + void DiamondcardRecharge(); + void DiamondcardBalanceHistory(); + void DiamondcardCallHistory(); + void DiamondcardAdminCenter(); + void whatsThis(); private: void init(); @@ -196,9 +196,9 @@ private: bool viewDisplay; bool viewCompactLineStatus; bool mwiFlashStatus; - Q3PopupMenu *buddyPopupMenu; - Q3PopupMenu *buddyListPopupMenu; - Q3PopupMenu *changeAvailabilityPopupMenu; + QMenu *buddyPopupMenu; + QMenu *buddyListPopupMenu; + QMenu *changeAvailabilityPopupMenu; bool viewBuddyList; }; diff --git a/src/gui/mphoneform.ui b/src/gui/mphoneform.ui index 0034164..45f4ded 100644 --- a/src/gui/mphoneform.ui +++ b/src/gui/mphoneform.ui @@ -1,7 +1,7 @@ MphoneForm - + true @@ -9,7 +9,7 @@ 0 0 - 739 + 733 693 @@ -38,21 +38,13 @@ true - - - 0 - 0 - 485 - 354 - - Qt::Horizontal - + 150 @@ -65,12 +57,20 @@ 0 + + Qt::CustomContextMenu + You can create a separate buddy list for each user profile. You can only see availability of your buddies and publish your own availability if your provider offers a presence server. - + true + + + Buddy list + + @@ -131,7 +131,7 @@ - + :/icons/images/kontact_contacts.png:/icons/images/kontact_contacts.png @@ -192,6 +192,12 @@ 0 + + Auto answer indication. + + + :/icons/images/auto_answer.png + false @@ -205,6 +211,12 @@ 0 + + Call redirect indication. + + + :/icons/images/cf.png + false @@ -218,6 +230,12 @@ 0 + + Do not disturb indication. + + + :/icons/images/cancel.png + false @@ -231,6 +249,12 @@ 0 + + Message waiting indication. + + + :/icons/images/mwi_none16.png + false @@ -244,6 +268,12 @@ 0 + + Missed call indication. + + + :/icons/images/missed.png + false @@ -257,6 +287,12 @@ 0 + + Registration status. + + + :/icons/images/twinkle16.png + false @@ -269,45 +305,45 @@ - + 0 0 - + Display - + 0 0 + + true + - - true - - + 0 0 - + Line status @@ -629,7 +665,7 @@ - QFrame::Box + QFrame::StyledPanel photo @@ -953,7 +989,7 @@ - QFrame::Box + QFrame::StyledPanel photo @@ -974,30 +1010,31 @@ - - - - 0 - 0 - 100 - 30 - + + + Qt::ToolButtonTextUnderIcon false - true + false - true + false - true + false - Call Toolbar + + + TopToolBarArea + + + false + @@ -1016,8 +1053,8 @@ 0 0 - 0 - 0 + 733 + 21 @@ -1783,40 +1820,6 @@ - - - - Q3MainWindow - QWidget -
q3mainwindow.h
- 1 -
- - Q3ListView - QWidget -
q3listview.h
-
- - Q3GroupBox - QWidget -
q3groupbox.h
-
- - Q3TextEdit - QWidget -
q3textedit.h
-
- - Q3ButtonGroup - QWidget -
q3buttongroup.h
-
- - Q3ToolBar - QWidget -
q3toolbar.h
-
-
callComboBox addressToolButton @@ -1879,8 +1882,8 @@ showAddressBook() - 20 - 20 + 634 + 127 20 @@ -1895,8 +1898,8 @@ quickCall() - 20 - 20 + 664 + 127 20 @@ -2279,8 +2282,8 @@ line2rbChangedState(bool) - 20 - 20 + 309 + 597 20 @@ -2295,8 +2298,8 @@ line1rbChangedState(bool) - 20 - 20 + 309 + 491 20 @@ -2417,14 +2420,14 @@
- buddyListView - rightButtonPressed(Q3ListViewItem*,QPoint,int) + viewBuddyListAction + toggled(bool) MphoneForm - showBuddyListPopupMenu(Q3ListViewItem*,QPoint) + showBuddyList(bool) - 20 - 20 + -1 + -1 20 @@ -2433,14 +2436,14 @@ - buddyListView - doubleClicked(Q3ListViewItem*) + helpManualAction + activated() MphoneForm - doMessageBuddy(Q3ListViewItem*) + manual() - 20 - 20 + -1 + -1 20 @@ -2449,10 +2452,10 @@ - viewBuddyListAction - toggled(bool) + diamondcardSign_upAction + activated() MphoneForm - showBuddyList(bool) + DiamondcardSignUp() -1 @@ -2465,36 +2468,40 @@ - helpManualAction - activated() + buddyListView + itemDoubleClicked(QTreeWidgetItem*,int) MphoneForm - manual() + doMessageBuddy(QTreeWidgetItem*) - -1 - -1 + 130 + 206 - 20 - 20 + 3 + 195 - diamondcardSign_upAction - activated() + buddyListView + customContextMenuRequested(QPoint) MphoneForm - DiamondcardSignUp() + showBuddyListPopupMenu(QPoint) - -1 - -1 + 98 + 285 - 20 - 20 + 3 + 301
+ + doMessageBuddy(QTreeWidgetItem*) + showBuddyListPopupMenu(QPoint) + diff --git a/src/gui/numberconversionform.cpp b/src/gui/numberconversionform.cpp index 16d0b3c..af95dd2 100644 --- a/src/gui/numberconversionform.cpp +++ b/src/gui/numberconversionform.cpp @@ -52,7 +52,7 @@ void NumberConversionForm::validate() if (expr.isEmpty()) { ((t_gui *)ui)->cb_show_msg(this, - tr("Match expression may not be empty.").ascii(), MSG_CRITICAL); + tr("Match expression may not be empty.").toStdString(), MSG_CRITICAL); exprLineEdit->setFocus(); exprLineEdit->selectAll(); return; @@ -60,17 +60,17 @@ void NumberConversionForm::validate() if (replace.isEmpty()) { ((t_gui *)ui)->cb_show_msg(this, - tr("Replace value may not be empty.").ascii(), MSG_CRITICAL); + tr("Replace value may not be empty.").toStdString(), MSG_CRITICAL); replaceLineEdit->setFocus(); replaceLineEdit->selectAll(); return; } try { - boost::regex re(expr.ascii()); + boost::regex re(expr.toStdString()); } catch (boost::bad_expression) { ((t_gui *)ui)->cb_show_msg(this, - tr("Invalid regular expression.").ascii(), MSG_CRITICAL); + tr("Invalid regular expression.").toStdString(), MSG_CRITICAL); exprLineEdit->setFocus(); return; } diff --git a/src/gui/qt_translator.h b/src/gui/qt_translator.h index c896d4c..8f4fd23 100644 --- a/src/gui/qt_translator.h +++ b/src/gui/qt_translator.h @@ -29,11 +29,11 @@ public: t_qt_translator(QApplication *qa) : _qa(qa) {}; virtual string translate(const string &s) { - return _qa->translate("TwinkleCore", s.c_str()).ascii(); + return _qa->translate("TwinkleCore", s.c_str()).toStdString(); }; virtual string translate2(const string &context, const string &s) { - return _qa->translate(context.c_str(), s.c_str()).ascii(); + return _qa->translate(context.c_str(), s.c_str()).toStdString(); }; private: diff --git a/src/gui/redirectform.cpp b/src/gui/redirectform.cpp index 7f47eb5..d8bc6f5 100644 --- a/src/gui/redirectform.cpp +++ b/src/gui/redirectform.cpp @@ -23,8 +23,8 @@ #include "audits/memman.h" #include "gui.h" -RedirectForm::RedirectForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +RedirectForm::RedirectForm(QWidget* parent) + : QDialog(parent) { setupUi(this); init(); @@ -53,12 +53,12 @@ void RedirectForm::init() // Set toolbutton icons for disabled options. QIcon i; - i = address1ToolButton->iconSet(); - i.setPixmap(QPixmap(":/icons/images/kontact_contacts-disabled.png"), - QIcon::Automatic, QIcon::Disabled); - address1ToolButton->setIconSet(i); - address2ToolButton->setIconSet(i); - address3ToolButton->setIconSet(i); + i = address1ToolButton->icon(); + i.addPixmap(QPixmap(":/icons/images/kontact_contacts-disabled.png"), + QIcon::Disabled); + address1ToolButton->setIcon(i); + address2ToolButton->setIcon(i); + address3ToolButton->setIcon(i); } void RedirectForm::destroy() @@ -91,7 +91,7 @@ void RedirectForm::validate() list dest_list; // 1st choice destination - ui->expand_destination(user_config, contact1LineEdit->text().stripWhiteSpace().ascii(), + ui->expand_destination(user_config, contact1LineEdit->text().trimmed().toStdString(), destination); if (destination.is_valid()) { dest_list.push_back(destination); @@ -103,7 +103,7 @@ void RedirectForm::validate() // 2nd choice destination if (!contact2LineEdit->text().isEmpty()) { ui->expand_destination(user_config, - contact2LineEdit->text().stripWhiteSpace().ascii(), destination); + contact2LineEdit->text().trimmed().toStdString(), destination); if (destination.is_valid()) { dest_list.push_back(destination); } else { @@ -115,7 +115,7 @@ void RedirectForm::validate() // 3rd choice destination if (!contact3LineEdit->text().isEmpty()) { ui->expand_destination(user_config, - contact3LineEdit->text().stripWhiteSpace().ascii(), destination); + contact3LineEdit->text().trimmed().toStdString(), destination); if (destination.is_valid()) { dest_list.push_back(destination); } else { @@ -131,8 +131,8 @@ void RedirectForm::validate() void RedirectForm::showAddressBook() { if (!getAddressForm) { - getAddressForm = new GetAddressForm( - this, "select address", true); + getAddressForm = new GetAddressForm(this); + getAddressForm->setModal(true); MEMMAN_NEW(getAddressForm); } diff --git a/src/gui/redirectform.h b/src/gui/redirectform.h index 583e4ff..6e74622 100644 --- a/src/gui/redirectform.h +++ b/src/gui/redirectform.h @@ -26,7 +26,7 @@ class RedirectForm : public QDialog, public Ui::RedirectForm Q_OBJECT public: - RedirectForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + RedirectForm(QWidget* parent = 0); ~RedirectForm(); public slots: diff --git a/src/gui/selectnicform.cpp b/src/gui/selectnicform.cpp index 735542b..370a6c6 100644 --- a/src/gui/selectnicform.cpp +++ b/src/gui/selectnicform.cpp @@ -29,8 +29,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -SelectNicForm::SelectNicForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +SelectNicForm::SelectNicForm(QWidget* parent) + : QDialog(parent) { setupUi(this); diff --git a/src/gui/selectnicform.h b/src/gui/selectnicform.h index f926ed3..027e972 100644 --- a/src/gui/selectnicform.h +++ b/src/gui/selectnicform.h @@ -8,7 +8,7 @@ class SelectNicForm : public QDialog, public Ui::SelectNicForm Q_OBJECT public: - SelectNicForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + SelectNicForm(QWidget* parent = 0); ~SelectNicForm(); public slots: diff --git a/src/gui/selectprofileform.cpp b/src/gui/selectprofileform.cpp index 0049dbe..8fc395e 100644 --- a/src/gui/selectprofileform.cpp +++ b/src/gui/selectprofileform.cpp @@ -41,8 +41,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -SelectProfileForm::SelectProfileForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +SelectProfileForm::SelectProfileForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -72,7 +72,7 @@ void SelectProfileForm::init() { user_config = 0; -#ifndef ENABLE_DIAMONDCARD +#ifndef WITH_DIAMONDCARD diamondcardPushButton->hide(); #endif } @@ -152,7 +152,7 @@ int SelectProfileForm::execForm() QString profile = item->text(); profile.append(USER_FILE_EXT); selectedProfiles.clear(); - selectedProfiles.push_back(profile.ascii()); + selectedProfiles.push_back(profile.toStdString()); QMessageBox::information(this, PRODUCT_NAME, tr( ""\ @@ -161,7 +161,8 @@ int SelectProfileForm::execForm() "

"\ "Click OK to view and adjust the system settings.")); - SysSettingsForm f(this, "system settings", true); + SysSettingsForm f(this); + f.setModal(true); f.exec(); return QDialog::Accepted; @@ -203,7 +204,7 @@ void SelectProfileForm::showForm(QWidget *_mainWindow) // Set pixmap of default profile list l = sys_config->get_start_user_profiles(); - if (std::find(l.begin(), l.end(), profile.ascii()) != l.end()) + if (std::find(l.begin(), l.end(), profile.toStdString()) != l.end()) { item->setData(Qt::DecorationRole, QPixmap(":/icons/images/twinkle16.png")); defaultSet = true; @@ -212,7 +213,7 @@ void SelectProfileForm::showForm(QWidget *_mainWindow) // Tick check box of active profile item->setFlags(item->flags() | Qt::ItemIsUserCheckable); - if (phone->ref_user_profile(profile.ascii())) { + if (phone->ref_user_profile(profile.toStdString())) { item->setCheckState(Qt::Checked); } } @@ -232,7 +233,7 @@ void SelectProfileForm::runProfile() QListWidgetItem* item = profileListView->item(i); QString profile = item->text(); profile.append(USER_FILE_EXT); - selectedProfiles.push_back(profile.ascii()); + selectedProfiles.push_back(profile.toStdString()); } if (selectedProfiles.empty()) { @@ -257,13 +258,13 @@ void SelectProfileForm::editProfile() // If the profile to edit is currently active, then edit the in-memory // user profile owned by the t_phone_user object if (mainWindow) { - t_user *active_user = phone->ref_user_profile(profile.ascii()); + t_user *active_user = phone->ref_user_profile(profile.toStdString()); if (active_user) { list user_list; user_list.push_back(active_user); - UserProfileForm *f = new UserProfileForm(this, - "edit user profile", true, - Qt::WDestructiveClose); + UserProfileForm *f = new UserProfileForm(this); + f->setAttribute(Qt::WA_DeleteOnClose); + f->setModal(true); connect(f, SIGNAL(authCredentialsChanged(t_user *, const string&)), mainWindow, @@ -290,7 +291,7 @@ void SelectProfileForm::editProfile() user_config = new t_user(); MEMMAN_NEW(user_config); - if (!user_config->read_config(profile.ascii(), error_msg)) { + if (!user_config->read_config(profile.toStdString(), error_msg)) { ((t_gui *)ui)->cb_show_msg(this, error_msg, MSG_WARNING); return; } @@ -298,8 +299,9 @@ void SelectProfileForm::editProfile() // Show the edit user profile form (modal dialog) list user_list; user_list.push_back(user_config); - UserProfileForm *f = new UserProfileForm(this, "edit user profile", true, - Qt::WDestructiveClose); + UserProfileForm *f = new UserProfileForm(this); + f->setAttribute(Qt::WA_DeleteOnClose); + f->setModal(true); f->show(user_list, ""); } @@ -311,7 +313,8 @@ void SelectProfileForm::newProfile() void SelectProfileForm::newProfile(bool exec_mode) { // Ask user for a profile name - GetProfileNameForm getProfileNameForm(this, "get profile name", true); + GetProfileNameForm getProfileNameForm(this); + getProfileNameForm.setModal(true); if (!getProfileNameForm.execNewName()) return; // Create file name @@ -326,13 +329,14 @@ void SelectProfileForm::newProfile(bool exec_mode) } user_config = new t_user(); MEMMAN_NEW(user_config); - user_config->set_config(filename.ascii()); + user_config->set_config(filename.toStdString()); // Show the edit user profile form (modal dialog) list user_list; user_list.push_back(user_config); - UserProfileForm *f = new UserProfileForm(this, "edit user profile", true, - Qt::WDestructiveClose); + UserProfileForm *f = new UserProfileForm(this); + f->setAttribute(Qt::WA_DeleteOnClose); + f->setModal(true); connect(f, SIGNAL(success()), this, SLOT(newProfileCreated())); if (exec_mode) { @@ -407,8 +411,8 @@ void SelectProfileForm::deleteProfile() // Delete profile from list of default profiles in // system settings list l = sys_config->get_start_user_profiles(); - if (std::find(l.begin(), l.end(), profile.ascii()) != l.end()) { - l.remove(profile.ascii()); + if (std::find(l.begin(), l.end(), profile.toStdString()) != l.end()) { + l.remove(profile.toStdString()); sys_config->set_start_user_profiles(l); string error_msg; @@ -447,7 +451,8 @@ void SelectProfileForm::renameProfile() QString oldProfile = item->text(); // Ask user for a new profile name - GetProfileNameForm getProfileNameForm(this, "get profile name", true); + GetProfileNameForm getProfileNameForm(this); + getProfileNameForm.setModal(true); if (!getProfileNameForm.execRename(oldProfile)) return; // Create file name for the new profile @@ -508,9 +513,9 @@ void SelectProfileForm::renameProfile() // Rename profile in list of default profiles in // system settings list l = sys_config->get_start_user_profiles(); - if (std::find(l.begin(), l.end(), oldProfile.ascii()) != l.end()) + if (std::find(l.begin(), l.end(), oldProfile.toStdString()) != l.end()) { - std::replace(l.begin(), l.end(), oldProfile.ascii(), newProfile.ascii()); + std::replace(l.begin(), l.end(), oldProfile.toStdString(), newProfile.toStdString()); sys_config->set_start_user_profiles(l); string error_msg; @@ -554,7 +559,7 @@ void SelectProfileForm::setAsDefault() if (item->checkState() == Qt::Checked) { item->setData(Qt::DecorationRole, QPixmap(":/icons/images/twinkle16.png")); - l.push_back(item->text().ascii()); + l.push_back(item->text().toStdString()); } else { @@ -580,7 +585,8 @@ void SelectProfileForm::wizardProfile() void SelectProfileForm::wizardProfile(bool exec_mode) { // Ask user for a profile name - GetProfileNameForm getProfileNameForm(this, "get profile name", true); + GetProfileNameForm getProfileNameForm(this); + getProfileNameForm.setModal(true); if (!getProfileNameForm.execNewName()) return; // Create file name @@ -595,10 +601,12 @@ void SelectProfileForm::wizardProfile(bool exec_mode) } user_config = new t_user(); MEMMAN_NEW(user_config); - user_config->set_config(filename.ascii()); + user_config->set_config(filename.toStdString()); // Show the wizard form (modal dialog) - WizardForm *f = new WizardForm(this, "wizard", true, Qt::WDestructiveClose); + WizardForm *f = new WizardForm(this); + f->setAttribute(Qt::WA_DeleteOnClose); + f->setModal(true); connect(f, SIGNAL(success()), this, SLOT(newProfileCreated())); if (exec_mode) { @@ -624,8 +632,10 @@ void SelectProfileForm::diamondcardProfile(bool exec_mode) MEMMAN_NEW(user_config); // Show the diamondcard profile form (modal dialog) - DiamondcardProfileForm *f = new DiamondcardProfileForm(this, "diamondcard", - true, Qt::WDestructiveClose); + DiamondcardProfileForm *f = new DiamondcardProfileForm(this); + f->setAttribute(Qt::WA_DeleteOnClose); + f->setModal(true); + connect(f, SIGNAL(success()), this, SLOT(newProfileCreated())); if (exec_mode) { @@ -638,8 +648,9 @@ void SelectProfileForm::diamondcardProfile(bool exec_mode) void SelectProfileForm::sysSettings() { - SysSettingsForm *f = new SysSettingsForm(this, "system settings", true, - Qt::WDestructiveClose); + SysSettingsForm *f = new SysSettingsForm(this); + f->setAttribute(Qt::WA_DeleteOnClose); + f->setModal(true); f->show(); } @@ -654,10 +665,10 @@ bool SelectProfileForm::getUserProfiles(QStringList &profiles, QString &error) } // Select all config files - QString filterName = "*"; + QString filterName = "*"; filterName.append(USER_FILE_EXT); d.setFilter(QDir::Files); - d.setNameFilter(filterName); + d.setNameFilters(QStringList(filterName)); d.setSorting(QDir::Name | QDir::IgnoreCase); profiles = d.entryList(); diff --git a/src/gui/selectprofileform.h b/src/gui/selectprofileform.h index 517efb1..8566a4e 100644 --- a/src/gui/selectprofileform.h +++ b/src/gui/selectprofileform.h @@ -14,7 +14,7 @@ class SelectProfileForm : public QDialog, public Ui::SelectProfileForm Q_OBJECT public: - SelectProfileForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + SelectProfileForm(QWidget* parent = 0); ~SelectProfileForm(); std::list selectedProfiles; diff --git a/src/gui/selectprofileform.ui b/src/gui/selectprofileform.ui index 6510d04..5010211 100644 --- a/src/gui/selectprofileform.ui +++ b/src/gui/selectprofileform.ui @@ -237,7 +237,6 @@ list string phone.h - q3mainwindow.h diff --git a/src/gui/selectuserform.cpp b/src/gui/selectuserform.cpp index 9f1618f..96c9eaa 100644 --- a/src/gui/selectuserform.cpp +++ b/src/gui/selectuserform.cpp @@ -30,8 +30,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -SelectUserForm::SelectUserForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +SelectUserForm::SelectUserForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -91,7 +91,7 @@ void SelectUserForm::show(t_select_purpose purpose) default: assert(false); } - setCaption(title); + setWindowTitle(title); purposeTextLabel->setText(msg_purpose); // Fill list view @@ -128,10 +128,10 @@ void SelectUserForm::validate() QListWidgetItem *item = userListView->item(i); if (item->checkState() == Qt::Checked) { selected_list.push_back(phone-> - ref_user_profile(item->text().ascii())); + ref_user_profile(item->text().toStdString())); } else { not_selected_list.push_back(phone-> - ref_user_profile(item->text().ascii())); + ref_user_profile(item->text().toStdString())); } i++; } diff --git a/src/gui/selectuserform.h b/src/gui/selectuserform.h index 9a9ce97..db99b5c 100644 --- a/src/gui/selectuserform.h +++ b/src/gui/selectuserform.h @@ -13,7 +13,7 @@ class SelectUserForm : public QDialog, public Ui::SelectUserForm Q_OBJECT public: - SelectUserForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + SelectUserForm(QWidget* parent = 0); ~SelectUserForm(); public slots: diff --git a/src/gui/sendfileform.cpp b/src/gui/sendfileform.cpp index cd9f10e..54b6cf3 100644 --- a/src/gui/sendfileform.cpp +++ b/src/gui/sendfileform.cpp @@ -32,8 +32,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -SendFileForm::SendFileForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +SendFileForm::SendFileForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -61,7 +61,7 @@ void SendFileForm::languageChange() void SendFileForm::init() { - setWindowFlags(windowFlags() | Qt::WDestructiveClose); + setAttribute(Qt::WA_DeleteOnClose); _chooseFileDialog = NULL; } @@ -80,7 +80,7 @@ void SendFileForm::destroy() void SendFileForm::signalSelectedInfo() { if (!QFile::exists(fileLineEdit->text())) { - ((t_gui *)ui)->cb_show_msg(this, tr("File does not exist.").ascii(), MSG_WARNING); + ((t_gui *)ui)->cb_show_msg(this, tr("File does not exist.").toStdString(), MSG_WARNING); return; } @@ -103,7 +103,7 @@ void SendFileForm::chooseFile() connect(d, SIGNAL(fileSelected(const QString &)), this, SLOT(setFilename())); #endif - d->setCaption(tr("Send file...")); + d->setWindowTitle(tr("Send file...")); if (_chooseFileDialog) { MEMMAN_DELETE(_chooseFileDialog); @@ -126,7 +126,10 @@ void SendFileForm::setFilename() filename = d->selectedFile(); #else QFileDialog *d = dynamic_cast(_chooseFileDialog); - filename = d->selectedFile(); + QStringList files = d->selectedFiles(); + + if (!files.empty()) + filename = files[0]; #endif fileLineEdit->setText(filename); diff --git a/src/gui/sendfileform.h b/src/gui/sendfileform.h index 6601ad2..c881b68 100644 --- a/src/gui/sendfileform.h +++ b/src/gui/sendfileform.h @@ -7,7 +7,7 @@ class SendFileForm : public QDialog, public Ui::SendFileForm Q_OBJECT public: - SendFileForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + SendFileForm(QWidget* parent = 0); ~SendFileForm(); public slots: diff --git a/src/gui/srvredirectform.cpp b/src/gui/srvredirectform.cpp index cfcfa93..dd0a429 100644 --- a/src/gui/srvredirectform.cpp +++ b/src/gui/srvredirectform.cpp @@ -33,8 +33,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -SrvRedirectForm::SrvRedirectForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +SrvRedirectForm::SrvRedirectForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -72,18 +72,17 @@ void SrvRedirectForm::init() // Set toolbutton icons for disabled options. QIcon i; - i = addrAlways1ToolButton->iconSet(); - i.setPixmap(QPixmap(":/icons/images/kontact_contacts-disabled.png"), - QIcon::Automatic, QIcon::Disabled); - addrAlways1ToolButton->setIconSet(i); - addrAlways2ToolButton->setIconSet(i); - addrAlways3ToolButton->setIconSet(i); - addrBusy1ToolButton->setIconSet(i); - addrBusy2ToolButton->setIconSet(i); - addrBusy3ToolButton->setIconSet(i); - addrNoanswer1ToolButton->setIconSet(i); - addrNoanswer2ToolButton->setIconSet(i); - addrNoanswer3ToolButton->setIconSet(i); + i = addrAlways1ToolButton->icon(); + i.addPixmap(QPixmap(":/icons/images/kontact_contacts-disabled.png"), QIcon::Disabled); + addrAlways1ToolButton->setIcon(i); + addrAlways2ToolButton->setIcon(i); + addrAlways3ToolButton->setIcon(i); + addrBusy1ToolButton->setIcon(i); + addrBusy2ToolButton->setIcon(i); + addrBusy3ToolButton->setIcon(i); + addrNoanswer1ToolButton->setIcon(i); + addrNoanswer2ToolButton->setIcon(i); + addrNoanswer3ToolButton->setIcon(i); } void SrvRedirectForm::destroy() @@ -168,7 +167,7 @@ void SrvRedirectForm::validate() accept(); } else { ((t_gui *)ui)->cb_show_msg(this, - tr("You have entered an invalid destination.").ascii(), + tr("You have entered an invalid destination.").toStdString(), MSG_WARNING); } } @@ -183,7 +182,7 @@ bool SrvRedirectForm::validateValues() cfAlwaysDst1LineEdit, cfAlwaysDst2LineEdit, cfAlwaysDst3LineEdit, cfDestAlways); if (!valid) { - cfTabWidget->setCurrentPage(0); + cfTabWidget->setCurrentIndex(0); return false; } @@ -192,7 +191,7 @@ bool SrvRedirectForm::validateValues() cfBusyDst1LineEdit, cfBusyDst2LineEdit, cfBusyDst3LineEdit, cfDestBusy); if (!valid) { - cfTabWidget->setCurrentPage(1); + cfTabWidget->setCurrentIndex(1); return false; } @@ -202,7 +201,7 @@ bool SrvRedirectForm::validateValues() cfNoanswerDst3LineEdit, cfDestNoanswer); if (!valid) { - cfTabWidget->setCurrentPage(2); + cfTabWidget->setCurrentIndex(2); return false; } @@ -231,7 +230,7 @@ bool SrvRedirectForm::validate(bool cf_active, } // 1st choice destination - ui->expand_destination(current_user, dst1->text().stripWhiteSpace().ascii(), destination); + ui->expand_destination(current_user, dst1->text().trimmed().toStdString(), destination); if (destination.is_valid()) { dest_list.push_back(destination); } else { @@ -242,7 +241,7 @@ bool SrvRedirectForm::validate(bool cf_active, // 2nd choice destination if (!dst2->text().isEmpty()) { ui->expand_destination(current_user, - dst2->text().stripWhiteSpace().ascii(), destination); + dst2->text().trimmed().toStdString(), destination); if (destination.is_valid()) { dest_list.push_back(destination); } else { @@ -254,7 +253,7 @@ bool SrvRedirectForm::validate(bool cf_active, // 3rd choice destination if (!dst3->text().isEmpty()) { ui->expand_destination(current_user, - dst3->text().stripWhiteSpace().ascii(), destination); + dst3->text().trimmed().toStdString(), destination); if (destination.is_valid()) { dest_list.push_back(destination); } else { @@ -300,22 +299,22 @@ void SrvRedirectForm::changedUser(const QString &user_profile) return; } - t_user *new_user = phone->ref_user_profile(user_profile.ascii()); + t_user *new_user = phone->ref_user_profile(user_profile.toStdString()); if (!new_user) { - userComboBox->setCurrentItem(current_user_idx); + userComboBox->setCurrentIndex(current_user_idx); return; } if (!validateValues()) { - userComboBox->setCurrentItem(current_user_idx); + userComboBox->setCurrentIndex(current_user_idx); ((t_gui *)ui)->cb_show_msg(this, - tr("You have entered an invalid destination.").ascii(), + tr("You have entered an invalid destination.").toStdString(), MSG_WARNING); return; } // Change current user - current_user_idx = userComboBox->currentItem(); + current_user_idx = userComboBox->currentIndex(); current_user = new_user; populate(); } @@ -323,8 +322,8 @@ void SrvRedirectForm::changedUser(const QString &user_profile) void SrvRedirectForm::showAddressBook() { if (!getAddressForm) { - getAddressForm = new GetAddressForm( - this, "select address", true); + getAddressForm = new GetAddressForm(this); + getAddressForm->setModal(true); MEMMAN_NEW(getAddressForm); } diff --git a/src/gui/srvredirectform.h b/src/gui/srvredirectform.h index 7ddaef6..62da9f5 100644 --- a/src/gui/srvredirectform.h +++ b/src/gui/srvredirectform.h @@ -16,7 +16,7 @@ class SrvRedirectForm : public QDialog, public Ui::SrvRedirectForm Q_OBJECT public: - SrvRedirectForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + SrvRedirectForm(QWidget* parent = 0); ~SrvRedirectForm(); virtual bool validateValues(); diff --git a/src/gui/syssettingsform.cpp b/src/gui/syssettingsform.cpp index d38a7ca..51c411d 100644 --- a/src/gui/syssettingsform.cpp +++ b/src/gui/syssettingsform.cpp @@ -37,8 +37,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -SysSettingsForm::SysSettingsForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +SysSettingsForm::SysSettingsForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -74,14 +74,14 @@ void SysSettingsForm::init() { // Set toolbutton icons for disabled options. QIcon i; - i = openRingtoneToolButton->iconSet(); - i.setPixmap(QPixmap(":/icons/images/fileopen-disabled.png"), - QIcon::Automatic, QIcon::Disabled); - openRingtoneToolButton->setIconSet(i); - i = openRingbackToolButton->iconSet(); - i.setPixmap(QPixmap(":/icons/images/fileopen-disabled.png"), - QIcon::Automatic, QIcon::Disabled); - openRingbackToolButton->setIconSet(i); + i = openRingtoneToolButton->icon(); + i.addPixmap(QPixmap(":/icons/images/fileopen-disabled.png"), + QIcon::Disabled); + openRingtoneToolButton->setIcon(i); + i = openRingbackToolButton->icon(); + i.addPixmap(QPixmap(":/icons/images/fileopen-disabled.png"), + QIcon::Disabled); + openRingbackToolButton->setIcon(i); QRegExp rxNumber("[0-9]+"); maxUdpSizeLineEdit->setValidator(new QRegExpValidator(rxNumber, this)); @@ -109,12 +109,12 @@ string SysSettingsForm::comboItem2audio_dev(QString item, QLineEdit *qleOther, b { if (item == QString("ALSA: ") + DEV_OTHER) { if (qleOther->text().isEmpty()) return ""; - return (QString(PFX_ALSA) + qleOther->text()).ascii(); + return (QString(PFX_ALSA) + qleOther->text()).toStdString(); } if (item == QString("OSS: ") + DEV_OTHER) { if (qleOther->text().isEmpty()) return ""; - return (QString(PFX_OSS) + qleOther->text()).ascii(); + return (QString(PFX_OSS) + qleOther->text()).toStdString(); } list &list_audio_dev = (playback ? @@ -123,7 +123,7 @@ string SysSettingsForm::comboItem2audio_dev(QString item, QLineEdit *qleOther, b for (list::iterator i = list_audio_dev.begin(); i != list_audio_dev.end(); i++) { - if (i->get_description() == item.ascii()) { + if (i->get_description() == item.toStdString()) { return i->get_settings_value(); } } @@ -134,8 +134,8 @@ string SysSettingsForm::comboItem2audio_dev(QString item, QLineEdit *qleOther, b void SysSettingsForm::populateComboBox(QComboBox *cb, const QString &s) { for (int i = 0; i < cb->count(); i++) { - if (cb->text(i) == s) { - cb->setCurrentItem(i); + if (cb->itemText(i) == s) { + cb->setCurrentIndex(i); return; } } @@ -168,17 +168,17 @@ void SysSettingsForm::populate() for (list::iterator i = list_audio_playback_dev.begin(); i != list_audio_playback_dev.end(); i++, idx++) { string item = i->get_description(); - ringtoneComboBox->insertItem(QString(item.c_str())); - speakerComboBox->insertItem(QString(item.c_str())); + ringtoneComboBox->addItem(QString(item.c_str())); + speakerComboBox->addItem(QString(item.c_str())); // Select audio device if (sys_config->get_dev_ringtone().device == i->device) { - ringtoneComboBox->setCurrentItem(idx); + ringtoneComboBox->setCurrentIndex(idx); otherRingtoneLineEdit->clear(); devRingtoneFound = true; } if (sys_config->get_dev_speaker().device == i->device) { - speakerComboBox->setCurrentItem(idx); + speakerComboBox->setCurrentIndex(idx); otherSpeakerLineEdit->clear(); devSpeakerFound = true; } @@ -197,13 +197,13 @@ void SysSettingsForm::populate() if (!devRingtoneFound) { t_audio_device dev = sys_config->get_dev_ringtone(); otherRingtoneLineEdit->setText(dev.device.c_str()); - ringtoneComboBox->setCurrentItem( + ringtoneComboBox->setCurrentIndex( (dev.type == t_audio_device::ALSA ? idxOtherPlaybackDevAlsa : idxOtherPlaybackDevOss)); } if (!devSpeakerFound) { t_audio_device dev = sys_config->get_dev_speaker(); otherSpeakerLineEdit->setText(dev.device.c_str()); - speakerComboBox->setCurrentItem( + speakerComboBox->setCurrentIndex( (dev.type == t_audio_device::ALSA ? idxOtherPlaybackDevAlsa : idxOtherPlaybackDevOss)); } @@ -212,11 +212,11 @@ void SysSettingsForm::populate() for (list::iterator i = list_audio_capture_dev.begin(); i != list_audio_capture_dev.end(); i++, idx++) { string item = i->get_description(); - micComboBox->insertItem(QString(item.c_str())); + micComboBox->addItem(QString(item.c_str())); // Select audio device if (sys_config->get_dev_mic().device == i->device) { - micComboBox->setCurrentItem(idx); + micComboBox->setCurrentIndex(idx); otherMicLineEdit->clear(); devMicFound = true; } @@ -235,14 +235,14 @@ void SysSettingsForm::populate() if (!devMicFound) { t_audio_device dev = sys_config->get_dev_mic(); otherMicLineEdit->setText(dev.device.c_str()); - micComboBox->setCurrentItem( + micComboBox->setCurrentIndex( (dev.type == t_audio_device::ALSA ? idxOtherCaptureDevAlsa : idxOtherCaptureDevOss)); } // Enable/disable line edit for non-standard device - devRingtoneSelected(ringtoneComboBox->currentItem()); - devSpeakerSelected(speakerComboBox->currentItem()); - devMicSelected(micComboBox->currentItem()); + devRingtoneSelected(ringtoneComboBox->currentIndex()); + devSpeakerSelected(speakerComboBox->currentIndex()); + devMicSelected(micComboBox->currentIndex()); validateAudioCheckBox->setChecked(sys_config->get_validate_audio_dev()); @@ -281,7 +281,7 @@ void SysSettingsForm::populate() QStringList profiles; if (!SelectProfileForm::getUserProfiles(profiles, msg)) { - ((t_gui *)ui)->cb_show_msg(this, msg.ascii(), MSG_CRITICAL); + ((t_gui *)ui)->cb_show_msg(this, msg.toStdString(), MSG_CRITICAL); } profileListView->clear(); for (QStringList::Iterator i = profiles.begin(); i != profiles.end(); i++) { @@ -294,7 +294,7 @@ void SysSettingsForm::populate() item->setData(Qt::DecorationRole, QPixmap(":/icons/images/penguin-small.png")); list l = sys_config->get_start_user_profiles(); - if (std::find(l.begin(), l.end(), profile.ascii()) != l.end()) + if (std::find(l.begin(), l.end(), profile.toStdString()) != l.end()) { item->setCheckState(Qt::Checked); } @@ -393,12 +393,12 @@ void SysSettingsForm::validate() for (int i = 0; i < profileListView->count(); i++) { QListWidgetItem *item = profileListView->item(i); - start_user_profiles.push_back(item->text().ascii()); + start_user_profiles.push_back(item->text().toStdString()); } sys_config->set_start_user_profiles(start_user_profiles); // Web browser command - sys_config->set_gui_browser_cmd(browserLineEdit->text().stripWhiteSpace().ascii()); + sys_config->set_gui_browser_cmd(browserLineEdit->text().trimmed().toStdString()); // Network if (sys_config->get_config_sip_port() != sipUdpPortSpinBox->value()) { @@ -415,11 +415,11 @@ void SysSettingsForm::validate() // Ring tones sys_config->set_play_ringtone(playRingtoneCheckBox->isChecked()); if (sys_config->get_play_ringtone()) { - if (defaultRingtoneRadioButton->isOn()) { + if (defaultRingtoneRadioButton->isChecked()) { sys_config->set_ringtone_file(""); } else { sys_config->set_ringtone_file(ringtoneLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); } } else { sys_config->set_ringtone_file(""); @@ -427,11 +427,11 @@ void SysSettingsForm::validate() sys_config->set_play_ringback(playRingbackCheckBox->isChecked()); if (sys_config->get_play_ringback()) { - if (defaultRingbackRadioButton->isOn()) { + if (defaultRingbackRadioButton->isChecked()) { sys_config->set_ringback_file(""); } else { sys_config->set_ringback_file(ringbackLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); } } else { sys_config->set_ringback_file(""); @@ -472,7 +472,7 @@ void SysSettingsForm::chooseRingtone() tr("Ring tones", "Description of .wav files in file dialog").append(" (*.wav)")); if (!file.isEmpty()) { ringtoneLineEdit->setText(file); - ((t_gui *)ui)->set_last_file_browse_path(QFileInfo(file).dirPath(true)); + ((t_gui *)ui)->set_last_file_browse_path(QFileInfo(file).absolutePath()); } } @@ -483,7 +483,7 @@ void SysSettingsForm::chooseRingback() tr("Ring back tones", "Description of .wav files in file dialog").append(" (*.wav)")); if (!file.isEmpty()) { ringbackLineEdit->setText(file); - ((t_gui *)ui)->set_last_file_browse_path(QFileInfo(file).dirPath(true)); + ((t_gui *)ui)->set_last_file_browse_path(QFileInfo(file).absolutePath()); } } diff --git a/src/gui/syssettingsform.h b/src/gui/syssettingsform.h index 5412219..3a5e6ac 100644 --- a/src/gui/syssettingsform.h +++ b/src/gui/syssettingsform.h @@ -10,7 +10,7 @@ class SysSettingsForm : public QDialog, public Ui::SysSettingsForm Q_OBJECT public: - SysSettingsForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + SysSettingsForm(QWidget* parent = 0); ~SysSettingsForm(); virtual string comboItem2audio_dev( QString item, QLineEdit * qleOther, bool playback ); diff --git a/src/gui/termcapform.cpp b/src/gui/termcapform.cpp index f1413c5..190a76a 100644 --- a/src/gui/termcapform.cpp +++ b/src/gui/termcapform.cpp @@ -32,8 +32,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -TermCapForm::TermCapForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +TermCapForm::TermCapForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -74,10 +74,10 @@ void TermCapForm::show(t_user *user_config, const QString &dest) // Select from user if (user_config) { for (int i = 0; i < fromComboBox->count(); i++) { - if (fromComboBox->text(i) == + if (fromComboBox->itemText(i) == user_config->get_profile_name().c_str()) { - fromComboBox->setCurrentItem(i); + fromComboBox->setCurrentIndex(i); break; } } @@ -99,10 +99,10 @@ void TermCapForm::validate() { string display, dest_str; t_user *from_user = phone->ref_user_profile( - fromComboBox->currentText().ascii()); + fromComboBox->currentText().toStdString()); ui->expand_destination(from_user, - partyLineEdit->text().stripWhiteSpace().ascii(), + partyLineEdit->text().trimmed().toStdString(), display, dest_str); t_url dest(dest_str); @@ -117,8 +117,8 @@ void TermCapForm::validate() void TermCapForm::showAddressBook() { if (!getAddressForm) { - getAddressForm = new GetAddressForm( - this, "select address", true); + getAddressForm = new GetAddressForm(this); + getAddressForm->setModal(true); MEMMAN_NEW(getAddressForm); } diff --git a/src/gui/termcapform.h b/src/gui/termcapform.h index 3cc53df..4b36e76 100644 --- a/src/gui/termcapform.h +++ b/src/gui/termcapform.h @@ -14,7 +14,7 @@ class TermCapForm : public QDialog, public Ui::TermCapForm Q_OBJECT public: - TermCapForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + TermCapForm(QWidget* parent = 0); ~TermCapForm(); public slots: diff --git a/src/gui/textbrowsernoautolink.h b/src/gui/textbrowsernoautolink.h index 56b7b6b..36be95e 100644 --- a/src/gui/textbrowsernoautolink.h +++ b/src/gui/textbrowsernoautolink.h @@ -40,8 +40,8 @@ class TextBrowserNoAutoLink : public QTextBrowser { Q_OBJECT public: - TextBrowserNoAutoLink ( QWidget * parent = 0, const char * name = 0 ) : - QTextBrowser(parent, name) {}; + TextBrowserNoAutoLink ( QWidget * parent = 0 ) : + QTextBrowser(parent) {}; virtual void setSource ( const QString & name ) {}; }; diff --git a/src/gui/transferform.cpp b/src/gui/transferform.cpp index 6394c37..8cab3a0 100644 --- a/src/gui/transferform.cpp +++ b/src/gui/transferform.cpp @@ -14,8 +14,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -TransferForm::TransferForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +TransferForm::TransferForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -65,10 +65,9 @@ void TransferForm::init() // Set toolbutton icons for disabled options. QIcon i; - i = addressToolButton->iconSet(); - i.setPixmap(QPixmap(":/icons/images/kontact_contacts-disabled.png"), - QIcon::Automatic, QIcon::Disabled); - addressToolButton->setIconSet(i); + i = addressToolButton->icon(); + i.addPixmap(QPixmap(":/icons/images/kontact_contacts-disabled.png"), QIcon::Disabled); + addressToolButton->setIcon(i); } void TransferForm::destroy() @@ -155,12 +154,12 @@ void TransferForm::reject() void TransferForm::validate() { t_display_url dest; - ui->expand_destination(user_config, toLineEdit->text().stripWhiteSpace().ascii(), dest); + ui->expand_destination(user_config, toLineEdit->text().trimmed().toStdString(), dest); t_transfer_type transfer_type; - if (consultRadioButton->isOn()) { + if (consultRadioButton->isChecked()) { transfer_type = TRANSFER_CONSULT; - } else if (otherLineRadioButton->isOn()) { + } else if (otherLineRadioButton->isChecked()) { transfer_type = TRANSFER_OTHER_LINE; } else { transfer_type = TRANSFER_BASIC; @@ -186,8 +185,8 @@ void TransferForm::closeEvent(QCloseEvent *) void TransferForm::showAddressBook() { if (!getAddressForm) { - getAddressForm = new GetAddressForm( - this, "select address", true); + getAddressForm = new GetAddressForm(this); + getAddressForm->setModal(true); MEMMAN_NEW(getAddressForm); } diff --git a/src/gui/transferform.h b/src/gui/transferform.h index 65477d8..a134975 100644 --- a/src/gui/transferform.h +++ b/src/gui/transferform.h @@ -16,7 +16,7 @@ class TransferForm : public QDialog, public Ui::TransferForm Q_OBJECT public: - TransferForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + TransferForm(QWidget* parent = 0); ~TransferForm(); public slots: diff --git a/src/gui/twinkleapplication.cpp b/src/gui/twinkleapplication.cpp index 6633031..4d344cb 100644 --- a/src/gui/twinkleapplication.cpp +++ b/src/gui/twinkleapplication.cpp @@ -33,7 +33,7 @@ t_twinkle_application::t_twinkle_application(int &argc, char **argv) : {} #endif void t_twinkle_application::commitData (QSessionManager &sm) { - sys_config->set_ui_session_id(sessionId().ascii()); + sys_config->set_ui_session_id(sessionId().toStdString()); // Create list of active profile file names list user_list = phone->ref_users(); diff --git a/src/gui/userprofileform.cpp b/src/gui/userprofileform.cpp index 040a57a..368a3fe 100644 --- a/src/gui/userprofileform.cpp +++ b/src/gui/userprofileform.cpp @@ -116,8 +116,8 @@ * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -UserProfileForm::UserProfileForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +UserProfileForm::UserProfileForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -174,13 +174,13 @@ void UserProfileForm::init() // Speex & (Speex) Preprocessing speexGroupBox->hide(); preprocessingGroupBox->hide(); - rtpAudioTabWidget->setTabEnabled(rtpAudioTabWidget->page(idxRtpSpeex), false); - rtpAudioTabWidget->setTabEnabled(rtpAudioTabWidget->page(idxRtpPreprocessing), false); + rtpAudioTabWidget->setTabEnabled(idxRtpSpeex, false); + rtpAudioTabWidget->setTabEnabled(idxRtpPreprocessing, false); #endif #ifndef HAVE_ILBC // iLBC ilbcGroupBox->hide(); - rtpAudioTabWidget->setTabEnabled(rtpAudioTabWidget->page(idxRtpIlbc), false); + rtpAudioTabWidget->setTabEnabled(idxRtpIlbc, false); #endif #ifndef HAVE_ZRTP // Zrtp @@ -190,12 +190,11 @@ void UserProfileForm::init() // Set toolbutton icons for disabled options. QIcon i; - i = openRingtoneToolButton->iconSet(); - i.setPixmap(QPixmap(":/icons/images/fileopen-disabled.png"), - QIcon::Automatic, QIcon::Disabled); - openRingtoneToolButton->setIconSet(i); - openRingbackToolButton->setIconSet(i); - openIncomingCallScriptToolButton->setIconSet(i); + i = openRingtoneToolButton->icon(); + i.addPixmap(QPixmap(":/icons/images/fileopen-disabled.png"), QIcon::Disabled); + openRingtoneToolButton->setIcon(i); + openRingbackToolButton->setIcon(i); + openIncomingCallScriptToolButton->setIcon(i); } void UserProfileForm::showCategory( int index ) @@ -329,7 +328,7 @@ void UserProfileForm::populate() s = PRODUCT_NAME; s.append(" - ").append(tr("User profile:")).append(" "); s.append(current_profile->get_profile_name().c_str()); - setCaption(s); + setWindowTitle(s); // Select the User category categoryListBox->setCurrentRow(idxCatUser); @@ -380,10 +379,10 @@ void UserProfileForm::populate() // VOICE MAIL vmAddressLineEdit->setText(current_profile->get_mwi_vm_address().c_str()); if (current_profile->get_mwi_sollicited()) { - mwiTypeComboBox->setCurrentItem(idxMWISollicited); + mwiTypeComboBox->setCurrentIndex(idxMWISollicited); mwiSollicitedGroupBox->setEnabled(true); } else { - mwiTypeComboBox->setCurrentItem(idxMWIUnsollicited); + mwiTypeComboBox->setCurrentIndex(idxMWIUnsollicited); mwiSollicitedGroupBox->setEnabled(false); } mwiUserLineEdit->setText(current_profile->get_mwi_user().c_str()); @@ -424,7 +423,7 @@ void UserProfileForm::populate() for (list::iterator i = audio_codecs.begin(); i != audio_codecs.end(); i++) { activeCodecListBox->addItem(codec2label(*i)); - allCodecs.remove(codec2label(*i)); + allCodecs.removeAll(codec2label(*i)); } availCodecListBox->clear(); if (!allCodecs.empty()) availCodecListBox->addItems(allCodecs); @@ -459,9 +458,9 @@ void UserProfileForm::populate() ilbcPayloadSpinBox->setValue(current_profile->get_ilbc_payload_type()); if (current_profile->get_ilbc_mode() == 20) { - ilbcPayloadSizeComboBox->setCurrentItem(idxIlbcMode20); + ilbcPayloadSizeComboBox->setCurrentIndex(idxIlbcMode20); } else { - ilbcPayloadSizeComboBox->setCurrentItem(idxIlbcMode30); + ilbcPayloadSizeComboBox->setCurrentIndex(idxIlbcMode30); } // G.726 @@ -471,24 +470,24 @@ void UserProfileForm::populate() g72640PayloadSpinBox->setValue(current_profile->get_g726_40_payload_type()); if (current_profile->get_g726_packing() == G726_PACK_RFC3551) { - g726PackComboBox->setCurrentItem(idxG726PackRfc3551); + g726PackComboBox->setCurrentIndex(idxG726PackRfc3551); } else { - g726PackComboBox->setCurrentItem(idxG726PackAal2); + g726PackComboBox->setCurrentIndex(idxG726PackAal2); } // DTMF switch (current_profile->get_dtmf_transport()) { case DTMF_RFC2833: - dtmfTransportComboBox->setCurrentItem(idxDtmfRfc2833); + dtmfTransportComboBox->setCurrentIndex(idxDtmfRfc2833); break; case DTMF_INBAND: - dtmfTransportComboBox->setCurrentItem(idxDtmfInband); + dtmfTransportComboBox->setCurrentIndex(idxDtmfInband); break; case DTMF_INFO: - dtmfTransportComboBox->setCurrentItem(idxDtmfInfo); + dtmfTransportComboBox->setCurrentIndex(idxDtmfInfo); break; default: - dtmfTransportComboBox->setCurrentItem(idxDtmfAuto); + dtmfTransportComboBox->setCurrentIndex(idxDtmfAuto); break; } @@ -500,10 +499,10 @@ void UserProfileForm::populate() // SIP PROTOCOL switch (current_profile->get_hold_variant()) { case HOLD_RFC2543: - holdVariantComboBox->setCurrentItem(idxHoldRfc2543); + holdVariantComboBox->setCurrentIndex(idxHoldRfc2543); break; default: - holdVariantComboBox->setCurrentItem(idxHoldRfc3264); + holdVariantComboBox->setCurrentIndex(idxHoldRfc3264); break; } @@ -522,7 +521,7 @@ void UserProfileForm::populate() maxRedirectTextLabel->setEnabled(current_profile->get_allow_redirection()); maxRedirectSpinBox->setEnabled(current_profile->get_allow_redirection()); maxRedirectSpinBox->setValue(current_profile->get_max_redirections()); - ext100relComboBox->setCurrentItem( + ext100relComboBox->setCurrentIndex( ext_support2indexComboItem(current_profile->get_ext_100rel())); extReplacesCheckBox->setChecked(current_profile->get_ext_replaces()); allowReferCheckBox->setChecked(current_profile->get_allow_refer()); @@ -540,13 +539,13 @@ void UserProfileForm::populate() // Transport/NAT switch (current_profile->get_sip_transport()) { case SIP_TRANS_UDP: - sipTransportComboBox->setCurrentItem(idxSipTransportUDP); + sipTransportComboBox->setCurrentIndex(idxSipTransportUDP); break; case SIP_TRANS_TCP: - sipTransportComboBox->setCurrentItem(idxSipTransportTCP); + sipTransportComboBox->setCurrentIndex(idxSipTransportTCP); break; default: - sipTransportComboBox->setCurrentItem(idxSipTransportAuto); + sipTransportComboBox->setCurrentIndex(idxSipTransportAuto); break; } @@ -635,7 +634,7 @@ void UserProfileForm::initProfileList(list profiles, QString show_prof int show_idx = 0; int idx = 0; for (list::iterator i = profile_list.begin(); i != profile_list.end(); i++) { - profileComboBox->insertItem((*i)->get_profile_name().c_str()); + profileComboBox->addItem((*i)->get_profile_name().c_str()); if (show_profile_name == (*i)->get_profile_name().c_str()) { show_idx = idx; show_profile = *i; @@ -651,7 +650,7 @@ void UserProfileForm::initProfileList(list profiles, QString show_prof } else { current_profile = show_profile; } - profileComboBox->setCurrentItem(current_profile_idx); + profileComboBox->setCurrentIndex(current_profile_idx); } // Show the form @@ -681,7 +680,7 @@ bool UserProfileForm::check_dynamic_payload(QSpinBox *spb, categoryListBox->setCurrentRow(idxCatRtpAudio); settingsWidgetStack->setCurrentWidget(pageRtpAudio); QString msg = tr("Dynamic payload type %1 is used more than once.").arg(spb->value()); - ((t_gui *)ui)->cb_show_msg(this, msg.ascii(), MSG_CRITICAL); + ((t_gui *)ui)->cb_show_msg(this, msg.toStdString(), MSG_CRITICAL); spb->setFocus(); return false; } @@ -701,9 +700,9 @@ list UserProfileForm::get_number_conversions() try { item = conversionListView->item(0, 0); - c.re.assign(item->text().ascii()); + c.re.assign(item->text().toStdString()); item = conversionListView->item(0, 1); - c.fmt = item->text().ascii(); + c.fmt = item->text().toStdString(); conversions.push_back(c); } catch (boost::bad_expression) { // Should never happen as validity has been @@ -723,7 +722,7 @@ bool UserProfileForm::validateValues() if (usernameLineEdit->text().isEmpty()) { categoryListBox->setCurrentRow(idxCatUser); settingsWidgetStack->setCurrentWidget(pageUser); - ((t_gui *)ui)->cb_show_msg(this, tr("You must fill in a user name for your SIP account.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("You must fill in a user name for your SIP account.").toStdString(), MSG_CRITICAL); usernameLineEdit->setFocus(); return false; @@ -736,7 +735,7 @@ bool UserProfileForm::validateValues() ((t_gui *)ui)->cb_show_msg(this, tr( "You must fill in a domain name for your SIP account.\n" "This could be the hostname or IP address of your PC " - "if you want direct PC to PC dialing.").ascii(), + "if you want direct PC to PC dialing.").toStdString(), MSG_CRITICAL); domainLineEdit->setFocus(); return false; @@ -745,11 +744,11 @@ bool UserProfileForm::validateValues() // Check validity of domain s = USER_SCHEME; s.append(':').append(domainLineEdit->text()); - t_url u_domain(s.ascii()); + t_url u_domain(s.toStdString()); if (!u_domain.is_valid() || u_domain.get_user() != "") { categoryListBox->setCurrentRow(idxCatUser); settingsWidgetStack->setCurrentWidget(pageUser); - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid domain.").ascii(), MSG_CRITICAL); + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid domain.").toStdString(), MSG_CRITICAL); domainLineEdit->setFocus(); return false; } @@ -758,11 +757,11 @@ bool UserProfileForm::validateValues() s = USER_SCHEME; s.append(':').append(usernameLineEdit->text()).append('@'); s.append(domainLineEdit->text()); - t_url u_user_domain(s.ascii()); + t_url u_user_domain(s.toStdString()); if (!u_user_domain.is_valid()) { categoryListBox->setCurrentRow(idxCatUser); settingsWidgetStack->setCurrentWidget(pageUser); - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid user name.").ascii(), MSG_CRITICAL); + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid user name.").toStdString(), MSG_CRITICAL); usernameLineEdit->setFocus(); return false; } @@ -771,11 +770,11 @@ bool UserProfileForm::validateValues() if (!registrarLineEdit->text().isEmpty()) { s = USER_SCHEME; s.append(':').append(registrarLineEdit->text()); - t_url u(s.ascii()); + t_url u(s.toStdString()); if (!u.is_valid() || u.get_user() != "") { categoryListBox->setCurrentRow(idxCatSipServer); settingsWidgetStack->setCurrentWidget(pageSipServer); - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for registrar.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for registrar.").toStdString(), MSG_CRITICAL); registrarLineEdit->setFocus(); registrarLineEdit->selectAll(); @@ -787,11 +786,11 @@ bool UserProfileForm::validateValues() if (useProxyCheckBox->isChecked()) { s = USER_SCHEME; s.append(':').append(proxyLineEdit->text()); - t_url u(s.ascii()); + t_url u(s.toStdString()); if (!u.is_valid() || u.get_user() != "") { categoryListBox->setCurrentRow(idxCatSipServer); settingsWidgetStack->setCurrentWidget(pageSipServer); - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for outbound proxy.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for outbound proxy.").toStdString(), MSG_CRITICAL); proxyLineEdit->setFocus(); proxyLineEdit->selectAll(); @@ -801,13 +800,13 @@ bool UserProfileForm::validateValues() // Validity check voice mail page - if (mwiTypeComboBox->currentItem() == idxMWISollicited) { + if (mwiTypeComboBox->currentIndex() == idxMWISollicited) { // Mailbox user name is mandatory if (mwiUserLineEdit->text().isEmpty()) { categoryListBox->setCurrentRow(idxCatVoiceMail); settingsWidgetStack->setCurrentWidget(pageVoiceMail); ((t_gui *)ui)->cb_show_msg(this, - tr("You must fill in a mailbox user name.").ascii(), + tr("You must fill in a mailbox user name.").toStdString(), MSG_CRITICAL); mwiUserLineEdit->setFocus(); return false; @@ -818,7 +817,7 @@ bool UserProfileForm::validateValues() categoryListBox->setCurrentRow(idxCatVoiceMail); settingsWidgetStack->setCurrentWidget(pageVoiceMail); ((t_gui *)ui)->cb_show_msg(this, - tr("You must fill in a mailbox server").ascii(), + tr("You must fill in a mailbox server").toStdString(), MSG_CRITICAL); mwiServerLineEdit->setFocus(); return false; @@ -827,11 +826,11 @@ bool UserProfileForm::validateValues() // Check validity of mailbox server s = USER_SCHEME; s.append(':').append(mwiServerLineEdit->text()); - t_url u_server(s.ascii()); + t_url u_server(s.toStdString()); if (!u_server.is_valid() || u_server.get_user() != "") { categoryListBox->setCurrentRow(idxCatVoiceMail); settingsWidgetStack->setCurrentWidget(pageVoiceMail); - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid mailbox server.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid mailbox server.").toStdString(), MSG_CRITICAL); mwiServerLineEdit->setFocus(); return false; @@ -841,11 +840,11 @@ bool UserProfileForm::validateValues() s = USER_SCHEME; s.append(':').append(mwiUserLineEdit->text()).append('@'); s.append(mwiServerLineEdit->text()); - t_url u_user_server(s.ascii()); + t_url u_user_server(s.toStdString()); if (!u_user_server.is_valid()) { categoryListBox->setCurrentRow(idxCatVoiceMail); settingsWidgetStack->setCurrentWidget(pageVoiceMail); - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid mailbox user name.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid mailbox user name.").toStdString(), MSG_CRITICAL); mwiUserLineEdit->setFocus(); return false; @@ -857,7 +856,7 @@ bool UserProfileForm::validateValues() if (publicIPLineEdit->text().isEmpty()){ categoryListBox->setCurrentRow(idxCatNat); settingsWidgetStack->setCurrentWidget(pageNat); - ((t_gui *)ui)->cb_show_msg(this, tr("Value for public IP address missing.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Value for public IP address missing.").toStdString(), MSG_CRITICAL); publicIPLineEdit->setFocus(); return false; @@ -870,12 +869,12 @@ bool UserProfileForm::validateValues() !check_dynamic_payload(spxWbPayloadSpinBox, checked_types) || !check_dynamic_payload(spxUwbPayloadSpinBox, checked_types)) { - rtpAudioTabWidget->showPage(tabSpeex); + rtpAudioTabWidget->setCurrentWidget(tabSpeex); return false; } if (!check_dynamic_payload(ilbcPayloadSpinBox, checked_types)) { - rtpAudioTabWidget->showPage(tabIlbc); + rtpAudioTabWidget->setCurrentWidget(tabIlbc); return false; } @@ -883,12 +882,12 @@ bool UserProfileForm::validateValues() !check_dynamic_payload(g72624PayloadSpinBox, checked_types) || !check_dynamic_payload(g72632PayloadSpinBox, checked_types) || !check_dynamic_payload(g72640PayloadSpinBox, checked_types)) { - rtpAudioTabWidget->showPage(tabG726); + rtpAudioTabWidget->setCurrentWidget(tabG726); return false; } if (!check_dynamic_payload(dtmfPayloadTypeSpinBox, checked_types)) { - rtpAudioTabWidget->showPage(tabDtmf); + rtpAudioTabWidget->setCurrentWidget(tabDtmf); return false; } @@ -896,11 +895,11 @@ bool UserProfileForm::validateValues() if (natStunRadioButton->isChecked()) { s = "stun:"; s.append(stunServerLineEdit->text()); - t_url u(s.ascii()); + t_url u(s.toStdString()); if (!u.is_valid() || u.get_user() != "") { categoryListBox->setCurrentRow(idxCatNat); settingsWidgetStack->setCurrentWidget(pageNat); - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for STUN server.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for STUN server.").toStdString(), MSG_CRITICAL); stunServerLineEdit->setFocus(); stunServerLineEdit->selectAll(); @@ -914,7 +913,7 @@ bool UserProfileForm::validateValues() } // Clear sollicited MWI settings if unsollicited MWI is used - if (mwiTypeComboBox->currentItem() == idxMWIUnsollicited) { + if (mwiTypeComboBox->currentIndex() == idxMWIUnsollicited) { t_user user_default; mwiUserLineEdit->clear(); mwiServerLineEdit->clear(); @@ -934,40 +933,40 @@ bool UserProfileForm::validateValues() // Set all values in the current_profile object // USER - if (current_profile->get_name() != usernameLineEdit->text().ascii() || - current_profile->get_display(false) != displayLineEdit->text().ascii() || - current_profile->get_domain() != domainLineEdit->text().ascii()) + if (current_profile->get_name() != usernameLineEdit->text().toStdString() || + current_profile->get_display(false) != displayLineEdit->text().toStdString() || + current_profile->get_domain() != domainLineEdit->text().toStdString()) { - current_profile->set_display(displayLineEdit->text().ascii()); - current_profile->set_name(usernameLineEdit->text().ascii()); - current_profile->set_domain (domainLineEdit->text().ascii()); + current_profile->set_display(displayLineEdit->text().toStdString()); + current_profile->set_name(usernameLineEdit->text().toStdString()); + current_profile->set_domain (domainLineEdit->text().toStdString()); emit sipUserChanged(current_profile); } - current_profile->set_organization(organizationLineEdit->text().ascii()); + current_profile->set_organization(organizationLineEdit->text().toStdString()); uint8 new_aka_op[AKA_OPLEN]; uint8 new_aka_amf[AKA_AMFLEN]; uint8 current_aka_op[AKA_OPLEN]; uint8 current_aka_amf[AKA_AMFLEN]; - hex2binary(padleft(authAkaOpLineEdit->text().ascii(), '0', 32), new_aka_op); - hex2binary(padleft(authAkaAmfLineEdit->text().ascii(), '0', 4), new_aka_amf); + hex2binary(padleft(authAkaOpLineEdit->text().toStdString(), '0', 32), new_aka_op); + hex2binary(padleft(authAkaAmfLineEdit->text().toStdString(), '0', 4), new_aka_amf); current_profile->get_auth_aka_op(current_aka_op); current_profile->get_auth_aka_amf(current_aka_amf); - if (current_profile->get_auth_realm() != authRealmLineEdit->text().ascii() || - current_profile->get_auth_name() != authNameLineEdit->text().ascii() || - current_profile->get_auth_pass() != authPasswordLineEdit->text().ascii() || + if (current_profile->get_auth_realm() != authRealmLineEdit->text().toStdString() || + current_profile->get_auth_name() != authNameLineEdit->text().toStdString() || + current_profile->get_auth_pass() != authPasswordLineEdit->text().toStdString() || memcmp(current_aka_op, new_aka_op, AKA_OPLEN) != 0 || memcmp(current_aka_amf, new_aka_amf, AKA_AMFLEN) != 0) { emit authCredentialsChanged(current_profile, current_profile->get_auth_realm()); - current_profile->set_auth_realm(authRealmLineEdit->text().ascii()); - current_profile->set_auth_name(authNameLineEdit->text().ascii()); - current_profile->set_auth_pass(authPasswordLineEdit->text().ascii()); + current_profile->set_auth_realm(authRealmLineEdit->text().toStdString()); + current_profile->set_auth_name(authNameLineEdit->text().toStdString()); + current_profile->set_auth_pass(authPasswordLineEdit->text().toStdString()); current_profile->set_auth_aka_op(new_aka_op); current_profile->set_auth_aka_amf(new_aka_amf); } @@ -976,25 +975,25 @@ bool UserProfileForm::validateValues() current_profile->set_use_registrar(!registrarLineEdit->text().isEmpty()); s = USER_SCHEME; s.append(':').append(registrarLineEdit->text()); - current_profile->set_registrar(t_url(s.ascii())); + current_profile->set_registrar(t_url(s.toStdString())); current_profile->set_registration_time(expirySpinBox->value()); current_profile->set_register_at_startup(regAtStartupCheckBox->isChecked()); current_profile->set_reg_add_qvalue(regAddQvalueCheckBox->isChecked()); - current_profile->set_reg_qvalue(atof(regQvalueLineEdit->text().ascii())); + current_profile->set_reg_qvalue(regQvalueLineEdit->text().toDouble()); current_profile->set_use_outbound_proxy(useProxyCheckBox->isChecked()); s = USER_SCHEME; s.append(':').append(proxyLineEdit->text()); - current_profile->set_outbound_proxy(t_url(s.ascii())); + current_profile->set_outbound_proxy(t_url(s.toStdString())); current_profile->set_all_requests_to_proxy(allRequestsCheckBox->isChecked()); current_profile->set_non_resolvable_to_proxy( proxyNonResolvableCheckBox->isChecked()); // VOICE MAIL - current_profile->set_mwi_vm_address(vmAddressLineEdit->text().ascii()); + current_profile->set_mwi_vm_address(vmAddressLineEdit->text().toStdString()); bool mustTriggerMWISubscribe = false; - bool mwiSollicited = (mwiTypeComboBox->currentItem() == idxMWISollicited); + bool mwiSollicited = (mwiTypeComboBox->currentIndex() == idxMWISollicited); if (mwiSollicited) { if (!current_profile->get_mwi_sollicited()) { // Sollicited MWI now enabled. Subscribe after all MWI @@ -1003,8 +1002,8 @@ bool UserProfileForm::validateValues() } else { s = USER_SCHEME; s.append(':').append(mwiServerLineEdit->text()); - if (mwiUserLineEdit->text().ascii() != current_profile->get_mwi_user() || - t_url(s.ascii()) != current_profile->get_mwi_server() || + if (mwiUserLineEdit->text().toStdString() != current_profile->get_mwi_user() || + t_url(s.toStdString()) != current_profile->get_mwi_server() || mwiViaProxyCheckBox->isChecked() != current_profile->get_mwi_via_proxy()) { // Sollicited MWI settings changed. Trigger unsubscribe @@ -1024,10 +1023,10 @@ bool UserProfileForm::validateValues() } current_profile->set_mwi_sollicited(mwiSollicited); - current_profile->set_mwi_user(mwiUserLineEdit->text().ascii()); + current_profile->set_mwi_user(mwiUserLineEdit->text().toStdString()); s = USER_SCHEME; s.append(':').append(mwiServerLineEdit->text()); - current_profile->set_mwi_server(t_url(s.ascii())); + current_profile->set_mwi_server(t_url(s.toStdString())); current_profile->set_mwi_via_proxy(mwiViaProxyCheckBox->isChecked()); current_profile->set_mwi_subscription_time(mwiDurationSpinBox->value()); @@ -1078,7 +1077,7 @@ bool UserProfileForm::validateValues() // iLBC current_profile->set_ilbc_payload_type(ilbcPayloadSpinBox->value()); - switch (ilbcPayloadSizeComboBox->currentItem()) { + switch (ilbcPayloadSizeComboBox->currentIndex()) { case idxIlbcMode20: current_profile->set_ilbc_mode(20); break; @@ -1093,7 +1092,7 @@ bool UserProfileForm::validateValues() current_profile->set_g726_32_payload_type(g72632PayloadSpinBox->value()); current_profile->set_g726_40_payload_type(g72640PayloadSpinBox->value()); - switch (g726PackComboBox->currentItem()) { + switch (g726PackComboBox->currentIndex()) { case idxG726PackRfc3551: current_profile->set_g726_packing(G726_PACK_RFC3551); break; @@ -1103,7 +1102,7 @@ bool UserProfileForm::validateValues() } // DTMF - switch (dtmfTransportComboBox->currentItem()) { + switch (dtmfTransportComboBox->currentIndex()) { case idxDtmfRfc2833: current_profile->set_dtmf_transport(DTMF_RFC2833); break; @@ -1124,7 +1123,7 @@ bool UserProfileForm::validateValues() current_profile->set_dtmf_volume(-(dtmfVolumeSpinBox->value())); // SIP PROTOCOL - switch (holdVariantComboBox->currentItem()) { + switch (holdVariantComboBox->currentIndex()) { case idxHoldRfc2543: current_profile->set_hold_variant(HOLD_RFC2543); break; @@ -1146,7 +1145,7 @@ bool UserProfileForm::validateValues() current_profile->set_ask_user_to_redirect(askUserRedirectCheckBox->isChecked()); current_profile->set_max_redirections(maxRedirectSpinBox->value()); current_profile->set_ext_100rel(indexComboItem2ext_support( - ext100relComboBox->currentItem())); + ext100relComboBox->currentIndex())); current_profile->set_ext_replaces(extReplacesCheckBox->isChecked()); current_profile->set_allow_refer(allowReferCheckBox->isChecked()); current_profile->set_ask_user_to_refer(askUserReferCheckBox->isChecked()); @@ -1159,7 +1158,7 @@ bool UserProfileForm::validateValues() current_profile->set_send_p_preferred_id(pPreferredIdCheckBox->isChecked()); // Transport/NAT - switch (sipTransportComboBox->currentItem()) { + switch (sipTransportComboBox->currentIndex()) { case idxSipTransportUDP: current_profile->set_sip_transport(SIP_TRANS_UDP); break; @@ -1174,15 +1173,15 @@ bool UserProfileForm::validateValues() current_profile->set_sip_transport_udp_threshold(udpThresholdSpinBox->value()); current_profile->set_use_nat_public_ip(natStaticRadioButton->isChecked()); - current_profile->set_nat_public_ip(publicIPLineEdit->text().ascii()); + current_profile->set_nat_public_ip(publicIPLineEdit->text().toStdString()); current_profile->set_use_stun(natStunRadioButton->isChecked()); - if (current_profile->get_stun_server().encode_noscheme() != stunServerLineEdit->text().ascii() || + if (current_profile->get_stun_server().encode_noscheme() != stunServerLineEdit->text().toStdString() || current_profile->get_enable_nat_keepalive() != natKeepaliveCheckBox->isChecked()) { s = "stun:"; s.append(stunServerLineEdit->text()); - current_profile->set_stun_server(t_url(s.ascii())); + current_profile->set_stun_server(t_url(s.toStdString())); current_profile->set_enable_nat_keepalive(natKeepaliveCheckBox->isChecked()); emit stunServerChanged(current_profile); } @@ -1197,7 +1196,7 @@ bool UserProfileForm::validateValues() current_profile->set_remove_special_phone_symbols( removeSpecialCheckBox->isChecked()); current_profile->set_special_phone_symbols( - specialLineEdit->text().stripWhiteSpace().ascii()); + specialLineEdit->text().trimmed().toStdString()); current_profile->set_number_conversions(get_number_conversions()); current_profile->set_use_tel_uri_for_phone(useTelUriCheckBox->isChecked()); @@ -1206,26 +1205,26 @@ bool UserProfileForm::validateValues() current_profile->set_timer_nat_keepalive(tmrNatKeepaliveSpinBox->value()); // RING TONES - current_profile->set_ringtone_file(ringtoneLineEdit->text().stripWhiteSpace().ascii()); - current_profile->set_ringback_file(ringbackLineEdit->text().stripWhiteSpace().ascii()); + current_profile->set_ringtone_file(ringtoneLineEdit->text().trimmed().toStdString()); + current_profile->set_ringback_file(ringbackLineEdit->text().trimmed().toStdString()); // SCRIPTS current_profile->set_script_incoming_call(incomingCallScriptLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); current_profile->set_script_in_call_answered(inCallAnsweredLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); current_profile->set_script_in_call_failed(inCallFailedLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); current_profile->set_script_outgoing_call(outCallLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); current_profile->set_script_out_call_answered(outCallAnsweredLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); current_profile->set_script_out_call_failed(outCallFailedLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); current_profile->set_script_local_release(localReleaseLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); current_profile->set_script_remote_release(remoteReleaseLineEdit-> - text().stripWhiteSpace().ascii()); + text().trimmed().toStdString()); // Security current_profile->set_zrtp_enabled(zrtpEnabledCheckBox->isChecked()); @@ -1262,7 +1261,7 @@ void UserProfileForm::changeProfile(const QString &profileName) { if (!validateValues()) { // Current values are not valid. // Do not change to the new profile. - profileComboBox->setCurrentItem(current_profile_idx); + profileComboBox->setCurrentIndex(current_profile_idx); return; } @@ -1271,13 +1270,13 @@ void UserProfileForm::changeProfile(const QString &profileName) { // Change to new profile. for (list::iterator i = profile_list.begin(); i != profile_list.end(); i++) { - if ((*i)->get_profile_name() == profileName.ascii()) { + if ((*i)->get_profile_name() == profileName.toStdString()) { current_profile = *i; break; } } - current_profile_idx = profileComboBox->currentItem(); + current_profile_idx = profileComboBox->currentIndex(); populate(); // Restore last viewed category @@ -1293,7 +1292,7 @@ void UserProfileForm::chooseFile(QLineEdit *qle, const QString &filter, const QS filter); if (!file.isEmpty()) { qle->setText(file); - ((t_gui *)ui)->set_last_file_browse_path(QFileInfo(file).dirPath(true)); + ((t_gui *)ui)->set_last_file_browse_path(QFileInfo(file).absolutePath()); } } @@ -1494,21 +1493,21 @@ void UserProfileForm::testConversion() { bool remove_special_phone_symbols = removeSpecialCheckBox->isChecked(); QString special_phone_symbols = specialLineEdit->text(); - number = remove_white_space(number.ascii()).c_str(); + number = remove_white_space(number.toStdString()).c_str(); // Remove special symbols if (remove_special_phone_symbols && - looks_like_phone(number.ascii(), special_phone_symbols.ascii())) + looks_like_phone(number.toStdString(), special_phone_symbols.toStdString())) { number = remove_symbols( - number.ascii(), special_phone_symbols.ascii()).c_str(); + number.toStdString(), special_phone_symbols.toStdString()).c_str(); } QString msg = tr("%1 converts to %2") .arg(number) - .arg(current_profile->convert_number(number.ascii(), get_number_conversions()).c_str()); + .arg(current_profile->convert_number(number.toStdString(), get_number_conversions()).c_str()); - ((t_gui *)ui)->cb_show_msg(this, msg.ascii(), MSG_INFO); + ((t_gui *)ui)->cb_show_msg(this, msg.toStdString(), MSG_INFO); } void UserProfileForm::changeMWIType(int idxMWIType) { diff --git a/src/gui/userprofileform.h b/src/gui/userprofileform.h index 7cdec8c..919ee9f 100644 --- a/src/gui/userprofileform.h +++ b/src/gui/userprofileform.h @@ -11,7 +11,7 @@ class UserProfileForm : public QDialog, public Ui::UserProfileForm Q_OBJECT public: - UserProfileForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + UserProfileForm(QWidget* parent = 0); ~UserProfileForm(); virtual t_audio_codec label2codec( const QString & label ); diff --git a/src/gui/userprofileform.ui b/src/gui/userprofileform.ui index b473cb7..f1bf4d8 100644 --- a/src/gui/userprofileform.ui +++ b/src/gui/userprofileform.ui @@ -4809,7 +4809,6 @@ Sollicited message waiting indication as specified by RFC 3842. user.h - q3valuelist.h map list diff --git a/src/gui/wizardform.cpp b/src/gui/wizardform.cpp index 0728454..d97cf49 100644 --- a/src/gui/wizardform.cpp +++ b/src/gui/wizardform.cpp @@ -42,8 +42,8 @@ struct t_provider { * The dialog will by default be modeless, unless you set 'modal' to * true to construct a modal dialog. */ -WizardForm::WizardForm(QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl) - : QDialog(parent, name, modal, fl) +WizardForm::WizardForm(QWidget* parent) + : QDialog(parent) { setupUi(this); @@ -79,14 +79,14 @@ void WizardForm::init() proxyLineEdit->setValidator(new QRegExpValidator(rxNoSpace, this)); initProviders(); - serviceProviderComboBox->setCurrentItem(serviceProviderComboBox->count() - 1); + serviceProviderComboBox->setCurrentIndex(serviceProviderComboBox->count() - 1); update(tr(PROV_OTHER)); } void WizardForm::initProviders() { serviceProviderComboBox->clear(); - serviceProviderComboBox->insertItem(tr(PROV_NONE)); + serviceProviderComboBox->addItem(tr(PROV_NONE)); QString fname = sys_config->get_dir_share().c_str(); fname.append("/").append(FILE_PROVIDERS); @@ -98,7 +98,7 @@ void WizardForm::initProviders() // Skip comment if (entry[0] == '#') continue; - QStringList l = QStringList::split(";", entry, true); + QStringList l = entry.split(";", QString::KeepEmptyParts); // Skip invalid lines if (l.size() != 4) continue; @@ -109,12 +109,12 @@ void WizardForm::initProviders() p.stun_server = l[3]; mapProviders[l[0]] = p; - serviceProviderComboBox->insertItem(l[0]); + serviceProviderComboBox->addItem(l[0]); } providersFile.close(); } - serviceProviderComboBox->insertItem(tr(PROV_OTHER)); + serviceProviderComboBox->addItem(tr(PROV_OTHER)); } int WizardForm::exec(t_user *user) @@ -125,7 +125,7 @@ int WizardForm::exec(t_user *user) QString s = PRODUCT_NAME; s.append(" - ").append(tr("User profile wizard:")).append(" "); s.append(user_config->get_profile_name().c_str()); - setCaption(s); + setWindowTitle(s); return QDialog::exec(); } @@ -138,7 +138,7 @@ void WizardForm::show(t_user *user) QString s = PRODUCT_NAME; s.append(" - ").append(tr("User profile wizard:")).append(" "); s.append(user_config->get_profile_name().c_str()); - setCaption(s); + setWindowTitle(s); QDialog::show(); } @@ -211,7 +211,7 @@ void WizardForm::validate() // Validity check user page // SIP username is mandatory if (usernameLineEdit->text().isEmpty()) { - ((t_gui *)ui)->cb_show_msg(this, tr("You must fill in a user name for your SIP account.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("You must fill in a user name for your SIP account.").toStdString(), MSG_CRITICAL); usernameLineEdit->setFocus(); return; @@ -222,7 +222,7 @@ void WizardForm::validate() ((t_gui *)ui)->cb_show_msg(this, tr( "You must fill in a domain name for your SIP account.\n" "This could be the hostname or IP address of your PC " - "if you want direct PC to PC dialing.").ascii(), + "if you want direct PC to PC dialing.").toStdString(), MSG_CRITICAL); domainLineEdit->setFocus(); return; @@ -232,9 +232,9 @@ void WizardForm::validate() if (proxyLineEdit->text() != "") { s = USER_SCHEME; s.append(':').append(proxyLineEdit->text()); - t_url u(s.ascii()); + t_url u(s.toStdString()); if (!u.is_valid() || u.get_user() != "") { - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for SIP proxy.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for SIP proxy.").toStdString(), MSG_CRITICAL); proxyLineEdit->setFocus(); proxyLineEdit->selectAll(); @@ -252,9 +252,9 @@ void WizardForm::validate() if (stunServerLineEdit->text() != "") { s = "stun:"; s.append(stunServerLineEdit->text()); - t_url u(s.ascii()); + t_url u(s.toStdString()); if (!u.is_valid() || u.get_user() != "") { - ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for STUN server.").ascii(), + ((t_gui *)ui)->cb_show_msg(this, tr("Invalid value for STUN server.").toStdString(), MSG_CRITICAL); stunServerLineEdit->setFocus(); stunServerLineEdit->selectAll(); @@ -264,23 +264,23 @@ void WizardForm::validate() // Set all values in the user_config object // USER - user_config->set_display(displayLineEdit->text().ascii()); - user_config->set_name(usernameLineEdit->text().ascii()); - user_config->set_domain(domainLineEdit->text().ascii()); - user_config->set_auth_name(authNameLineEdit->text().ascii()); - user_config->set_auth_pass(authPasswordLineEdit->text().ascii()); + user_config->set_display(displayLineEdit->text().toStdString()); + user_config->set_name(usernameLineEdit->text().toStdString()); + user_config->set_domain(domainLineEdit->text().toStdString()); + user_config->set_auth_name(authNameLineEdit->text().toStdString()); + user_config->set_auth_pass(authPasswordLineEdit->text().toStdString()); // SIP SERVER user_config->set_use_outbound_proxy(!proxyLineEdit->text().isEmpty()); s = USER_SCHEME; s.append(':').append(proxyLineEdit->text()); - user_config->set_outbound_proxy(t_url(s.ascii())); + user_config->set_outbound_proxy(t_url(s.toStdString())); // NAT user_config->set_use_stun(!stunServerLineEdit->text().isEmpty()); s = "stun:"; s.append(stunServerLineEdit->text()); - user_config->set_stun_server(t_url(s.ascii())); + user_config->set_stun_server(t_url(s.toStdString())); // Save user config string error_msg; diff --git a/src/gui/wizardform.h b/src/gui/wizardform.h index 9332d3f..1ecdf3a 100644 --- a/src/gui/wizardform.h +++ b/src/gui/wizardform.h @@ -12,7 +12,7 @@ class WizardForm : public QDialog, public Ui::WizardForm Q_OBJECT public: - WizardForm(QWidget* parent = 0, const char* name = 0, bool modal = false, Qt::WindowFlags fl = 0); + WizardForm(QWidget* parent = 0); ~WizardForm(); virtual void show( t_user * user ); diff --git a/src/gui/yesnodialog.cpp b/src/gui/yesnodialog.cpp index 868f3d0..ec1810b 100644 --- a/src/gui/yesnodialog.cpp +++ b/src/gui/yesnodialog.cpp @@ -38,17 +38,23 @@ void YesNoDialog::actionNo() { } YesNoDialog::YesNoDialog() { - new QDialog(NULL, NULL, true, Qt::WDestructiveClose); + setAttribute(Qt::WA_DeleteOnClose); } YesNoDialog::YesNoDialog(QWidget *parent, const QString &caption, const QString &text) : - QDialog(parent, NULL, true, Qt::WDestructiveClose) + QDialog(parent) { - setCaption(caption); - QBoxLayout *vb = new QVBoxLayout(this, 11, 6); + setModal(true); + setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(caption); + + QBoxLayout *vb = new QVBoxLayout(this); + vb->setMargin(11); + vb->setSpacing(6); QLabel *lblQuestion = new QLabel(text, this); vb->addWidget(lblQuestion); - QHBoxLayout *hb = new QHBoxLayout(NULL, 0, 6); + QHBoxLayout *hb = new QHBoxLayout(this); + hb->setSpacing(6); QSpacerItem *spacer1 = new QSpacerItem(1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum ); hb->addItem(spacer1); -- cgit v1.2.3