2007-06-07 21:10:48 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2007 by Peter Penz <peter.penz@gmx.at> *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#include "dolphinviewcontainer.h"
|
|
|
|
|
|
|
|
#include <QtGui/QApplication>
|
|
|
|
#include <QtGui/QClipboard>
|
|
|
|
#include <QtGui/QKeyEvent>
|
|
|
|
#include <QtGui/QItemSelection>
|
|
|
|
#include <QtGui/QBoxLayout>
|
|
|
|
#include <QtCore/QTimer>
|
|
|
|
#include <QtGui/QScrollBar>
|
|
|
|
|
|
|
|
#include <kfileitemdelegate.h>
|
|
|
|
#include <kfileplacesmodel.h>
|
|
|
|
#include <kglobalsettings.h>
|
|
|
|
#include <klocale.h>
|
|
|
|
#include <kiconeffect.h>
|
|
|
|
#include <kio/netaccess.h>
|
|
|
|
#include <kio/previewjob.h>
|
|
|
|
#include <kmimetyperesolver.h>
|
|
|
|
#include <konqmimedata.h>
|
|
|
|
#include <konq_operations.h>
|
|
|
|
#include <kurl.h>
|
|
|
|
|
2007-09-17 04:02:17 +00:00
|
|
|
#include "dolphinmodel.h"
|
2007-06-07 21:10:48 +00:00
|
|
|
#include "dolphincolumnview.h"
|
|
|
|
#include "dolphincontroller.h"
|
|
|
|
#include "dolphinstatusbar.h"
|
|
|
|
#include "dolphinmainwindow.h"
|
|
|
|
#include "dolphindirlister.h"
|
|
|
|
#include "dolphinsortfilterproxymodel.h"
|
|
|
|
#include "dolphindetailsview.h"
|
|
|
|
#include "dolphiniconsview.h"
|
|
|
|
#include "dolphincontextmenu.h"
|
|
|
|
#include "filterbar.h"
|
|
|
|
#include "kurlnavigator.h"
|
|
|
|
#include "viewproperties.h"
|
|
|
|
#include "dolphinsettings.h"
|
|
|
|
#include "dolphin_generalsettings.h"
|
|
|
|
|
|
|
|
DolphinViewContainer::DolphinViewContainer(DolphinMainWindow* mainWindow,
|
|
|
|
QWidget* parent,
|
2007-06-19 16:35:52 +00:00
|
|
|
const KUrl& url) :
|
2007-06-07 21:10:48 +00:00
|
|
|
QWidget(parent),
|
|
|
|
m_showProgress(false),
|
|
|
|
m_mainWindow(mainWindow),
|
|
|
|
m_topLayout(0),
|
|
|
|
m_urlNavigator(0),
|
|
|
|
m_view(0),
|
|
|
|
m_filterBar(0),
|
|
|
|
m_statusBar(0),
|
|
|
|
m_dirLister(0),
|
|
|
|
m_proxyModel(0)
|
|
|
|
{
|
|
|
|
hide();
|
|
|
|
setFocusPolicy(Qt::StrongFocus);
|
|
|
|
m_topLayout = new QVBoxLayout(this);
|
|
|
|
m_topLayout->setSpacing(0);
|
|
|
|
m_topLayout->setMargin(0);
|
|
|
|
|
|
|
|
m_urlNavigator = new KUrlNavigator(DolphinSettings::instance().placesModel(), url, this);
|
2007-06-09 16:01:46 +00:00
|
|
|
connect(m_urlNavigator, SIGNAL(urlsDropped(const KUrl::List&, const KUrl&)),
|
|
|
|
m_mainWindow, SLOT(dropUrls(const KUrl::List&, const KUrl&)));
|
2007-06-13 17:08:39 +00:00
|
|
|
connect(m_urlNavigator, SIGNAL(activated()),
|
|
|
|
this, SLOT(activate()));
|
2007-06-07 21:10:48 +00:00
|
|
|
|
|
|
|
const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
|
|
|
|
m_urlNavigator->setUrlEditable(settings->editableUrl());
|
|
|
|
m_urlNavigator->setHomeUrl(settings->homeUrl());
|
|
|
|
|
|
|
|
m_dirLister = new DolphinDirLister();
|
|
|
|
m_dirLister->setAutoUpdate(true);
|
2008-02-15 18:18:21 +00:00
|
|
|
m_dirLister->setMainWindow(topLevelWidget());
|
2007-06-07 21:10:48 +00:00
|
|
|
m_dirLister->setDelayedMimeTypes(true);
|
|
|
|
|
2007-10-05 21:00:44 +00:00
|
|
|
m_dolphinModel = new DolphinModel(this);
|
2007-09-17 04:02:17 +00:00
|
|
|
m_dolphinModel->setDirLister(m_dirLister);
|
|
|
|
m_dolphinModel->setDropsAllowed(DolphinModel::DropOnDirectory);
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
m_proxyModel = new DolphinSortFilterProxyModel(this);
|
2007-09-17 04:02:17 +00:00
|
|
|
m_proxyModel->setSourceModel(m_dolphinModel);
|
2008-01-02 17:40:15 +00:00
|
|
|
m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
2007-06-07 21:10:48 +00:00
|
|
|
|
|
|
|
connect(m_dirLister, SIGNAL(clear()),
|
|
|
|
this, SLOT(updateStatusBar()));
|
|
|
|
connect(m_dirLister, SIGNAL(percent(int)),
|
|
|
|
this, SLOT(updateProgress(int)));
|
2007-10-01 08:00:48 +00:00
|
|
|
connect(m_dirLister, SIGNAL(deleteItem(const KFileItem&)),
|
2007-06-07 21:10:48 +00:00
|
|
|
this, SLOT(updateStatusBar()));
|
|
|
|
connect(m_dirLister, SIGNAL(completed()),
|
2007-10-09 22:32:54 +00:00
|
|
|
this, SLOT(slotDirListerCompleted()));
|
2007-06-07 21:10:48 +00:00
|
|
|
connect(m_dirLister, SIGNAL(infoMessage(const QString&)),
|
|
|
|
this, SLOT(showInfoMessage(const QString&)));
|
|
|
|
connect(m_dirLister, SIGNAL(errorMessage(const QString&)),
|
|
|
|
this, SLOT(showErrorMessage(const QString&)));
|
|
|
|
|
|
|
|
m_view = new DolphinView(this,
|
|
|
|
url,
|
|
|
|
m_dirLister,
|
2007-09-17 04:02:17 +00:00
|
|
|
m_dolphinModel,
|
2008-01-21 19:31:07 +00:00
|
|
|
m_proxyModel);
|
2007-06-07 21:10:48 +00:00
|
|
|
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
|
|
|
|
m_urlNavigator, SLOT(setUrl(const KUrl&)));
|
2007-08-13 21:57:20 +00:00
|
|
|
connect(m_view, SIGNAL(requestContextMenu(KFileItem, const KUrl&)),
|
|
|
|
this, SLOT(openContextMenu(KFileItem, const KUrl&)));
|
2007-06-10 11:46:41 +00:00
|
|
|
connect(m_view, SIGNAL(contentsMoved(int, int)),
|
|
|
|
this, SLOT(saveContentsPos(int, int)));
|
2007-07-02 17:24:54 +00:00
|
|
|
connect(m_view, SIGNAL(requestItemInfo(KFileItem)),
|
|
|
|
this, SLOT(showItemInfo(KFileItem)));
|
2007-06-08 14:14:34 +00:00
|
|
|
connect(m_view, SIGNAL(errorMessage(const QString&)),
|
|
|
|
this, SLOT(showErrorMessage(const QString&)));
|
|
|
|
connect(m_view, SIGNAL(infoMessage(const QString&)),
|
|
|
|
this, SLOT(showInfoMessage(const QString&)));
|
2007-11-17 00:08:54 +00:00
|
|
|
connect(m_view, SIGNAL(operationCompletedMessage(const QString&)),
|
|
|
|
this, SLOT(showOperationCompletedMessage(const QString&)));
|
2007-08-28 17:50:54 +00:00
|
|
|
connect(m_view, SIGNAL(itemTriggered(KFileItem)),
|
|
|
|
this, SLOT(slotItemTriggered(KFileItem)));
|
2007-09-25 09:02:29 +00:00
|
|
|
connect(m_view, SIGNAL(startedPathLoading(const KUrl&)),
|
|
|
|
this, SLOT(saveRootUrl(const KUrl&)));
|
2007-06-07 21:10:48 +00:00
|
|
|
|
|
|
|
connect(m_urlNavigator, SIGNAL(urlChanged(const KUrl&)),
|
2007-09-24 13:50:31 +00:00
|
|
|
this, SLOT(restoreView(const KUrl&)));
|
2007-06-07 21:10:48 +00:00
|
|
|
|
|
|
|
m_statusBar = new DolphinStatusBar(this, url);
|
2007-08-28 17:50:54 +00:00
|
|
|
connect(m_view, SIGNAL(urlChanged(const KUrl&)),
|
|
|
|
m_statusBar, SLOT(updateSpaceInfoContent(const KUrl&)));
|
2007-06-07 21:10:48 +00:00
|
|
|
|
|
|
|
m_filterBar = new FilterBar(this);
|
|
|
|
m_filterBar->setVisible(settings->filterBar());
|
|
|
|
connect(m_filterBar, SIGNAL(filterChanged(const QString&)),
|
2007-10-09 22:32:54 +00:00
|
|
|
this, SLOT(setNameFilter(const QString&)));
|
2007-06-07 21:10:48 +00:00
|
|
|
connect(m_filterBar, SIGNAL(closeRequest()),
|
|
|
|
this, SLOT(closeFilterBar()));
|
|
|
|
|
|
|
|
m_topLayout->addWidget(m_urlNavigator);
|
|
|
|
m_topLayout->addWidget(m_view);
|
|
|
|
m_topLayout->addWidget(m_filterBar);
|
|
|
|
m_topLayout->addWidget(m_statusBar);
|
|
|
|
}
|
|
|
|
|
|
|
|
DolphinViewContainer::~DolphinViewContainer()
|
|
|
|
{
|
2007-12-08 23:05:32 +00:00
|
|
|
m_dirLister->disconnect();
|
|
|
|
|
|
|
|
delete m_proxyModel;
|
2007-12-08 22:42:13 +00:00
|
|
|
m_proxyModel = 0;
|
2007-12-08 23:05:32 +00:00
|
|
|
delete m_dolphinModel;
|
2007-12-08 16:16:45 +00:00
|
|
|
m_dolphinModel = 0;
|
|
|
|
m_dirLister = 0; // deleted by m_dolphinModel
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::setUrl(const KUrl& url)
|
|
|
|
{
|
|
|
|
m_urlNavigator->setUrl(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
const KUrl& DolphinViewContainer::url() const
|
|
|
|
{
|
|
|
|
return m_urlNavigator->url();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::setActive(bool active)
|
|
|
|
{
|
|
|
|
m_urlNavigator->setActive(active);
|
|
|
|
m_view->setActive(active);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DolphinViewContainer::isActive() const
|
|
|
|
{
|
|
|
|
Q_ASSERT(m_view->isActive() == m_urlNavigator->isActive());
|
|
|
|
return m_view->isActive();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DolphinViewContainer::isFilterBarVisible() const
|
|
|
|
{
|
|
|
|
return m_filterBar->isVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool DolphinViewContainer::isUrlEditable() const
|
|
|
|
{
|
|
|
|
return m_urlNavigator->isUrlEditable();
|
|
|
|
}
|
|
|
|
|
2007-08-13 21:57:20 +00:00
|
|
|
KFileItem DolphinViewContainer::fileItem(const QModelIndex& index) const
|
2007-06-07 21:10:48 +00:00
|
|
|
{
|
2007-09-17 04:02:17 +00:00
|
|
|
const QModelIndex dolphinModelIndex = m_proxyModel->mapToSource(index);
|
|
|
|
return m_dolphinModel->itemForIndex(dolphinModelIndex);
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::updateProgress(int percent)
|
|
|
|
{
|
2007-06-08 14:02:34 +00:00
|
|
|
if (!m_showProgress) {
|
|
|
|
// Only show the directory loading progress if the status bar does
|
|
|
|
// not contain another progress information. This means that
|
|
|
|
// the directory loading progress information has the lowest priority.
|
|
|
|
const QString progressText(m_statusBar->progressText());
|
2007-07-12 06:10:54 +00:00
|
|
|
const QString loadingText(i18nc("@info:progress", "Loading folder..."));
|
2007-07-08 21:09:48 +00:00
|
|
|
m_showProgress = progressText.isEmpty() || (progressText == loadingText);
|
2007-06-08 14:02:34 +00:00
|
|
|
if (m_showProgress) {
|
2007-07-08 21:09:48 +00:00
|
|
|
m_statusBar->setProgressText(loadingText);
|
2007-06-08 14:02:34 +00:00
|
|
|
m_statusBar->setProgress(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
if (m_showProgress) {
|
|
|
|
m_statusBar->setProgress(percent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-09 22:32:54 +00:00
|
|
|
void DolphinViewContainer::slotDirListerCompleted()
|
2007-06-07 21:10:48 +00:00
|
|
|
{
|
|
|
|
if (m_showProgress) {
|
|
|
|
m_statusBar->setProgressText(QString());
|
|
|
|
m_statusBar->setProgress(100);
|
|
|
|
m_showProgress = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
updateStatusBar();
|
|
|
|
|
2007-06-10 11:46:41 +00:00
|
|
|
QTimer::singleShot(100, this, SLOT(restoreContentsPos()));
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
|
|
|
|
2007-07-02 17:24:54 +00:00
|
|
|
void DolphinViewContainer::showItemInfo(const KFileItem& item)
|
2007-06-08 13:44:59 +00:00
|
|
|
{
|
2007-07-02 17:24:54 +00:00
|
|
|
if (item.isNull()) {
|
2007-06-08 13:44:59 +00:00
|
|
|
m_statusBar->clear();
|
2007-07-02 17:24:54 +00:00
|
|
|
} else {
|
|
|
|
m_statusBar->setMessage(item.getStatusBarInfo(), DolphinStatusBar::Default);
|
2007-06-08 13:44:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
void DolphinViewContainer::showInfoMessage(const QString& msg)
|
|
|
|
{
|
|
|
|
m_statusBar->setMessage(msg, DolphinStatusBar::Information);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::showErrorMessage(const QString& msg)
|
|
|
|
{
|
|
|
|
m_statusBar->setMessage(msg, DolphinStatusBar::Error);
|
|
|
|
}
|
|
|
|
|
2007-11-17 00:08:54 +00:00
|
|
|
void DolphinViewContainer::showOperationCompletedMessage(const QString& msg)
|
|
|
|
{
|
|
|
|
m_statusBar->setMessage(msg, DolphinStatusBar::OperationCompleted);
|
|
|
|
}
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
void DolphinViewContainer::closeFilterBar()
|
|
|
|
{
|
|
|
|
m_filterBar->hide();
|
|
|
|
emit showFilterBarChanged(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString DolphinViewContainer::defaultStatusBarText() const
|
|
|
|
{
|
2007-10-09 22:32:54 +00:00
|
|
|
int folderCount = 0;
|
|
|
|
int fileCount = 0;
|
|
|
|
m_view->calculateItemCount(fileCount, folderCount);
|
|
|
|
return KIO::itemsSummaryString(fileCount + folderCount,
|
|
|
|
fileCount,
|
|
|
|
folderCount,
|
2007-06-07 21:10:48 +00:00
|
|
|
0, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString DolphinViewContainer::selectionStatusBarText() const
|
|
|
|
{
|
|
|
|
QString text;
|
2007-10-02 19:03:03 +00:00
|
|
|
const KFileItemList list = m_view->selectedItems();
|
2007-06-07 21:10:48 +00:00
|
|
|
if (list.isEmpty()) {
|
|
|
|
// when an item is triggered, it is temporary selected but selectedItems()
|
|
|
|
// will return an empty list
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
|
|
|
int fileCount = 0;
|
|
|
|
int folderCount = 0;
|
|
|
|
KIO::filesize_t byteSize = 0;
|
2007-10-02 19:03:03 +00:00
|
|
|
KFileItemList::const_iterator it = list.begin();
|
|
|
|
const KFileItemList::const_iterator end = list.end();
|
2007-06-07 21:10:48 +00:00
|
|
|
while (it != end) {
|
2007-08-13 21:57:20 +00:00
|
|
|
const KFileItem& item = *it;
|
|
|
|
if (item.isDir()) {
|
2007-06-07 21:10:48 +00:00
|
|
|
++folderCount;
|
|
|
|
} else {
|
|
|
|
++fileCount;
|
2007-08-13 21:57:20 +00:00
|
|
|
byteSize += item.size();
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
|
|
|
++it;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (folderCount > 0) {
|
2007-07-08 21:09:48 +00:00
|
|
|
text = i18ncp("@info:status", "1 Folder selected", "%1 Folders selected", folderCount);
|
2007-06-07 21:10:48 +00:00
|
|
|
if (fileCount > 0) {
|
|
|
|
text += ", ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fileCount > 0) {
|
|
|
|
const QString sizeText(KIO::convertSize(byteSize));
|
2007-07-08 21:09:48 +00:00
|
|
|
text += i18ncp("@info:status", "1 File selected (%2)", "%1 Files selected (%2)", fileCount, sizeText);
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::showFilterBar(bool show)
|
|
|
|
{
|
|
|
|
Q_ASSERT(m_filterBar != 0);
|
|
|
|
m_filterBar->setVisible(show);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::updateStatusBar()
|
|
|
|
{
|
|
|
|
// As the item count information is less important
|
|
|
|
// in comparison with other messages, it should only
|
|
|
|
// be shown if:
|
|
|
|
// - the status bar is empty or
|
|
|
|
// - shows already the item count information or
|
|
|
|
// - shows only a not very important information
|
|
|
|
// - if any progress is given don't show the item count info at all
|
|
|
|
const QString msg(m_statusBar->message());
|
|
|
|
const bool updateStatusBarMsg = (msg.isEmpty() ||
|
|
|
|
(msg == m_statusBar->defaultText()) ||
|
|
|
|
(m_statusBar->type() == DolphinStatusBar::Information)) &&
|
|
|
|
(m_statusBar->progress() == 100);
|
|
|
|
|
|
|
|
const QString text(m_view->hasSelection() ? selectionStatusBarText() : defaultStatusBarText());
|
|
|
|
m_statusBar->setDefaultText(text);
|
|
|
|
|
|
|
|
if (updateStatusBarMsg) {
|
|
|
|
m_statusBar->setMessage(text, DolphinStatusBar::Default);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-10-09 22:32:54 +00:00
|
|
|
void DolphinViewContainer::setNameFilter(const QString& nameFilter)
|
2007-06-07 21:10:48 +00:00
|
|
|
{
|
2007-10-09 22:32:54 +00:00
|
|
|
m_view->setNameFilter(nameFilter);
|
2007-09-17 04:02:17 +00:00
|
|
|
updateStatusBar();
|
2007-06-07 21:10:48 +00:00
|
|
|
}
|
|
|
|
|
2007-08-13 21:57:20 +00:00
|
|
|
void DolphinViewContainer::openContextMenu(const KFileItem& item,
|
2007-06-07 21:10:48 +00:00
|
|
|
const KUrl& url)
|
|
|
|
{
|
|
|
|
DolphinContextMenu contextMenu(m_mainWindow, item, url);
|
|
|
|
contextMenu.open();
|
|
|
|
}
|
|
|
|
|
2007-06-10 11:46:41 +00:00
|
|
|
void DolphinViewContainer::saveContentsPos(int x, int y)
|
|
|
|
{
|
|
|
|
m_urlNavigator->savePosition(x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::restoreContentsPos()
|
|
|
|
{
|
|
|
|
if (!url().isEmpty()) {
|
|
|
|
const QPoint pos = m_urlNavigator->savedPosition();
|
|
|
|
m_view->setContentsPosition(pos.x(), pos.y());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-13 17:08:39 +00:00
|
|
|
void DolphinViewContainer::activate()
|
|
|
|
{
|
|
|
|
setActive(true);
|
|
|
|
}
|
2007-06-10 11:46:41 +00:00
|
|
|
|
2007-09-24 13:50:31 +00:00
|
|
|
void DolphinViewContainer::restoreView(const KUrl& url)
|
|
|
|
{
|
2007-09-25 09:02:29 +00:00
|
|
|
m_view->updateView(url, m_urlNavigator->savedRootUrl());
|
|
|
|
}
|
|
|
|
|
|
|
|
void DolphinViewContainer::saveRootUrl(const KUrl& url)
|
|
|
|
{
|
|
|
|
Q_UNUSED(url);
|
|
|
|
m_urlNavigator->saveRootUrl(m_view->rootUrl());
|
2007-09-24 13:50:31 +00:00
|
|
|
}
|
|
|
|
|
2007-08-28 17:50:54 +00:00
|
|
|
void DolphinViewContainer::slotItemTriggered(const KFileItem& item)
|
|
|
|
{
|
|
|
|
// Prefer the local path over the URL.
|
|
|
|
bool isLocal;
|
|
|
|
KUrl url = item.mostLocalUrl(isLocal);
|
|
|
|
|
|
|
|
if (item.isDir()) {
|
|
|
|
m_view->setUrl(url);
|
2008-01-21 16:07:45 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-12-15 15:20:45 +00:00
|
|
|
|
2008-01-21 16:07:45 +00:00
|
|
|
const GeneralSettings* settings = DolphinSettings::instance().generalSettings();
|
|
|
|
const bool browseThroughArchives = settings->browseThroughArchives() &&
|
|
|
|
item.isFile() && url.isLocalFile();
|
|
|
|
if (browseThroughArchives) {
|
2007-08-28 17:50:54 +00:00
|
|
|
KMimeType::Ptr mime = item.mimeTypePtr();
|
2007-12-15 15:20:45 +00:00
|
|
|
|
|
|
|
// Don't use mime->is("application/zip"), as this would
|
|
|
|
// also browse through Open Office files:
|
|
|
|
if (mime->name() == "application/zip") {
|
2007-08-28 17:50:54 +00:00
|
|
|
url.setProtocol("zip");
|
|
|
|
m_view->setUrl(url);
|
2008-01-21 16:07:45 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mime->is("application/x-tar") ||
|
|
|
|
mime->is("application/x-tarz") ||
|
|
|
|
mime->is("application/x-bzip-compressed-tar") ||
|
|
|
|
mime->is("application/x-compressed-tar") ||
|
|
|
|
mime->is("application/x-tzo")) {
|
2007-08-28 17:50:54 +00:00
|
|
|
url.setProtocol("tar");
|
|
|
|
m_view->setUrl(url);
|
2008-01-21 16:07:45 +00:00
|
|
|
return;
|
2007-08-28 17:50:54 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-21 16:07:45 +00:00
|
|
|
|
|
|
|
item.run();
|
2007-08-28 17:50:54 +00:00
|
|
|
}
|
|
|
|
|
2007-06-07 21:10:48 +00:00
|
|
|
#include "dolphinviewcontainer.moc"
|