mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-20 00:41:23 +00:00
Internal cleanup: Remove public method selectedUrls() from DolphinView to keep the interface minimal (selectedItems() is already available)
svn path=/trunk/KDE/kdebase/apps/; revision=1184457
This commit is contained in:
parent
e7419dbae9
commit
11befe3a6b
|
@ -74,8 +74,10 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
|
|||
// The context menu either accesses the URLs of the selected items
|
||||
// or the items itself. To increase the performance both lists are cached.
|
||||
const DolphinView* view = m_mainWindow->activeViewContainer()->view();
|
||||
m_selectedUrls = view->selectedUrls();
|
||||
m_selectedItems = view->selectedItems();
|
||||
foreach (const KFileItem &item, m_selectedItems) {
|
||||
m_selectedUrls.append(item.url());
|
||||
}
|
||||
|
||||
if (m_keyInfo != 0) {
|
||||
if (m_keyInfo->isKeyPressed(Qt::Key_Shift) || m_keyInfo->isKeyLatched(Qt::Key_Shift)) {
|
||||
|
|
|
@ -465,7 +465,7 @@ void DolphinMainWindow::openInNewTab()
|
|||
if (list.isEmpty()) {
|
||||
openNewTab(m_activeViewContainer->url());
|
||||
} else if ((list.count() == 1) && list[0].isDir()) {
|
||||
openNewTab(m_activeViewContainer->view()->selectedUrls()[0]);
|
||||
openNewTab(list[0].url());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@ void DolphinMainWindow::openInNewWindow()
|
|||
if (list.isEmpty()) {
|
||||
newWindowUrl = m_activeViewContainer->url();
|
||||
} else if ((list.count() == 1) && list[0].isDir()) {
|
||||
newWindowUrl = m_activeViewContainer->view()->selectedUrls()[0];
|
||||
newWindowUrl = list[0].url();
|
||||
}
|
||||
|
||||
if (!newWindowUrl.isEmpty()) {
|
||||
|
@ -912,30 +912,31 @@ void DolphinMainWindow::compareFiles()
|
|||
|
||||
KUrl urlA;
|
||||
KUrl urlB;
|
||||
KUrl::List urls = m_viewTab[m_tabIndex].primaryView->view()->selectedUrls();
|
||||
|
||||
switch (urls.count()) {
|
||||
KFileItemList items = m_viewTab[m_tabIndex].primaryView->view()->selectedItems();
|
||||
|
||||
switch (items.count()) {
|
||||
case 0: {
|
||||
Q_ASSERT(m_viewTab[m_tabIndex].secondaryView != 0);
|
||||
urls = m_viewTab[m_tabIndex].secondaryView->view()->selectedUrls();
|
||||
items = m_viewTab[m_tabIndex].secondaryView->view()->selectedItems();
|
||||
Q_ASSERT(urls.count() == 2);
|
||||
urlA = urls[0];
|
||||
urlB = urls[1];
|
||||
urlA = items[0].url();
|
||||
urlB = items[1].url();
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
urlA = urls[0];
|
||||
urlA = items[0].url();
|
||||
Q_ASSERT(m_viewTab[m_tabIndex].secondaryView != 0);
|
||||
urls = m_viewTab[m_tabIndex].secondaryView->view()->selectedUrls();
|
||||
Q_ASSERT(urls.count() == 1);
|
||||
urlB = urls[0];
|
||||
items = m_viewTab[m_tabIndex].secondaryView->view()->selectedItems();
|
||||
Q_ASSERT(items.count() == 1);
|
||||
urlB = items[0].url();
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
urlA = urls[0];
|
||||
urlB = urls[1];
|
||||
urlA = items[0].url();
|
||||
urlB = items[1].url();
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -314,16 +314,6 @@ KFileItemList DolphinView::selectedItems() const
|
|||
return itemList;
|
||||
}
|
||||
|
||||
KUrl::List DolphinView::selectedUrls() const
|
||||
{
|
||||
KUrl::List urls;
|
||||
const KFileItemList list = selectedItems();
|
||||
foreach (const KFileItem &item, list) {
|
||||
urls.append(item.url());
|
||||
}
|
||||
return urls;
|
||||
}
|
||||
|
||||
int DolphinView::selectedItemsCount() const
|
||||
{
|
||||
const QAbstractItemView* view = m_viewAccessor.itemView();
|
||||
|
@ -1261,11 +1251,19 @@ void DolphinView::updateZoomLevel(int oldZoomLevel)
|
|||
|
||||
KUrl::List DolphinView::simplifiedSelectedUrls() const
|
||||
{
|
||||
KUrl::List list = selectedUrls();
|
||||
if (itemsExpandable() ) {
|
||||
list = KDirModel::simplifiedUrlList(list);
|
||||
KUrl::List urls;
|
||||
|
||||
const KFileItemList items = selectedItems();
|
||||
foreach (const KFileItem &item, items) {
|
||||
urls.append(item.url());
|
||||
}
|
||||
return list;
|
||||
|
||||
|
||||
if (itemsExpandable()) {
|
||||
urls = KDirModel::simplifiedUrlList(urls);
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
||||
QMimeData* DolphinView::selectionMimeData() const
|
||||
|
|
|
@ -195,13 +195,6 @@ public:
|
|||
*/
|
||||
KFileItemList selectedItems() const;
|
||||
|
||||
/**
|
||||
* Returns a list of URLs for all selected items. An empty list
|
||||
* is returned, if no item is selected.
|
||||
* @see DolphinView::selectedItems()
|
||||
*/
|
||||
KUrl::List selectedUrls() const;
|
||||
|
||||
/**
|
||||
* Returns the number of selected items (this is faster than
|
||||
* invoking selectedItems().count()).
|
||||
|
|
Loading…
Reference in a new issue