Commit f47c9e2c authored by scuq's avatar scuq

upload without text shortcut Alt+Up

parent 50e2e5e0
Pipeline #400 failed with stage
in 5 minutes and 8 seconds
......@@ -177,6 +177,8 @@ void dialogChat::closeEvent(QCloseEvent *closeev)
}
void dialogChat::resizeEvent(QResizeEvent *e)
{
this->m_mp->setSaveWindowStatePosition(this->windowTitle().replace(" ","").replace("*",""), saveGeometry(),0);
......@@ -294,15 +296,19 @@ bool dialogChat::eventFilter(QObject *obj, QEvent *event)
}
return true; // do not process this event further
}
if(ke->key() == Qt::Key_Up) {
qDebug() << this->getAttachmentIds().count();
if (this->getAttachmentIds().count() > 0) {
this->sendMessage(this->ui->plainTextEditChatInput->toPlainText());
}
}
if( (ke->modifiers() & Qt::AltModifier)){
return true; // do not process this event further
}
if(ke->key() == Qt::Key_Up) {
qDebug() << this->getAttachmentIds().count();
if (this->getAttachmentIds().count() > 0) {
this->sendMessage(this->ui->plainTextEditChatInput->toPlainText());
}
return true; // do not process this event further
}
}
......@@ -311,6 +317,8 @@ bool dialogChat::eventFilter(QObject *obj, QEvent *event)
}
if(event->type() == QKeyEvent::KeyPress) {
QKeyEvent * ke = static_cast<QKeyEvent*>(event);
if (ke->matches(QKeySequence::Paste)) {
......@@ -335,11 +343,13 @@ bool dialogChat::eventFilter(QObject *obj, QEvent *event)
this->session->uploadFile(this->contact->getDirectChannelId(),"test.png",arr);
this->ui->wAttachment->setPreviewImage(this->clip->image());
this->ui->wAttachment->setHidden(false);
this->ui->plainTextEditChatInput->setPlaceholderText("Hit Alt-Enter to send attachment without text!");
this->ui->plainTextEditChatInput->setPlaceholderText("Hit Alt-Up (Cursor) to send attachment without text!");
}
}
}
......
......@@ -4,7 +4,7 @@
#include <QDialog>
#include <QtMath>
#include <QTextEdit>
#include <QPlainTextEdit>
#include "qplainchatedit.h"
#include <QScrollBar>
#include <QDesktopServices>
#include <QPainter>
......@@ -138,6 +138,7 @@ private:
protected:
bool eventFilter(QObject *obj, QEvent *event);
};
#endif // DIALOGCHAT_H
......@@ -10,6 +10,9 @@
<height>521</height>
</rect>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
......@@ -49,6 +52,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="autoFillBackground">
<bool>true</bool>
</property>
......@@ -75,7 +81,7 @@
<enum>QLayout::SetNoConstraint</enum>
</property>
<item>
<widget class="QPlainTextEdit" name="plainTextEditChatInput">
<widget class="QPlainChatEdit" name="plainTextEditChatInput">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
......@@ -95,7 +101,7 @@
</size>
</property>
<property name="acceptDrops">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
......@@ -143,6 +149,11 @@
<header location="global">widgetattachment.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QPlainChatEdit</class>
<extends>QPlainTextEdit</extends>
<header location="global">qplainchatedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>textBrowserChatOutput</tabstop>
......
......@@ -52,7 +52,8 @@ SOURCES += \
qclicklabel.cpp \
aictrayicon.cpp \
statuslabel.cpp \
widgetattachment.cpp
widgetattachment.cpp \
qplainchatedit.cpp
HEADERS += \
qmmainwindow.h \
......@@ -79,7 +80,8 @@ HEADERS += \
qclicklabel.h \
aictrayicon.h \
statuslabel.h \
widgetattachment.h
widgetattachment.h \
qplainchatedit.h
FORMS += \
qmmainwindow.ui \
......
......@@ -547,6 +547,7 @@ void qmMainWindow::slOnRosterClicked(const QModelIndex &index)
} else {
chatDialogs.value(_contact->getId())->show();
chatDialogs.value(_contact->getId())->raise();
}
......
#include "qplainchatedit.h"
QPlainChatEdit::QPlainChatEdit(QObject *parent)
{
}
void QPlainChatEdit::dropEvent(QDropEvent *e)
{
qDebug() << "drop event";
}
#ifndef QPLAINCHATEDIT_H
#define QPLAINCHATEDIT_H
#include <QObject>
#include <QPlainTextEdit>
#include <QDebug>
class QPlainChatEdit : public QPlainTextEdit
{
public:
QPlainChatEdit(QObject *parent);
protected:
void dropEvent(QDropEvent *e);
};
#endif // QPLAINCHATEDIT_H
......@@ -34,6 +34,9 @@
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment