Commit 5c6edf64 authored by Urs Wolfer's avatar Urs Wolfer

Use bookmark URL instead of text as URL for new connection from dock widget.

BUG:166842

svn path=/trunk/KDE/kdenetwork/krdc/; revision=834046
parent c763130b
......@@ -363,8 +363,9 @@ void MainWindow::newConnection(const KUrl &newUrl, bool switchFullscreenWhenConn
void MainWindow::openFromDockWidget(const QModelIndex &index)
{
if (index.data(Qt::UserRole).toBool()) {
KUrl url(index.data().toString());
QString data = index.data(Qt::UserRole).toString();
if (!data.isEmpty()) {
KUrl url(data);
// first check if url has already been opened; in case show the tab
for (int i = 0; i < m_remoteViewList.count(); i++) {
if (m_remoteViewList.at(i)->url() == url) {
......
......@@ -53,7 +53,7 @@ int RemoteDesktopsItem::childCount() const
int RemoteDesktopsItem::columnCount() const
{
return itemData.count();
return 1;
}
QVariant RemoteDesktopsItem::data(int column) const
......
......@@ -96,8 +96,11 @@ QVariant RemoteDesktopsModel::data(const QModelIndex &index, int role) const
return KIcon("view-history");
else
return KIcon("folder-bookmarks");
case Qt::UserRole: // tell if it is an address
return QVariant(item->data(index.column()).toString().contains("://"));
case Qt::UserRole:
if (item->data(index.column() + 1).toString().contains("://"))
return QVariant(item->data(index.column() + 1).toString());
else
return QVariant();
default:
return QVariant();
}
......@@ -171,7 +174,7 @@ void RemoteDesktopsModel::buildModelFromBookmarkGroup(const KBookmarkGroup &grou
{
KBookmark bm = group.first();
while (!bm.isNull()) {
RemoteDesktopsItem *newItem = new RemoteDesktopsItem(QList<QVariant>() << bm.text(), item);
RemoteDesktopsItem *newItem = new RemoteDesktopsItem(QList<QVariant>() << bm.text() << bm.url().url(), item);
item->appendChild(newItem);
if (bm.isGroup())
buildModelFromBookmarkGroup(bm.toGroup(), newItem); //recursive
......
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