[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/office/skrooge
From: Stephane Mankowski <stephane () mankowski ! fr>
Date: 2010-08-31 21:25:20
Message-ID: 20100831212520.34B14AC857 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1170432 by smankowski:
FEATURE: Addition of file as property by drag and drop
M +1 -0 CHANGELOG
M +0 -3 skg_bookmark/skgbookmarkplugindockwidget_base.ui
M +26 -7 skgbasegui/skgobjectmodelbase.cpp
M +32 -0 skgbasemodeler/skgdocument.cpp
M +15 -0 skgbasemodeler/skgdocument.h
M +5 -0 skgbasemodeler/skgobjectbase.cpp
M +11 -0 skgbasemodeler/skgobjectbase.h
M +1 -4 skrooge_bank/skgbankpluginwidget_base.ui
M +3 -0 skrooge_calculator/skgcalculatorpluginwidget_base.ui
M +3 -8 skrooge_operation/skgoperationpluginwidget_base.ui
M +3 -3 skrooge_scheduled/skgscheduledpluginwidget_base.ui
M +3 -3 skrooge_search/skgsearchpluginwidget_base.ui
M +3 -3 skrooge_tracker/skgtrackerpluginwidget_base.ui
M +2 -8 skrooge_unit/skgunitpluginwidget_base.ui
--- trunk/extragear/office/skrooge/CHANGELOG #1170431:1170432
@@ -17,6 +17,7 @@
*New feature: Context in a toolbar (useful for small screen)
*New feature: Advice widget in dashboard
*New feature: Full screen (useful for small screen)
+ *New feature: Addition of file as property by drag and drop
-- maintainer Stephane MANKOWSKI <stephane@mankowski.fr> xxx
--- trunk/extragear/office/skrooge/skg_bookmark/skgbookmarkplugindockwidget_base.ui \
#1170431:1170432 @@ -23,9 +23,6 @@
</item>
<item>
<widget class="SKGTreeView" name="kBookmarksList">
- <property name="acceptDrops">
- <bool>true</bool>
- </property>
<property name="toolTip">
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"> \
<html><head><meta name="qrichtext" content="1" \
/><style type="text/css">
--- trunk/extragear/office/skrooge/skgbasegui/skgobjectmodelbase.cpp #1170431:1170432
@@ -532,12 +532,11 @@
{
_SKGTRACEIN(10, "SKGObjectModelBase::flags");
- Qt::ItemFlags flags=QAbstractItemModel::flags(index);
+ Qt::ItemFlags flags=QAbstractItemModel::flags(index)| Qt::ItemIsDropEnabled;
if (nodeTable) {
flags|=Qt::ItemIsEditable;
- if (index.isValid()) flags|=Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled;
- else flags|=Qt::ItemIsDropEnabled;
+ if (index.isValid()) flags|=Qt::ItemIsDragEnabled;
}
if (index.column() == 0) flags|=Qt::ItemIsUserCheckable;
return flags;
@@ -571,13 +570,14 @@
Qt::DropActions SKGObjectModelBase::supportedDropActions() const
{
- return (nodeTable ? Qt::MoveAction : Qt::IgnoreAction);
+ return Qt::MoveAction;
}
QStringList SKGObjectModelBase::mimeTypes() const
{
QStringList types;
types << "application/skg."+getRealTable()+".ids";
+ types << "text/uri-list";
return types;
}
@@ -609,14 +609,33 @@
{
Q_UNUSED(row);
if (action == Qt::IgnoreAction) return true;
- if (!data || !data->hasFormat("application/skg.node.ids")) return false;
+ if (!data || !(data->hasFormat("application/skg.node.ids") || data->hasUrls())) \
return false; if (column > 0) return false;
+ SKGError err;
+ //Drop files
+ if (data->hasUrls() && parent.isValid() && getRealTable()!="node")
+ {
+ QList<QUrl> urls=data->urls();
+ int nb=urls.count();
+ {
+ SKGObjectBase obj=getObject(parent);
+
+ SKGBEGINPROGRESSTRANSACTION(*getDocument(), i18nc("Noun, name of the \
user action", "Property creation"), err, nb); + for (int i=0; \
err.isSucceeded() && i<nb; ++i) + {
+ err=obj.setProperty(urls.at(i).toLocalFile(), \
urls.at(i).toLocalFile(), urls.at(i).toLocalFile()); + if \
(err.isSucceeded()) err=getDocument()->stepForward(i+1); + }
+ }
+ }
+ //Drop nodes
+ else if (data->hasFormat ( "application/skg.node.ids" ))
+ {
QByteArray encodedData = data->data("application/skg.node.ids");
QDataStream stream(&encodedData, QIODevice::ReadOnly);
QStringList newItems;
- SKGError err;
SKGNodeObject parentNode;
if (parent.isValid())
{
@@ -667,7 +686,7 @@
if (err.isSucceeded()) err=child.save();
}
}
-
+ }
SKGMainPanel::displayErrorMessage(err);
return err.isSucceeded();
}
--- trunk/extragear/office/skrooge/skgbasemodeler/skgdocument.cpp #1170431:1170432
@@ -1499,6 +1499,38 @@
return output;
}
+SKGError SKGDocument::setParameter(const QString& iName, const QString& iValue, \
const QString& iFileName, const QString& iParentUUID, SKGPropertyObject* \
oObjectCreated) +{
+ SKGError err;
+ SKGTRACEINRC(10, "SKGDocument::setParameter", err);
+ SKGTRACEL(10) << "Input parameter [iName] =[" << iName << ']' << endl;
+ SKGTRACEL(10) << "Input parameter [iValue] =[" << iValue << ']' << endl;
+ SKGTRACEL(10) << "Input parameter [iFileName]=[" << iFileName << ']' << endl;
+ QVariant blob;
+ QString value=iValue;
+ QFile file(iFileName);
+ if (file.exists()) {
+ //Open file
+ if (!file.open(QIODevice::ReadOnly)) {
+ err=SKGError(ERR_INVALIDARG, i18nc("Error message", "Open file '%1' \
failed", iFileName)); + } else {
+ QByteArray blob_bytes=file.readAll();
+ if (!blob_bytes.count()) {
+ err=SKGError(ERR_INVALIDARG, i18nc("Error message", "Open file '%1' \
failed", iFileName)); + } else {
+ blob=blob_bytes;
+ value=QFileInfo(iFileName).fileName();
+ }
+
+ //close file
+ file.close();
+ }
+ }
+
+ if (err.isSucceeded()) err=setParameter(iName, value, blob, iParentUUID, \
oObjectCreated); + return err;
+}
+
SKGError SKGDocument::setParameter(const QString& iName, const QString& iValue, \
const QVariant& iBlob, const QString& iParentUUID, SKGPropertyObject* oObjectCreated) \
{ SKGError err;
--- trunk/extragear/office/skrooge/skgbasemodeler/skgdocument.h #1170431:1170432
@@ -370,6 +370,21 @@
* @see beginTransaction
* @param iName the parameter unique identifier.
* @param iValue the parameter value.
+ * @param iFileName the file name.
+ * @param iParentUUID the unique identifier of the object owning this parameter.
+ * @param oObjectCreated the parameter object created
+ * @return an object managing the error.
+ * @see SKGError
+ */
+ virtual SKGError setParameter(const QString& iName, const QString& iValue, const \
QString& iFileName, + const QString& \
iParentUUID="document", SKGPropertyObject* oObjectCreated=NULL); +
+ /**
+ * Set a parameter.
+ * WARNING: This method must be used in a transaction.
+ * @see beginTransaction
+ * @param iName the parameter unique identifier.
+ * @param iValue the parameter value.
* @param iBlob the parameter blob.
* @param iParentUUID the unique identifier of the object owning this parameter.
* @param oObjectCreated the parameter object created
--- trunk/extragear/office/skrooge/skgbasemodeler/skgobjectbase.cpp #1170431:1170432
@@ -450,6 +450,11 @@
return getDocument()->getParameterBlob(iName, getUniqueID());
}
+SKGError SKGObjectBase::setProperty(const QString& iName, const QString& iValue, \
const QString& iFileName, SKGPropertyObject* oObjectCreated) +{
+ return getDocument()->setParameter(iName, iValue, iFileName, getUniqueID(), \
oObjectCreated); +}
+
SKGError SKGObjectBase::setProperty(const QString& iName, const QString& iValue, \
const QVariant& iBlob, SKGPropertyObject* oObjectCreated) {
return getDocument()->setParameter(iName, iValue, iBlob, getUniqueID(), \
oObjectCreated);
--- trunk/extragear/office/skrooge/skgbasemodeler/skgobjectbase.h #1170431:1170432
@@ -279,6 +279,17 @@
* Set the value for a property
* @param iName the property name
* @param iValue the property value
+ * @param iFileName the file name.
+ * @param oObjectCreated the property object created
+ * @return an object managing the property
+ * @see SKGError
+ */
+ virtual SKGError setProperty(const QString& iName, const QString& iValue, const \
QString& iFileName, SKGPropertyObject* oObjectCreated=NULL); +
+ /**
+ * Set the value for a property
+ * @param iName the property name
+ * @param iValue the property value
* @param iBlob the property blob
* @param oObjectCreated the property object created
* @return an object managing the property
--- trunk/extragear/office/skrooge/skrooge_bank/skgbankpluginwidget_base.ui \
#1170431:1170432 @@ -87,7 +87,7 @@
<string/>
</property>
<property name="dragDropMode">
- <enum>QAbstractItemView::NoDragDrop</enum>
+ <enum>QAbstractItemView::DropOnly</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
@@ -95,9 +95,6 @@
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
--- trunk/extragear/office/skrooge/skrooge_calculator/skgcalculatorpluginwidget_base.ui \
#1170431:1170432 @@ -192,6 +192,9 @@
<property name="statusTip">
<string>Parameters for interest computation</string>
</property>
+ <property name="dragDropMode">
+ <enum>QAbstractItemView::DropOnly</enum>
+ </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
--- trunk/extragear/office/skrooge/skrooge_operation/skgoperationpluginwidget_base.ui \
#1170431:1170432 @@ -160,6 +160,9 @@
</item>
<item>
<widget class="SKGTableView" name="kOperationView">
+ <property name="acceptDrops">
+ <bool>true</bool>
+ </property>
<property name="toolTip">
<string>list of operations</string>
</property>
@@ -172,9 +175,6 @@
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
@@ -1490,11 +1490,6 @@
<header>kfilterproxysearchline.h</header>
</customwidget>
<customwidget>
- <class>KSqueezedTextLabel</class>
- <extends>QLabel</extends>
- <header>ksqueezedtextlabel.h</header>
- </customwidget>
- <customwidget>
<class>KTitleWidget</class>
<extends>QWidget</extends>
<header>ktitlewidget.h</header>
--- trunk/extragear/office/skrooge/skrooge_scheduled/skgscheduledpluginwidget_base.ui \
#1170431:1170432 @@ -71,15 +71,15 @@
<property name="statusTip">
<string>List of recurrent operations</string>
</property>
+ <property name="dragDropMode">
+ <enum>QAbstractItemView::DropOnly</enum>
+ </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
--- trunk/extragear/office/skrooge/skrooge_search/skgsearchpluginwidget_base.ui \
#1170431:1170432 @@ -66,15 +66,15 @@
<property name="statusTip">
<string>List of searches and processes</string>
</property>
+ <property name="dragDropMode">
+ <enum>QAbstractItemView::DropOnly</enum>
+ </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
</widget>
</item>
<item>
--- trunk/extragear/office/skrooge/skrooge_tracker/skgtrackerpluginwidget_base.ui \
#1170431:1170432 @@ -84,15 +84,15 @@
<property name="statusTip">
<string>list of trackers</string>
</property>
+ <property name="dragDropMode">
+ <enum>QAbstractItemView::DropOnly</enum>
+ </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
--- trunk/extragear/office/skrooge/skrooge_unit/skgunitpluginwidget_base.ui \
#1170431:1170432 @@ -75,7 +75,7 @@
<string>List of units</string>
</property>
<property name="dragDropMode">
- <enum>QAbstractItemView::NoDragDrop</enum>
+ <enum>QAbstractItemView::DropOnly</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
@@ -83,9 +83,6 @@
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
@@ -114,7 +111,7 @@
<string>List of quotes for selected unit</string>
</property>
<property name="dragDropMode">
- <enum>QAbstractItemView::NoDragDrop</enum>
+ <enum>QAbstractItemView::DropOnly</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
@@ -122,9 +119,6 @@
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
- <property name="selectionBehavior">
- <enum>QAbstractItemView::SelectRows</enum>
- </property>
<property name="sortingEnabled">
<bool>false</bool>
</property>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic