Hi! > I've still have to try the patch. There is a new class in the directory "information". Please link kdebase/apps/dolphin/src/panels/information to kdegraphics/okular/ui/information and use the attached new patch. Now okular.diff includes my files, too. I hope, now it is easy and safe for you, to test my patch.
> > AFAIKS the standard file information (filename, size etc.) can be hidden > > in the view, so only the semantical information last. Yes. > That'd be okaish, does the patch follow the system wide setting of enabling > the semantic desktop (systemsettings -> advanced -> desktop search -> > enable semantic desktop) and if it's disabled is not shown? The information widget is always shown. In dolphin it is always shown, too. If semantic desktop is disabled, the widget only shows standard file information. I think the user should be able to decide wheter the information widget is shown or not in okular ("General Options" of okular's configure dialog). This isn't implemented yet. The system wide settings decide whether semantic information is shown or not in the information widget. The user is able to fade out the information, he doen't want to see, by right clicking on the information widget. Best regards, Oliver. P.S.: Is the line "#define MAX_OBSERVER_ID 12" in core/observer.h still correct with my patch?
Index: part.cpp =================================================================== --- part.cpp (revision 1050848) +++ part.cpp (working copy) @@ -77,6 +77,7 @@ #include "ui/sidebar.h" #include "ui/fileprinterpreview.h" #include "ui/guiutils.h" +#include "ui/nepomukwidget.h" #include "conf/preferencesdialog.h" #include "settings.h" #include "core/bookmarkmanager.h" @@ -309,6 +310,11 @@ m_sidebar->addItem( m_bookmarkList, KIcon("bookmarks"), i18n("Bookmarks") ); m_sidebar->setItemEnabled( 3, false ); + // [left toolbox: Tags] | [] + m_nepomuk = new NepomukWidget( m_document, 0 ); + m_sidebar->addItem( m_nepomuk, KIcon("nepomuk"), i18n("Information") ); + m_sidebar->setItemEnabled( 4, true ); + // widgets: [../miniBarContainer] | [] #ifdef OKULAR_ENABLE_MINIBAR QWidget * miniBarContainer = new QWidget( 0 ); @@ -385,6 +391,7 @@ m_document->addObserver( m_reviewsWidget ); m_document->addObserver( m_pageSizeLabel ); m_document->addObserver( m_bookmarkList ); + m_document->addObserver( m_nepomuk ); connect( m_document->bookmarkManager(), SIGNAL( saved() ), this, SLOT( slotRebuildBookmarkMenu() ) ); @@ -633,7 +640,8 @@ delete m_pageSizeLabel; delete m_reviewsWidget; delete m_bookmarkList; - + delete m_nepomuk; + delete m_document; delete m_tempfile; Index: core/observer.h =================================================================== --- core/observer.h (revision 1050848) +++ core/observer.h (working copy) @@ -29,6 +29,7 @@ #define PAGESIZELABEL_ID 9 #define BOOKMARKLIST_ID 10 #define ANNOTATIONMODEL_ID 11 +#define NEPOMUKWIDGET_ID 12 // the biggest id, useful for ignoring wrong id request #define MAX_OBSERVER_ID 12 Index: part.h =================================================================== --- part.h (revision 1050848) +++ part.h (working copy) @@ -56,6 +56,7 @@ class FileKeeper; class Reviews; class BookmarkList; +class NepomukWidget; namespace Okular { @@ -208,6 +209,7 @@ QPointer<PageSizeLabel> m_pageSizeLabel; QPointer<Reviews> m_reviewsWidget; QPointer<BookmarkList> m_bookmarkList; + QPointer<NepomukWidget> m_nepomuk; // document watcher (and reloader) variables KDirWatch *m_watcher; Index: ui/nepomukwidget.cpp =================================================================== --- ui/nepomukwidget.cpp (revision 0) +++ ui/nepomukwidget.cpp (revision 0) @@ -0,0 +1,81 @@ +/*************************************************************************** + * Copyright (C) 2009 by Oliver Heidbüchel <p...@oliver-heidbuechel.de> * + * * + * This file is based on bookmarklist.cpp * + * (Copyright (C) 2006 by Pino Toscano <p...@kde.org>) * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "nepomukwidget.h" +#include "core/document.h" +#include "information/kmetadatawidget.h" +#include "information/kmetadataconfigurationdialog.h" + +#include <KLocale> +#include <KUrl> +#include <KMenu> +#include <QContextMenuEvent> +#include <QScrollArea> +#include <QVBoxLayout> +#include <QResizeEvent> +#include <QScrollBar> + +NepomukWidget::NepomukWidget(Okular::Document *document, QWidget *parent) + : QScrollArea(parent), + m_document(document) +{ + QWidget * inner = new QWidget(this); + QVBoxLayout * layout = new QVBoxLayout(inner); + mdw = new KMetaDataWidget(inner); + layout->addWidget(mdw); + layout->addStretch(); + setWidget(inner); + setWidgetResizable(true); + setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + //setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); +} + + +NepomukWidget::~NepomukWidget() +{ + m_document->removeObserver(this); +} + + +uint NepomukWidget::observerId() const +{ + return NEPOMUKWIDGET_ID; +} + + +void NepomukWidget::notifySetup(const QVector<Okular::Page *> &pages, int setupFlags) +{ + if ( !( setupFlags & Okular::DocumentObserver::DocumentChanged) ) + return; + + KUrl url = m_document->currentDocument(); + mdw->setItem(url); +} + + +void NepomukWidget::contextMenuEvent(QContextMenuEvent *event) +{ + KMenu configureMenu(this); + QAction * configureAction = configureMenu.addAction(KIcon("configure"), i18nc("@action:inmenu", "Configure...")); + QAction * choosenAction = configureMenu.exec(QCursor::pos()); + if (choosenAction == configureAction){ + KMetaDataConfigurationDialog dialog(mdw, this, Qt::Dialog); + dialog.exec(); + } +} + +void NepomukWidget::resizeEvent(QResizeEvent * event) +{ + mdw->setFixedWidth(width() * 0.9); +} + Index: ui/nepomukwidget.h =================================================================== --- ui/nepomukwidget.h (revision 0) +++ ui/nepomukwidget.h (revision 0) @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2009 by Oliver Heidbüchel <p...@oliver-heidbuechel.de> * + * * + * This file is based on bookmarklist.h * + * (Copyright (C) 2006 by Pino Toscano <p...@kde.org>) * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef TAGS_H +#define TAGS_H + +#include "core/observer.h" +#include "information/kmetadatawidget.h" + +#include <QScrollArea> +#include <QResizeEvent> + + + +namespace Okular { + class Document; +} + +class NepomukWidget : public QScrollArea, public Okular::DocumentObserver +{ + Q_OBJECT + + public: + explicit NepomukWidget( Okular::Document *document, QWidget *parent = 0 ); + ~NepomukWidget(); + + // inherited from DocumentObserver + uint observerId() const; + void notifySetup( const QVector< Okular::Page * > & pages, int setupFlags ); + + protected: + virtual void contextMenuEvent(QContextMenuEvent* event); + virtual void resizeEvent (QResizeEvent * event); + + private: + Okular::Document * m_document; + KMetaDataWidget * mdw; +}; + +#endif Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 1050848) +++ CMakeLists.txt (working copy) @@ -15,7 +15,20 @@ ${QIMAGEBLITZ_INCLUDES} ) +macro_optional_find_package(Nepomuk) +macro_log_feature(Nepomuk_FOUND "Nepomuk" "Nepomuk" "http://www.kde.org" FALSE "" "For adding desktop-wide tagging support to okular") +macro_bool_to_01(Nepomuk_FOUND HAVE_NEPOMUK) +configure_file(config-nepomuk.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-nepomuk.h ) +include_directories( ${KDE4_INCLUDE_DIR} ${QT_INCLUDES} ${QIMAGEBLITZ_INCLUDES} ) + +if (Nepomuk_FOUND) + # Yes, Soprano includes is what we need here + include_directories( ${SOPRANO_INCLUDE_DIR} ${NEPOMUK_INCLUDE_DIR} ) +endif (Nepomuk_FOUND) + +find_package(Nepomuk REQUIRED) + # okularcore set(okularcore_SRCS @@ -55,6 +68,13 @@ core/script/kjs_field.cpp core/script/kjs_spell.cpp core/script/kjs_util.cpp + ui/information/kmetadatawidget.cpp + ui/information/kmetadataconfigurationdialog.cpp + ui/information/kcommentwidget.cpp + ui/information/kedittagsdialog.cpp + ui/information/nepomukmassupdatejob.cpp + ui/information/ktaggingwidget.cpp + ui/information/kloadmetadatathread.cpp ) install( FILES @@ -89,7 +109,7 @@ core/chooseenginewidget.ui ) -kde4_add_kcfg_files(okularcore_SRCS conf/settings.kcfgc ) +kde4_add_kcfg_files(okularcore_SRCS conf/settings.kcfgc) kde4_add_library(okularcore SHARED ${okularcore_SRCS}) @@ -99,7 +119,7 @@ SET(OKULAR_IOKIT "-framework IOKit" CACHE STRING "Apple IOKit framework") ENDIF(APPLE) -target_link_libraries(okularcore ${OKULAR_IOKIT} ${KDE4_KIO_LIBS} ${KDE4_PHONON_LIBRARY} ${KDE4_KJSAPI_LIBRARY} ${MATH_LIB} ${KDE4_THREADWEAVER_LIBRARY} ) +target_link_libraries(okularcore ${OKULAR_IOKIT} ${KDE4_KIO_LIBS} ${KDE4_PHONON_LIBRARY} ${KDE4_KJSAPI_LIBRARY} ${MATH_LIB} ${KDE4_THREADWEAVER_LIBRARY} ${NEPOMUK_LIBRARIES} ${SOPRANO_LIBRARIES} ) set_target_properties(okularcore PROPERTIES VERSION 1.3.0 SOVERSION 1 ) @@ -156,6 +176,14 @@ ui/toolaction.cpp ui/tts.cpp ui/videowidget.cpp + ui/nepomukwidget.cpp + ui/information/kmetadatawidget.cpp + ui/information/kmetadataconfigurationdialog.cpp + ui/information/kcommentwidget.cpp + ui/information/kedittagsdialog.cpp + ui/information/nepomukmassupdatejob.cpp + ui/information/ktaggingwidget.cpp + ui/information/kloadmetadatathread.cpp ) kde4_add_ui_files(okularpart_SRCS @@ -171,7 +199,7 @@ kde4_add_plugin(okularpart ${okularpart_SRCS}) -target_link_libraries(okularpart okularcore ${KDE4_KPARTS_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_KNEWSTUFF2_LIBS} ${MATH_LIB} ${QIMAGEBLITZ_LIBRARIES} ${KDE4_PHONON_LIBRARY}) +target_link_libraries(okularpart okularcore ${KDE4_KPARTS_LIBS} ${KDE4_KUTILS_LIBS} ${KDE4_KNEWSTUFF2_LIBS} ${MATH_LIB} ${QIMAGEBLITZ_LIBRARIES} ${KDE4_PHONON_LIBRARY} ${NEPOMUK_LIBRARIES} ${SOPRANO_LIBRARIES} ) install(TARGETS okularpart DESTINATION ${PLUGIN_INSTALL_DIR})
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Okular-devel mailing list Okular-devel@kde.org https://mail.kde.org/mailman/listinfo/okular-devel