[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kget/ui/history
From: Javier Goday <jgoday () gmail ! com>
Date: 2008-05-04 14:41:28
Message-ID: 1209912088.461876.29406.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 803939 by jgoday:
Allow open dowloaded file with doubleclick from history
M +1 -1 rangetreewidget.cpp
M +17 -2 transferhistory.cpp
M +1 -1 transferhistory.h
M +7 -1 transferhistorycategorizedview.cpp
M +2 -0 transferhistorycategorizedview.h
--- trunk/KDE/kdenetwork/kget/ui/history/rangetreewidget.cpp #803938:803939
@@ -97,7 +97,7 @@
// delegate for the range title
RangeTreeWidgetItemDelegate *delegate = new RangeTreeWidgetItemDelegate(this);
- setItemDelegate(delegate);
+ setItemDelegate(delegate);
}
RangeTreeWidget::~RangeTreeWidget()
--- trunk/KDE/kdenetwork/kget/ui/history/transferhistory.cpp #803938:803939
@@ -98,6 +98,7 @@
connect(m_rangeTypeCombobox, SIGNAL(activated(int)), this, \
SLOT(slotLoadRangeType(int)));
connect(m_view, SIGNAL(deletedTransfer(const QString &, const QModelIndex &)),
SLOT(slotDeleteTransfer(const QString &, const QModelIndex &)));
+ connect(m_view, SIGNAL(doubleClicked(const QModelIndex &)), \
SLOT(slotOpenFile(const QModelIndex &))); connect(m_store, SIGNAL(loadFinished()), \
SLOT(slotLoadFinished()));
connect(m_store, SIGNAL(elementLoaded(int, int, const TransferHistoryItem &)),
SLOT(slotElementLoaded(int, int, const TransferHistoryItem \
&))); @@ -175,12 +176,23 @@
}
}
-void TransferHistory::slotOpenFile()
+void TransferHistory::slotOpenFile(const QModelIndex &index)
{
+ QString file;
+
if (!m_iconModeEnabled) {
RangeTreeWidget *range_view = qobject_cast <RangeTreeWidget *> (m_view);
- new KRun(range_view->currentItem(1)->text(), this, true, false);
+ file = range_view->currentItem(1)->text();
}
+ else {
+ TransferHistoryCategorizedView *categorized_view = qobject_cast \
<TransferHistoryCategorizedView *> (m_view); + file = \
categorized_view->data(index, \
TransferHistoryCategorizedDelegate::RoleDest).toString(); + }
+
+ kDebug() << "Try to open the file : " << file;
+ if (!file.isEmpty()) {
+ new KRun(file, this, true, false);
+ }
}
void TransferHistory::hideEvent(QHideEvent *event)
@@ -292,6 +304,8 @@
slotLoadRangeType(m_rangeType);
connect(m_searchBar, SIGNAL(textChanged(const QString &)), m_view, \
SLOT(setFilterRegExp(const QString &))); + // we connect the doubleClicked signal \
over an item to the open file action + connect(m_view, SIGNAL(doubleClicked(const \
QModelIndex &)), SLOT(slotOpenFile(const QModelIndex &))); }
void TransferHistory::slotSetIconMode()
@@ -305,6 +319,7 @@
connect(m_searchBar, SIGNAL(textChanged(const QString &)), m_view, \
SLOT(setFilterRegExp(const QString &)));
connect(m_view, SIGNAL(deletedTransfer(const QString &, const QModelIndex &)),
SLOT(slotDeleteTransfer(const QString &, const QModelIndex &)));
+ connect(m_view, SIGNAL(doubleClicked(const QModelIndex &)), \
SLOT(slotOpenFile(const QModelIndex &))); }
void TransferHistory::slotElementLoaded(int number, int total, const \
TransferHistoryItem &item)
--- trunk/KDE/kdenetwork/kget/ui/history/transferhistory.h #803938:803939
@@ -70,7 +70,7 @@
void slotClear();
void slotWriteDefault();
void slotDownload();
- void slotOpenFile();
+ void slotOpenFile(const QModelIndex &index = QModelIndex());
void contextMenuEvent(QContextMenuEvent *event);
void slotLoadRangeType(int type);
void slotSetListMode();
--- trunk/KDE/kdenetwork/kget/ui/history/transferhistorycategorizedview.cpp \
#803938:803939 @@ -55,7 +55,7 @@
connect(item_delegate, SIGNAL(deletedTransfer(const QString &, const QModelIndex \
&)),
SIGNAL(deletedTransfer(const QString &, const QModelIndex \
&)));
-
+ connect(m_view, SIGNAL(doubleClicked(const QModelIndex &)), \
SIGNAL(doubleClicked(const QModelIndex &))); setLayout(layout);
}
@@ -75,6 +75,12 @@
m_model->appendRow(item);
}
+QVariant TransferHistoryCategorizedView::data(const QModelIndex &index,
+ \
TransferHistoryCategorizedDelegate::AlternativeRoles role) const +{
+ return m_model->itemFromIndex(m_proxyModel->mapToSource(index))->data(role);
+}
+
void TransferHistoryCategorizedView::clear()
{
m_model->clear();
--- trunk/KDE/kdenetwork/kget/ui/history/transferhistorycategorizedview.h \
#803938:803939 @@ -32,9 +32,11 @@
~TransferHistoryCategorizedView();
void addData(const QDate &date, const QString &url, const QString &dest, int \
size); + QVariant data(const QModelIndex &index, \
TransferHistoryCategorizedDelegate::AlternativeRoles role) const;
signals:
void deletedTransfer(const QString &url, const QModelIndex &index);
+ void doubleClicked(const QModelIndex &);
public slots:
void clear();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic