summaryrefslogtreecommitdiffstats
path: root/src/dolphinview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dolphinview.cpp')
-rw-r--r--src/dolphinview.cpp139
1 files changed, 86 insertions, 53 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index 5b0a310..88a966c 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -22,6 +22,7 @@
#include <tqlayout.h>
#include <kurl.h>
+#include <kstandarddirs.h>
#include <tdelocale.h>
#include <tdeio/netaccess.h>
#include <tdeio/renamedlg.h>
@@ -57,27 +58,27 @@ DolphinView::DolphinView(TQWidget *parent,
m_fileCount(0),
m_filterBar(0)
{
- setFocusPolicy(TQ_StrongFocus);
+ setFocusPolicy(TQWidget::StrongFocus);
m_topLayout = new TQVBoxLayout(this);
Dolphin& dolphin = Dolphin::mainWin();
- connect(this, TQT_SIGNAL(signalModeChanged()),
- &dolphin, TQT_SLOT(slotViewModeChanged()));
- connect(this, TQT_SIGNAL(signalShowHiddenFilesChanged()),
- &dolphin, TQT_SLOT(slotShowHiddenFilesChanged()));
- connect(this, TQT_SIGNAL(signalSortingChanged(DolphinView::Sorting)),
- &dolphin, TQT_SLOT(slotSortingChanged(DolphinView::Sorting)));
- connect(this, TQT_SIGNAL(signalSortOrderChanged(TQt::SortOrder)),
- &dolphin, TQT_SLOT(slotSortOrderChanged(TQt::SortOrder)));
+ connect(this, TQ_SIGNAL(signalModeChanged()),
+ &dolphin, TQ_SLOT(slotViewModeChanged()));
+ connect(this, TQ_SIGNAL(signalShowHiddenFilesChanged()),
+ &dolphin, TQ_SLOT(slotShowHiddenFilesChanged()));
+ connect(this, TQ_SIGNAL(signalSortingChanged(DolphinView::Sorting)),
+ &dolphin, TQ_SLOT(slotSortingChanged(DolphinView::Sorting)));
+ connect(this, TQ_SIGNAL(signalSortOrderChanged(TQt::SortOrder)),
+ &dolphin, TQ_SLOT(slotSortOrderChanged(TQt::SortOrder)));
m_urlNavigator = new URLNavigator(url, this);
- connect(m_urlNavigator, TQT_SIGNAL(urlChanged(const KURL&)),
- this, TQT_SLOT(slotURLChanged(const KURL&)));
- connect(m_urlNavigator, TQT_SIGNAL(urlChanged(const KURL&)),
- &dolphin, TQT_SLOT(slotURLChanged(const KURL&)));
- connect(m_urlNavigator, TQT_SIGNAL(historyChanged()),
- &dolphin, TQT_SLOT(slotHistoryChanged()));
+ connect(m_urlNavigator, TQ_SIGNAL(urlChanged(const KURL&)),
+ this, TQ_SLOT(slotURLChanged(const KURL&)));
+ connect(m_urlNavigator, TQ_SIGNAL(urlChanged(const KURL&)),
+ &dolphin, TQ_SLOT(slotURLChanged(const KURL&)));
+ connect(m_urlNavigator, TQ_SIGNAL(historyChanged()),
+ &dolphin, TQ_SLOT(slotHistoryChanged()));
m_statusBar = new DolphinStatusBar(this);
@@ -85,22 +86,22 @@ DolphinView::DolphinView(TQWidget *parent,
m_dirLister->setAutoUpdate(true);
m_dirLister->setMainWindow(this);
m_dirLister->setShowingDotFiles(showHiddenFiles);
- connect(m_dirLister, TQT_SIGNAL(clear()),
- this, TQT_SLOT(slotClear()));
- connect(m_dirLister, TQT_SIGNAL(percent(int)),
- this, TQT_SLOT(slotPercent(int)));
- connect(m_dirLister, TQT_SIGNAL(deleteItem(KFileItem*)),
- this, TQT_SLOT(slotDeleteItem(KFileItem*)));
- connect(m_dirLister, TQT_SIGNAL(completed()),
- this, TQT_SLOT(slotCompleted()));
- connect(m_dirLister, TQT_SIGNAL(infoMessage(const TQString&)),
- this, TQT_SLOT(slotInfoMessage(const TQString&)));
- connect(m_dirLister, TQT_SIGNAL(errorMessage(const TQString&)),
- this, TQT_SLOT(slotErrorMessage(const TQString&)));
- connect(m_dirLister, TQT_SIGNAL(refreshItems (const KFileItemList&)),
- this, TQT_SLOT(slotRefreshItems(const KFileItemList&)));
- connect(m_dirLister, TQT_SIGNAL(newItems(const KFileItemList&)),
- this, TQT_SLOT(slotAddItems(const KFileItemList&)));
+ connect(m_dirLister, TQ_SIGNAL(clear()),
+ this, TQ_SLOT(slotClear()));
+ connect(m_dirLister, TQ_SIGNAL(percent(int)),
+ this, TQ_SLOT(slotPercent(int)));
+ connect(m_dirLister, TQ_SIGNAL(deleteItem(KFileItem*)),
+ this, TQ_SLOT(slotDeleteItem(KFileItem*)));
+ connect(m_dirLister, TQ_SIGNAL(completed()),
+ this, TQ_SLOT(slotCompleted()));
+ connect(m_dirLister, TQ_SIGNAL(infoMessage(const TQString&)),
+ this, TQ_SLOT(slotInfoMessage(const TQString&)));
+ connect(m_dirLister, TQ_SIGNAL(errorMessage(const TQString&)),
+ this, TQ_SLOT(slotErrorMessage(const TQString&)));
+ connect(m_dirLister, TQ_SIGNAL(refreshItems (const KFileItemList&)),
+ this, TQ_SLOT(slotRefreshItems(const KFileItemList&)));
+ connect(m_dirLister, TQ_SIGNAL(newItems(const KFileItemList&)),
+ this, TQ_SLOT(slotAddItems(const KFileItemList&)));
m_iconSize = TDEIcon::SizeMedium;
@@ -110,8 +111,8 @@ DolphinView::DolphinView(TQWidget *parent,
m_filterBar = new FilterBar(this);
m_filterBar->hide();
m_topLayout->addWidget(m_filterBar);
- connect(m_filterBar, TQT_SIGNAL(signalFilterChanged(const TQString&)),
- this, TQT_SLOT(slotChangeNameFilter(const TQString&)));
+ connect(m_filterBar, TQ_SIGNAL(signalFilterChanged(const TQString&)),
+ this, TQ_SLOT(slotChangeNameFilter(const TQString&)));
m_topLayout->addWidget(m_statusBar);
}
@@ -149,7 +150,7 @@ void DolphinView::setMode(Mode mode)
}
TQWidget* view = (m_iconsView != 0) ? static_cast<TQWidget*>(m_iconsView) :
- static_cast<TQWidget*>(m_detailsView);
+ static_cast<TQWidget*>(m_detailsView);
if (view != 0) {
m_topLayout->remove(view);
view->close();
@@ -651,7 +652,7 @@ void DolphinView::triggerIconsViewItem(TQIconViewItem* item)
if ((item != 0) && !isSelectionActive) {
// Updating the URL must be done outside the scope of this slot,
// as iconview items will get deleted.
- TQTimer::singleShot(0, this, TQT_SLOT(updateURL()));
+ TQTimer::singleShot(0, this, TQ_SLOT(updateURL()));
Dolphin::mainWin().setActiveView(this);
}
}
@@ -667,7 +668,7 @@ void DolphinView::triggerDetailsViewItem(TQListViewItem* item,
if (m_detailsView->isOnFilename(item, pos)) {
// Updating the URL must be done outside the scope of this slot,
// as listview items will get deleted.
- TQTimer::singleShot(0, this, TQT_SLOT(updateURL()));
+ TQTimer::singleShot(0, this, TQ_SLOT(updateURL()));
Dolphin::mainWin().setActiveView(this);
}
else {
@@ -691,7 +692,39 @@ void DolphinView::updateURL()
return;
}
- if (fileItem->isDir()) {
+ if (fileItem->isDir())
+ {
+ TQString itemMimeType = fileItem->mimetype();
+ if (itemMimeType.contains("encrypted_locked") || itemMimeType.contains("encrypted_unlocked"))
+ {
+ // Default action for media encrypted disks is either lock or unlock based on current status
+ TQString lockingAction = TQString::null;
+ if (itemMimeType.contains("encrypted_locked"))
+ {
+ lockingAction = "d3lphin/servicemenus/media_unlock.desktop";
+ }
+ else if (itemMimeType.contains("encrypted_unlocked"))
+ {
+ lockingAction = "d3lphin/servicemenus/media_lock.desktop";
+ }
+ if (!lockingAction.isEmpty())
+ {
+ TQString lockingService = TDEGlobal::dirs()->findResource("data", lockingAction);
+ if (!lockingService.isEmpty())
+ {
+ TQValueList<KDEDesktopMimeType::Service> serviceList = KDEDesktopMimeType::userDefinedServices(lockingService, fileItem->url().isLocalFile());
+ if (serviceList.count() == 1)
+ {
+ KURL::List m_lstURLs;
+ m_lstURLs.append(fileItem->url());
+ KDEDesktopMimeType::executeService(m_lstURLs, serviceList[0]);
+ Dolphin::mainWin().refreshViews();
+ return;
+ }
+ }
+ }
+ }
+
// Prefer the local path over the URL. This assures that the
// volume space information is correct. Assuming that the URL is media:/sda1,
// and the local path is /windows/C: For the URL the space info is related
@@ -798,7 +831,7 @@ void DolphinView::slotCompleted()
// Prevent a flickering of the icon view widget by giving a small
// timeslot to swallow asynchronous update events.
m_iconsView->setUpdatesEnabled(false);
- TQTimer::singleShot(10, this, TQT_SLOT(slotDelayedUpdate()));
+ TQTimer::singleShot(10, this, TQ_SLOT(slotDelayedUpdate()));
}
if (m_detailsView != 0) {
@@ -828,7 +861,7 @@ void DolphinView::slotErrorMessage(const TQString& msg)
void DolphinView::slotRefreshItems(const KFileItemList& /* list */)
{
- TQTimer::singleShot(0, this, TQT_SLOT(reload()));
+ TQTimer::singleShot(0, this, TQ_SLOT(reload()));
}
void DolphinView::slotAddItems(const KFileItemList& list)
@@ -867,12 +900,12 @@ void DolphinView::createView()
m_topLayout->insertWidget(1, m_iconsView);
setFocusProxy(m_iconsView);
- connect(m_iconsView, TQT_SIGNAL(executed(TQIconViewItem*)),
- this, TQT_SLOT(triggerIconsViewItem(TQIconViewItem*)));
- connect(m_iconsView, TQT_SIGNAL(returnPressed(TQIconViewItem*)),
- this, TQT_SLOT(triggerIconsViewItem(TQIconViewItem*)));
- connect(m_iconsView, TQT_SIGNAL(signalRequestActivation()),
- this, TQT_SLOT(slotGrabActivation()));
+ connect(m_iconsView, TQ_SIGNAL(executed(TQIconViewItem*)),
+ this, TQ_SLOT(triggerIconsViewItem(TQIconViewItem*)));
+ connect(m_iconsView, TQ_SIGNAL(returnPressed(TQIconViewItem*)),
+ this, TQ_SLOT(triggerIconsViewItem(TQIconViewItem*)));
+ connect(m_iconsView, TQ_SIGNAL(signalRequestActivation()),
+ this, TQ_SLOT(slotGrabActivation()));
m_iconsView->endItemUpdates();
m_iconsView->show();
@@ -885,12 +918,12 @@ void DolphinView::createView()
m_topLayout->insertWidget(1, m_detailsView);
setFocusProxy(m_detailsView);
- connect(m_detailsView, TQT_SIGNAL(executed(TQListViewItem*, const TQPoint&, int)),
- this, TQT_SLOT(triggerDetailsViewItem(TQListViewItem*, const TQPoint&, int)));
- connect(m_detailsView, TQT_SIGNAL(returnPressed(TQListViewItem*)),
- this, TQT_SLOT(triggerDetailsViewItem(TQListViewItem*)));
- connect(m_detailsView, TQT_SIGNAL(signalRequestActivation()),
- this, TQT_SLOT(slotGrabActivation()));
+ connect(m_detailsView, TQ_SIGNAL(executed(TQListViewItem*, const TQPoint&, int)),
+ this, TQ_SLOT(triggerDetailsViewItem(TQListViewItem*, const TQPoint&, int)));
+ connect(m_detailsView, TQ_SIGNAL(returnPressed(TQListViewItem*)),
+ this, TQ_SLOT(triggerDetailsViewItem(TQListViewItem*)));
+ connect(m_detailsView, TQ_SIGNAL(signalRequestActivation()),
+ this, TQ_SLOT(slotGrabActivation()));
m_detailsView->show();
m_detailsView->setFocus();
break;
@@ -900,8 +933,8 @@ void DolphinView::createView()
break;
}
- connect(scrollView(), TQT_SIGNAL(contentsMoving(int, int)),
- this, TQT_SLOT(slotContentsMoving(int, int)));
+ connect(scrollView(), TQ_SIGNAL(contentsMoving(int, int)),
+ this, TQ_SLOT(slotContentsMoving(int, int)));
startDirLister(m_urlNavigator->url());
}