]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Add libkmetadata detection and minor fixes
authorOscar Blumberg <o.blumberg@robertlan.eu.org>
Thu, 22 Feb 2007 20:15:20 +0000 (20:15 +0000)
committerOscar Blumberg <o.blumberg@robertlan.eu.org>
Thu, 22 Feb 2007 20:15:20 +0000 (20:15 +0000)
SVN_SILENT

svn path=/trunk/KDE/kdebase/apps/; revision=636328

12 files changed:
src/CMakeLists.txt
src/config-kmetadata.h.cmake [new file with mode: 0644]
src/dolphinmainwindow.cpp
src/dolphinstatusbar.cpp
src/dolphinview.cpp
src/editbookmarkdialog.cpp
src/generalsettingspage.cpp
src/metadataloader.cpp
src/statusbarmessagelabel.cpp
src/statusbarspaceinfo.cpp
src/urlbutton.cpp
src/urlnavigator.cpp

index 6411a719ebccbbc1532595b8c9e76ed8bd201236..2ed9374e82bf0ba99269f74a94c8a9a2b0bcc56f 100644 (file)
@@ -4,7 +4,6 @@ add_subdirectory( servicemenus )
 
 include_directories( ${CMAKE_SOURCE_DIR}/libkonq ${KDE4_INCLUDE_DIR} ${QT_INCLUDES}  )
 
-
 ########### next target ###############
 
 set(dolphin_SRCS
@@ -64,8 +63,16 @@ qt4_add_dbus_adaptor(dolphin_SRCS
    org.kde.dolphin.MainWindow.xml
    dolphinmainwindow.h DolphinMainWindow)
 kde4_add_executable(dolphin ${dolphin_SRCS})
-
-#set(KDE4_KMETADATA kmetadata)
+# find Nepomuk's libkmetadata
+find_path(KMETADATA_INCLUDE_DIR NAMES kmetadata/kmetadata.h PATHS ${KDE4_INCLUDE_DIR})
+find_library(KMETADATA_LIBRARY NAMES kmetadata PATHS ${KDE4_LIB_DIR})
+if(KMETADATA_INCLUDE_DIR AND KMETADATA_LIBRARY)
+set(KDE4_KMETADATA kmetadata)
+set(HAVE_KMETADATA 1)
+else(KMETADATA_INCLUDE_DIR AND KMETADATA_LIBRARY)
+set(KDE4_KMETADATA "")
+endif(KMETADATA_INCLUDE_DIR AND KMETADATA_LIBRARY)
+configure_file(config-kmetadata.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kmetadata.h )
 target_link_libraries(dolphin  ${KDE4_KDECORE_LIBS} ${KDE4_KDEPRINT_LIBS} ${KDE4_KMETADATA} konq)
 
 install(TARGETS dolphin DESTINATION ${BIN_INSTALL_DIR})
diff --git a/src/config-kmetadata.h.cmake b/src/config-kmetadata.h.cmake
new file mode 100644 (file)
index 0000000..bb046d5
--- /dev/null
@@ -0,0 +1 @@
+#cmakedefine HAVE_KMETADATA 
index adc7d17ceebc7c4f09ce3ee94db8e49f072b4c9e..2585a7b82d9e9bad2cc97a4ea3da75e8c05b2793 100644 (file)
@@ -19,6 +19,7 @@
  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *\r
  ***************************************************************************/\r
 \r
+#include <config-kmetadata.h>\r
 #include "dolphinmainwindow.h"\r
 \r
 #include <assert.h>\r
@@ -154,17 +155,17 @@ void DolphinMainWindow::dropUrls(const KUrl::List& urls,
         QString seq = QKeySequence(Qt::ShiftModifier).toString();\r
         seq.chop(1); // chop superfluous '+'\r
         QAction* moveAction = popup.addAction(KIcon("goto"),\r
-                                              i18n("&Move Here") + "\t" + seq);\r
+                                              i18n("&Move Here") + '\t' + seq);\r
 \r
         seq = QKeySequence(Qt::ControlModifier).toString();\r
         seq.chop(1);\r
         QAction* copyAction = popup.addAction(KIcon("editcopy"),\r
-                                              i18n("&Copy Here") + "\t" + seq);\r
+                                              i18n("&Copy Here") + '\t' + seq);\r
 \r
         seq = QKeySequence(Qt::ControlModifier + Qt::ShiftModifier).toString();\r
         seq.chop(1);\r
         QAction* linkAction = popup.addAction(KIcon("www"),\r
-                                              i18n("&Link Here") + "\t" + seq);\r
+                                              i18n("&Link Here") + '\t' + seq);\r
 \r
         popup.addSeparator();\r
         popup.addAction(KIcon("stop"), i18n("Cancel"));\r
@@ -428,7 +429,7 @@ void DolphinMainWindow::deleteItems()
 \r
     const bool del = KMessageBox::warningContinueCancel(this,\r
                                                         text,\r
-                                                        QString::null,\r
+                                                        QString(),\r
                                                         KGuiItem(i18n("Delete"), KIcon("editdelete"))\r
                                                        ) == KMessageBox::Continue;\r
     if (del) {\r
@@ -953,9 +954,10 @@ void DolphinMainWindow::init()
         // assure a proper default size if Dolphin runs the first time\r
         resize(640, 480);\r
     }\r
-    \r
+    #ifdef HAVE_KMETADATA\r
     if (!DolphinApplication::app()->metadataLoader()->storageUp())\r
         activeView()->statusBar()->setMessage(i18n("Failed to contact Nepomuk service, annotation and tagging are disabled."), DolphinStatusBar::Error);\r
+    #endif\r
 }\r
 \r
 void DolphinMainWindow::loadSettings()\r
index 26a373875ebb82f34d5a73b4ee2aacd3c8752ead..f908a24cd733136d93f915651365a1fc8a140ac1 100644 (file)
@@ -125,7 +125,7 @@ void DolphinStatusBar::setProgress(int percent)
     const QString& defaultText = m_messageLabel->defaultText();
     const QString msg(m_messageLabel->text());
     if ((percent == 0) && !msg.isEmpty()) {
-        setMessage(QString::null, Default);
+        setMessage(QString(), Default);
     }
     else if ((percent == 100) && (msg != defaultText)) {
         setMessage(defaultText, Default);
index 86b864583dd7c41c6e80b8f76ab55e24b963c443..5ec8c901eecb9b86432aee5c7c7ba1725d7c5b29 100644 (file)
@@ -654,7 +654,7 @@ void DolphinView::updateProgress(int percent)
 void DolphinView::updateItemCount()
 {
     if (m_showProgress) {
-        m_statusBar->setProgressText(QString::null);
+        m_statusBar->setProgressText(QString());
         m_statusBar->setProgress(100);
         m_showProgress = false;
     }
index 35d0f6e736733c034041883ae772680403d8f80c..12be5b2ca326c947d73716159ebb9a313b17fdc8 100644 (file)
@@ -83,7 +83,7 @@ EditBookmarkDialog::EditBookmarkDialog(const QString& title,
     // create icon widgets
     new QLabel(i18n("Icon:"), grid);
     m_iconName = icon;
-    m_iconButton = new QPushButton(SmallIcon(m_iconName), QString::null, grid);
+    m_iconButton = new QPushButton(SmallIcon(m_iconName), QString(), grid);
     m_iconButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     connect(m_iconButton, SIGNAL(clicked()),
             this, SLOT(selectIcon()));
@@ -103,7 +103,7 @@ EditBookmarkDialog::EditBookmarkDialog(const QString& title,
     m_location = new QLineEdit(url.prettyUrl(), locationBox);
     m_location->setMinimumWidth(320);
 
-    QPushButton* selectLocationButton = new QPushButton(SmallIcon("folder"), QString::null, locationBox);
+    QPushButton* selectLocationButton = new QPushButton(SmallIcon("folder"), QString(), locationBox);
     selectLocationButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
     connect(selectLocationButton, SIGNAL(clicked()),
             this, SLOT(selectLocation()));
index 6994af0523b5a2122a16cad36cb81c672d5bd3b3..e31d0620e78c34556c388d1b2ce1da8e24b9dfc2 100644 (file)
@@ -75,7 +75,7 @@ GeneralSettingsPage::GeneralSettingsPage(DolphinMainWindow* mainWin,QWidget* par
     new QLabel(i18n("Location:"), homeUrlBox);
     m_homeUrl = new QLineEdit(settings->homeUrl(), homeUrlBox);
 
-    QPushButton* selectHomeUrlButton = new QPushButton(SmallIcon("folder"), QString::null, homeUrlBox);
+    QPushButton* selectHomeUrlButton = new QPushButton(SmallIcon("folder"), QString(), homeUrlBox);
     connect(selectHomeUrlButton, SIGNAL(clicked()),
             this, SLOT(selectHomeUrl()));
 
index 61c809feb6d944f79b898e60b859181de28797ca..2269a43743c332eb0c7d69664129c01e146e4737 100644 (file)
  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
  ***************************************************************************/
 
+#include <config-kmetadata.h>
+
 #include "metadataloader.h"
 
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_KMETADATA
 #include <kmetadata/kmetadata.h>
 #endif
 
@@ -29,7 +31,7 @@
 
 MetadataLoader::MetadataLoader()
 {
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_KMETADATA
     if (Nepomuk::KMetaData::ResourceManager::instance()->init()) {
         m_up = false;
         Nepomuk::KMetaData::ResourceManager::instance()->setAutoSync(false);
@@ -37,7 +39,7 @@ MetadataLoader::MetadataLoader()
         m_up = true;
     }
 #else
-    m_up = true;
+    m_up = false;
 #endif
 }
 
@@ -51,7 +53,7 @@ bool MetadataLoader::storageUp() {
 
 QString MetadataLoader::getAnnotation(const KUrl& file)
 {
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_KMETADATA
     if(m_up)
         return Nepomuk::KMetaData::File(file.url()).getAnnotation();
     else
@@ -61,7 +63,7 @@ QString MetadataLoader::getAnnotation(const KUrl& file)
 
 void MetadataLoader::setAnnotation(const KUrl& file, const QString& annotation)
 {
-#ifdef HAVE_NEPOMUK
+#ifdef HAVE_KMETADATA
     if(m_up)
         Nepomuk::KMetaData::File(file.url()).setAnnotation(annotation);
 #endif
index 2efcd2e7df40fa98a6b8e2dcc7fb387fbe2913eb..11bbea36db113633b78a4bf6312f6f85358b931e 100644 (file)
@@ -303,7 +303,7 @@ bool StatusBarMessageLabel::showPendingMessage()
 
 void StatusBarMessageLabel::reset()
 {
-    m_text = QString::null;
+    m_text.clear();
     m_type = DolphinStatusBar::Default;
 }
 
index 8d07d799623fc13edc06c91cc5e1315fc52190e6..c648351ebcecc88c105e645934eba9c63449ec93 100644 (file)
@@ -98,7 +98,7 @@ void StatusBarSpaceInfo::paintEvent(QPaintEvent* /* event */)
             text = i18n("Getting size...");
         }
         else {
-            text = QString::null;
+            text = QString();
             QTimer::singleShot(0, this, SLOT(hide()));
         }
     }
index 0ef302999a1b4dc519dbfe1fc709af949fa756ca..32d8da9112820f670de5d10563b14518e4982f7f 100644 (file)
@@ -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.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
  ***************************************************************************/
 
 #include "urlnavigatorbutton.h"
index b9290983fdac19e93b57115182d2522e121f260f..1ac92474ea6046343448f5caeea581dc31db7883 100644 (file)
@@ -343,7 +343,7 @@ void UrlNavigator::slotReturnPressed(const QString& text)
 
     KUrl typedUrl(text);
     if (typedUrl.hasPass()) {
-        typedUrl.setPass(QString::null);
+        typedUrl.setPass(QString());
     }
 
     QStringList urls = m_pathBox->urls();
@@ -567,7 +567,7 @@ void UrlNavigator::updateContent()
                 QString hostText = url().host();
 
                 if (!url().user().isEmpty()) {
-                    hostText = url().user() + "@" + hostText;
+                    hostText = url().user() + '@' + hostText;
                 }
 
                 if (!m_host) {