mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-12 20:51:17 +00:00
Activities support for Okular
REVIEW: 106685
This commit is contained in:
parent
ec7b2e763d
commit
09a2fdab8c
|
@ -3,6 +3,16 @@ include_directories(
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/..
|
||||
)
|
||||
|
||||
# checking whether we should enable activities support
|
||||
|
||||
macro_optional_find_package(KActivities 6.1.0)
|
||||
macro_log_feature(KActivities_FOUND "KActivities" "Activities interface library" "https://projects.kde.org/projects/kde/kdelibs/kactivities" FALSE "6.1.0" "Required for Activities integration.")
|
||||
|
||||
if(KActivities_FOUND)
|
||||
add_definitions(-DKActivities_FOUND)
|
||||
include_directories(${KACTIVITIES_INCLUDE_DIRS})
|
||||
endif(KActivities_FOUND)
|
||||
|
||||
# okular
|
||||
|
||||
set(okular_SRCS
|
||||
|
@ -15,7 +25,7 @@ kde4_add_app_icon(okular_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../ui/data/icons/hi*-
|
|||
|
||||
kde4_add_executable(okular ${okular_SRCS})
|
||||
|
||||
target_link_libraries(okular ${KDE4_KPARTS_LIBS} )
|
||||
target_link_libraries(okular ${KDE4_KPARTS_LIBS} ${KACTIVITIES_LIBRARY})
|
||||
|
||||
install(TARGETS okular ${INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
|
|
|
@ -44,6 +44,10 @@
|
|||
#include <kactioncollection.h>
|
||||
#include <kwindowsystem.h>
|
||||
|
||||
#ifdef KActivities_FOUND
|
||||
#include <KActivities/ResourceInstance>
|
||||
#endif
|
||||
|
||||
// local includes
|
||||
#include "kdocumentviewer.h"
|
||||
#include "shellutils.h"
|
||||
|
@ -53,6 +57,9 @@ static const char *shouldShowToolBarComingFromFullScreen = "shouldShowToolBarCom
|
|||
|
||||
Shell::Shell(KCmdLineArgs* args, int argIndex)
|
||||
: KParts::MainWindow(), m_args(args), m_menuBarWasShown(true), m_toolBarWasShown(true)
|
||||
#ifdef KActivities_FOUND
|
||||
, m_activityResource(0)
|
||||
#endif
|
||||
{
|
||||
if (m_args && argIndex != -1)
|
||||
{
|
||||
|
@ -167,7 +174,15 @@ void Shell::openUrl( const KUrl & url )
|
|||
if ( !isstdin )
|
||||
{
|
||||
if ( openOk )
|
||||
{
|
||||
#ifdef KActivities_FOUND
|
||||
if ( !m_activityResource )
|
||||
m_activityResource = new KActivities::ResourceInstance( window()->winId(), this );
|
||||
|
||||
m_activityResource->setUri( url );
|
||||
#endif
|
||||
m_recent->addUrl( url );
|
||||
}
|
||||
else
|
||||
m_recent->removeUrl( url );
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ class KToggleAction;
|
|||
class KDocumentViewer;
|
||||
class Part;
|
||||
|
||||
#ifdef KActivities_FOUND
|
||||
namespace KActivities { class ResourceInstance; }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is the application "Shell". It has a menubar and a toolbar
|
||||
* but relies on the "Part" to do all the real work.
|
||||
|
@ -112,6 +116,10 @@ private:
|
|||
bool m_menuBarWasShown, m_toolBarWasShown;
|
||||
bool m_unique;
|
||||
KUrl m_openUrl;
|
||||
|
||||
#ifdef KActivities_FOUND
|
||||
KActivities::ResourceInstance* m_activityResource;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue