diff options
| author | Peter Penz <[email protected]> | 2012-05-14 17:41:18 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-05-14 17:42:10 +0200 |
| commit | f74c72b9652ea4613156cc58b681c9244395cf72 (patch) | |
| tree | 7207a8b38dc9141e0ea5cd1375fbb2b42a7d8a3f /src/panels/places/placespanel.cpp | |
| parent | c10affe267ed32a2df61e357b33fdb90911b045d (diff) | |
Fix several bookmark synchronization issues
Diffstat (limited to 'src/panels/places/placespanel.cpp')
| -rw-r--r-- | src/panels/places/placespanel.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/panels/places/placespanel.cpp b/src/panels/places/placespanel.cpp index 75f765812..4c0162dc4 100644 --- a/src/panels/places/placespanel.cpp +++ b/src/panels/places/placespanel.cpp @@ -312,17 +312,17 @@ void PlacesPanel::addEntry() dialog->setAllowGlobal(true); dialog->setUrl(url); if (dialog->exec() == QDialog::Accepted) { - KStandardItem* item = createStandardItemFromDialog(dialog); + PlacesItem* item = m_model->createPlacesItem(dialog->text(), dialog->url(), dialog->icon()); // Insert the item as last item of the corresponding group. int i = 0; - while (i < m_model->count() && m_model->item(i)->group() != item->group()) { + while (i < m_model->count() && m_model->placesItem(i)->group() != item->group()) { ++i; } bool inserted = false; while (!inserted && i < m_model->count()) { - if (m_model->item(i)->group() != item->group()) { + if (m_model->placesItem(i)->group() != item->group()) { m_model->insertItem(i, item); inserted = true; } @@ -348,14 +348,11 @@ void PlacesPanel::editEntry(int index) dialog->setUrl(data.value("url").value<KUrl>()); dialog->setAllowGlobal(true); if (dialog->exec() == QDialog::Accepted) { - KStandardItem* oldItem = m_model->item(index); + PlacesItem* oldItem = m_model->placesItem(index); if (oldItem) { - KStandardItem* item = createStandardItemFromDialog(dialog); - // Although the user might have changed the URL of the item in a way - // that another group should be assigned, we still apply the old - // group to keep the same position for the item. - item->setGroup(oldItem->group()); - m_model->changeItem(index, item); + oldItem->setText(dialog->text()); + oldItem->setUrl(dialog->url()); + oldItem->setIcon(dialog->icon()); } } @@ -371,20 +368,6 @@ void PlacesPanel::selectClosestItem() selectionManager->setSelected(index); } -KStandardItem* PlacesPanel::createStandardItemFromDialog(PlacesItemEditDialog* dialog) const -{ - Q_ASSERT(dialog); - - const KUrl newUrl = dialog->url(); - KStandardItem* item = new KStandardItem(); - item->setIcon(dialog->icon()); - item->setText(dialog->text()); - item->setDataValue("url", newUrl); - item->setGroup(m_model->groupName(newUrl)); - - return item; -} - KUrl PlacesPanel::convertedUrl(const KUrl& url) { KUrl newUrl = url; |
