From c8a4f1fd8d3c9b50e51b7234123b3fbe0b979552 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Mon, 9 Apr 2007 19:12:54 +0000 Subject: [PATCH] adapt Dolphin to kdelibs coding style (http://techbase.kde.org/Policies/Kdelibs_Coding_Style) by using: astyle --indent=spaces=4 --brackets=linux \ --indent-labels --pad=oper --unpad=paren \ --one-line=keep-statements --convert-tabs \ --indent-preprocessor \ `find -type f -name '*.cpp'` `find -type f -name '*.h'` svn path=/trunk/KDE/kdebase/apps/; revision=651981 --- src/applyviewpropsjob.cpp | 14 +- src/applyviewpropsjob.h | 5 +- src/columnviewsettingspage.cpp | 38 ++-- src/detailsviewsettingspage.cpp | 46 ++--- src/dolphinapplication.cpp | 5 +- src/dolphincolumnview.cpp | 23 +-- src/dolphincontextmenu.cpp | 81 +++----- src/dolphincontextmenu.h | 6 +- src/dolphincontroller.cpp | 18 +- src/dolphincontroller.h | 35 +++- src/dolphindetailsview.cpp | 19 +- src/dolphindirlister.cpp | 8 +- src/dolphiniconsview.cpp | 40 ++-- src/dolphinmainwindow.cpp | 309 +++++++++++++--------------- src/dolphinmainwindow.h | 29 ++- src/dolphinnewmenu.cpp | 13 +- src/dolphinnewmenu.h | 2 +- src/dolphinsettings.h | 28 ++- src/dolphinsettingsdialog.cpp | 13 +- src/dolphinsettingsdialog.h | 3 +- src/dolphinsortfilterproxymodel.cpp | 90 ++++---- src/dolphinsortfilterproxymodel.h | 10 +- src/dolphinstatusbar.cpp | 25 +-- src/dolphinstatusbar.h | 8 +- src/dolphinview.cpp | 192 ++++++++--------- src/dolphinview.h | 25 ++- src/filterbar.cpp | 5 +- src/generalsettingspage.cpp | 17 +- src/generalviewsettingspage.cpp | 21 +- src/iconsizedialog.cpp | 45 ++-- src/iconsizedialog.h | 10 +- src/iconsviewsettingspage.cpp | 35 ++-- src/infosidebarpage.cpp | 118 +++++------ src/infosidebarpage.h | 9 +- src/main.cpp | 15 +- src/metadatawidget.cpp | 105 +++++----- src/metadatawidget.h | 12 +- src/pixmapviewer.cpp | 7 +- src/pixmapviewer.h | 5 +- src/renamedialog.cpp | 20 +- src/renamedialog.h | 10 +- src/settingspagebase.cpp | 8 +- src/sidebarpage.cpp | 12 +- src/sidebarpage.h | 6 +- src/sidebartreeview.cpp | 8 +- src/sidebartreeview.h | 8 +- src/statusbarmessagelabel.cpp | 131 ++++++------ src/statusbarmessagelabel.h | 40 +++- src/statusbarspaceinfo.cpp | 29 ++- src/statusbarspaceinfo.h | 5 +- src/treeviewcontextmenu.cpp | 18 +- src/treeviewsidebarpage.cpp | 13 +- src/viewproperties.cpp | 12 +- src/viewpropertiesdialog.cpp | 40 ++-- src/viewpropsprogressinfo.cpp | 20 +- src/viewsettingspage.cpp | 13 +- 56 files changed, 933 insertions(+), 949 deletions(-) diff --git a/src/applyviewpropsjob.cpp b/src/applyviewpropsjob.cpp index cddc4d653..fb48244e1 100644 --- a/src/applyviewpropsjob.cpp +++ b/src/applyviewpropsjob.cpp @@ -28,10 +28,10 @@ ApplyViewPropsJob::ApplyViewPropsJob(const KUrl& dir, const ViewProperties& viewProps) : - KIO::Job(false), - m_viewProps(0), - m_progress(0), - m_dir(dir) + KIO::Job(false), + m_viewProps(0), + m_progress(0), + m_dir(dir) { m_viewProps = new ViewProperties(dir); m_viewProps->setViewMode(viewProps.viewMode()); @@ -69,7 +69,7 @@ void ApplyViewPropsJob::slotEntries(KIO::Job*, const KIO::UDSEntryList& list) for (; it != end; ++it) { const KIO::UDSEntry& entry = *it; const QString name = entry.stringValue(KIO::UDS_NAME); - if ((name != ".") && (name != ".." ) && entry.isDir()) { + if ((name != ".") && (name != "..") && entry.isDir()) { ++m_progress; KUrl url(m_dir); @@ -86,8 +86,8 @@ void ApplyViewPropsJob::slotEntries(KIO::Job*, const KIO::UDSEntryList& list) void ApplyViewPropsJob::slotResult(KJob* job) { if (job->error()) { - setError( job->error() ); - setErrorText( job->errorText() ); + setError(job->error()); + setErrorText(job->errorText()); } emitResult(); } diff --git a/src/applyviewpropsjob.h b/src/applyviewpropsjob.h index 1b49d1206..cdcf305b6 100644 --- a/src/applyviewpropsjob.h +++ b/src/applyviewpropsjob.h @@ -62,7 +62,10 @@ public: */ ApplyViewPropsJob(const KUrl& dir, const ViewProperties& viewProps); virtual ~ApplyViewPropsJob(); - int progress() const { return m_progress; } + int progress() const + { + return m_progress; + } private: void startNextJob(const KUrl & url); diff --git a/src/columnviewsettingspage.cpp b/src/columnviewsettingspage.cpp index 5d9ee34f7..cd52c362f 100644 --- a/src/columnviewsettingspage.cpp +++ b/src/columnviewsettingspage.cpp @@ -36,13 +36,13 @@ #include ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow, - QWidget* parent) : - KVBox(parent), - m_mainWindow(mainWindow), - m_smallIconSize(0), - m_mediumIconSize(0), - m_largeIconSize(0), - m_fontRequester(0) + QWidget* parent) : + KVBox(parent), + m_mainWindow(mainWindow), + m_smallIconSize(0), + m_mediumIconSize(0), + m_largeIconSize(0), + m_fontRequester(0) { const int spacing = KDialog::spacingHint(); const int margin = KDialog::marginHint(); @@ -62,17 +62,17 @@ ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow, m_mediumIconSize = new QRadioButton(i18n("Medium"), this); m_largeIconSize = new QRadioButton(i18n("Large"), this); switch (settings->iconSize()) { - case K3Icon::SizeLarge: - m_largeIconSize->setChecked(true); - break; + case K3Icon::SizeLarge: + m_largeIconSize->setChecked(true); + break; - case K3Icon::SizeMedium: - m_mediumIconSize->setChecked(true); - break; + case K3Icon::SizeMedium: + m_mediumIconSize->setChecked(true); + break; - case K3Icon::SizeSmall: - default: - m_smallIconSize->setChecked(true); + case K3Icon::SizeSmall: + default: + m_smallIconSize->setChecked(true); } QButtonGroup* iconSizeGroup = new QButtonGroup(this); @@ -108,8 +108,7 @@ ColumnViewSettingsPage::ColumnViewSettingsPage(DolphinMainWindow* mainWindow, } ColumnViewSettingsPage::~ColumnViewSettingsPage() -{ -} +{} void ColumnViewSettingsPage::applySettings() { @@ -119,8 +118,7 @@ void ColumnViewSettingsPage::applySettings() int iconSize = K3Icon::SizeSmall; if (m_mediumIconSize->isChecked()) { iconSize = K3Icon::SizeMedium; - } - else if (m_largeIconSize->isChecked()) { + } else if (m_largeIconSize->isChecked()) { iconSize = K3Icon::SizeLarge; } settings->setIconSize(iconSize); diff --git a/src/detailsviewsettingspage.cpp b/src/detailsviewsettingspage.cpp index 9a9d55093..7ec11b153 100644 --- a/src/detailsviewsettingspage.cpp +++ b/src/detailsviewsettingspage.cpp @@ -36,17 +36,17 @@ #include DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow, - QWidget* parent) : - KVBox(parent), - m_mainWindow(mainWindow), - m_dateBox(0), - m_permissionsBox(0), - m_ownerBox(0), - m_groupBox(0), - m_smallIconSize(0), - m_mediumIconSize(0), - m_largeIconSize(0), - m_fontRequester(0) + QWidget* parent) : + KVBox(parent), + m_mainWindow(mainWindow), + m_dateBox(0), + m_permissionsBox(0), + m_ownerBox(0), + m_groupBox(0), + m_smallIconSize(0), + m_mediumIconSize(0), + m_largeIconSize(0), + m_fontRequester(0) { const int spacing = KDialog::spacingHint(); const int margin = KDialog::marginHint(); @@ -88,17 +88,17 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow, m_mediumIconSize = new QRadioButton(i18n("Medium"), this); m_largeIconSize = new QRadioButton(i18n("Large"), this); switch (settings->iconSize()) { - case K3Icon::SizeLarge: - m_largeIconSize->setChecked(true); - break; + case K3Icon::SizeLarge: + m_largeIconSize->setChecked(true); + break; - case K3Icon::SizeMedium: - m_mediumIconSize->setChecked(true); - break; + case K3Icon::SizeMedium: + m_mediumIconSize->setChecked(true); + break; - case K3Icon::SizeSmall: - default: - m_smallIconSize->setChecked(true); + case K3Icon::SizeSmall: + default: + m_smallIconSize->setChecked(true); } QButtonGroup* iconSizeGroup = new QButtonGroup(this); @@ -134,8 +134,7 @@ DetailsViewSettingsPage::DetailsViewSettingsPage(DolphinMainWindow* mainWindow, } DetailsViewSettingsPage::~DetailsViewSettingsPage() -{ -} +{} void DetailsViewSettingsPage::applySettings() { @@ -150,8 +149,7 @@ void DetailsViewSettingsPage::applySettings() int iconSize = K3Icon::SizeSmall; if (m_mediumIconSize->isChecked()) { iconSize = K3Icon::SizeMedium; - } - else if (m_largeIconSize->isChecked()) { + } else if (m_largeIconSize->isChecked()) { iconSize = K3Icon::SizeLarge; } settings->setIconSize(iconSize); diff --git a/src/dolphinapplication.cpp b/src/dolphinapplication.cpp index 9e6d0565f..ad345dbeb 100644 --- a/src/dolphinapplication.cpp +++ b/src/dolphinapplication.cpp @@ -27,7 +27,7 @@ #include DolphinApplication::DolphinApplication() : - m_lastId(0) + m_lastId(0) { new ApplicationAdaptor(this); QDBusConnection::sessionBus().registerObject("/dolphin/Application", this); @@ -78,8 +78,7 @@ int DolphinApplication::newInstance() for (int i = 0; i < args->count(); ++i) { openWindow(args->arg(i)); } - } - else { + } else { openWindow(QString()); } diff --git a/src/dolphincolumnview.cpp b/src/dolphincolumnview.cpp index 9ce51dbd2..c50314c97 100644 --- a/src/dolphincolumnview.cpp +++ b/src/dolphincolumnview.cpp @@ -32,8 +32,8 @@ #include DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* controller) : - QColumnView(parent), - m_controller(controller) + QColumnView(parent), + m_controller(controller) { Q_ASSERT(controller != 0); @@ -53,7 +53,7 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control connect(controller, SIGNAL(zoomOut()), this, SLOT(zoomOut())); - // apply the column mode settings to the widget + // apply the column mode settings to the widget const ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); Q_ASSERT(settings != 0); @@ -68,8 +68,7 @@ DolphinColumnView::DolphinColumnView(QWidget* parent, DolphinController* control } DolphinColumnView::~DolphinColumnView() -{ -} +{} QStyleOptionViewItem DolphinColumnView::viewOptions() const { @@ -113,9 +112,9 @@ void DolphinColumnView::zoomIn() ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); // TODO: get rid of K3Icon sizes switch (settings->iconSize()) { - case K3Icon::SizeSmall: settings->setIconSize(K3Icon::SizeMedium); break; - case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeLarge); break; - default: Q_ASSERT(false); break; + case K3Icon::SizeSmall: settings->setIconSize(K3Icon::SizeMedium); break; + case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeLarge); break; + default: Q_ASSERT(false); break; } updateDecorationSize(); } @@ -123,13 +122,13 @@ void DolphinColumnView::zoomIn() void DolphinColumnView::zoomOut() { - if (isZoomOutPossible()) { + if (isZoomOutPossible()) { ColumnModeSettings* settings = DolphinSettings::instance().columnModeSettings(); // TODO: get rid of K3Icon sizes switch (settings->iconSize()) { - case K3Icon::SizeLarge: settings->setIconSize(K3Icon::SizeMedium); break; - case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeSmall); break; - default: Q_ASSERT(false); break; + case K3Icon::SizeLarge: settings->setIconSize(K3Icon::SizeMedium); break; + case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeSmall); break; + default: Q_ASSERT(false); break; } updateDecorationSize(); } diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index 79fded599..752f28e12 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -50,10 +50,10 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, KFileItem* fileInfo, const KUrl& baseUrl) : - m_mainWindow(parent), - m_fileInfo(fileInfo), - m_baseUrl(baseUrl), - m_context(NoContext) + m_mainWindow(parent), + m_fileInfo(fileInfo), + m_baseUrl(baseUrl), + m_context(NoContext) { // The context menu either accesses the URLs of the selected items // or the items itself. To increase the performance both lists are cached. @@ -63,8 +63,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, } DolphinContextMenu::~DolphinContextMenu() -{ -} +{} void DolphinContextMenu::open() { @@ -76,21 +75,18 @@ void DolphinContextMenu::open() if (m_fileInfo != 0) { m_context |= ItemContext; // TODO: handle other use cases like devices + desktop files - } + } // open the corresponding popup for the context if (m_context & TrashContext) { if (m_context & ItemContext) { openTrashItemContextMenu(); - } - else { + } else { openTrashContextMenu(); } - } - else if (m_context & ItemContext) { + } else if (m_context & ItemContext) { openItemContextMenu(); - } - else { + } else { Q_ASSERT(m_context == NoContext); openViewportContextMenu(); } @@ -114,10 +110,10 @@ void DolphinContextMenu::openTrashContextMenu() if (popup->exec(QCursor::pos()) == emptyTrashAction) { const QString text(i18n("Do you really want to empty the Trash? All items will get deleted.")); const bool del = KMessageBox::warningContinueCancel(m_mainWindow, - text, - QString(), - KGuiItem(i18n("Empty Trash"), KIcon("user-trash")) - ) == KMessageBox::Continue; + text, + QString(), + KGuiItem(i18n("Empty Trash"), KIcon("user-trash")) + ) == KMessageBox::Continue; if (del) { KonqOperations::emptyTrash(m_mainWindow); } @@ -179,25 +175,22 @@ void DolphinContextMenu::openItemContextMenu() QAction* activatedAction = popup->exec(QCursor::pos()); - if ((bookmarkAction!= 0) && (activatedAction == bookmarkAction)) { + if ((bookmarkAction != 0) && (activatedAction == bookmarkAction)) { const KUrl selectedUrl(m_fileInfo->url()); if (selectedUrl.isValid()) { DolphinSettings::instance().placesModel()->addPlace(selectedUrl.fileName(), - selectedUrl); + selectedUrl); } - } - else if (serviceActions.contains(activatedAction)) { + } else if (serviceActions.contains(activatedAction)) { // one of the 'Actions' items has been selected int id = serviceActions.indexOf(activatedAction); KDesktopFileActions::executeService(m_selectedUrls, actionsVector[id]); - } - else if (openWithActions.contains(activatedAction)) { + } else if (openWithActions.contains(activatedAction)) { // one of the 'Open With' items has been selected if (openWithActions.last() == activatedAction) { // the item 'Other...' has been selected KRun::displayOpenWithDialog(m_selectedUrls, m_mainWindow); - } - else { + } else { int id = openWithActions.indexOf(activatedAction); KService::Ptr servicePtr = openWithVector[id]; KRun::run(*servicePtr, m_selectedUrls, m_mainWindow); @@ -247,8 +240,7 @@ void DolphinContextMenu::openViewportContextMenu() QAction* activatedAction = popup->exec(QCursor::pos()); if (activatedAction == propertiesAction) { new KPropertiesDialog(m_mainWindow->activeView()->url()); - } - else if (activatedAction == bookmarkAction) { + } else if (activatedAction == bookmarkAction) { const KUrl& url = m_mainWindow->activeView()->url(); if (url.isValid()) { DolphinSettings::instance().placesModel()->addPlace(url.fileName(), url); @@ -285,8 +277,7 @@ void DolphinContextMenu::insertDefaultItemActions(KMenu* popup) if (url.isLocalFile()) { QAction* moveToTrashAction = collection->action("move_to_trash"); popup->addAction(moveToTrashAction); - } - else { + } else { showDeleteCommand = true; } @@ -297,7 +288,7 @@ void DolphinContextMenu::insertDefaultItemActions(KMenu* popup) } QList DolphinContextMenu::insertOpenWithItems(KMenu* popup, - QVector& openWithVector) + QVector& openWithVector) { // Parts of the following code have been taken // from the class KonqOperations located in @@ -322,12 +313,12 @@ QList DolphinContextMenu::insertOpenWithItems(KMenu* popup, // fill the 'Open with' sub menu with application types const KMimeType::Ptr mimePtr = KMimeType::findByUrl(m_fileInfo->url()); KService::List offers = KMimeTypeTrader::self()->query(mimePtr->name(), - "Application", - "Type == 'Application'"); + "Application", + "Type == 'Application'"); if (offers.count() > 0) { KService::List::Iterator it; KMenu* openWithMenu = new KMenu(i18n("Open With")); - for(it = offers.begin(); it != offers.end(); ++it) { + for (it = offers.begin(); it != offers.end(); ++it) { // The offer list from the KTrader returns duplicate // application entries. Although this seems to be a configuration // problem outside the scope of Dolphin, duplicated entries just @@ -346,16 +337,14 @@ QList DolphinContextMenu::insertOpenWithItems(KMenu* popup, openWithActions << action; popup->addMenu(openWithMenu); - } - else { + } else { // No applications are registered, hence just offer // a "Open With..." item instead of a sub menu containing // only one entry. QAction* action = popup->addAction(i18n("Open With...")); openWithActions << action; } - } - else { + } else { // At least one of the selected items has a different MIME type. In this case // just show a disabled "Open With..." entry. QAction* action = popup->addAction(i18n("Open With...")); @@ -366,7 +355,7 @@ QList DolphinContextMenu::insertOpenWithItems(KMenu* popup, } QList DolphinContextMenu::insertActionItems(KMenu* popup, - QVector& actionsVector) + QVector& actionsVector) { // Parts of the following code have been taken // from the class KonqOperations located in @@ -388,7 +377,7 @@ QList DolphinContextMenu::insertActionItems(KMenu* popup, QStringList entries = dir.entryList(QDir::Files); for (QStringList::ConstIterator entryIt = entries.begin(); entryIt != entries.end(); ++entryIt) { - KConfigGroup cfg(KSharedConfig::openConfig( *dirIt + *entryIt, KConfig::OnlyLocal), "Desktop Entry" ); + KConfigGroup cfg(KSharedConfig::openConfig(*dirIt + *entryIt, KConfig::OnlyLocal), "Desktop Entry"); if ((cfg.hasKey("Actions") || cfg.hasKey("X-KDE-GetActionMenu")) && cfg.hasKey("ServiceTypes")) { //const QStringList types = cfg.readListEntry("ServiceTypes"); QStringList types; @@ -429,7 +418,7 @@ QList DolphinContextMenu::insertActionItems(KMenu* popup, if (insert) { menu = actionsMenu; - const QString submenuName = cfg.readEntry( "X-KDE-Submenu" ); + const QString submenuName = cfg.readEntry("X-KDE-Submenu"); if (!submenuName.isEmpty()) { menu = new KMenu(submenuName); actionsMenu->addMenu(menu); @@ -445,8 +434,7 @@ QList DolphinContextMenu::insertActionItems(KMenu* popup, QAction* action = menu->addAction(KIcon(service.m_strIcon), service.m_strName); serviceActions << action; - } - else { + } else { QAction *action = menu->addAction(service.m_strName); serviceActions << action; } @@ -479,21 +467,18 @@ QList DolphinContextMenu::insertActionItems(KMenu* popup, QAction* action = popup->addAction(text); serviceActions.clear(); serviceActions << action; - } - else { + } else { QAction* action = popup->addAction(icon, text); serviceActions.clear(); serviceActions << action; } - } - else { + } else { // The item is a sub menu, hence show the sub menu in the root menu. popup->addMenu(menu); } actionsMenu->deleteLater(); actionsMenu = 0; - } - else { + } else { popup->addMenu(actionsMenu); } diff --git a/src/dolphincontextmenu.h b/src/dolphincontextmenu.h index 5674c96c3..17c980215 100644 --- a/src/dolphincontextmenu.h +++ b/src/dolphincontextmenu.h @@ -109,7 +109,8 @@ private: const QString& entryName) const; private: - struct Entry { + struct Entry + { int type; QString name; QString filePath; // empty for separator @@ -118,7 +119,8 @@ private: QString comment; }; - enum ContextType { + enum ContextType + { NoContext = 0, ItemContext = 1, TrashContext = 2 diff --git a/src/dolphincontroller.cpp b/src/dolphincontroller.cpp index 288083533..151d27208 100644 --- a/src/dolphincontroller.cpp +++ b/src/dolphincontroller.cpp @@ -20,16 +20,14 @@ #include "dolphincontroller.h" DolphinController::DolphinController(QObject* parent) : - QObject(parent), - m_showPreview(false), - m_zoomInPossible(false), - m_zoomOutPossible(false) -{ -} + QObject(parent), + m_showPreview(false), + m_zoomInPossible(false), + m_zoomOutPossible(false) +{} DolphinController::~DolphinController() -{ -} +{} void DolphinController::triggerContextMenuRequest(const QPoint& pos) { @@ -43,8 +41,8 @@ void DolphinController::triggerActivation() } void DolphinController::indicateDroppedUrls(const KUrl::List& urls, - const QModelIndex& index, - QWidget* source) + const QModelIndex& index, + QWidget* source) { emit urlsDropped(urls, index, source); } diff --git a/src/dolphincontroller.h b/src/dolphincontroller.h index af5ac3517..f9f4f4e47 100644 --- a/src/dolphincontroller.h +++ b/src/dolphincontroller.h @@ -54,8 +54,14 @@ public: explicit DolphinController(QObject* parent); virtual ~DolphinController(); - void setUrl(const KUrl& url) { m_url = url; } - const KUrl& url() const { return m_url; } + void setUrl(const KUrl& url) + { + m_url = url; + } + const KUrl& url() const + { + return m_url; + } void triggerContextMenuRequest(const QPoint& pos); @@ -70,15 +76,30 @@ public: void indicateSortOrderChange(Qt::SortOrder order); void setShowPreview(bool showPreview); - bool showPreview() const { return m_showPreview; } + bool showPreview() const + { + return m_showPreview; + } void triggerZoomIn(); - void setZoomInPossible(bool possible) { m_zoomInPossible = possible; } - bool isZoomInPossible() const { return m_zoomInPossible; } + void setZoomInPossible(bool possible) + { + m_zoomInPossible = possible; + } + bool isZoomInPossible() const + { + return m_zoomInPossible; + } void triggerZoomOut(); - void setZoomOutPossible(bool possible) { m_zoomOutPossible = possible; } - bool isZoomOutPossible() const { return m_zoomOutPossible; } + void setZoomOutPossible(bool possible) + { + m_zoomOutPossible = possible; + } + bool isZoomOutPossible() const + { + return m_zoomOutPossible; + } public slots: void triggerItem(const QModelIndex& index); diff --git a/src/dolphindetailsview.cpp b/src/dolphindetailsview.cpp index dc05ef3ea..88537471b 100644 --- a/src/dolphindetailsview.cpp +++ b/src/dolphindetailsview.cpp @@ -33,8 +33,8 @@ #include DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* controller) : - QTreeView(parent), - m_controller(controller) + QTreeView(parent), + m_controller(controller) { Q_ASSERT(controller != 0); @@ -85,8 +85,7 @@ DolphinDetailsView::DolphinDetailsView(QWidget* parent, DolphinController* contr } DolphinDetailsView::~DolphinDetailsView() -{ -} +{} bool DolphinDetailsView::event(QEvent* event) { @@ -186,9 +185,9 @@ void DolphinDetailsView::zoomIn() DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); // TODO: get rid of K3Icon sizes switch (settings->iconSize()) { - case K3Icon::SizeSmall: settings->setIconSize(K3Icon::SizeMedium); break; - case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeLarge); break; - default: Q_ASSERT(false); break; + case K3Icon::SizeSmall: settings->setIconSize(K3Icon::SizeMedium); break; + case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeLarge); break; + default: Q_ASSERT(false); break; } updateDecorationSize(); } @@ -200,9 +199,9 @@ void DolphinDetailsView::zoomOut() DetailsModeSettings* settings = DolphinSettings::instance().detailsModeSettings(); // TODO: get rid of K3Icon sizes switch (settings->iconSize()) { - case K3Icon::SizeLarge: settings->setIconSize(K3Icon::SizeMedium); break; - case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeSmall); break; - default: Q_ASSERT(false); break; + case K3Icon::SizeLarge: settings->setIconSize(K3Icon::SizeMedium); break; + case K3Icon::SizeMedium: settings->setIconSize(K3Icon::SizeSmall); break; + default: Q_ASSERT(false); break; } updateDecorationSize(); } diff --git a/src/dolphindirlister.cpp b/src/dolphindirlister.cpp index 8da962b18..a88acc937 100644 --- a/src/dolphindirlister.cpp +++ b/src/dolphindirlister.cpp @@ -22,13 +22,11 @@ #include DolphinDirLister::DolphinDirLister() : - KDirLister() -{ -} + KDirLister() +{} DolphinDirLister::~DolphinDirLister() -{ -} +{} void DolphinDirLister::handleError(KIO::Job* job) { diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 0b9b1e6fa..63989a30d 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -32,8 +32,8 @@ #include DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controller) : - QListView(parent), - m_controller(controller) + QListView(parent), + m_controller(controller) { Q_ASSERT(controller != 0); setViewMode(QListView::IconMode); @@ -68,16 +68,14 @@ DolphinIconsView::DolphinIconsView(QWidget* parent, DolphinController* controlle if (settings->arrangement() == QListView::TopToBottom) { setFlow(QListView::LeftToRight); m_viewOptions.decorationPosition = QStyleOptionViewItem::Top; - } - else { + } else { setFlow(QListView::TopToBottom); m_viewOptions.decorationPosition = QStyleOptionViewItem::Left; } } DolphinIconsView::~DolphinIconsView() -{ -} +{} QStyleOptionViewItem DolphinIconsView::viewOptions() const { @@ -153,8 +151,7 @@ void DolphinIconsView::zoomIn() if (showPreview) { const int previewSize = increasedIconSize(settings->previewSize()); settings->setPreviewSize(previewSize); - } - else { + } else { newIconSize = increasedIconSize(oldIconSize); settings->setIconSize(newIconSize); if (settings->previewSize() < newIconSize) { @@ -189,8 +186,7 @@ void DolphinIconsView::zoomOut() newIconSize = previewSize; settings->setIconSize(newIconSize); } - } - else { + } else { newIconSize = decreasedIconSize(settings->iconSize()); settings->setIconSize(newIconSize); } @@ -223,12 +219,12 @@ int DolphinIconsView::increasedIconSize(int size) const // TODO: get rid of K3Icon sizes int incSize = 0; switch (size) { - case K3Icon::SizeSmall: incSize = K3Icon::SizeSmallMedium; break; - case K3Icon::SizeSmallMedium: incSize = K3Icon::SizeMedium; break; - case K3Icon::SizeMedium: incSize = K3Icon::SizeLarge; break; - case K3Icon::SizeLarge: incSize = K3Icon::SizeHuge; break; - case K3Icon::SizeHuge: incSize = K3Icon::SizeEnormous; break; - default: Q_ASSERT(false); break; + case K3Icon::SizeSmall: incSize = K3Icon::SizeSmallMedium; break; + case K3Icon::SizeSmallMedium: incSize = K3Icon::SizeMedium; break; + case K3Icon::SizeMedium: incSize = K3Icon::SizeLarge; break; + case K3Icon::SizeLarge: incSize = K3Icon::SizeHuge; break; + case K3Icon::SizeHuge: incSize = K3Icon::SizeEnormous; break; + default: Q_ASSERT(false); break; } return incSize; } @@ -238,12 +234,12 @@ int DolphinIconsView::decreasedIconSize(int size) const // TODO: get rid of K3Icon sizes int decSize = 0; switch (size) { - case K3Icon::SizeSmallMedium: decSize = K3Icon::SizeSmall; break; - case K3Icon::SizeMedium: decSize = K3Icon::SizeSmallMedium; break; - case K3Icon::SizeLarge: decSize = K3Icon::SizeMedium; break; - case K3Icon::SizeHuge: decSize = K3Icon::SizeLarge; break; - case K3Icon::SizeEnormous: decSize = K3Icon::SizeHuge; break; - default: Q_ASSERT(false); break; + case K3Icon::SizeSmallMedium: decSize = K3Icon::SizeSmall; break; + case K3Icon::SizeMedium: decSize = K3Icon::SizeSmallMedium; break; + case K3Icon::SizeLarge: decSize = K3Icon::SizeMedium; break; + case K3Icon::SizeHuge: decSize = K3Icon::SizeLarge; break; + case K3Icon::SizeEnormous: decSize = K3Icon::SizeHuge; break; + default: Q_ASSERT(false); break; } return decSize; } diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index 1e55d0b55..3a375ebb9 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -73,11 +73,11 @@ #include DolphinMainWindow::DolphinMainWindow(int id) : - KMainWindow(0), - m_newMenu(0), - m_splitter(0), - m_activeView(0), - m_id(id) + KMainWindow(0), + m_newMenu(0), + m_splitter(0), + m_activeView(0), + m_id(id) { setObjectName("Dolphin"); m_view[PrimaryIdx] = 0; @@ -133,16 +133,13 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls, if (shiftPressed && controlPressed) { // shortcut for 'Link Here' is used action = Qt::LinkAction; - } - else if (shiftPressed) { + } else if (shiftPressed) { // shortcut for 'Move Here' is used action = Qt::MoveAction; - } - else if (controlPressed) { + } else if (controlPressed) { // shortcut for 'Copy Here' is used action = Qt::CopyAction; - } - else { + } else { // open a context menu which offers the following actions: // - Move Here // - Copy Here @@ -172,33 +169,30 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls, QAction* activatedAction = popup.exec(QCursor::pos()); if (activatedAction == moveAction) { action = Qt::MoveAction; - } - else if (activatedAction == copyAction) { + } else if (activatedAction == copyAction) { action = Qt::CopyAction; - } - else if (activatedAction == linkAction) { + } else if (activatedAction == linkAction) { action = Qt::LinkAction; - } - else { + } else { return; } } switch (action) { - case Qt::MoveAction: - moveUrls(urls, destination); - break; + case Qt::MoveAction: + moveUrls(urls, destination); + break; - case Qt::CopyAction: - copyUrls(urls, destination); - break; + case Qt::CopyAction: + copyUrls(urls, destination); + break; - case Qt::LinkAction: - linkUrls(urls, destination); - break; + case Qt::LinkAction: + linkUrls(urls, destination); + break; - default: - break; + default: + break; } } @@ -215,7 +209,7 @@ void DolphinMainWindow::refreshViews() const bool isPrimaryViewActive = (m_activeView == m_view[PrimaryIdx]); KUrl url; for (int i = PrimaryIdx; i <= SecondaryIdx; ++i) { - if (m_view[i] != 0) { + if (m_view[i] != 0) { url = m_view[i]->url(); // delete view instance... @@ -285,26 +279,26 @@ void DolphinMainWindow::slotSortingChanged(DolphinView::Sorting sorting) { QAction* action = 0; switch (sorting) { - case DolphinView::SortByName: - action = actionCollection()->action("by_name"); - break; - case DolphinView::SortBySize: - action = actionCollection()->action("by_size"); - break; - case DolphinView::SortByDate: - action = actionCollection()->action("by_date"); - break; - case DolphinView::SortByPermissions: - action = actionCollection()->action("by_permissions"); - break; - case DolphinView::SortByOwner: - action = actionCollection()->action("by_owner"); - break; - case DolphinView::SortByGroup: - action = actionCollection()->action("by_group"); - break; - default: - break; + case DolphinView::SortByName: + action = actionCollection()->action("by_name"); + break; + case DolphinView::SortBySize: + action = actionCollection()->action("by_size"); + break; + case DolphinView::SortByDate: + action = actionCollection()->action("by_date"); + break; + case DolphinView::SortByPermissions: + action = actionCollection()->action("by_permissions"); + break; + case DolphinView::SortByOwner: + action = actionCollection()->action("by_owner"); + break; + case DolphinView::SortByGroup: + action = actionCollection()->action("by_group"); + break; + default: + break; } if (action != 0) { @@ -324,19 +318,19 @@ void DolphinMainWindow::slotAdditionalInfoChanged(KFileItemDelegate::AdditionalI { QAction* action = 0; switch (info) { - case KFileItemDelegate::FriendlyMimeType: - action = actionCollection()->action("show_mime_info"); - break; - case KFileItemDelegate::Size: - action = actionCollection()->action("show_size_info"); - break; - case KFileItemDelegate::ModificationTime: - action = actionCollection()->action("show_date_info"); - break; - case KFileItemDelegate::NoInformation: - default: - action = actionCollection()->action("clear_info"); - break; + case KFileItemDelegate::FriendlyMimeType: + action = actionCollection()->action("show_mime_info"); + break; + case KFileItemDelegate::Size: + action = actionCollection()->action("show_size_info"); + break; + case KFileItemDelegate::ModificationTime: + action = actionCollection()->action("show_date_info"); + break; + case KFileItemDelegate::NoInformation: + default: + action = actionCollection()->action("clear_info"); + break; } if (action != 0) { @@ -430,8 +424,7 @@ void DolphinMainWindow::readProperties(KConfig* config) } m_view[SecondaryIdx]->setUrl(secondaryView.readEntry("Url")); m_view[SecondaryIdx]->setUrlEditable(secondaryView.readEntry("Editable Url", false)); - } - else if (m_view[SecondaryIdx] != 0) { + } else if (m_view[SecondaryIdx] != 0) { toggleSplitView(); } } @@ -462,9 +455,9 @@ void DolphinMainWindow::deleteItems() const KUrl::List list = m_activeView->selectedUrls(); const bool del = KonqOperations::askDeleteConfirmation(list, - KonqOperations::DEL, - KonqOperations::DEFAULT_CONFIRMATION, - this); + KonqOperations::DEL, + KonqOperations::DEFAULT_CONFIRMATION, + this); if (del) { KIO::Job* job = KIO::del(list); @@ -515,34 +508,34 @@ void DolphinMainWindow::slotUndoAvailable(bool available) const KonqUndoManager::CommandType command = m_undoCommandTypes.takeFirst(); DolphinStatusBar* statusBar = m_activeView->statusBar(); switch (command) { - case KonqUndoManager::COPY: - statusBar->setMessage(i18n("Copy operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KonqUndoManager::MOVE: - statusBar->setMessage(i18n("Move operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KonqUndoManager::LINK: - statusBar->setMessage(i18n("Link operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KonqUndoManager::TRASH: - statusBar->setMessage(i18n("Move to trash operation completed."), - DolphinStatusBar::OperationCompleted); - break; - case KonqUndoManager::RENAME: - statusBar->setMessage(i18n("Renaming operation completed."), - DolphinStatusBar::OperationCompleted); - break; - - case KonqUndoManager::MKDIR: - statusBar->setMessage(i18n("Created directory."), - DolphinStatusBar::OperationCompleted); - break; - - default: - break; + case KonqUndoManager::COPY: + statusBar->setMessage(i18n("Copy operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KonqUndoManager::MOVE: + statusBar->setMessage(i18n("Move operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KonqUndoManager::LINK: + statusBar->setMessage(i18n("Link operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KonqUndoManager::TRASH: + statusBar->setMessage(i18n("Move to trash operation completed."), + DolphinStatusBar::OperationCompleted); + break; + case KonqUndoManager::RENAME: + statusBar->setMessage(i18n("Renaming operation completed."), + DolphinStatusBar::OperationCompleted); + break; + + case KonqUndoManager::MKDIR: + statusBar->setMessage(i18n("Created directory."), + DolphinStatusBar::OperationCompleted); + break; + + default: + break; } } @@ -610,8 +603,7 @@ void DolphinMainWindow::paste() if (KonqMimeData::decodeIsCutSelection(mimeData)) { moveUrls(sourceUrls, destUrl); clipboard->clear(); - } - else { + } else { copyUrls(sourceUrls, destUrl); } } @@ -632,8 +624,7 @@ void DolphinMainWindow::updatePasteAction() pasteAction->setEnabled(true); pasteAction->setText(i18np("Paste One File", "Paste %1 Files", urls.count())); - } - else { + } else { pasteAction->setEnabled(false); pasteAction->setText(i18n("Paste")); } @@ -645,8 +636,7 @@ void DolphinMainWindow::updatePasteAction() // pasting should not be allowed when more than one file // is selected pasteAction->setEnabled(false); - } - else if (count == 1) { + } else if (count == 1) { // Only one file is selected. Pasting is only allowed if this // file is a directory. // TODO: this doesn't work with remote protocols; instead we need a @@ -762,16 +752,14 @@ void DolphinMainWindow::toggleSplitView() m_splitter->setSizes(QList() << newWidth << newWidth); m_view[SecondaryIdx]->reload(); m_view[SecondaryIdx]->show(); - } - else { + } else { // remove secondary view if (m_activeView == m_view[PrimaryIdx]) { m_view[SecondaryIdx]->close(); m_view[SecondaryIdx]->deleteLater(); m_view[SecondaryIdx] = 0; setActiveView(m_view[PrimaryIdx]); - } - else { + } else { // The secondary view is active, hence from the users point of view // the content of the secondary view should be moved to the primary view. // From an implementation point of view it is more efficient to close @@ -793,8 +781,7 @@ void DolphinMainWindow::reloadView() } void DolphinMainWindow::stopLoading() -{ -} +{} void DolphinMainWindow::togglePreview() { @@ -911,35 +898,35 @@ void DolphinMainWindow::compareFiles() KUrl::List urls = m_view[PrimaryIdx]->selectedUrls(); switch (urls.count()) { - case 0: { - Q_ASSERT(m_view[SecondaryIdx] != 0); - urls = m_view[SecondaryIdx]->selectedUrls(); - Q_ASSERT(urls.count() == 2); - urlA = urls[0]; - urlB = urls[1]; - break; - } + case 0: { + Q_ASSERT(m_view[SecondaryIdx] != 0); + urls = m_view[SecondaryIdx]->selectedUrls(); + Q_ASSERT(urls.count() == 2); + urlA = urls[0]; + urlB = urls[1]; + break; + } - case 1: { - urlA = urls[0]; - Q_ASSERT(m_view[SecondaryIdx] != 0); - urls = m_view[SecondaryIdx]->selectedUrls(); - Q_ASSERT(urls.count() == 1); - urlB = urls[0]; - break; - } + case 1: { + urlA = urls[0]; + Q_ASSERT(m_view[SecondaryIdx] != 0); + urls = m_view[SecondaryIdx]->selectedUrls(); + Q_ASSERT(urls.count() == 1); + urlB = urls[0]; + break; + } - case 2: { - urlA = urls[0]; - urlB = urls[1]; - break; - } + case 2: { + urlA = urls[0]; + urlB = urls[1]; + break; + } - default: { - // may not happen: compareFiles may only get invoked if 2 - // files are selected - Q_ASSERT(false); - } + default: { + // may not happen: compareFiles may only get invoked if 2 + // files are selected + Q_ASSERT(false); + } } QString command("kompare -c \""); @@ -993,7 +980,7 @@ void DolphinMainWindow::init() setCentralWidget(m_splitter); setupDockWidgets(); - setupGUI(Keys|Save|Create|ToolBar); + setupGUI(Keys | Save | Create | ToolBar); createGUI(); stateChanged("new_file"); @@ -1011,10 +998,10 @@ void DolphinMainWindow::init() // assure a proper default size if Dolphin runs the first time resize(640, 480); } - #ifdef HAVE_KMETADATA - if ( !MetaDataWidget::metaDataAvailable() ) +#ifdef HAVE_KMETADATA + if (!MetaDataWidget::metaDataAvailable()) activeView()->statusBar()->setMessage(i18n("Failed to contact Nepomuk service, annotation and tagging are disabled."), DolphinStatusBar::Error); - #endif +#endif emit urlChanged(homeUrl); } @@ -1104,12 +1091,12 @@ void DolphinMainWindow::setupActions() // setup 'View' menu KStandardAction::zoomIn(this, - SLOT(zoomIn()), - actionCollection()); + SLOT(zoomIn()), + actionCollection()); KStandardAction::zoomOut(this, - SLOT(zoomOut()), - actionCollection()); + SLOT(zoomOut()), + actionCollection()); KToggleAction* iconsView = actionCollection()->add("icons"); iconsView->setText(i18n("Icons")); @@ -1342,8 +1329,7 @@ void DolphinMainWindow::updateEditActions() const KFileItemList list = m_activeView->selectedItems(); if (list.isEmpty()) { stateChanged("has_no_selection"); - } - else { + } else { stateChanged("has_selection"); QAction* renameAction = actionCollection()->action("rename"); @@ -1385,17 +1371,17 @@ void DolphinMainWindow::updateViewActions() QAction* action = 0; switch (m_activeView->mode()) { - case DolphinView::IconsView: - action = actionCollection()->action("icons"); - break; - case DolphinView::DetailsView: - action = actionCollection()->action("details"); - break; - case DolphinView::ColumnView: - action = actionCollection()->action("columns"); - break; - default: - break; + case DolphinView::IconsView: + action = actionCollection()->action("icons"); + break; + case DolphinView::DetailsView: + action = actionCollection()->action("details"); + break; + case DolphinView::ColumnView: + action = actionCollection()->action("columns"); + break; + default: + break; } if (action != 0) { @@ -1491,25 +1477,24 @@ void DolphinMainWindow::connectSidebarPage(SidebarPage* page) this, SLOT(changeUrl(KUrl))); connect(page, SIGNAL(changeSelection(KFileItemList)), this, SLOT(changeSelection(KFileItemList))); - connect(page, SIGNAL(urlsDropped(KUrl::List,KUrl)), - this, SLOT(dropUrls(KUrl::List,KUrl))); + connect(page, SIGNAL(urlsDropped(KUrl::List, KUrl)), + this, SLOT(dropUrls(KUrl::List, KUrl))); connect(this, SIGNAL(urlChanged(KUrl)), page, SLOT(setUrl(KUrl))); - connect(this, SIGNAL(selectionChanged(KFileItemList)), - page, SLOT(setSelection(KFileItemList))); + connect(this, SIGNAL(selectionChanged(KFileItemList)), + page, SLOT(setSelection(KFileItemList))); } DolphinMainWindow::UndoUiInterface::UndoUiInterface(DolphinMainWindow* mainWin) : - KonqUndoManager::UiInterface(mainWin), - m_mainWin(mainWin) + KonqUndoManager::UiInterface(mainWin), + m_mainWin(mainWin) { Q_ASSERT(m_mainWin != 0); } DolphinMainWindow::UndoUiInterface::~UndoUiInterface() -{ -} +{} void DolphinMainWindow::UndoUiInterface::jobError(KIO::Job* job) { diff --git a/src/dolphinmainwindow.h b/src/dolphinmainwindow.h index c6b46817f..4212a0987 100644 --- a/src/dolphinmainwindow.h +++ b/src/dolphinmainwindow.h @@ -51,19 +51,22 @@ class DolphinMainWindow: public KMainWindow public: virtual ~DolphinMainWindow(); - /** - * Activates the given view, which means that - * all menu actions are applied to this view. When - * having a split view setup the nonactive view - * is usually shown in darker colors. - */ + /** + * Activates the given view, which means that + * all menu actions are applied to this view. When + * having a split view setup the nonactive view + * is usually shown in darker colors. + */ void setActiveView(DolphinView* view); /** * Returns the currently active view. See * DolphinMainWindow::setActiveView() for more details. */ - DolphinView* activeView() const { return m_activeView; } + DolphinView* activeView() const + { + return m_activeView; + } /** Renames the item represented by \a oldUrl to \a newUrl. */ void rename(const KUrl& oldUrl, const KUrl& newUrl); @@ -78,7 +81,10 @@ public: * Returns the 'Create New...' sub menu which also can be shared * with other menus (e. g. a context menu). */ - KNewMenu* newMenu() const { return m_newMenu; } + KNewMenu* newMenu() const + { + return m_newMenu; + } public slots: /** @@ -98,7 +104,10 @@ public slots: /** * Returns the main window ID used through DBus. */ - int getId() const { return m_id; } + int getId() const + { + return m_id; + } /** * Inform all affected dolphin components (sidebars, views) of an URL @@ -425,7 +434,7 @@ private: * assures that all errors are shown in the status bar of Dolphin * instead as modal error dialog with an OK button. */ - class UndoUiInterface : public KonqUndoManager::UiInterface +class UndoUiInterface : public KonqUndoManager::UiInterface { public: UndoUiInterface(DolphinMainWindow* mainWin); diff --git a/src/dolphinnewmenu.cpp b/src/dolphinnewmenu.cpp index 8592c30ad..b78c109cb 100644 --- a/src/dolphinnewmenu.cpp +++ b/src/dolphinnewmenu.cpp @@ -27,22 +27,19 @@ #include DolphinNewMenu::DolphinNewMenu(DolphinMainWindow* mainWin) : - KNewMenu(mainWin->actionCollection(), mainWin, "create_new"), - m_mainWin(mainWin) -{ -} + KNewMenu(mainWin->actionCollection(), mainWin, "create_new"), + m_mainWin(mainWin) +{} DolphinNewMenu::~DolphinNewMenu() -{ -} +{} void DolphinNewMenu::slotResult(KJob* job) { if (job->error()) { DolphinStatusBar* statusBar = m_mainWin->activeView()->statusBar(); statusBar->setMessage(job->errorString(), DolphinStatusBar::Error); - } - else { + } else { KNewMenu::slotResult(job); } } diff --git a/src/dolphinnewmenu.h b/src/dolphinnewmenu.h index 978c1ce59..8db07548f 100644 --- a/src/dolphinnewmenu.h +++ b/src/dolphinnewmenu.h @@ -36,7 +36,7 @@ class KJob; */ class DolphinNewMenu : public KNewMenu { -Q_OBJECT + Q_OBJECT public: DolphinNewMenu(DolphinMainWindow* mainWin); diff --git a/src/dolphinsettings.h b/src/dolphinsettings.h index 202ce1db7..327e4defc 100644 --- a/src/dolphinsettings.h +++ b/src/dolphinsettings.h @@ -40,15 +40,31 @@ class KFilePlacesModel; * - bookmarks * - properties for icons and details view */ -class LIBDOLPHINPRIVATE_EXPORT DolphinSettings { +class LIBDOLPHINPRIVATE_EXPORT DolphinSettings +{ public: static DolphinSettings& instance(); - GeneralSettings* generalSettings() const { return m_generalSettings; } - IconsModeSettings* iconsModeSettings() const { return m_iconsModeSettings; } - DetailsModeSettings* detailsModeSettings() const { return m_detailsModeSettings; } - ColumnModeSettings* columnModeSettings() const { return m_columnModeSettings; } - KFilePlacesModel* placesModel() const { return m_placesModel; } + GeneralSettings* generalSettings() const + { + return m_generalSettings; + } + IconsModeSettings* iconsModeSettings() const + { + return m_iconsModeSettings; + } + DetailsModeSettings* detailsModeSettings() const + { + return m_detailsModeSettings; + } + ColumnModeSettings* columnModeSettings() const + { + return m_columnModeSettings; + } + KFilePlacesModel* placesModel() const + { + return m_placesModel; + } /** @see DolphinSettingsBase::save */ virtual void save(); diff --git a/src/dolphinsettingsdialog.cpp b/src/dolphinsettingsdialog.cpp index 53579f5ad..909fd6f28 100644 --- a/src/dolphinsettingsdialog.cpp +++ b/src/dolphinsettingsdialog.cpp @@ -29,15 +29,15 @@ #include DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) : - KPageDialog(), - m_mainWindow(mainWindow) + KPageDialog(), + m_mainWindow(mainWindow) { const QSize minSize = minimumSize(); setMinimumSize(QSize(512, minSize.height())); - setFaceType( List); + setFaceType(List); setCaption(i18n("Dolphin Preferences")); - setButtons(Ok|Apply|Cancel); + setButtons(Ok | Apply | Cancel); setDefaultButton(Ok); m_generalSettingsPage = new GeneralSettingsPage(mainWindow, this); @@ -50,12 +50,11 @@ DolphinSettingsDialog::DolphinSettingsDialog(DolphinMainWindow* mainWindow) : } DolphinSettingsDialog::~DolphinSettingsDialog() -{ -} +{} void DolphinSettingsDialog::slotButtonClicked(int button) { - if (button==Ok || button==Apply) { + if (button == Ok || button == Apply) { applySettings(); } KPageDialog::slotButtonClicked(button); diff --git a/src/dolphinsettingsdialog.h b/src/dolphinsettingsdialog.h index 3854d2dcd..95150dab8 100644 --- a/src/dolphinsettingsdialog.h +++ b/src/dolphinsettingsdialog.h @@ -34,7 +34,8 @@ class DolphinMainWindow; * * @author Peter Penz */ -class DolphinSettingsDialog : public KPageDialog { +class DolphinSettingsDialog : public KPageDialog +{ Q_OBJECT public: diff --git a/src/dolphinsortfilterproxymodel.cpp b/src/dolphinsortfilterproxymodel.cpp index e42843cb4..aba4117e8 100644 --- a/src/dolphinsortfilterproxymodel.cpp +++ b/src/dolphinsortfilterproxymodel.cpp @@ -25,30 +25,32 @@ #include static const int dolphinMapSize = 6; -static int dolphinViewToDirModelColumn[] = { - KDirModel::Name, // DolphinView::SortByName - KDirModel::Size, // DolphinView::SortBySize - KDirModel::ModifiedTime, // DolphinView::SortByDate - KDirModel::Permissions, // DolphinView::SortByPermissions - KDirModel::Owner, // DolphinView::SortByOwner - KDirModel::Group // DolphinView::SortByGroup -}; - -static DolphinView::Sorting dirModelColumnToDolphinView[] = { - DolphinView::SortByName, // KDirModel::Name - DolphinView::SortBySize, // KDirModel::Size - DolphinView::SortByDate, // KDirModel::ModifiedTime - DolphinView::SortByPermissions, // KDirModel::Permissions - DolphinView::SortByOwner, // KDirModel::Owner - DolphinView::SortByGroup // KDirModel::Group -}; +static int dolphinViewToDirModelColumn[] = + { + KDirModel::Name, // DolphinView::SortByName + KDirModel::Size, // DolphinView::SortBySize + KDirModel::ModifiedTime, // DolphinView::SortByDate + KDirModel::Permissions, // DolphinView::SortByPermissions + KDirModel::Owner, // DolphinView::SortByOwner + KDirModel::Group // DolphinView::SortByGroup + }; + +static DolphinView::Sorting dirModelColumnToDolphinView[] = + { + DolphinView::SortByName, // KDirModel::Name + DolphinView::SortBySize, // KDirModel::Size + DolphinView::SortByDate, // KDirModel::ModifiedTime + DolphinView::SortByPermissions, // KDirModel::Permissions + DolphinView::SortByOwner, // KDirModel::Owner + DolphinView::SortByGroup // KDirModel::Group + }; DolphinSortFilterProxyModel::DolphinSortFilterProxyModel(QObject* parent) : - QSortFilterProxyModel(parent), - m_sortColumn(0), - m_sorting(DolphinView::SortByName), - m_sortOrder(Qt::AscendingOrder) + QSortFilterProxyModel(parent), + m_sortColumn(0), + m_sorting(DolphinView::SortByName), + m_sortOrder(Qt::AscendingOrder) { setDynamicSortFilter(true); @@ -59,8 +61,7 @@ DolphinSortFilterProxyModel::DolphinSortFilterProxyModel(QObject* parent) : } DolphinSortFilterProxyModel::~DolphinSortFilterProxyModel() -{ -} +{} void DolphinSortFilterProxyModel::setSorting(DolphinView::Sorting sorting) { @@ -108,7 +109,7 @@ DolphinView::Sorting DolphinSortFilterProxyModel::sortingForColumn(int column) } bool DolphinSortFilterProxyModel::lessThan(const QModelIndex& left, - const QModelIndex& right) const + const QModelIndex& right) const { KDirModel* dirModel = static_cast(sourceModel()); @@ -134,7 +135,7 @@ bool DolphinSortFilterProxyModel::lessThan(const QModelIndex& left, const QString rightStr = rightData.toString(); return sortCaseSensitivity() ? (naturalCompare(leftStr, rightStr) < 0) : - (naturalCompare(leftStr.toLower(), rightStr.toLower()) < 0); + (naturalCompare(leftStr.toLower(), rightStr.toLower()) < 0); } // We have set a SortRole and trust the ProxyModel to do @@ -143,7 +144,7 @@ bool DolphinSortFilterProxyModel::lessThan(const QModelIndex& left, } int DolphinSortFilterProxyModel::naturalCompare(const QString& a, - const QString& b) + const QString& b) { // This method chops the input a and b into pieces of // digits and non-digits (a1.05 becomes a | 1 | . | 05) @@ -193,24 +194,19 @@ int DolphinSortFilterProxyModel::naturalCompare(const QString& a, while (1) { if (!currA->isDigit() && !currB->isDigit()) { break; - } - else if (!currA->isDigit()) { + } else if (!currA->isDigit()) { return -1; - } - else if (!currB->isDigit()) { - return +1; - } - else if (*currA < *currB ) { + } else if (!currB->isDigit()) { + return + 1; + } else if (*currA < *currB) { return -1; - } - else if (*currA > *currB) { - return +1; + } else if (*currA > *currB) { + return + 1; } ++currA; ++currB; } - } - else { + } else { // No digit-sequence starts with 0 -> assume we are looking at some integer // do right aligned comparison. // @@ -225,18 +221,14 @@ int DolphinSortFilterProxyModel::naturalCompare(const QString& a, return weight; } break; - } - else if (!currA->isDigit()) { + } else if (!currA->isDigit()) { return -1; - } - else if (!currB->isDigit()) { - return +1; - } - else if ((*currA < *currB) && (weight == 0)) { + } else if (!currB->isDigit()) { + return + 1; + } else if ((*currA < *currB) && (weight == 0)) { weight = -1; - } - else if ((*currA > *currB) && (weight == 0)) { - weight = +1; + } else if ((*currA > *currB) && (weight == 0)) { + weight = + 1; } ++currA; ++currB; @@ -251,7 +243,7 @@ int DolphinSortFilterProxyModel::naturalCompare(const QString& a, return 0; } - return currA->isNull() ? -1 : +1; + return currA->isNull() ? -1 : + 1; } #include "dolphinsortfilterproxymodel.moc" diff --git a/src/dolphinsortfilterproxymodel.h b/src/dolphinsortfilterproxymodel.h index 2db8ee267..e7fc78182 100644 --- a/src/dolphinsortfilterproxymodel.h +++ b/src/dolphinsortfilterproxymodel.h @@ -48,10 +48,16 @@ public: virtual ~DolphinSortFilterProxyModel(); void setSorting(DolphinView::Sorting sorting); - DolphinView::Sorting sorting() const { return m_sorting; } + DolphinView::Sorting sorting() const + { + return m_sorting; + } void setSortOrder(Qt::SortOrder sortOrder); - Qt::SortOrder sortOrder() const { return m_sortOrder; } + Qt::SortOrder sortOrder() const + { + return m_sortOrder; + } /** * @reimplemented, @internal diff --git a/src/dolphinstatusbar.cpp b/src/dolphinstatusbar.cpp index f908a24cd..1f6859a8f 100644 --- a/src/dolphinstatusbar.cpp +++ b/src/dolphinstatusbar.cpp @@ -31,11 +31,11 @@ #include DolphinStatusBar::DolphinStatusBar(DolphinView* parent) : - KHBox(parent), - m_messageLabel(0), - m_spaceInfo(0), - m_progressBar(0), - m_progress(100) + KHBox(parent), + m_messageLabel(0), + m_spaceInfo(0), + m_progressBar(0), + m_progress(100) { setSpacing(4); @@ -65,8 +65,7 @@ DolphinStatusBar::DolphinStatusBar(DolphinView* parent) : DolphinStatusBar::~DolphinStatusBar() -{ -} +{} void DolphinStatusBar::setMessage(const QString& msg, Type type) @@ -105,8 +104,7 @@ void DolphinStatusBar::setProgress(int percent) { if (percent < 0) { percent = 0; - } - else if (percent > 100) { + } else if (percent > 100) { percent = 100; } @@ -126,8 +124,7 @@ void DolphinStatusBar::setProgress(int percent) const QString msg(m_messageLabel->text()); if ((percent == 0) && !msg.isEmpty()) { setMessage(QString(), Default); - } - else if ((percent == 100) && (msg != defaultText)) { + } else if ((percent == 100) && (msg != defaultText)) { setMessage(defaultText, Default); } } @@ -163,8 +160,7 @@ void DolphinStatusBar::updateProgressInfo() m_progressText->show(); m_progressBar->show(); } - } - else { + } else { // hide the progress information and show the space information m_progressText->hide(); m_progressBar->hide(); @@ -191,8 +187,7 @@ void DolphinStatusBar::showSpaceInfo() if (isProgressBarVisible || (widthGap > 0)) { m_spaceInfo->hide(); } - } - else if (widthGap + m_spaceInfo->width() <= 0) { + } else if (widthGap + m_spaceInfo->width() <= 0) { m_spaceInfo->show(); } } diff --git a/src/dolphinstatusbar.h b/src/dolphinstatusbar.h index 5a04b21cb..e57288228 100644 --- a/src/dolphinstatusbar.h +++ b/src/dolphinstatusbar.h @@ -37,7 +37,8 @@ class QTimer; * The statusbar allows to show messages and progress * information. */ -class DolphinStatusBar : public KHBox { +class DolphinStatusBar : public KHBox +{ Q_OBJECT public: @@ -93,7 +94,10 @@ public: * operations. */ void setProgress(int percent); - int progress() const { return m_progress; } + int progress() const + { + return m_progress; + } /** * Clears the message text of the status bar by replacing diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 3b5610f60..45717afc1 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -63,26 +63,26 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow, const KUrl& url, Mode mode, bool showHiddenFiles) : - QWidget(parent), - m_showProgress(false), - m_blockContentsMovedSignal(false), - m_mode(mode), - m_iconSize(0), - m_folderCount(0), - m_fileCount(0), - m_mainWindow(mainWindow), - m_topLayout(0), - m_urlNavigator(0), - m_controller(0), - m_iconsView(0), - m_detailsView(0), - m_columnView(0), - m_fileItemDelegate(0), - m_filterBar(0), - m_statusBar(0), - m_dirModel(0), - m_dirLister(0), - m_proxyModel(0) + QWidget(parent), + m_showProgress(false), + m_blockContentsMovedSignal(false), + m_mode(mode), + m_iconSize(0), + m_folderCount(0), + m_fileCount(0), + m_mainWindow(mainWindow), + m_topLayout(0), + m_urlNavigator(0), + m_controller(0), + m_iconsView(0), + m_detailsView(0), + m_columnView(0), + m_fileItemDelegate(0), + m_filterBar(0), + m_statusBar(0), + m_dirModel(0), + m_dirLister(0), + m_proxyModel(0) { hide(); setFocusPolicy(Qt::StrongFocus); @@ -164,7 +164,7 @@ DolphinView::DolphinView(DolphinMainWindow* mainWindow, m_filterBar = new FilterBar(this); m_filterBar->hide(); connect(m_filterBar, SIGNAL(filterChanged(const QString&)), - this, SLOT(changeNameFilter(const QString&))); + this, SLOT(changeNameFilter(const QString&))); connect(m_filterBar, SIGNAL(closeRequest()), this, SLOT(closeFilterBar())); @@ -271,8 +271,7 @@ void DolphinView::renameSelectedItems() if (newName.isEmpty()) { view->statusBar()->setMessage(dialog.errorString(), DolphinStatusBar::Error); - } - else { + } else { // TODO: check how this can be integrated into KonqUndoManager/KonqOperations // as one operation instead of n rename operations like it is done now... Q_ASSERT(newName.contains('#')); @@ -300,8 +299,7 @@ void DolphinView::renameSelectedItems() ++it; } } - } - else { + } else { // Only one item has been selected for renaming. Use the custom // renaming mechanism from the views. Q_ASSERT(urls.count() == 1); @@ -318,8 +316,7 @@ void DolphinView::renameSelectedItems() if (newName.isEmpty()) { view->statusBar()->setMessage(dialog.errorString(), DolphinStatusBar::Error); - } - else { + } else { const KUrl& oldUrl = urls.first(); KUrl newUrl = oldUrl; newUrl.setFileName(newName); @@ -360,7 +357,7 @@ void DolphinView::emitRequestItemInfo(const KUrl& url) bool DolphinView::isFilterBarVisible() const { - return m_filterBar->isVisible(); + return m_filterBar->isVisible(); } bool DolphinView::isUrlEditable() const @@ -522,8 +519,8 @@ void DolphinView::rename(const KUrl& source, const QString& newName) dest.addPath(newName); const bool destExists = KIO::NetAccess::exists(dest, - false, - mainWindow()->activeView()); + false, + mainWindow()->activeView()); if (destExists) { // the destination already exists, hence ask the user // how to proceed... @@ -533,25 +530,24 @@ void DolphinView::rename(const KUrl& source, const QString& newName) dest.path(), KIO::M_OVERWRITE); switch (renameDialog.exec()) { - case KIO::R_OVERWRITE: - // the destination should be overwritten - ok = KIO::NetAccess::file_move(source, dest, -1, true); - break; - - case KIO::R_RENAME: { - // a new name for the destination has been used - KUrl newDest(renameDialog.newDestUrl()); - ok = KIO::NetAccess::file_move(source, newDest); - break; - } + case KIO::R_OVERWRITE: + // the destination should be overwritten + ok = KIO::NetAccess::file_move(source, dest, -1, true); + break; - default: - // the renaming operation has been canceled - reload(); - return; + case KIO::R_RENAME: { + // a new name for the destination has been used + KUrl newDest(renameDialog.newDestUrl()); + ok = KIO::NetAccess::file_move(source, newDest); + break; } - } - else { + + default: + // the renaming operation has been canceled + reload(); + return; + } + } else { // no destination exists, hence just move the file to // do the renaming ok = KIO::NetAccess::file_move(source, dest); @@ -559,13 +555,12 @@ void DolphinView::rename(const KUrl& source, const QString& newName) const QString destFileName = dest.fileName(); if (ok) { - m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.",source.fileName(), destFileName), + m_statusBar->setMessage(i18n("Renamed file '%1' to '%2'.", source.fileName(), destFileName), DolphinStatusBar::OperationCompleted); KonqOperations::rename(this, source, destFileName); - } - else { - m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.",source.fileName(), destFileName), + } else { + m_statusBar->setMessage(i18n("Renaming of file '%1' to '%2' failed.", source.fileName(), destFileName), DolphinStatusBar::Error); reload(); } @@ -589,7 +584,7 @@ DolphinMainWindow* DolphinView::mainWindow() const void DolphinView::loadDirectory(const KUrl& url) { - if(!isActive()) { + if (!isActive()) { requestActivation(); } @@ -675,34 +670,29 @@ void DolphinView::triggerItem(const QModelIndex& index) KUrl url; if (localPath.isEmpty()) { url = item->url(); - } - else { + } else { url = localPath; } if (item->isDir()) { setUrl(url); - } - else if (item->isFile()) { + } else if (item->isFile()) { // allow to browse through ZIP and tar files KMimeType::Ptr mime = item->mimeTypePtr(); if (mime->is("application/zip")) { url.setProtocol("zip"); setUrl(url); - } - else 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")) { + } else 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")) { url.setProtocol("tar"); setUrl(url); - } - else { + } else { item->run(); } - } - else { + } else { item->run(); } } @@ -733,8 +723,7 @@ void DolphinView::updateItemCount() KFileItem* item = *it; if (item->isDir()) { ++m_folderCount; - } - else { + } else { ++m_fileCount; } ++it; @@ -765,8 +754,7 @@ void DolphinView::showPreview(const KFileItem* item, const QPixmap& pixmap) KIconEffect iconEffect; const QPixmap cutPixmap = iconEffect.apply(pixmap, K3Icon::Desktop, K3Icon::DisabledState); m_dirModel->setData(idx, QIcon(cutPixmap), Qt::DecorationRole); - } - else { + } else { m_dirModel->setData(idx, QIcon(pixmap), Qt::DecorationRole); } } @@ -811,9 +799,8 @@ void DolphinView::startDirLister(const KUrl& url, bool reload) const QString location(url.pathOrUrl()); if (location.isEmpty()) { m_statusBar->setMessage(i18n("The location is empty."), DolphinStatusBar::Error); - } - else { - m_statusBar->setMessage(i18n("The location '%1' is invalid.",location), + } else { + m_statusBar->setMessage(i18n("The location '%1' is invalid.", location), DolphinStatusBar::Error); } return; @@ -844,19 +831,17 @@ void DolphinView::startDirLister(const KUrl& url, bool reload) if (dirListerUrl.isValid()) { const KUrl::List dirs = m_dirLister->directories(); KUrl url; - foreach (url, dirs) { + foreach(url, dirs) { m_dirLister->updateDirectory(url); } openDir = false; } - } - else if (m_dirLister->directories().contains(url)) { + } else if (m_dirLister->directories().contains(url)) { // The dir lister contains the directory already, so // KDirLister::openUrl() may not been invoked twice. m_dirLister->updateDirectory(url); openDir = false; - } - else { + } else { const KUrl& dirListerUrl = m_dirLister->url(); if ((dirListerUrl == url) || !m_dirLister->url().isParentOf(url)) { // The current URL is not a child of the dir lister @@ -895,12 +880,11 @@ QString DolphinView::selectionStatusBarText() const KIO::filesize_t byteSize = 0; KFileItemList::const_iterator it = list.begin(); const KFileItemList::const_iterator end = list.end(); - while (it != end){ + while (it != end) { KFileItem* item = *it; if (item->isDir()) { ++folderCount; - } - else { + } else { ++fileCount; byteSize += item->size(); } @@ -927,8 +911,7 @@ void DolphinView::showFilterBar(bool show) Q_ASSERT(m_filterBar != 0); if (show) { m_filterBar->show(); - } - else { + } else { m_filterBar->hide(); } } @@ -970,7 +953,7 @@ void DolphinView::changeSelection(const KFileItemList& selection) KUrl baseUrl = url(); KUrl url; QItemSelection new_selection; - foreach (KFileItem* item, selection) { + foreach(KFileItem* item, selection) { url = item->url().upUrl(); if (baseUrl.equals(url, KUrl::CompareWithoutTrailingSlash)) { QModelIndex index = m_proxyModel->mapFromSource(m_dirModel->indexForItem(*item)); @@ -1003,7 +986,7 @@ void DolphinView::changeNameFilter(const QString& nameFilter) m_dirLister->setNameFilter(adjustedFilter); m_dirLister->emitChanges(); #else - m_proxyModel->setFilterRegExp( nameFilter ); + m_proxyModel->setFilterRegExp(nameFilter); #endif } @@ -1041,7 +1024,7 @@ void DolphinView::dropUrls(const KUrl::List& urls, } const KUrl& destination = (directory == 0) ? url() : - directory->url(); + directory->url(); dropUrls(urls, destination); } @@ -1081,7 +1064,7 @@ void DolphinView::emitContentsMoved() void DolphinView::updateActivationState() { m_urlNavigator->setActive(isActive()); - if(isActive()) { + if (isActive()) { emit urlChanged(url()); emit selectionChanged(selectedItems()); } @@ -1127,20 +1110,20 @@ void DolphinView::createView() // ... and recreate it representing the current mode switch (m_mode) { - case IconsView: - m_iconsView = new DolphinIconsView(this, m_controller); - view = m_iconsView; - break; - - case DetailsView: - m_detailsView = new DolphinDetailsView(this, m_controller); - view = m_detailsView; - break; - - case ColumnView: - m_columnView = new DolphinColumnView(this, m_controller); - view = m_columnView; - break; + case IconsView: + m_iconsView = new DolphinIconsView(this, m_controller); + view = m_iconsView; + break; + + case DetailsView: + m_detailsView = new DolphinDetailsView(this, m_controller); + view = m_detailsView; + break; + + case ColumnView: + m_columnView = new DolphinColumnView(this, m_controller); + view = m_columnView; + break; } Q_ASSERT(view != 0); @@ -1169,7 +1152,7 @@ void DolphinView::selectAll(QItemSelectionModel::SelectionFlags flags) const QModelIndex topLeft = itemModel->index(0, 0); const QModelIndex bottomRight = itemModel->index(itemModel->rowCount() - 1, - itemModel->columnCount() - 1); + itemModel->columnCount() - 1); QItemSelection selection(topLeft, bottomRight); selectionModel->select(selection, flags); @@ -1179,8 +1162,7 @@ QAbstractItemView* DolphinView::itemView() const { if (m_detailsView != 0) { return m_detailsView; - } - else if (m_columnView != 0) { + } else if (m_columnView != 0) { return m_columnView; } @@ -1200,7 +1182,7 @@ bool DolphinView::isCutItem(const KFileItem& item) const const KUrl& itemUrl = item.url(); KUrl::List::const_iterator it = cutUrls.begin(); const KUrl::List::const_iterator end = cutUrls.end(); - while (it != end){ + while (it != end) { if (*it == itemUrl) { return true; } diff --git a/src/dolphinview.h b/src/dolphinview.h index 2118aaf56..4f78f050b 100644 --- a/src/dolphinview.h +++ b/src/dolphinview.h @@ -72,12 +72,12 @@ class DolphinView : public QWidget Q_OBJECT public: - /** - * Defines the view mode for a directory. The view mode - * can be defined when constructing a DolphinView. The - * view mode is automatically updated if the directory itself - * defines a view mode (see class ViewProperties for details). - */ + /** + * Defines the view mode for a directory. The view mode + * can be defined when constructing a DolphinView. The + * view mode is automatically updated if the directory itself + * defines a view mode (see class ViewProperties for details). + */ enum Mode { /** @@ -307,7 +307,10 @@ public: KFileItemDelegate::AdditionalInformation additionalInfo() const; /** Returns the KUrlNavigator of the view for read access. */ - const KUrlNavigator* urlNavigator() const { return m_urlNavigator; } + const KUrlNavigator* urlNavigator() const + { + return m_urlNavigator; + } /** * Triggers to request user information for the item given @@ -550,14 +553,18 @@ private: * requires some special handling for iterating through directories, * this method has been introduced for convenience. */ - bool isColumnViewActive() const { return m_columnView != 0; } + bool isColumnViewActive() const + { + return m_columnView != 0; + } private: /** * Remembers the original pixmap for an item before * the cut effect is applied. */ - struct CutItem { + struct CutItem + { KUrl url; QPixmap pixmap; }; diff --git a/src/filterbar.cpp b/src/filterbar.cpp index f7c582262..46c28f3c2 100644 --- a/src/filterbar.cpp +++ b/src/filterbar.cpp @@ -32,7 +32,7 @@ #include "dolphinmainwindow.h" FilterBar::FilterBar(QWidget* parent) : - QWidget(parent) + QWidget(parent) { const int gap = 3; @@ -65,8 +65,7 @@ FilterBar::FilterBar(QWidget* parent) : } FilterBar::~FilterBar() -{ -} +{} void FilterBar::hideEvent(QHideEvent* event) { diff --git a/src/generalsettingspage.cpp b/src/generalsettingspage.cpp index 2961cf0d6..4a2b6df68 100644 --- a/src/generalsettingspage.cpp +++ b/src/generalsettingspage.cpp @@ -38,13 +38,13 @@ #include "dolphin_generalsettings.h" -GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* parent) : - SettingsPageBase(parent), - m_mainWindow(mainWin), - m_homeUrl(0), - m_startSplit(0), - m_startEditable(0), - m_showDeleteCommand(0) +GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin, QWidget* parent) : + SettingsPageBase(parent), + m_mainWindow(mainWin), + m_homeUrl(0), + m_startSplit(0), + m_startEditable(0), + m_showDeleteCommand(0) { const int spacing = KDialog::spacingHint(); GeneralSettings* settings = DolphinSettings::instance().generalSettings(); @@ -109,8 +109,7 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* par GeneralSettingsPage::~GeneralSettingsPage() -{ -} +{} void GeneralSettingsPage::applySettings() { diff --git a/src/generalviewsettingspage.cpp b/src/generalviewsettingspage.cpp index 4f496246b..e35d948b5 100644 --- a/src/generalviewsettingspage.cpp +++ b/src/generalviewsettingspage.cpp @@ -37,12 +37,12 @@ #include GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow, - QWidget* parent) : - KVBox(parent), - m_mainWindow(mainWindow), - m_localProps(0), - m_globalProps(0), - m_maxPreviewSize(0) + QWidget* parent) : + KVBox(parent), + m_mainWindow(mainWindow), + m_localProps(0), + m_globalProps(0), + m_maxPreviewSize(0) { GeneralSettings* settings = DolphinSettings::instance().generalSettings(); Q_ASSERT(settings != 0); @@ -60,8 +60,7 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow, m_globalProps = new QRadioButton(i18n("Use common view properties for all folders"), propsBox); if (settings->globalViewProps()) { m_globalProps->setChecked(true); - } - else { + } else { m_localProps->setChecked(true); } @@ -90,8 +89,7 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow, int maxMByteSize = maxByteSize / (1024 * 1024); if (maxMByteSize < 1) { maxMByteSize = 1; - } - else if (maxMByteSize > max) { + } else if (maxMByteSize > max) { maxMByteSize = max; } m_maxPreviewSize->setValue(maxMByteSize); @@ -119,8 +117,7 @@ GeneralViewSettingsPage::GeneralViewSettingsPage(DolphinMainWindow* mainWindow, GeneralViewSettingsPage::~GeneralViewSettingsPage() -{ -} +{} void GeneralViewSettingsPage::applySettings() { diff --git a/src/iconsizedialog.cpp b/src/iconsizedialog.cpp index d7d248819..55256e87c 100644 --- a/src/iconsizedialog.cpp +++ b/src/iconsizedialog.cpp @@ -34,13 +34,13 @@ #include IconSizeDialog::IconSizeDialog(QWidget* parent) : - KDialog(parent), - m_iconSize(0), - m_previewSize(0), - m_iconSizeSlider(0), - m_iconSizeViewer(0), - m_previewSizeSlider(0), - m_previewSizeViewer(0) + KDialog(parent), + m_iconSize(0), + m_previewSize(0), + m_iconSizeSlider(0), + m_iconSizeViewer(0), + m_previewSizeSlider(0), + m_previewSizeViewer(0) { IconsModeSettings* settings = DolphinSettings::instance().iconsModeSettings(); @@ -51,7 +51,7 @@ IconSizeDialog::IconSizeDialog(QWidget* parent) : const int spacing = KDialog::spacingHint(); setCaption(i18n("Change Icon & Preview Size")); - setButtons(Ok|Cancel); + setButtons(Ok | Cancel); setDefaultButton(Ok); QWidget* main = new QWidget(); @@ -112,8 +112,7 @@ IconSizeDialog::IconSizeDialog(QWidget* parent) : } IconSizeDialog::~IconSizeDialog() -{ -} +{} void IconSizeDialog::slotButtonClicked(int button) { @@ -160,12 +159,12 @@ int IconSizeDialog::iconSize(int sliderValue) const { int size = K3Icon::SizeMedium; switch (sliderValue) { - case 0: size = K3Icon::SizeSmall; break; - case 1: size = K3Icon::SizeSmallMedium; break; - case 2: size = K3Icon::SizeMedium; break; - case 3: size = K3Icon::SizeLarge; break; - case 4: size = K3Icon::SizeHuge; break; - case 5: size = K3Icon::SizeEnormous; break; + case 0: size = K3Icon::SizeSmall; break; + case 1: size = K3Icon::SizeSmallMedium; break; + case 2: size = K3Icon::SizeMedium; break; + case 3: size = K3Icon::SizeLarge; break; + case 4: size = K3Icon::SizeHuge; break; + case 5: size = K3Icon::SizeEnormous; break; } return size; } @@ -174,13 +173,13 @@ int IconSizeDialog::sliderValue(int iconSize) const { int value = 0; switch (iconSize) { - case K3Icon::SizeSmall: value = 0; break; - case K3Icon::SizeSmallMedium: value = 1; break; - case K3Icon::SizeMedium: value = 2; break; - case K3Icon::SizeLarge: value = 3; break; - case K3Icon::SizeHuge: value = 4; break; - case K3Icon::SizeEnormous: value = 5; break; - default: break; + case K3Icon::SizeSmall: value = 0; break; + case K3Icon::SizeSmallMedium: value = 1; break; + case K3Icon::SizeMedium: value = 2; break; + case K3Icon::SizeLarge: value = 3; break; + case K3Icon::SizeHuge: value = 4; break; + case K3Icon::SizeEnormous: value = 5; break; + default: break; } return value; } diff --git a/src/iconsizedialog.h b/src/iconsizedialog.h index 9fffa3dfc..33cd83725 100644 --- a/src/iconsizedialog.h +++ b/src/iconsizedialog.h @@ -46,8 +46,14 @@ public: explicit IconSizeDialog(QWidget* parent); virtual ~IconSizeDialog(); - int iconSize() const { return m_iconSize; } - int previewSize() const { return m_previewSize; } + int iconSize() const + { + return m_iconSize; + } + int previewSize() const + { + return m_previewSize; + } protected slots: virtual void slotButtonClicked(int button); diff --git a/src/iconsviewsettingspage.cpp b/src/iconsviewsettingspage.cpp index 3492b3a65..84270a71d 100644 --- a/src/iconsviewsettingspage.cpp +++ b/src/iconsviewsettingspage.cpp @@ -40,17 +40,17 @@ #include IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow, - QWidget* parent) : - KVBox(parent), - m_mainWindow(mainWindow), - m_iconSize(0), - m_previewSize(0), - m_iconSizeButton(0), - m_textWidthBox(0), - m_fontRequester(0), - m_textlinesCountBox(0), - m_arrangementBox(0), - m_gridSpacingBox(0) + QWidget* parent) : + KVBox(parent), + m_mainWindow(mainWindow), + m_iconSize(0), + m_previewSize(0), + m_iconSizeButton(0), + m_textWidthBox(0), + m_fontRequester(0), + m_textlinesCountBox(0), + m_arrangementBox(0), + m_gridSpacingBox(0) { const int spacing = KDialog::spacingHint(); const int margin = KDialog::marginHint(); @@ -96,13 +96,12 @@ IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow, const int remainingWidth = settings->gridWidth() - settings->iconSize(); if (leftToRightArrangement) { textWidthIndex = (remainingWidth - LeftToRightBase) / LeftToRightInc; - } - else { + } else { textWidthIndex = (remainingWidth - TopToBottomBase) / TopToBottomInc; } // ensure that chosen index is always valid - textWidthIndex = qMax(textWidthIndex,0); - textWidthIndex = qMin(textWidthIndex,m_textWidthBox->count()-1); + textWidthIndex = qMax(textWidthIndex, 0); + textWidthIndex = qMin(textWidthIndex, m_textWidthBox->count() - 1); m_textWidthBox->setCurrentIndex(textWidthIndex); @@ -144,8 +143,7 @@ IconsViewSettingsPage::IconsViewSettingsPage(DolphinMainWindow* mainWindow, } IconsViewSettingsPage::~IconsViewSettingsPage() -{ -} +{} void IconsViewSettingsPage::applySettings() { @@ -170,8 +168,7 @@ void IconsViewSettingsPage::applySettings() if (arrangement == QListView::TopToBottom) { gridWidth += TopToBottomBase + textSizeIndex * TopToBottomInc; gridHeight += fontSize * 6; - } - else { + } else { gridWidth += LeftToRightBase + textSizeIndex * LeftToRightInc; } diff --git a/src/infosidebarpage.cpp b/src/infosidebarpage.cpp index a7c38ca95..42352429b 100644 --- a/src/infosidebarpage.cpp +++ b/src/infosidebarpage.cpp @@ -54,14 +54,14 @@ #include "metadatawidget.h" InfoSidebarPage::InfoSidebarPage(QWidget* parent) : - SidebarPage(parent), - m_multipleSelection(false), //TODO:check if I'm needed - m_pendingPreview(false), - m_timer(0), - m_currentSelection(KFileItemList()), - m_preview(0), - m_name(0), - m_infos(0) + SidebarPage(parent), + m_multipleSelection(false), //TODO:check if I'm needed + m_pendingPreview(false), + m_timer(0), + m_currentSelection(KFileItemList()), + m_preview(0), + m_name(0), + m_infos(0) { const int spacing = KDialog::spacingHint(); @@ -94,8 +94,8 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) : KSeparator* sep2 = new KSeparator(this); - if ( MetaDataWidget::metaDataAvailable() ) - m_metadataWidget = new MetaDataWidget( this ); + if (MetaDataWidget::metaDataAvailable()) + m_metadataWidget = new MetaDataWidget(this); else m_metadataWidget = 0; @@ -109,9 +109,9 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) : layout->addWidget(sep1); layout->addWidget(m_infos); layout->addWidget(sep2); - if ( m_metadataWidget ) { - layout->addWidget( m_metadataWidget ); - layout->addWidget( new KSeparator( this ) ); + if (m_metadataWidget) { + layout->addWidget(m_metadataWidget); + layout->addWidget(new KSeparator(this)); } layout->addWidget(m_actionBox); // ensure that widgets in the information side bar are aligned towards the top @@ -120,8 +120,7 @@ InfoSidebarPage::InfoSidebarPage(QWidget* parent) : } InfoSidebarPage::~InfoSidebarPage() -{ -} +{} void InfoSidebarPage::setUrl(const KUrl& url) { @@ -157,7 +156,7 @@ void InfoSidebarPage::showItemInfo() KFileItemList selectedItems = m_currentSelection; KUrl file; - if(selectedItems.count() == 0) { + if (selectedItems.count() == 0) { file = m_shownUrl; } else { file = selectedItems[0]->url(); @@ -168,9 +167,8 @@ void InfoSidebarPage::showItemInfo() K3Icon::NoGroup, K3Icon::SizeEnormous); m_preview->setPixmap(icon); - m_name->setText(i18n("%1 items selected",selectedItems.count())); - } - else if (!applyBookmark(file)) { + m_name->setText(i18n("%1 items selected", selectedItems.count())); + } else if (!applyBookmark(file)) { // try to get a preview pixmap from the item... KUrl::List list; list.append(file); @@ -231,8 +229,7 @@ void InfoSidebarPage::startService(int index) if (m_currentSelection.count() > 0) { // TODO: Use "at()" as soon as executeService is fixed to take a const param (BIC) KDesktopFileActions::executeService(m_currentSelection.urlList(), m_actionsVector[index]); - } - else { + } else { // TODO: likewise KDesktopFileActions::executeService(m_shownUrl, m_actionsVector[index]); } @@ -243,7 +240,7 @@ bool InfoSidebarPage::applyBookmark(const KUrl& url) KFilePlacesModel *placesModel = DolphinSettings::instance().placesModel(); int count = placesModel->rowCount(); - for (int i=0; iindex(i, 0); if (url.equals(placesModel->url(index), KUrl::CompareWithoutTrailingSlash)) { @@ -269,17 +266,16 @@ void InfoSidebarPage::cancelRequest() void InfoSidebarPage::createMetaInfo() { beginInfoLines(); - if(m_currentSelection.size() == 0) { + if (m_currentSelection.size() == 0) { KFileItem fileItem(S_IFDIR, KFileItem::Unknown, m_shownUrl); fileItem.refresh(); if (fileItem.isDir()) { addInfoLine(i18n("Type:"), i18n("Directory")); } - if ( MetaDataWidget::metaDataAvailable() ) - m_metadataWidget->setFile( fileItem.url() ); - } - else if (m_currentSelection.count() == 1) { + if (MetaDataWidget::metaDataAvailable()) + m_metadataWidget->setFile(fileItem.url()); + } else if (m_currentSelection.count() == 1) { KFileItem* fileItem = m_currentSelection.at(0); addInfoLine(i18n("Type:"), fileItem->mimeComment()); @@ -297,12 +293,11 @@ void InfoSidebarPage::createMetaInfo() } } } - if ( MetaDataWidget::metaDataAvailable() ) - m_metadataWidget->setFile( fileItem->url() ); - } - else { - if ( MetaDataWidget::metaDataAvailable() ) - m_metadataWidget->setFiles( m_currentSelection.urlList() ); + if (MetaDataWidget::metaDataAvailable()) + m_metadataWidget->setFile(fileItem->url()); + } else { + if (MetaDataWidget::metaDataAvailable()) + m_metadataWidget->setFiles(m_currentSelection.urlList()); unsigned long int totSize = 0; foreach(KFileItem* item, m_currentSelection) { totSize += item->size(); //FIXME what to do with directories ? (same with the one-item-selected-code), item->size() does not return the size of the content : not very instinctive for users @@ -326,19 +321,19 @@ bool InfoSidebarPage::showMetaInfo(const QString& key) const { // sorted list of keys, where it's data should be shown static const char* keys[] = { - "Album", - "Artist", - "Author", - "Bitrate", - "Date", - "Dimensions", - "Genre", - "Length", - "Lines", - "Pages", - "Title", - "Words" - }; + "Album", + "Artist", + "Author", + "Bitrate", + "Date", + "Dimensions", + "Genre", + "Length", + "Lines", + "Pages", + "Title", + "Words" + }; // do a binary search for the key... int top = 0; @@ -348,11 +343,9 @@ bool InfoSidebarPage::showMetaInfo(const QString& key) const const int result = key.compare(keys[middle]); if (result < 0) { bottom = middle - 1; - } - else if (result > 0) { + } else if (result > 0) { top = middle + 1; - } - else { + } else { return true; } } @@ -400,7 +393,7 @@ void InfoSidebarPage::insertActions() QStringList entries = dir.entryList(QStringList("*.desktop"), QDir::Files); for (QStringList::ConstIterator entryIt = entries.begin(); entryIt != entries.end(); ++entryIt) { - KConfigGroup cfg(KSharedConfig::openConfig( *dirIt + *entryIt, KConfig::OnlyLocal ), "Desktop Entry" ); + KConfigGroup cfg(KSharedConfig::openConfig(*dirIt + *entryIt, KConfig::OnlyLocal), "Desktop Entry"); if ((cfg.hasKey("Actions") || cfg.hasKey("X-KDE-GetActionMenu")) && cfg.hasKey("ServiceTypes")) { const QStringList types = cfg.readEntry("ServiceTypes", QStringList(), ','); for (QStringList::ConstIterator it = types.begin(); it != types.end(); ++it) { @@ -437,7 +430,7 @@ void InfoSidebarPage::insertActions() } if (insert) { - const QString submenuName = cfg.readEntry( "X-KDE-Submenu" ); + const QString submenuName = cfg.readEntry("X-KDE-Submenu"); QMenu* popup = 0; if (!submenuName.isEmpty()) { // create a sub menu containing all actions @@ -460,14 +453,13 @@ void InfoSidebarPage::insertActions() KDesktopFileActions::Service service = (*serviceIt); if (popup == 0) { ServiceButton* button = new ServiceButton(KIcon(service.m_strIcon), - service.m_strName, - m_actionBox, - actionsIndex); + service.m_strName, + m_actionBox, + actionsIndex); connect(button, SIGNAL(requestServiceStart(int)), this, SLOT(startService(int))); button->show(); - } - else { + } else { popup->insertItem(KIcon(service.m_strIcon), service.m_strName, actionsIndex); } @@ -487,9 +479,9 @@ ServiceButton::ServiceButton(const QIcon& icon, const QString& text, QWidget* parent, int index) : - QPushButton(icon, text, parent), - m_hover(false), - m_index(index) + QPushButton(icon, text, parent), + m_hover(false), + m_index(index) { setEraseColor(palette().brush(QPalette::Background).color()); setFocusPolicy(Qt::NoFocus); @@ -498,8 +490,7 @@ ServiceButton::ServiceButton(const QIcon& icon, } ServiceButton::~ServiceButton() -{ -} +{} void ServiceButton::paintEvent(QPaintEvent* event) { @@ -513,8 +504,7 @@ void ServiceButton::paintEvent(QPaintEvent* event) if (m_hover) { backgroundColor = KGlobalSettings::highlightColor(); foregroundColor = KGlobalSettings::highlightedTextColor(); - } - else { + } else { backgroundColor = palette().brush(QPalette::Background).color(); foregroundColor = KGlobalSettings::buttonTextColor(); } diff --git a/src/infosidebarpage.h b/src/infosidebarpage.h index cd233b6ef..62d0ac1cb 100644 --- a/src/infosidebarpage.h +++ b/src/infosidebarpage.h @@ -33,8 +33,9 @@ #include #include -namespace KIO { - class Job; +namespace KIO +{ +class Job; } class QPixmap; @@ -54,7 +55,7 @@ class MetaDataWidget; */ class InfoSidebarPage : public SidebarPage { - Q_OBJECT + Q_OBJECT public: explicit InfoSidebarPage(QWidget* parent = 0); @@ -139,7 +140,7 @@ private: QTimer* m_timer; KUrl m_shownUrl; KUrl m_urlCandidate; - KFileItemList m_currentSelection; + KFileItemList m_currentSelection; PixmapViewer* m_preview; QLabel* m_name; diff --git a/src/main.cpp b/src/main.cpp index b0843a5e7..98a6a87f1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,10 +25,11 @@ #include static KCmdLineOptions options[] = -{ - { "+[Url]", I18N_NOOP( "Document to open" ), 0 }, - KCmdLineLastOption -}; + { + { "+[Url]", I18N_NOOP("Document to open"), 0 + }, + KCmdLineLastOption + }; int main(int argc, char **argv) { @@ -64,11 +65,11 @@ int main(int argc, char **argv) #if 0 if (false /* KDE4-TODO: app.isSessionRestored() */) { int n = 1; - while (KMainWindow::canBeRestored(n)){ + while (KMainWindow::canBeRestored(n)) { Dolphin::mainWin().restore(n); ++n; } } else { #endif - return app.exec(); -} + return app.exec(); + } diff --git a/src/metadatawidget.cpp b/src/metadatawidget.cpp index e8cb3dbea..85c1fa30f 100644 --- a/src/metadatawidget.cpp +++ b/src/metadatawidget.cpp @@ -50,17 +50,17 @@ class MetaDataWidget::Private { public: #ifdef HAVE_KMETADATA - void loadComment( const QString& comment ) { - editComment->blockSignals( true ); - if ( comment.isEmpty() ) { - editComment->setFontItalic( true ); - editComment->setText( i18n( "Click to add comment..." ) ); + void loadComment(const QString& comment) + { + editComment->blockSignals(true); + if (comment.isEmpty()) { + editComment->setFontItalic(true); + editComment->setText(i18n("Click to add comment...")); + } else { + editComment->setFontItalic(false); + editComment->setText(comment); } - else { - editComment->setFontItalic( false ); - editComment->setText( comment ); - } - editComment->blockSignals( false ); + editComment->blockSignals(false); } KUrl fileUrl; @@ -74,34 +74,34 @@ public: }; -MetaDataWidget::MetaDataWidget( QWidget* parent ) - : QWidget( parent ) +MetaDataWidget::MetaDataWidget(QWidget* parent) + : QWidget(parent) { #ifdef HAVE_KMETADATA d = new Private; - d->editComment = new QTextEdit( this ); - d->tagWidget = new Nepomuk::KMetaData::TagWidget( this ); - d->ratingWidget = new KRatingWidget( this ); - connect( d->ratingWidget, SIGNAL(ratingChanged(int)), this, SLOT(slotRatingChanged(int)) ); - connect( d->editComment, SIGNAL( textChanged() ), this, SLOT( slotCommentChanged() ) ); - - QVBoxLayout* lay = new QVBoxLayout( this ); - lay->setMargin( 0 ); + d->editComment = new QTextEdit(this); + d->tagWidget = new Nepomuk::KMetaData::TagWidget(this); + d->ratingWidget = new KRatingWidget(this); + connect(d->ratingWidget, SIGNAL(ratingChanged(int)), this, SLOT(slotRatingChanged(int))); + connect(d->editComment, SIGNAL(textChanged()), this, SLOT(slotCommentChanged())); + + QVBoxLayout* lay = new QVBoxLayout(this); + lay->setMargin(0); QHBoxLayout* hbox = new QHBoxLayout; - hbox->addWidget( new QLabel( i18n( "Rating:" ), this ) ); - hbox->addStretch( 1 ); - hbox->addWidget( d->ratingWidget ); - lay->addLayout( hbox ); - lay->addWidget( d->editComment ); + hbox->addWidget(new QLabel(i18n("Rating:"), this)); + hbox->addStretch(1); + hbox->addWidget(d->ratingWidget); + lay->addLayout(hbox); + lay->addWidget(d->editComment); hbox = new QHBoxLayout; - hbox->addWidget( new QLabel( i18n( "Tags:" ), this ) ); - hbox->addWidget( d->tagWidget, 1 ); - lay->addLayout( hbox ); + hbox->addWidget(new QLabel(i18n("Tags:"), this)); + hbox->addWidget(d->tagWidget, 1); + lay->addLayout(hbox); - d->editComment->installEventFilter( this ); - d->editComment->viewport()->installEventFilter( this ); + d->editComment->installEventFilter(this); + d->editComment->viewport()->installEventFilter(this); #else - d=0L; + d = 0L; #endif } @@ -112,24 +112,24 @@ MetaDataWidget::~MetaDataWidget() } -void MetaDataWidget::setFile( const KUrl& url ) +void MetaDataWidget::setFile(const KUrl& url) { #ifdef HAVE_KMETADATA d->fileUrl = url; - d->file = Nepomuk::KMetaData::File( url.url() ); - d->file.setLocation( url.url() ); - d->ratingWidget->setRating( d->file.getRating() ); - d->tagWidget->setTaggedResource( d->file ); - d->loadComment( d->file.getComment() ); + d->file = Nepomuk::KMetaData::File(url.url()); + d->file.setLocation(url.url()); + d->ratingWidget->setRating(d->file.getRating()); + d->tagWidget->setTaggedResource(d->file); + d->loadComment(d->file.getComment()); #endif } -void MetaDataWidget::setFiles( const KUrl::List urls ) +void MetaDataWidget::setFiles(const KUrl::List urls) { #ifdef HAVE_KMETADATA // FIXME: support multiple files - setFile( urls.first() ); + setFile(urls.first()); #endif } @@ -137,37 +137,36 @@ void MetaDataWidget::setFiles( const KUrl::List urls ) void MetaDataWidget::slotCommentChanged() { #ifdef HAVE_KMETADATA - d->file.setComment( d->editComment->toPlainText() ); + d->file.setComment(d->editComment->toPlainText()); #endif } -void MetaDataWidget::slotRatingChanged( int r ) +void MetaDataWidget::slotRatingChanged(int r) { #ifdef HAVE_KMETADATA - d->file.setRating( r ); + d->file.setRating(r); #endif } -bool MetaDataWidget::eventFilter( QObject* obj, QEvent* event ) +bool MetaDataWidget::eventFilter(QObject* obj, QEvent* event) { #ifdef HAVE_KMETADATA - if ( obj == d->editComment->viewport() - || obj == d->editComment ) { - if ( event->type() == QEvent::FocusOut ) { + if (obj == d->editComment->viewport() + || obj == d->editComment) { + if (event->type() == QEvent::FocusOut) { // make sure the info text is displayed again - d->loadComment( d->editComment->toPlainText() ); - } - else if ( event->type() == QEvent::FocusIn ) { - d->editComment->setFontItalic( false ); - if ( d->file.getComment().isEmpty() ) - d->editComment->setText( QString() ); + d->loadComment(d->editComment->toPlainText()); + } else if (event->type() == QEvent::FocusIn) { + d->editComment->setFontItalic(false); + if (d->file.getComment().isEmpty()) + d->editComment->setText(QString()); } } #endif - return QWidget::eventFilter( obj, event ); + return QWidget::eventFilter(obj, event); } #include "metadatawidget.moc" diff --git a/src/metadatawidget.h b/src/metadatawidget.h index 0b544e23d..b51cb593d 100644 --- a/src/metadatawidget.h +++ b/src/metadatawidget.h @@ -30,7 +30,7 @@ class MetaDataWidget : public QWidget Q_OBJECT public: - MetaDataWidget( QWidget* parent = 0 ); + MetaDataWidget(QWidget* parent = 0); ~MetaDataWidget(); /** @@ -39,10 +39,10 @@ public: * been initialized properly. */ static bool metaDataAvailable(); - + public Q_SLOTS: - void setFile( const KUrl& url ); - void setFiles( const KUrl::List urls ); + void setFile(const KUrl& url); + void setFiles(const KUrl::List urls); signals: /** @@ -53,10 +53,10 @@ signals: private Q_SLOTS: void slotCommentChanged(); - void slotRatingChanged( int r ); + void slotRatingChanged(int r); protected: - bool eventFilter( QObject* obj, QEvent* event ); + bool eventFilter(QObject* obj, QEvent* event); private: class Private; diff --git a/src/pixmapviewer.cpp b/src/pixmapviewer.cpp index ae739cf43..798771078 100644 --- a/src/pixmapviewer.cpp +++ b/src/pixmapviewer.cpp @@ -15,7 +15,7 @@ * 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 * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * ***************************************************************************/ #include "pixmapviewer.h" @@ -28,15 +28,14 @@ #include PixmapViewer::PixmapViewer(QWidget* parent) : - QWidget(parent) + QWidget(parent) { setMinimumWidth(K3Icon::SizeEnormous); setMinimumWidth(K3Icon::SizeEnormous); } PixmapViewer::~PixmapViewer() -{ -} +{} void PixmapViewer::setPixmap(const QPixmap& pixmap) { diff --git a/src/pixmapviewer.h b/src/pixmapviewer.h index fadcd2259..40ff9e55f 100644 --- a/src/pixmapviewer.h +++ b/src/pixmapviewer.h @@ -39,7 +39,10 @@ public: explicit PixmapViewer(QWidget* parent); virtual ~PixmapViewer(); void setPixmap(const QPixmap& pixmap); - const QPixmap& pixmap() const { return m_pixmap; } + const QPixmap& pixmap() const + { + return m_pixmap; + } protected: virtual void paintEvent(QPaintEvent* event); diff --git a/src/renamedialog.cpp b/src/renamedialog.cpp index c3fe9d722..190f64b93 100644 --- a/src/renamedialog.cpp +++ b/src/renamedialog.cpp @@ -26,8 +26,8 @@ #include RenameDialog::RenameDialog(const KUrl::List& items) : - KDialog(), - m_renameOneItem(false) + KDialog(), + m_renameOneItem(false) { const QSize minSize = minimumSize(); setMinimumSize(QSize(320, minSize.height())); @@ -37,7 +37,7 @@ RenameDialog::RenameDialog(const KUrl::List& items) : m_renameOneItem = (itemCount == 1); setCaption(m_renameOneItem ? i18n("Rename Item") : i18n("Rename Items")); - setButtons(Ok|Cancel); + setButtons(Ok | Cancel); setDefaultButton(Ok); setButtonGuiItem(Ok, KGuiItem(i18n("Rename"), "dialog-apply")); @@ -54,15 +54,14 @@ RenameDialog::RenameDialog(const KUrl::List& items) : m_newName = url.fileName(); editLabel = new QLabel(i18n("Rename the item '%1' to:", m_newName), page); - } - else { + } else { m_newName = i18n("New name #"); editLabel = new QLabel(i18n("Rename the %1 selected items to:", itemCount), page); } m_lineEdit = new KLineEdit(page); - QString postfix(items[0].prettyUrl().section('.',1)); + QString postfix(items[0].prettyUrl().section('.', 1)); if (postfix.length() > 0) { // The first item seems to have a postfix (e. g. 'jpg' or 'txt'). Now // check whether all other items have the same postfix. If this is the @@ -86,8 +85,7 @@ RenameDialog::RenameDialog(const KUrl::List& items) : if (postfixLength > 0) { if (m_renameOneItem) { selectionLength -= postfixLength; - } - else { + } else { m_newName.append(postfix); } } @@ -106,8 +104,7 @@ RenameDialog::RenameDialog(const KUrl::List& items) : } RenameDialog::~RenameDialog() -{ -} +{} void RenameDialog::slotButtonClicked(int button) { @@ -115,8 +112,7 @@ void RenameDialog::slotButtonClicked(int button) m_newName = m_lineEdit->text(); if (m_newName.isEmpty()) { m_errorString = i18n("The new name is empty. A name with at least one character must be entered."); - } - else if (!m_renameOneItem && m_newName.contains('#') != 1) { + } else if (!m_renameOneItem && m_newName.contains('#') != 1) { m_newName.truncate(0); m_errorString = i18n("The name must contain exactly one # character."); } diff --git a/src/renamedialog.h b/src/renamedialog.h index 220b8b803..cc2cb5407 100644 --- a/src/renamedialog.h +++ b/src/renamedialog.h @@ -62,12 +62,18 @@ public: * been deleted by the user, although more then one item should be * renamed). */ - const QString& newName() const { return m_newName; } + const QString& newName() const + { + return m_newName; + } /** * Returns the error string, if Dialog::newName() returned an empty string. */ - const QString& errorString() const { return m_errorString; } + const QString& errorString() const + { + return m_errorString; + } protected slots: virtual void slotButtonClicked(int button); diff --git a/src/settingspagebase.cpp b/src/settingspagebase.cpp index 6f8dae7c5..6f8dcbfb6 100644 --- a/src/settingspagebase.cpp +++ b/src/settingspagebase.cpp @@ -21,13 +21,11 @@ #include "settingspagebase.h" SettingsPageBase::SettingsPageBase(QWidget* parent) : - QWidget(parent) -{ -} + QWidget(parent) +{} SettingsPageBase::~SettingsPageBase() -{ -} +{} #include "settingspagebase.moc" diff --git a/src/sidebarpage.cpp b/src/sidebarpage.cpp index 5b0e68f28..c6c120f0e 100644 --- a/src/sidebarpage.cpp +++ b/src/sidebarpage.cpp @@ -23,15 +23,13 @@ #include SidebarPage::SidebarPage(QWidget* parent) : - QWidget(parent), - m_url(KUrl()), - m_currentSelection(KFileItemList()) -{ -} + QWidget(parent), + m_url(KUrl()), + m_currentSelection(KFileItemList()) +{} SidebarPage::~SidebarPage() -{ -} +{} void SidebarPage::setUrl(const KUrl& url) { diff --git a/src/sidebarpage.h b/src/sidebarpage.h index e992955a2..587e435c1 100644 --- a/src/sidebarpage.h +++ b/src/sidebarpage.h @@ -31,9 +31,9 @@ */ class SidebarPage : public QWidget { - Q_OBJECT + Q_OBJECT public: - explicit SidebarPage(QWidget* parent=0); + explicit SidebarPage(QWidget* parent = 0); virtual ~SidebarPage(); public slots: @@ -41,7 +41,7 @@ public slots: * This is invoked every time the folder being displayed in the * file-management views changes. */ - virtual void setUrl(const KUrl& url); + virtual void setUrl(const KUrl& url); /** * This is invoked to inform the sidebar that the user has selected a new diff --git a/src/sidebartreeview.cpp b/src/sidebartreeview.cpp index 9390e5672..30ad6b169 100644 --- a/src/sidebartreeview.cpp +++ b/src/sidebartreeview.cpp @@ -27,7 +27,7 @@ #include SidebarTreeView::SidebarTreeView(QWidget* parent) : - QTreeView(parent) + QTreeView(parent) { setAcceptDrops(true); setUniformRowHeights(true); @@ -43,8 +43,7 @@ SidebarTreeView::SidebarTreeView(QWidget* parent) : } SidebarTreeView::~SidebarTreeView() -{ -} +{} bool SidebarTreeView::event(QEvent* event) { @@ -73,8 +72,7 @@ void SidebarTreeView::dropEvent(QDropEvent* event) const KUrl::List urls = KUrl::List::fromMimeData(event->mimeData()); if (urls.isEmpty() || (event->source() == this)) { QTreeView::dropEvent(event); - } - else { + } else { event->acceptProposedAction(); const QModelIndex index = indexAt(event->pos()); if (index.isValid()) { diff --git a/src/sidebartreeview.h b/src/sidebartreeview.h index d4560fb44..d12737151 100644 --- a/src/sidebartreeview.h +++ b/src/sidebartreeview.h @@ -37,10 +37,10 @@ public: virtual ~SidebarTreeView(); signals: - /** - * Is emitted if the URLs \a urls have been dropped to - * the index \a index. - */ + /** + * Is emitted if the URLs \a urls have been dropped to + * the index \a index. + */ void urlsDropped(const KUrl::List& urls, const QModelIndex& index); diff --git a/src/statusbarmessagelabel.cpp b/src/statusbarmessagelabel.cpp index c870406d3..7cf5bb68a 100644 --- a/src/statusbarmessagelabel.cpp +++ b/src/statusbarmessagelabel.cpp @@ -34,13 +34,13 @@ #include StatusBarMessageLabel::StatusBarMessageLabel(QWidget* parent) : - QWidget(parent), - m_type(DolphinStatusBar::Default), - m_state(Default), - m_illumination(0), - m_minTextHeight(-1), - m_timer(0), - m_closeButton(0) + QWidget(parent), + m_type(DolphinStatusBar::Default), + m_state(Default), + m_illumination(0), + m_minTextHeight(-1), + m_timer(0), + m_closeButton(0) { setMinimumHeight(K3Icon::SizeSmall); @@ -55,8 +55,7 @@ StatusBarMessageLabel::StatusBarMessageLabel(QWidget* parent) : } StatusBarMessageLabel::~StatusBarMessageLabel() -{ -} +{} void StatusBarMessageLabel::setMessage(const QString& text, DolphinStatusBar::Type type) @@ -68,8 +67,7 @@ void StatusBarMessageLabel::setMessage(const QString& text, if (m_type == DolphinStatusBar::Error) { if (type == DolphinStatusBar::Error) { m_pendingMessages.insert(0, m_text); - } - else if ((m_state != Default) || !m_pendingMessages.isEmpty()) { + } else if ((m_state != Default) || !m_pendingMessages.isEmpty()) { // a non-error message should not be shown, as there // are other pending error messages in the queue return; @@ -86,29 +84,29 @@ void StatusBarMessageLabel::setMessage(const QString& text, const char* iconName = 0; QPixmap pixmap; switch (type) { - case DolphinStatusBar::OperationCompleted: - iconName = "ok"; - m_closeButton->hide(); - break; - - case DolphinStatusBar::Information: - iconName = "document-properties"; - m_closeButton->hide(); - break; - - case DolphinStatusBar::Error: - iconName = "error"; - m_timer->start(100); - m_state = Illuminate; - - updateCloseButtonPosition(); - m_closeButton->show(); - break; - - case DolphinStatusBar::Default: - default: - m_closeButton->hide(); - break; + case DolphinStatusBar::OperationCompleted: + iconName = "ok"; + m_closeButton->hide(); + break; + + case DolphinStatusBar::Information: + iconName = "document-properties"; + m_closeButton->hide(); + break; + + case DolphinStatusBar::Error: + iconName = "error"; + m_timer->start(100); + m_state = Illuminate; + + updateCloseButtonPosition(); + m_closeButton->show(); + break; + + case DolphinStatusBar::Default: + default: + m_closeButton->hide(); + break; } m_pixmap = (iconName == 0) ? QPixmap() : SmallIcon(iconName); @@ -176,41 +174,39 @@ void StatusBarMessageLabel::resizeEvent(QResizeEvent* event) void StatusBarMessageLabel::timerDone() { switch (m_state) { - case Illuminate: { - // increase the illumination - if (m_illumination < 100) { - m_illumination += 20; - update(); - } - else { - m_state = Illuminated; - m_timer->start(5000); - } - break; + case Illuminate: { + // increase the illumination + if (m_illumination < 100) { + m_illumination += 20; + update(); + } else { + m_state = Illuminated; + m_timer->start(5000); } + break; + } - case Illuminated: { - // start desaturation - m_state = Desaturate; - m_timer->start(100); - break; - } + case Illuminated: { + // start desaturation + m_state = Desaturate; + m_timer->start(100); + break; + } - case Desaturate: { - // desaturate - if (m_illumination > 0) { - m_illumination -= 5; - update(); - } - else { - m_state = Default; - m_timer->stop(); - } - break; + case Desaturate: { + // desaturate + if (m_illumination > 0) { + m_illumination -= 5; + update(); + } else { + m_state = Default; + m_timer->stop(); } + break; + } - default: - break; + default: + break; } } @@ -224,8 +220,8 @@ void StatusBarMessageLabel::assureVisibleText() // needed for having a fully visible text QFontMetrics fontMetrics(font()); const QRect bounds(fontMetrics.boundingRect(0, 0, availableTextWidth(), height(), - Qt::AlignVCenter | Qt::TextWordWrap, - m_text)); + Qt::AlignVCenter | Qt::TextWordWrap, + m_text)); int requiredHeight = bounds.height(); if (requiredHeight < m_minTextHeight) { requiredHeight = m_minTextHeight; @@ -244,8 +240,7 @@ void StatusBarMessageLabel::assureVisibleText() } setMinimumHeight(minHeight); updateGeometry(); - } - else if (minHeight > requiredHeight) { + } else if (minHeight > requiredHeight) { minHeight -= gap; if (minHeight < requiredHeight) { minHeight = requiredHeight; diff --git a/src/statusbarmessagelabel.h b/src/statusbarmessagelabel.h index 9f7c7a4a6..678fde08b 100644 --- a/src/statusbarmessagelabel.h +++ b/src/statusbarmessagelabel.h @@ -51,15 +51,30 @@ public: void setMessage(const QString& text, DolphinStatusBar::Type type); - DolphinStatusBar::Type type() const { return m_type; } - const QString& text() const { return m_text; } - - void setDefaultText(const QString& text) { m_defaultText = text; } - const QString& defaultText() const { return m_defaultText; } + DolphinStatusBar::Type type() const + { + return m_type; + } + const QString& text() const + { + return m_text; + } + + void setDefaultText(const QString& text) + { + m_defaultText = text; + } + const QString& defaultText() const + { + return m_defaultText; + } // TODO: maybe a better approach is possible with the size hint void setMinimumTextHeight(int min); - int minimumTextHeight() const { return m_minTextHeight; } + int minimumTextHeight() const + { + return m_minTextHeight; + } /** * Returns the gap of the width of the current set text to the @@ -116,14 +131,18 @@ private: void reset(); private: - enum State { + enum State + { Default, Illuminate, Illuminated, Desaturate }; - enum { GeometryTimeout = 100 }; + enum + { + GeometryTimeout = 100 + }; DolphinStatusBar::Type m_type; State m_state; @@ -140,7 +159,10 @@ private: const QColor& c2, int percent) const; - int borderGap() const { return 2; } + int borderGap() const + { + return 2; + } }; #endif diff --git a/src/statusbarspaceinfo.cpp b/src/statusbarspaceinfo.cpp index c648351eb..a21f22c32 100644 --- a/src/statusbarspaceinfo.cpp +++ b/src/statusbarspaceinfo.cpp @@ -30,10 +30,10 @@ #include StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) : - QWidget(parent), - m_gettingSize(false), - m_kBSize(0), - m_kBAvailable(0) + QWidget(parent), + m_gettingSize(false), + m_kBSize(0), + m_kBAvailable(0) { setMinimumWidth(200); @@ -45,8 +45,7 @@ StatusBarSpaceInfo::StatusBarSpaceInfo(QWidget* parent) : } StatusBarSpaceInfo::~StatusBarSpaceInfo() -{ -} +{} void StatusBarSpaceInfo::setUrl(const KUrl& url) { @@ -83,7 +82,7 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */) painter.setPen(Qt::NoPen); painter.setBrush(progressColor(backgrColor)); int usedWidth = barWidth - static_cast((m_kBAvailable * - static_cast(barWidth)) / m_kBSize); + static_cast(barWidth)) / m_kBSize); const int left = 1; int right = usedWidth - widthDec; if (right < left) { @@ -92,12 +91,10 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */) painter.drawRect(QRect(left, barTop + 2, right, barHeight - 1)); text = i18n("%1% of %2 used", 100 - (int)(100.0 * m_kBAvailable / m_kBSize), KIO::convertSizeFromKiB(m_kBSize)); - } - else { + } else { if (m_gettingSize) { text = i18n("Getting size..."); - } - else { + } else { text = QString(); QTimer::singleShot(0, this, SLOT(hide())); } @@ -112,9 +109,9 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */) void StatusBarSpaceInfo::slotFoundMountPoint(const unsigned long& kBSize, - const unsigned long& /* kBUsed */, - const unsigned long& kBAvailable, - const QString& /* mountPoint */) + const unsigned long& /* kBUsed */, + const unsigned long& kBAvailable, + const QString& /* mountPoint */) { m_gettingSize = false; m_kBSize = kBSize; @@ -150,11 +147,11 @@ void StatusBarSpaceInfo::refresh() connect(job, SIGNAL(foundMountPoint(const unsigned long&, const unsigned long&, const unsigned long&, - const QString& )), + const QString&)), this, SLOT(slotFoundMountPoint(const unsigned long&, const unsigned long&, const unsigned long&, - const QString& ))); + const QString&))); connect(job, SIGNAL(done()), this, SLOT(showResult())); diff --git a/src/statusbarspaceinfo.h b/src/statusbarspaceinfo.h index bfa1156c3..0b6924466 100644 --- a/src/statusbarspaceinfo.h +++ b/src/statusbarspaceinfo.h @@ -42,7 +42,10 @@ public: virtual ~StatusBarSpaceInfo(); void setUrl(const KUrl& url); - const KUrl& url() const { return m_url; } + const KUrl& url() const + { + return m_url; + } protected: /** @see QWidget::paintEvent() */ diff --git a/src/treeviewcontextmenu.cpp b/src/treeviewcontextmenu.cpp index 48d75b5bc..eae68c67b 100644 --- a/src/treeviewcontextmenu.cpp +++ b/src/treeviewcontextmenu.cpp @@ -34,15 +34,13 @@ #include TreeViewContextMenu::TreeViewContextMenu(QWidget* parent, - KFileItem* fileInfo) : - m_parent(parent), - m_fileInfo(fileInfo) -{ -} + KFileItem* fileInfo) : + m_parent(parent), + m_fileInfo(fileInfo) +{} TreeViewContextMenu::~TreeViewContextMenu() -{ -} +{} void TreeViewContextMenu::open() { @@ -82,8 +80,7 @@ void TreeViewContextMenu::open() QAction* moveToTrashAction = new QAction(KIcon("edit-trash"), i18n("Move To Trash"), this); connect(moveToTrashAction, SIGNAL(triggered()), this, SLOT(moveToTrash())); popup->addAction(moveToTrashAction); - } - else { + } else { showDeleteCommand = true; } @@ -132,8 +129,7 @@ void TreeViewContextMenu::paste() if (KonqMimeData::decodeIsCutSelection(mimeData)) { KonqOperations::copy(m_parent, KonqOperations::MOVE, source, dest); clipboard->clear(); - } - else { + } else { KonqOperations::copy(m_parent, KonqOperations::COPY, source, dest); } } diff --git a/src/treeviewsidebarpage.cpp b/src/treeviewsidebarpage.cpp index 095117119..8c746a253 100644 --- a/src/treeviewsidebarpage.cpp +++ b/src/treeviewsidebarpage.cpp @@ -37,11 +37,11 @@ #include "dolphinsettings.h" TreeViewSidebarPage::TreeViewSidebarPage(QWidget* parent) : - SidebarPage(parent), - m_dirLister(0), - m_dirModel(0), - m_proxyModel(0), - m_treeView(0) + SidebarPage(parent), + m_dirLister(0), + m_dirModel(0), + m_proxyModel(0), + m_treeView(0) { m_dirLister = new KDirLister(); m_dirLister->setDirOnlyMode(true); @@ -105,8 +105,7 @@ void TreeViewSidebarPage::setUrl(const KUrl& url) const QModelIndex proxyIndex = m_proxyModel->mapFromSource(index); m_treeView->scrollTo(proxyIndex); selModel->setCurrentIndex(proxyIndex, QItemSelectionModel::Select); - } - else { + } else { // The item with the given URL is not loaded by the model yet. Iterate // backward to the base URL and trigger the loading of the items for // each hierarchy level. diff --git a/src/viewproperties.cpp b/src/viewproperties.cpp index 5d652281a..485ed4384 100644 --- a/src/viewproperties.cpp +++ b/src/viewproperties.cpp @@ -37,9 +37,9 @@ #define FILE_NAME "/.directory" ViewProperties::ViewProperties(const KUrl& url) : - m_changedProps(false), - m_autoSave(true), - m_node(0) + m_changedProps(false), + m_autoSave(true), + m_node(0) { KUrl cleanUrl(url); cleanUrl.cleanPath(); @@ -57,14 +57,12 @@ ViewProperties::ViewProperties(const KUrl& url) : const bool useGlobalViewProps = settings->globalViewProps(); if (useGlobalViewProps) { m_filepath = destinationDir("global"); - } - else if (cleanUrl.isLocalFile()) { + } else if (cleanUrl.isLocalFile()) { const QFileInfo info(m_filepath); if (!info.isWritable()) { m_filepath = destinationDir("local") + m_filepath; } - } - else { + } else { m_filepath = destinationDir("remote") + m_filepath; } diff --git a/src/viewpropertiesdialog.cpp b/src/viewpropertiesdialog.cpp index faaffc6cc..9a721e2bc 100644 --- a/src/viewpropertiesdialog.cpp +++ b/src/viewpropertiesdialog.cpp @@ -44,19 +44,19 @@ #include ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : - KDialog(dolphinView), - m_isDirty(false), - m_dolphinView(dolphinView), - m_viewProps(0), - m_viewMode(0), - m_sorting(0), - m_sortOrder(0), - m_additionalInfo(0), - m_showPreview(0), - m_showHiddenFiles(0), - m_applyToCurrentFolder(0), - m_applyToSubFolders(0), - m_useAsDefault(0) + KDialog(dolphinView), + m_isDirty(false), + m_dolphinView(dolphinView), + m_viewProps(0), + m_viewMode(0), + m_sorting(0), + m_sortOrder(0), + m_additionalInfo(0), + m_showPreview(0), + m_showHiddenFiles(0), + m_applyToCurrentFolder(0), + m_applyToSubFolders(0), + m_useAsDefault(0) { Q_ASSERT(dolphinView != 0); const bool useGlobalViewProps = DolphinSettings::instance().generalSettings()->globalViewProps(); @@ -162,7 +162,7 @@ ViewPropertiesDialog::ViewPropertiesDialog(DolphinView* dolphinView) : m_applyToCurrentFolder = new QRadioButton(i18n("Current folder"), applyBox); m_applyToCurrentFolder->setChecked(true); m_applyToSubFolders = new QRadioButton(i18n("Current folder including all sub folders"), applyBox); - m_applyToAllFolders = new QRadioButton(i18n("All folders"),applyBox); + m_applyToAllFolders = new QRadioButton(i18n("All folders"), applyBox); QButtonGroup* applyGroup = new QButtonGroup(this); applyGroup->addButton(m_applyToCurrentFolder); @@ -237,10 +237,10 @@ void ViewPropertiesDialog::slotAdditionalInfoChanged(int index) { KFileItemDelegate::AdditionalInformation info = KFileItemDelegate::NoInformation; switch (index) { - case 1: info = KFileItemDelegate::FriendlyMimeType; break; - case 2: info = KFileItemDelegate::Size; break; - case 3: info = KFileItemDelegate::ModificationTime; break; - default: break; + case 1: info = KFileItemDelegate::FriendlyMimeType; break; + case 2: info = KFileItemDelegate::Size; break; + case 3: info = KFileItemDelegate::ModificationTime; break; + default: break; } m_viewProps->setAdditionalInfo(info); m_isDirty = true; @@ -277,8 +277,8 @@ void ViewPropertiesDialog::applyViewProperties() } ViewPropsProgressInfo* info = new ViewPropsProgressInfo(m_dolphinView, - m_dolphinView->url(), - *m_viewProps); + m_dolphinView->url(), + *m_viewProps); info->setWindowModality(Qt::NonModal); info->show(); } diff --git a/src/viewpropsprogressinfo.cpp b/src/viewpropsprogressinfo.cpp index 61f6423c4..e0037a6f9 100644 --- a/src/viewpropsprogressinfo.cpp +++ b/src/viewpropsprogressinfo.cpp @@ -33,16 +33,16 @@ #include ViewPropsProgressInfo::ViewPropsProgressInfo(QWidget* parent, - const KUrl& dir, - const ViewProperties& viewProps) : - KDialog(parent), - m_dir(dir), - m_viewProps(0), - m_label(0), - m_progressBar(0), - m_dirSizeJob(0), - m_applyViewPropsJob(0), - m_timer(0) + const KUrl& dir, + const ViewProperties& viewProps) : + KDialog(parent), + m_dir(dir), + m_viewProps(0), + m_label(0), + m_progressBar(0), + m_dirSizeJob(0), + m_applyViewPropsJob(0), + m_timer(0) { const QSize minSize = minimumSize(); setMinimumSize(QSize(320, minSize.height())); diff --git a/src/viewsettingspage.cpp b/src/viewsettingspage.cpp index 019c83afe..bef99bacc 100644 --- a/src/viewsettingspage.cpp +++ b/src/viewsettingspage.cpp @@ -36,11 +36,11 @@ ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow, QWidget* parent) : - SettingsPageBase(parent), - m_generalPage(0), - m_iconsPage(0), - m_detailsPage(0), - m_columnPage(0) + SettingsPageBase(parent), + m_generalPage(0), + m_iconsPage(0), + m_detailsPage(0), + m_columnPage(0) { QVBoxLayout* topLayout = new QVBoxLayout(this); topLayout->setMargin(0); @@ -68,8 +68,7 @@ ViewSettingsPage::ViewSettingsPage(DolphinMainWindow* mainWindow, } ViewSettingsPage::~ViewSettingsPage() -{ -} +{} void ViewSettingsPage::applySettings() { -- 2.47.3