summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLubos Dolezel <lubos@dolezel.info>2015-06-02 23:01:13 +0200
committerLubos Dolezel <lubos@dolezel.info>2015-06-02 23:01:13 +0200
commit344495d4f01649aa6dd2f761d40986a7550f0ea4 (patch)
treec98362ee8173c61b8c26f34f319f953eed58ebb4 /src/gui
parent24eb07ecb18a65dcfc0491d6465a317b60cca052 (diff)
downloadtwinkle-344495d4f01649aa6dd2f761d40986a7550f0ea4.tar
twinkle-344495d4f01649aa6dd2f761d40986a7550f0ea4.tar.gz
twinkle-344495d4f01649aa6dd2f761d40986a7550f0ea4.tar.lz
twinkle-344495d4f01649aa6dd2f761d40986a7550f0ea4.tar.xz
twinkle-344495d4f01649aa6dd2f761d40986a7550f0ea4.zip
messageform ported to Qt4
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/messageform.cpp29
-rw-r--r--src/gui/messageform.h8
-rw-r--r--src/gui/messageform.ui9
3 files changed, 20 insertions, 26 deletions
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 <QKeyEvent>
#include <QLabel>
#include <QPixmap>
-#include <Q3Frame>
-#include <Q3PopupMenu>
-#include <QCloseEvent>
#endif
#include "gui.h"
@@ -42,12 +39,13 @@
#include "util.h"
#include <QPixmap>
#include <QCursor>
-#include <Q3FileDialog>
+#include <QFileDialog>
#include "utils/file_utils.h"
#include <QFile>
#include "sendfileform.h"
#include <QStatusBar>
-#include <Q3Frame>
+#include <QFrame>
+#include <QTextDocument>
#include "messageform.h"
@@ -62,7 +60,7 @@ using namespace utils;
#define IMG_SCALE_FACTOR(width, height) (std::min<float>( 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 += "<font color=\"blue\">";
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 += "</font>";
s += "</b>";
@@ -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<KFileDialog *>(_saveAsDialog);
#else
- Q3FileDialog *d = dynamic_cast<Q3FileDialog *>(_saveAsDialog);
+ QFileDialog *d = dynamic_cast<QFileDialog *>(_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 <Qt3Support/Q3PopupMenu>
#include <QtGui/QLabel>
#include <QtCore/QStringRef>
#include "textbrowsernoautolink.h"
#include "user.h"
#include "ui_messageform.h"
-#include <Q3MainWindow>
+#include <QMainWindow>
+#include <QMenu>
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<string, string> _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 @@
<comment></comment>
<exportmacro></exportmacro>
<class>MessageForm</class>
- <widget class="Q3MainWindow" name="MessageForm">
+ <widget class="QMainWindow" name="MessageForm">
<property name="geometry">
<rect>
<x>0</x>
@@ -89,7 +89,7 @@
</layout>
</item>
<item>
- <widget class="Q3GroupBox" name="conversationGroupBox">
+ <widget class="QGroupBox" name="conversationGroupBox">
<property name="title">
<string>Conversation</string>
</property>
@@ -132,10 +132,7 @@
</item>
</layout>
</widget>
- <widget class="Q3ToolBar" name="Toolbar">
- <property name="horizontallyStretchable">
- <bool>false</bool>
- </property>
+ <widget class="QToolBar" name="Toolbar">
<property name="label">
<string>Instant message toolbar</string>
</property>