Commit fe1cccfc authored by Aurélien Gâteau's avatar Aurélien Gâteau
Browse files

Use a KTextEdit for semantic description.

BUG:182568

svn path=/trunk/KDE/kdegraphics/gwenview/; revision=955573
parent 80a3fb06
......@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA
#include "semanticinfocontextmanageritem.moc"
// Qt
#include <QEvent>
#include <QShortcut>
#include <QSignalMapper>
#include <QStyle>
......@@ -145,8 +146,7 @@ struct SemanticInfoContextManagerItemPrivate : public Ui_SemanticInfoSideBarItem
QObject::connect(mRatingMapper, SIGNAL(mapped(int)),
mRatingWidget, SLOT(setRating(int)) );
QObject::connect(mDescriptionLineEdit, SIGNAL(editingFinished()),
that, SLOT(storeDescription()));
mDescriptionTextEdit->installEventFilter(that);
QObject::connect(mTagLabel, SIGNAL(linkActivated(const QString&)),
mEditTagsAction, SLOT(trigger()) );
......@@ -301,7 +301,7 @@ void SemanticInfoContextManagerItem::update() {
first = false;
}
d->mRatingWidget->setRating(rating);
d->mDescriptionLineEdit->setText(description);
d->mDescriptionTextEdit->setText(description);
// Init tagInfo from tagHash
d->mTagInfo.clear();
......@@ -343,7 +343,11 @@ void SemanticInfoContextManagerItem::slotRatingChanged(int rating) {
void SemanticInfoContextManagerItem::storeDescription() {
QString description = d->mDescriptionLineEdit->text();
if (!d->mDescriptionTextEdit->document()->isModified()) {
return;
}
d->mDescriptionTextEdit->document()->setModified(false);
QString description = d->mDescriptionTextEdit->toPlainText();
KFileItemList itemList = contextManager()->selection();
SortedDirModel* dirModel = contextManager()->dirModel();
......@@ -408,4 +412,12 @@ void SemanticInfoContextManagerItem::showSemanticInfoDialog() {
}
bool SemanticInfoContextManagerItem::eventFilter(QObject*, QEvent* event) {
if (event->type() == QEvent::FocusOut) {
storeDescription();
}
return false;
}
} // namespace
......@@ -41,6 +41,9 @@ public:
SemanticInfoContextManagerItem(ContextManager*, KActionCollection*, QWidget* documentPanel);
~SemanticInfoContextManagerItem();
protected:
virtual bool eventFilter(QObject*, QEvent*);
private Q_SLOTS:
void slotSelectionChanged();
void update();
......
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SemanticInfoSideBarItem</class>
<widget class="QWidget" name="SemanticInfoSideBarItem" >
<property name="geometry" >
<widget class="QWidget" name="SemanticInfoSideBarItem">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>231</width>
<height>112</height>
<height>183</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout" >
<property name="labelAlignment" >
<layout class="QFormLayout" name="formLayout">
<property name="labelAlignment">
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Rating:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KRatingWidget" native="1" name="mRatingWidget" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<item row="0" column="1">
<widget class="KRatingWidget" name="mRatingWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Description:</string>
</property>
<property name="alignment" >
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>mDescriptionLineEdit</cstring>
<property name="buddy">
<cstring>mDescriptionTextEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KLineEdit" name="mDescriptionLineEdit" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Tags:</string>
<item row="2" column="1">
<widget class="KTextEdit" name="mDescriptionTextEdit">
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QLabel" name="mTagLabel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<item row="1" column="1">
<widget class="QLabel" name="mTagLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Tags:</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
<class>KTextEdit</class>
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
<customwidget>
<class>KRatingWidget</class>
......
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