1
0
mirror of https://invent.kde.org/system/dolphin synced 2024-07-04 17:30:55 +00:00

compile++

Welcome to Dolphin! Trying to help a bit with the porting. If I did 
something wrong, feel free to blame me. :-)

CCMAIL: peter.penz@gmx.at


svn path=/trunk/playground/utils/dolphin/; revision=606802
This commit is contained in:
Kevin Ottens 2006-11-21 21:10:33 +00:00
parent e907cf38f2
commit c20f14478a
8 changed files with 100 additions and 95 deletions

View File

@ -38,7 +38,7 @@ BookmarkSelector::BookmarkSelector(URLNavigator* parent) :
URLButton(parent), URLButton(parent),
m_selectedIndex(0) m_selectedIndex(0)
{ {
setFocusPolicy(QWidget::NoFocus); setFocusPolicy(Qt::NoFocus);
m_bookmarksMenu = new Q3PopupMenu(this); m_bookmarksMenu = new Q3PopupMenu(this);
@ -83,7 +83,7 @@ void BookmarkSelector::updateSelection(const KUrl& url)
while (!bookmark.isNull()) { while (!bookmark.isNull()) {
const KUrl bookmarkURL = bookmark.url(); const KUrl bookmarkURL = bookmark.url();
if (bookmarkURL.isParentOf(url)) { if (bookmarkURL.isParentOf(url)) {
const int length = bookmarkURL.prettyURL().length(); const int length = bookmarkURL.prettyUrl().length();
if (length > maxLength) { if (length > maxLength) {
m_selectedIndex = i; m_selectedIndex = i;
setPixmap(SmallIcon(bookmark.icon())); setPixmap(SmallIcon(bookmark.icon()));
@ -144,7 +144,7 @@ void BookmarkSelector::drawButton(QPainter* painter)
} }
// draw button backround // draw button backround
painter->setPen(NoPen); painter->setPen(Qt::NoPen);
painter->setBrush(backgroundColor); painter->setBrush(backgroundColor);
painter->drawRect(0, 0, buttonWidth, buttonHeight); painter->drawRect(0, 0, buttonWidth, buttonHeight);

View File

@ -20,7 +20,6 @@
#include "dolphindetailsview.h" #include "dolphindetailsview.h"
#include <kurldrag.h>
#include <qpainter.h> #include <qpainter.h>
#include <qobject.h> #include <qobject.h>
#include <q3header.h> #include <q3header.h>
@ -35,8 +34,10 @@
#include <QMouseEvent> #include <QMouseEvent>
#include <QEvent> #include <QEvent>
#include <QPaintEvent> #include <QPaintEvent>
#include <QStyleOptionFocusRect>
#include <klocale.h> #include <klocale.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <kicontheme.h>
#include <qscrollbar.h> #include <qscrollbar.h>
#include <qcursor.h> #include <qcursor.h>
#include <qstyle.h> #include <qstyle.h>
@ -51,7 +52,7 @@
#include "detailsmodesettings.h" #include "detailsmodesettings.h"
DolphinDetailsView::DolphinDetailsView(DolphinView* parent) : DolphinDetailsView::DolphinDetailsView(DolphinView* parent) :
KFileDetailView(parent, 0), KFileDetailView(parent),
m_dolphinView(parent), m_dolphinView(parent),
m_resizeTimer(0), m_resizeTimer(0),
m_scrollTimer(0), m_scrollTimer(0),
@ -195,8 +196,8 @@ void DolphinDetailsView::zoomIn()
if (isZoomInPossible()) { if (isZoomInPossible()) {
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
switch (settings->iconSize()) { switch (settings->iconSize()) {
case KIcon::SizeSmall: settings->setIconSize(KIcon::SizeMedium); break; case K3Icon::SizeSmall: settings->setIconSize(K3Icon::SizeMedium); break;
case KIcon::SizeMedium: settings->setIconSize(KIcon::SizeLarge); break; case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeLarge); break;
default: assert(false); break; default: assert(false); break;
} }
ItemEffectsManager::zoomIn(); ItemEffectsManager::zoomIn();
@ -208,8 +209,8 @@ void DolphinDetailsView::zoomOut()
if (isZoomOutPossible()) { if (isZoomOutPossible()) {
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
switch (settings->iconSize()) { switch (settings->iconSize()) {
case KIcon::SizeLarge: settings->setIconSize(KIcon::SizeMedium); break; case K3Icon::SizeLarge: settings->setIconSize(K3Icon::SizeMedium); break;
case KIcon::SizeMedium: settings->setIconSize(KIcon::SizeSmall); break; case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeSmall); break;
default: assert(false); break; default: assert(false); break;
} }
ItemEffectsManager::zoomOut(); ItemEffectsManager::zoomOut();
@ -219,13 +220,13 @@ void DolphinDetailsView::zoomOut()
bool DolphinDetailsView::isZoomInPossible() const bool DolphinDetailsView::isZoomInPossible() const
{ {
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
return settings->iconSize() < KIcon::SizeLarge; return settings->iconSize() < K3Icon::SizeLarge;
} }
bool DolphinDetailsView::isZoomOutPossible() const bool DolphinDetailsView::isZoomOutPossible() const
{ {
DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings();
return settings->iconSize() > KIcon::SizeSmall; return settings->iconSize() > K3Icon::SizeSmall;
} }
void DolphinDetailsView::resizeContents(int width, int height) void DolphinDetailsView::resizeContents(int width, int height)
@ -255,7 +256,7 @@ void DolphinDetailsView::slotOnItem(Q3ListViewItem* item)
void DolphinDetailsView::slotOnViewport() void DolphinDetailsView::slotOnViewport()
{ {
resetActivatedItem(); resetActivatedItem();
m_dolphinView->requestItemInfo(KURL()); m_dolphinView->requestItemInfo(KUrl());
} }
void DolphinDetailsView::setContextPixmap(void* context, void DolphinDetailsView::setContextPixmap(void* context,
@ -322,7 +323,8 @@ void DolphinDetailsView::resizeEvent(QResizeEvent* event)
bool DolphinDetailsView::acceptDrag(QDropEvent* event) const bool DolphinDetailsView::acceptDrag(QDropEvent* event) const
{ {
bool accept = KURLDrag::canDecode(event) && KUrl::List uriList = KUrl::List::fromMimeData( event->mimeData() );
bool accept = !uriList.isEmpty() &&
(event->action() == QDropEvent::Copy || (event->action() == QDropEvent::Copy ||
event->action() == QDropEvent::Move || event->action() == QDropEvent::Move ||
event->action() == QDropEvent::Link); event->action() == QDropEvent::Link);
@ -369,9 +371,9 @@ void DolphinDetailsView::contentsDropEvent(QDropEvent* event)
} }
emit dropped(event, 0); emit dropped(event, 0);
KURL::List urls; KUrl::List urls = KUrl::List::fromMimeData( event->mimeData() );
if (KURLDrag::decode(event, urls) && !urls.isEmpty()) { if (!urls.isEmpty()) {
emit dropped(event, urls, KURL()); emit dropped(event, urls, KUrl());
sig->dropURLs(0, event, urls); sig->dropURLs(0, event, urls);
} }
} }
@ -395,9 +397,9 @@ void DolphinDetailsView::contentsMousePressEvent(QMouseEvent* event)
KFileDetailView::contentsMousePressEvent(event); KFileDetailView::contentsMousePressEvent(event);
} }
else if (event->button() == Qt::LeftButton) { else if (event->button() == Qt::LeftButton) {
const ButtonState keyboardState = KApplication::keyboardMouseState(); const Qt::KeyboardModifiers keyboardState = QApplication::keyboardModifiers();
const bool isSelectionActive = (keyboardState & ShiftButton) || const bool isSelectionActive = (keyboardState & Qt::ShiftModifier) ||
(keyboardState & ControlButton); (keyboardState & Qt::ControlModifier);
if (!isSelectionActive) { if (!isSelectionActive) {
clearSelection(); clearSelection();
} }
@ -475,15 +477,16 @@ void DolphinDetailsView::drawRubber()
QPainter p; QPainter p;
p.begin(viewport()); p.begin(viewport());
p.setRasterOp(NotROP); //p.setRasterOp(NotROP);
p.setPen(QPen(color0, 1)); p.setPen(QPen(Qt::color0, 1));
p.setBrush(NoBrush); p.setBrush(Qt::NoBrush);
QPoint point(m_rubber->x(), m_rubber->y()); QPoint point(m_rubber->x(), m_rubber->y());
point = contentsToViewport(point); point = contentsToViewport(point);
style().drawPrimitive(QStyle::PE_FocusRect, &p, QStyleOptionFocusRect option;
QRect(point.x(), point.y(), m_rubber->width(), m_rubber->height()), option.initFrom(this);
colorGroup(), QStyle::Style_Default, colorGroup().base()); option.rect = QRect(point.x(), point.y(), m_rubber->width(), m_rubber->height());
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &p);
p.end(); p.end();
} }
@ -506,19 +509,19 @@ void DolphinDetailsView::slotActivationUpdate()
// TODO: there must be a simpler way to say // TODO: there must be a simpler way to say
// "update all children" // "update all children"
const QObjectList* list = children(); const QList<QObject*> list = children();
if (list == 0) { if (list.isEmpty()) {
return; return;
} }
QObjectListIterator it(*list); QListIterator<QObject*> it(list);
QObject* object = 0; QObject* object = 0;
while ((object = it.current()) != 0) { while (it.hasNext()) {
object = it.next();
if (object->inherits("QWidget")) { if (object->inherits("QWidget")) {
QWidget* widget = static_cast<QWidget*>(object); QWidget* widget = static_cast<QWidget*>(object);
widget->update(); widget->update();
} }
++it;
} }
} }
@ -647,7 +650,7 @@ void DolphinDetailsView::slotItemRenamed(Q3ListViewItem* item,
int /* column */) int /* column */)
{ {
KFileItem* fileInfo = static_cast<KFileListViewItem*>(item)->fileInfo(); KFileItem* fileInfo = static_cast<KFileListViewItem*>(item)->fileInfo();
m_dolphinView->rename(KURL(fileInfo->url()), name); m_dolphinView->rename(KUrl(fileInfo->url()), name);
} }
void DolphinDetailsView::slotHeaderClicked(int /* section */) void DolphinDetailsView::slotHeaderClicked(int /* section */)

View File

@ -25,7 +25,7 @@
#include <stdio.h> #include <stdio.h>
DolphinDirLister::DolphinDirLister() : DolphinDirLister::DolphinDirLister() :
KDirLister(true) KDirLister()
{ {
} }

View File

@ -31,12 +31,12 @@
#include <kapplication.h> #include <kapplication.h>
#include <qobject.h> #include <qobject.h>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <kurldrag.h>
#include <qclipboard.h> #include <qclipboard.h>
#include <assert.h> #include <assert.h>
#include <kaction.h> #include <kaction.h>
#include <kstdaction.h> #include <kstdaction.h>
#include <kfileitem.h> #include <kfileitem.h>
#include <kactioncollection.h>
#include "dolphinview.h" #include "dolphinview.h"
#include "viewproperties.h" #include "viewproperties.h"
@ -52,7 +52,7 @@ DolphinIconsView::DolphinIconsView(DolphinView* parent, LayoutMode layoutMode) :
m_dolphinView(parent) m_dolphinView(parent)
{ {
setAcceptDrops(true); setAcceptDrops(true);
setMode(KIconView::Execute); setMode(K3IconView::Execute);
setSelectionMode(KFile::Extended); setSelectionMode(KFile::Extended);
Dolphin& dolphin = Dolphin::mainWin(); Dolphin& dolphin = Dolphin::mainWin();
@ -216,13 +216,13 @@ bool DolphinIconsView::isZoomInPossible() const
{ {
IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
const int size = (m_layoutMode == Icons) ? settings->iconSize() : settings->previewSize(); const int size = (m_layoutMode == Icons) ? settings->iconSize() : settings->previewSize();
return size < KIcon::SizeEnormous; return size < K3Icon::SizeEnormous;
} }
bool DolphinIconsView::isZoomOutPossible() const bool DolphinIconsView::isZoomOutPossible() const
{ {
IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings();
return settings->iconSize() > KIcon::SizeSmall; return settings->iconSize() > K3Icon::SizeSmall;
} }
void DolphinIconsView::arrangeItemsInGrid( bool updated ) void DolphinIconsView::arrangeItemsInGrid( bool updated )
@ -309,11 +309,11 @@ void DolphinIconsView::drawBackground(QPainter* painter, const QRect& rect)
Q3DragObject* DolphinIconsView::dragObject() Q3DragObject* DolphinIconsView::dragObject()
{ {
KURL::List urls; KUrl::List urls;
KFileItemListIterator it(*KFileView::selectedItems()); QListIterator<KFileItem*> it(*KFileView::selectedItems());
while (it.current() != 0) { while (it.hasNext()) {
urls.append((*it)->url()); KFileItem *item = it.next();
++it; urls.append(item->url());
} }
QPixmap pixmap; QPixmap pixmap;
@ -331,9 +331,12 @@ Q3DragObject* DolphinIconsView::dragObject()
pixmap = currentFileItem()->pixmap(iconSize()); pixmap = currentFileItem()->pixmap(iconSize());
} }
/* This should be ported to QMimeData
Q3DragObject* dragObj = new KURLDrag(urls, widget()); Q3DragObject* dragObj = new KURLDrag(urls, widget());
dragObj->setPixmap(pixmap); dragObj->setPixmap(pixmap);
return dragObj; return dragObj;
*/
return 0;
} }
void DolphinIconsView::contentsDragEnterEvent(QDragEnterEvent* event) void DolphinIconsView::contentsDragEnterEvent(QDragEnterEvent* event)
@ -351,7 +354,8 @@ void DolphinIconsView::contentsDragEnterEvent(QDragEnterEvent* event)
return; return;
} }
const bool accept = KURLDrag::canDecode(event) && KUrl::List uriList = KUrl::List::fromMimeData( event->mimeData() );
const bool accept = !uriList.isEmpty() &&
(event->action() == QDropEvent::Copy || (event->action() == QDropEvent::Copy ||
event->action() == QDropEvent::Move || event->action() == QDropEvent::Move ||
event->action() == QDropEvent::Link ); event->action() == QDropEvent::Link );
@ -397,7 +401,8 @@ void DolphinIconsView::contentsDropEvent(QDropEvent* event)
} }
KFileIconViewItem* item = static_cast<KFileIconViewItem*>(findItem(contentsToViewport(event->pos()))); KFileIconViewItem* item = static_cast<KFileIconViewItem*>(findItem(contentsToViewport(event->pos())));
const bool accept = KURLDrag::canDecode(event) && KUrl::List urls = KUrl::List::fromMimeData( event->mimeData() );
const bool accept = !urls.isEmpty() &&
(event->action() == QDropEvent::Copy || (event->action() == QDropEvent::Copy ||
event->action() == QDropEvent::Move || event->action() == QDropEvent::Move ||
event->action() == QDropEvent::Link ) && event->action() == QDropEvent::Link ) &&
@ -412,9 +417,8 @@ void DolphinIconsView::contentsDropEvent(QDropEvent* event)
return; return;
} }
emit dropped(event, fileItem); emit dropped(event, fileItem);
KURL::List urls; if (!urls.isEmpty()) {
if (KURLDrag::decode(event, urls) && !urls.isEmpty()) { emit dropped(event, urls, fileItem != 0 ? fileItem->url() : KUrl());
emit dropped(event, urls, fileItem != 0 ? fileItem->url() : KURL());
sig->dropURLs(fileItem, event, urls); sig->dropURLs(fileItem, event, urls);
} }
} }
@ -431,7 +435,7 @@ void DolphinIconsView::slotOnItem(Q3IconViewItem* item)
void DolphinIconsView::slotOnViewport() void DolphinIconsView::slotOnViewport()
{ {
resetActivatedItem(); resetActivatedItem();
m_dolphinView->requestItemInfo(KURL()); m_dolphinView->requestItemInfo(KUrl());
} }
void DolphinIconsView::slotContextMenuRequested(Q3IconViewItem* item, void DolphinIconsView::slotContextMenuRequested(Q3IconViewItem* item,
@ -448,7 +452,7 @@ void DolphinIconsView::slotItemRenamed(Q3IconViewItem* item,
const QString& name) const QString& name)
{ {
KFileItem* fileInfo = static_cast<KFileIconViewItem*>(item)->fileInfo(); KFileItem* fileInfo = static_cast<KFileIconViewItem*>(item)->fileInfo();
m_dolphinView->rename(KURL(fileInfo->url()), name); m_dolphinView->rename(KUrl(fileInfo->url()), name);
} }
void DolphinIconsView::slotActivationUpdate() void DolphinIconsView::slotActivationUpdate()
@ -457,19 +461,19 @@ void DolphinIconsView::slotActivationUpdate()
// TODO: there must be a simpler way to say // TODO: there must be a simpler way to say
// "update all children" // "update all children"
const QObjectList* list = children(); const QList<QObject*> list = children();
if (list == 0) { if (list.isEmpty()) {
return; return;
} }
QObjectListIterator it(*list); QListIterator<QObject*> it(list);
QObject* object = 0; QObject* object = 0;
while ((object = it.current()) != 0) { while (it.hasNext()) {
object = it.next();
if (object->inherits("QWidget")) { if (object->inherits("QWidget")) {
QWidget* widget = static_cast<QWidget*>(object); QWidget* widget = static_cast<QWidget*>(object);
widget->update(); widget->update();
} }
++it;
} }
} }
@ -482,11 +486,11 @@ int DolphinIconsView::increasedIconSize(int size) const
{ {
int incSize = 0; int incSize = 0;
switch (size) { switch (size) {
case KIcon::SizeSmall: incSize = KIcon::SizeSmallMedium; break; case K3Icon::SizeSmall: incSize = K3Icon::SizeSmallMedium; break;
case KIcon::SizeSmallMedium: incSize = KIcon::SizeMedium; break; case K3Icon::SizeSmallMedium: incSize = K3Icon::SizeMedium; break;
case KIcon::SizeMedium: incSize = KIcon::SizeLarge; break; case K3Icon::SizeMedium: incSize = K3Icon::SizeLarge; break;
case KIcon::SizeLarge: incSize = KIcon::SizeHuge; break; case K3Icon::SizeLarge: incSize = K3Icon::SizeHuge; break;
case KIcon::SizeHuge: incSize = KIcon::SizeEnormous; break; case K3Icon::SizeHuge: incSize = K3Icon::SizeEnormous; break;
default: assert(false); break; default: assert(false); break;
} }
return incSize; return incSize;
@ -496,11 +500,11 @@ int DolphinIconsView::decreasedIconSize(int size) const
{ {
int decSize = 0; int decSize = 0;
switch (size) { switch (size) {
case KIcon::SizeSmallMedium: decSize = KIcon::SizeSmall; break; case K3Icon::SizeSmallMedium: decSize = K3Icon::SizeSmall; break;
case KIcon::SizeMedium: decSize = KIcon::SizeSmallMedium; break; case K3Icon::SizeMedium: decSize = K3Icon::SizeSmallMedium; break;
case KIcon::SizeLarge: decSize = KIcon::SizeMedium; break; case K3Icon::SizeLarge: decSize = K3Icon::SizeMedium; break;
case KIcon::SizeHuge: decSize = KIcon::SizeLarge; break; case K3Icon::SizeHuge: decSize = K3Icon::SizeLarge; break;
case KIcon::SizeEnormous: decSize = KIcon::SizeHuge; break; case K3Icon::SizeEnormous: decSize = K3Icon::SizeHuge; break;
default: assert(false); break; default: assert(false); break;
} }
return decSize; return decSize;

View File

@ -66,9 +66,9 @@ KBookmarkManager* DolphinSettings::bookmarkManager() const
{ {
QString basePath = KGlobal::instance()->instanceName(); QString basePath = KGlobal::instance()->instanceName();
basePath.append("/bookmarks.xml"); basePath.append("/bookmarks.xml");
const QString file = locateLocal("data", basePath); const QString file = KStandardDirs::locateLocal("data", basePath);
return KBookmarkManager::managerForFile(file, false); return KBookmarkManager::managerForFile(file, "dolphin", false);
} }
void DolphinSettings::save() void DolphinSettings::save()
@ -81,9 +81,9 @@ void DolphinSettings::save()
QString basePath = KGlobal::instance()->instanceName(); QString basePath = KGlobal::instance()->instanceName();
basePath.append("/bookmarks.xml"); basePath.append("/bookmarks.xml");
const QString file = locateLocal( "data", basePath); const QString file = KStandardDirs::locateLocal( "data", basePath);
KBookmarkManager* manager = KBookmarkManager::managerForFile(file, false); KBookmarkManager* manager = KBookmarkManager::managerForFile(file, "dolphin", false);
manager->save(false); manager->save(false);
} }
@ -100,14 +100,14 @@ void DolphinSettings::calculateGridSize(int hint)
int gridHeight = 0; int gridHeight = 0;
if (arrangement == Q3IconView::LeftToRight) { if (arrangement == Q3IconView::LeftToRight) {
int widthUnit = maxSize + (maxSize / 2); int widthUnit = maxSize + (maxSize / 2);
if (widthUnit < KIcon::SizeLarge) { if (widthUnit < K3Icon::SizeLarge) {
widthUnit = KIcon::SizeLarge; widthUnit = K3Icon::SizeLarge;
} }
gridWidth = widthUnit + hint * KIcon::SizeLarge; gridWidth = widthUnit + hint * K3Icon::SizeLarge;
gridHeight = iconSize; gridHeight = iconSize;
if (gridHeight <= KIcon::SizeMedium) { if (gridHeight <= K3Icon::SizeMedium) {
gridHeight = gridHeight * 2; gridHeight = gridHeight * 2;
} }
else { else {
@ -141,10 +141,10 @@ int DolphinSettings::textWidthHint() const
int hint = 0; int hint = 0;
if (arrangement == Q3IconView::LeftToRight) { if (arrangement == Q3IconView::LeftToRight) {
int widthUnit = maxSize + (maxSize / 2); int widthUnit = maxSize + (maxSize / 2);
if (widthUnit < KIcon::SizeLarge) { if (widthUnit < K3Icon::SizeLarge) {
widthUnit = KIcon::SizeLarge; widthUnit = K3Icon::SizeLarge;
} }
hint = (gridWidth - widthUnit) / KIcon::SizeLarge; hint = (gridWidth - widthUnit) / K3Icon::SizeLarge;
} }
else { else {
assert(arrangement == Q3IconView::TopToBottom); assert(arrangement == Q3IconView::TopToBottom);

View File

@ -26,7 +26,6 @@
#include <QPixmap> #include <QPixmap>
#include <kglobalsettings.h> #include <kglobalsettings.h>
#include <qclipboard.h> #include <qclipboard.h>
#include <kurldrag.h>
#include <klocale.h> #include <klocale.h>
#include "dolphin.h" #include "dolphin.h"
@ -76,8 +75,8 @@ void ItemEffectsManager::activateItem(void* context)
// apply an icon effect to the item below the mouse pointer // apply an icon effect to the item below the mouse pointer
KIconEffect iconEffect; KIconEffect iconEffect;
QPixmap pixmap = iconEffect.apply(*itemPixmap, QPixmap pixmap = iconEffect.apply(*itemPixmap,
KIcon::Desktop, K3Icon::Desktop,
KIcon::ActiveState); K3Icon::ActiveState);
setContextPixmap(context, pixmap); setContextPixmap(context, pixmap);
} }
@ -99,8 +98,8 @@ void ItemEffectsManager::resetActivatedItem()
// the highlighted item has been found and is restored to the default state // the highlighted item has been found and is restored to the default state
KIconEffect iconEffect; KIconEffect iconEffect;
QPixmap pixmap = iconEffect.apply(*m_pixmapCopy, QPixmap pixmap = iconEffect.apply(*m_pixmapCopy,
KIcon::Desktop, K3Icon::Desktop,
KIcon::DefaultState); K3Icon::DefaultState);
// TODO: KFileIconView does not emit any signal when the preview has been finished. // TODO: KFileIconView does not emit any signal when the preview has been finished.
// Hence check the size to prevent that a preview is hidden by restoring a // Hence check the size to prevent that a preview is hidden by restoring a
@ -144,15 +143,14 @@ void ItemEffectsManager::updateDisabledItems()
} }
QClipboard* clipboard = QApplication::clipboard(); QClipboard* clipboard = QApplication::clipboard();
QMimeSource* data = clipboard->data(); const QMimeData* data = clipboard->mimeData();
if (!KUrlDrag::canDecode(data)) { KUrl::List urls = KUrl::List::fromMimeData(data);
if (urls.isEmpty()) {
return; return;
} }
// The clipboard contains items, which have been cutted. Change the pixmaps of all those // The clipboard contains items, which have been cutted. Change the pixmaps of all those
// items to the disabled state. // items to the disabled state.
KUrl::List urls;
KUrlDrag::decode(data, urls);
for (void* context = firstContext(); context != 0; context = nextContext(context)) { for (void* context = firstContext(); context != 0; context = nextContext(context)) {
const KFileItem* fileInfo = contextFileInfo(context); const KFileItem* fileInfo = contextFileInfo(context);
const KUrl& fileURL = fileInfo->url(); const KUrl& fileURL = fileInfo->url();
@ -168,8 +166,8 @@ void ItemEffectsManager::updateDisabledItems()
KIconEffect iconEffect; KIconEffect iconEffect;
QPixmap disabledPixmap = iconEffect.apply(*itemPixmap, QPixmap disabledPixmap = iconEffect.apply(*itemPixmap,
KIcon::Desktop, K3Icon::Desktop,
KIcon::DisabledState); K3Icon::DisabledState);
setContextPixmap(context, disabledPixmap); setContextPixmap(context, disabledPixmap);
} }
break; break;

View File

@ -25,8 +25,6 @@
#include <qfontmetrics.h> #include <qfontmetrics.h>
//Added by qt3to4: //Added by qt3to4:
#include <QEvent> #include <QEvent>
#include <kurldrag.h>
#include <kpopupmenu.h>
#include <kiconloader.h> #include <kiconloader.h>
#include <klocale.h> #include <klocale.h>
@ -91,8 +89,8 @@ void URLButton::leaveEvent(QEvent* event)
QColor URLButton::mixColors(const QColor& c1, QColor URLButton::mixColors(const QColor& c1,
const QColor& c2) const const QColor& c2) const
{ {
const int Qt::red = (c1.Qt::red() + c2.Qt::red()) / 2; const int red = (c1.red() + c2.red()) / 2;
const int Qt::green = (c1.Qt::green() + c2.Qt::green()) / 2; const int green = (c1.green() + c2.green()) / 2;
const int Qt::blue = (c1.Qt::blue() + c2.Qt::blue()) / 2; const int blue = (c1.blue() + c2.blue()) / 2;
return QColor(Qt::red, Qt::green, Qt::blue); return QColor(red, green, blue);
} }

View File

@ -27,6 +27,7 @@
#include <klocale.h> #include <klocale.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <kurl.h> #include <kurl.h>
#include <kinstance.h>
#include "viewproperties.h" #include "viewproperties.h"
@ -40,7 +41,7 @@ ViewProperties::ViewProperties(KUrl url) :
m_subDirValidityHidden(false), m_subDirValidityHidden(false),
m_node(0) m_node(0)
{ {
url.cleanPath(true); url.cleanPath();
m_filepath = url.path(); m_filepath = url.path();
if ((m_filepath.length() < 1) || (m_filepath.at(0) != QChar('/'))) { if ((m_filepath.length() < 1) || (m_filepath.at(0) != QChar('/'))) {
@ -58,14 +59,14 @@ ViewProperties::ViewProperties(KUrl url) :
if (!info.isWritable()) { if (!info.isWritable()) {
QString basePath = KGlobal::instance()->instanceName(); QString basePath = KGlobal::instance()->instanceName();
basePath.append("/view_properties/local"); basePath.append("/view_properties/local");
rootDir = locateLocal("data", basePath); rootDir = KStandardDirs::locateLocal("data", basePath);
m_filepath = rootDir + m_filepath; m_filepath = rootDir + m_filepath;
} }
} }
else { else {
QString basePath = KGlobal::instance()->instanceName(); QString basePath = KGlobal::instance()->instanceName();
basePath.append("/view_properties/remote/").append(url.host()); basePath.append("/view_properties/remote/").append(url.host());
rootDir = locateLocal("data", basePath); rootDir = KStandardDirs::locateLocal("data", basePath);
m_filepath = rootDir + m_filepath; m_filepath = rootDir + m_filepath;
} }
@ -86,7 +87,8 @@ ViewProperties::ViewProperties(KUrl url) :
(parentNode.timestamp() > m_node->timestamp()); (parentNode.timestamp() > m_node->timestamp());
if (inheritProps) { if (inheritProps) {
*m_node = parentNode; delete m_node;
m_node = new ViewPropertySettings(KSharedConfig::openConfig(dir.path() + FILE_NAME));
break; break;
} }
} }