From 344495d4f01649aa6dd2f761d40986a7550f0ea4 Mon Sep 17 00:00:00 2001 From: Lubos Dolezel Date: Tue, 2 Jun 2015 23:01:13 +0200 Subject: messageform ported to Qt4 --- src/gui/messageform.cpp | 29 +++++++++++++---------------- src/gui/messageform.h | 8 ++++---- src/gui/messageform.ui | 9 +++------ 3 files changed, 20 insertions(+), 26 deletions(-) (limited to 'src/gui') diff --git a/src/gui/messageform.cpp b/src/gui/messageform.cpp index ad801be..0e71995 100644 --- a/src/gui/messageform.cpp +++ b/src/gui/messageform.cpp @@ -30,9 +30,6 @@ #include #include #include -#include -#include -#include #endif #include "gui.h" @@ -42,12 +39,13 @@ #include "util.h" #include #include -#include +#include #include "utils/file_utils.h" #include #include "sendfileform.h" #include -#include +#include +#include #include "messageform.h" @@ -62,7 +60,7 @@ 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) - : Q3MainWindow(parent, name, fl) + : QMainWindow(parent, name, fl) { setupUi(this); @@ -104,7 +102,7 @@ void MessageForm::init() // Set toolbutton icons for disabled options. setDisabledIcon(addressToolButton, "kontact_contacts-disabled.png"); - attachmentPopupMenu = new Q3PopupMenu(this); + attachmentPopupMenu = new QMenu(this); MEMMAN_NEW(attachmentPopupMenu); connect(attachmentPopupMenu, SIGNAL(activated(int)), @@ -153,7 +151,7 @@ void MessageForm::destroy() void MessageForm::closeEvent(QCloseEvent *e) { MEMMAN_DELETE(this); // destructive close - Q3MainWindow::closeEvent(e); + QMainWindow::closeEvent(e); } @@ -172,7 +170,7 @@ void MessageForm::show() msgLineEdit->setFocus(); } - Q3MainWindow::show(); + QMainWindow::show(); } void MessageForm::selectUserConfig(t_user *user_config) @@ -320,7 +318,7 @@ void MessageForm::addMessage(const im::t_msg &msg, const QString &name) // Timestamp and name of sender if (msg.direction == im::MSG_DIR_IN) s += ""; s += time2str(msg.timestamp, "%H:%M:%S ").c_str(); - s += Q3StyleSheet::escape(name); + s += Qt::escape(name); if (msg.direction == im::MSG_DIR_IN) s += ""; s += ""; @@ -503,7 +501,7 @@ void MessageForm::showAttachmentPopupMenu(const QString &attachment) { attachmentPopupMenu->insertItem(openIcon, tr("Open with..."), id++); #endif - attachmentPopupMenu->popup(QCursor::pos()); + attachmentPopupMenu->popup(QCursor::pos(), 0); } void MessageForm::attachmentPopupActivated(int id) { @@ -521,14 +519,13 @@ void MessageForm::attachmentPopupActivated(int id) { connect(d, SIGNAL(okClicked()), this, SLOT(saveAttachment())); #else - Q3FileDialog *d = new Q3FileDialog(QString::null, QString::null, this, 0, true); + QFileDialog *d = new QFileDialog(this); MEMMAN_NEW(d); - d->setMode(Q3FileDialog::AnyFile); connect(d, SIGNAL(fileSelected(const QString &)), this, SLOT(saveAttachment())); #endif - d->setSelection(_filenameMap[clickedAttachment.ascii()].c_str()); + d->selectFile(QString::fromStdString(_filenameMap[clickedAttachment.ascii()])); d->setCaption(tr("Save attachment as...")); if (_saveAsDialog) { @@ -555,7 +552,7 @@ void MessageForm::saveAttachment() { #ifdef HAVE_KDE KFileDialog *d = dynamic_cast(_saveAsDialog); #else - Q3FileDialog *d = dynamic_cast(_saveAsDialog); + QFileDialog *d = dynamic_cast(_saveAsDialog); #endif QString filename = d->selectedFile(); @@ -579,7 +576,7 @@ void MessageForm::chooseFileToSend() // Indicate that a message is being composed. setLocalComposingIndicationActive(); - SendFileForm *form = new SendFileForm(); + SendFileForm *form = new SendFileForm(this); MEMMAN_NEW(form); // Form will auto destruct itself on close. diff --git a/src/gui/messageform.h b/src/gui/messageform.h index 8cf9037..323c099 100644 --- a/src/gui/messageform.h +++ b/src/gui/messageform.h @@ -4,18 +4,18 @@ #include "getaddressform.h" #include "im/msg_session.h" #include "phone.h" -#include #include #include #include "textbrowsernoautolink.h" #include "user.h" #include "ui_messageform.h" -#include +#include +#include class t_phone; extern t_phone *phone; -class MessageForm : public Q3MainWindow, public Ui::MessageForm +class MessageForm : public QMainWindow, public Ui::MessageForm { Q_OBJECT @@ -60,7 +60,7 @@ private: map _filenameMap; bool _remotePartyComplete; GetAddressForm *_getAddressForm; - Q3PopupMenu *attachmentPopupMenu; + QMenu *attachmentPopupMenu; QString clickedAttachment; void *_serviceMap; QLabel *_isComposingLabel; diff --git a/src/gui/messageform.ui b/src/gui/messageform.ui index 7c77067..d0ecf17 100644 --- a/src/gui/messageform.ui +++ b/src/gui/messageform.ui @@ -4,7 +4,7 @@ MessageForm - + 0 @@ -89,7 +89,7 @@ - + Conversation @@ -132,10 +132,7 @@ - - - false - + Instant message toolbar -- cgit v1.2.3