Commit 93622716 authored by Nicolás Alvarez's avatar Nicolás Alvarez
Browse files

Initial import from the monolithic kdepim.

This is the beginning of revision history for this module. If you
want to look at revision history older than this, please refer to the
techbase wiki for how to use Git history grafting. At the time of
writing, this wiki is located here:

http://community.kde.org/Frameworks/GitOldHistory

If you have already performed the grafting and you don't see any
history beyond this commit, try running "git log" with the "--follow"
argument.

Branched from the monolithic repo, kdepim master branch, at commit
d0009536f24e8c7f4cc32a70936f5c25194e9a6f
parents
EXTRA camelcase,defines,kdebug,null,qenums,tipsandthis
SKIP /viewerapp/
cmake_minimum_required(VERSION 2.8.12)
project(eventviews)
if(${CMAKE_SOURCE_DIR} STREQUAL ${eventviews_SOURCE_DIR})
# ECM setup
find_package(ECM 5.16.0 CONFIG REQUIRED)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
set(LIBRARY_NAMELINK)
include(GenerateExportHeader)
include(ECMSetupVersion)
include(ECMGenerateHeaders)
include(ECMGeneratePriFile)
include(ECMPackageConfigHelpers)
include(ECMSetupVersion)
include(FeatureSummary)
include(KDEInstallDirs)
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(KF5_VERSION "5.16.0")
set(CALENDARUTILS_LIB_VERSION "4.80.0")
set(KDEPIMLIBS_LIB_VERSION "5.1.42")
set(KDEPIM_LIB_VERSION "5.1.42")
set(QT_REQUIRED_VERSION "5.4.0")
set(KCALENDARCORE_LIB_VERSION "4.81.0")
set(AKONADICALENDAR_LIB_VERSION "4.80.0")
set(KMIME_LIB_VERSION "4.87.0")
set(IDENTITYMANAGEMENT_LIB_VERSION "4.80.0")
find_package(KF5Akonadi ${KDEPIMLIBS_LIB_VERSION} CONFIG REQUIRED)
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test UiTools)
find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Codecs ${KF5_VERSION} CONFIG REQUIRED)
find_package(KF5Libkdepim ${KDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5KDGantt2 ${KDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarUtils ${CALENDARUTILS_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarCore ${KCALENDARCORE_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5CalendarSupport ${KDEPIM_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5AkonadiCalendar ${AKONADICALENDAR_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED)
find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED)
ecm_setup_version(${KDEPIM_LIB_VERSION} VARIABLE_PREFIX EVENTVIEWS
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/eventviews_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfigVersion.cmake"
SOVERSION 5
)
########### Targets ###########
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
remove_definitions( -DQT_NO_CAST_FROM_BYTEARRAY )
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5EventViews")
ecm_configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/KF5EventViewsConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfig.cmake"
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfigVersion.cmake"
DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
COMPONENT Devel
)
install(EXPORT KF5EventViewsTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5EventViewsTargets.cmake NAMESPACE KF5::)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/eventviews_version.h
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel
)
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
else()
ecm_setup_version(${KDEPIM_LIB_VERSION} VARIABLE_PREFIX EVENTVIEWS
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/eventviews_version.h"
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5EventViewsConfigVersion.cmake"
SOVERSION 5
)
endif()
add_subdirectory(src)
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
install( FILES eventviews.categories DESTINATION ${KDE_INSTALL_CONFDIR} )
@PACKAGE_INIT@
find_dependency(KF5Akonadi "@KDEPIMLIBS_LIB_VERSION@")
find_dependency(KF5CalendarSupport "@KDEPIM_LIB_VERSION@")
find_dependency(KF5CalendarCore "@KCALENDARCORE_LIB_VERSION@")
find_dependency(KF5CalendarUtils "@CALENDARUTILS_LIB_VERSION@")
find_dependency(KF5AkonadiCalendar "@AKONADICALENDAR_LIB_VERSION@")
include("${CMAKE_CURRENT_LIST_DIR}/KF5EventViewsTargets.cmake")
log_calendarview kdepim (eventviews)
# The following macros can be defined to alter behavior.
# (if desired, use add_definitions() to define them)
#
# EVENTVIEWS_NODECOS - turns-off decoration plugins in views.
# No idea why you would want to define this, perhaps to save
# screen real estate? But there are a config options for that.
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_definitions(-DTRANSLATION_DOMAIN=\"libeventviews\")
if(KDEPIM_BUILD_EXAMPLES)
add_subdirectory(viewerapp)
endif()
option(EVENTVIEWS_NODECOS "Turn-off decoration plugins in views." FALSE)
if(EVENTVIEWS_NODECOS)
add_definitions(-DEVENTVIEWS_NODECOS)
endif()
########### next target ###############
set(eventviews_LIB_SRCS
eventview_p.cpp
eventview.cpp
helper.cpp
prefs.cpp
# Agenda view specific code.
agenda/agenda.cpp
agenda/agendaitem.cpp
agenda/agendaview.cpp
agenda/alternatelabel.cpp
agenda/calendardecoration.cpp
agenda/decorationlabel.cpp
agenda/timelabels.cpp
agenda/timelabelszone.cpp
agenda/timescaleconfigdialog.cpp
agenda/viewcalendar.cpp
journal/journalframe.cpp
journal/journalview.cpp
list/listview.cpp
month/monthgraphicsitems.cpp
month/monthitem.cpp
month/monthscene.cpp
month/monthview.cpp
multiagenda/multiagendaview.cpp
todo/tododelegates.cpp
todo/todomodel.cpp
todo/incidencetreemodel.cpp
todo/todoviewquickaddline.cpp
todo/todoviewquicksearch.cpp
todo/todoviewsortfilterproxymodel.cpp
todo/todoviewview.cpp
todo/todoview.cpp
timeline/timelineview.cpp
timeline/timelineitem.cpp
timeline/timelineview_p.cpp
timespent/timespentview.cpp
whatsnext/whatsnextview.cpp
)
kconfig_add_kcfg_files(eventviews_LIB_SRCS prefs_base.kcfgc)
ecm_qt_declare_logging_category(eventviews_LIB_SRCS HEADER calendarview_debug.h IDENTIFIER CALENDARVIEW_LOG CATEGORY_NAME log_calendarview)
ki18n_wrap_ui(eventviews_LIB_SRCS
agenda/timescaleedit_base.ui
)
add_library(KF5EventViews ${eventviews_LIB_SRCS})
generate_export_header(KF5EventViews BASE_NAME eventviews)
add_library(KF5::EventViews ALIAS KF5EventViews)
target_link_libraries(KF5EventViews
PUBLIC
KF5::AkonadiCore
KF5::CalendarSupport
KF5::CalendarCore
KF5::CalendarUtils
KF5::AkonadiCalendar
PRIVATE
KF5::Libkdepim
KF5::Codecs
KF5::KDGantt2
KF5::AkonadiWidgets
)
target_include_directories(KF5EventViews INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/EventViews/;${KDE_INSTALL_INCLUDEDIR_KF5}/eventviews>")
target_include_directories(KF5EventViews PUBLIC "$<BUILD_INTERFACE:${eventviews_SOURCE_DIR}/src;${eventviews_BINARY_DIR}/src;>")
set_target_properties(KF5EventViews PROPERTIES
VERSION ${EVENTVIEWS_VERSION_STRING}
SOVERSION ${EVENTVIEWS_SOVERSION}
EXPORT_NAME EventViews
)
install(TARGETS
KF5EventViews
EXPORT KF5EventViewsTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
)
ecm_generate_headers(eventviews_CamelCase_HEADERS
HEADER_NAMES
Prefs
EventView
REQUIRED_HEADERS eventviews_CamelCase_HEADERS
PREFIX EventViews
)
ecm_generate_headers(eventviews_CamelCaseagenda_HEADERS
HEADER_NAMES
CalendarDecoration
AgendaView
ViewCalendar
REQUIRED_HEADERS eventviews_agenda_HEADERS
PREFIX EventViews
RELATIVE agenda
)
ecm_generate_headers(eventviews_CamelCasetodo_HEADERS
HEADER_NAMES
TodoView
REQUIRED_HEADERS eventviews_todo_HEADERS
PREFIX EventViews
RELATIVE todo
)
ecm_generate_headers(eventviews_CamelCasemonth_HEADERS
HEADER_NAMES
MonthView
REQUIRED_HEADERS eventviews_month_HEADERS
PREFIX EventViews
RELATIVE month
)
ecm_generate_headers(eventviews_CamelCaselist_HEADERS
HEADER_NAMES
ListView
REQUIRED_HEADERS eventviews_list_HEADERS
PREFIX EventViews
RELATIVE list
)
ecm_generate_headers(eventviews_CamelCasejournal_HEADERS
HEADER_NAMES
JournalView
REQUIRED_HEADERS eventviews_journal_HEADERS
PREFIX EventViews
RELATIVE journal
)
ecm_generate_headers(eventviews_CamelCasemultiagenda_HEADERS
HEADER_NAMES
MultiAgendaView
ConfigDialogInterface
REQUIRED_HEADERS eventviews_multiagenda_HEADERS
PREFIX EventViews
RELATIVE multiagenda
)
ecm_generate_headers(eventviews_CamelCasetimeline_HEADERS
HEADER_NAMES
TimeLineView
REQUIRED_HEADERS eventviews_timeline_HEADERS
PREFIX EventViews
RELATIVE timeline
)
ecm_generate_headers(eventviews_CamelCasetimespent_HEADERS
HEADER_NAMES
TimeSpentView
REQUIRED_HEADERS eventviews_timespent_HEADERS
PREFIX EventViews
RELATIVE timespent
)
ecm_generate_headers(eventviews_CamelCasewhatsnext_HEADERS
HEADER_NAMES
WhatsNextView
REQUIRED_HEADERS eventviews_whatsnext_HEADERS
PREFIX EventViews
RELATIVE whatsnext
)
ecm_generate_pri_file(BASE_NAME EventViews
LIB_NAME KF5EventViews
DEPS "Mime IdentityManagement AkonadiCalendar" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/EventViews
)
if(${CMAKE_SOURCE_DIR} STREQUAL ${eventviews_SOURCE_DIR})
install(FILES
${eventviews_CamelCase_HEADERS}
${eventviews_CamelCaseagenda_HEADERS}
${eventviews_CamelCasetodo_HEADERS}
${eventviews_CamelCasetimespent_HEADERS}
${eventviews_CamelCasewhatsnext_HEADERS}
${eventviews_CamelCasetimeline_HEADERS}
${eventviews_CamelCasemultiagenda_HEADERS}
${eventviews_CamelCasejournal_HEADERS}
${eventviews_CamelCaselist_HEADERS}
${eventviews_CamelCasemonth_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/EventViews
COMPONENT Devel
)
install(FILES
${eventviews_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/eventviews_export.h
${eventviews_CamelCase_HEADERS}
${eventviews_agenda_HEADERS}
${eventviews_todo_HEADERS}
${eventviews_timespent_HEADERS}
${eventviews_whatsnext_HEADERS}
${eventviews_timeline_HEADERS}
${eventviews_multiagenda_HEADERS}
${eventviews_journal_HEADERS}
${eventviews_list_HEADERS}
${eventviews_month_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/eventviews
COMPONENT Devel
)
install(FILES
${PRI_FILENAME}
DESTINATION ${ECM_MKSPECS_INSTALL_DIR})
endif()
install(FILES agenda/calendardecoration.desktop DESTINATION ${KDE_INSTALL_KSERVICETYPES5DIR})
#! /bin/sh
$EXTRACTRC `find . -name '*.ui' -or -name '*.kcfg'` >> rc.cpp || exit 11
$XGETTEXT `find . -name "*.cpp" | grep -v '/tests/'` -o $podir/libeventviews.pot
rm -f rc.cpp
This diff is collapsed.
/*
Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
Copyright (C) 2003-2004 Reinhold Kainhofer <reinhold@kainhofer.com>
Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
Author: Kevin Krammer, krake@kdab.com
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef EVENTVIEWS_AGENDA_H
#define EVENTVIEWS_AGENDA_H
#include "eventviews_export.h"
#include "agendaitem.h"
#include "viewcalendar.h"
#include <Item>
#include <KCalCore/Todo>
#include <QFrame>
#include <QScrollArea>
namespace Akonadi
{
class IncidenceChanger;
}
namespace EventViews
{
class Agenda;
class AgendaItem;
class AgendaView;
class MarcusBains : public QFrame
{
Q_OBJECT
public:
explicit MarcusBains(EventView *eventView, Agenda *agenda = Q_NULLPTR);
void updateLocationRecalc(bool recalculate = false);
virtual ~MarcusBains();
public Q_SLOTS:
void updateLocation();
private:
class Private;
Private *const d;
};
class EVENTVIEWS_EXPORT Agenda : public QWidget
{
Q_OBJECT
public:
Agenda(AgendaView *agendaView, QScrollArea *scrollArea,
int columns, int rows, int rowSize, bool isInteractive);
Agenda(AgendaView *agendaView, QScrollArea *scrollArea, int columns, bool isInteractive);
virtual ~Agenda();
KCalCore::Incidence::Ptr selectedIncidence() const;
QDate selectedIncidenceDate() const;
QSize sizeHint() const Q_DECL_OVERRIDE;
QSize minimumSizeHint() const Q_DECL_OVERRIDE;
QSize minimumSize() const;
int minimumHeight() const;
// QSizePolicy sizePolicy() const;
int contentsY() const
{
return -y();
}
int contentsX() const
{
return x();
}
QScrollBar *verticalScrollBar() const;
QScrollArea *scrollArea() const;
AgendaItem::List agendaItems(const QString &uid) const;
/**
Returns the uid of the last incidence that was selected. This
persists across reloads and clear, so that if the same uid
reappears, it can be reselected.
*/
QString lastSelectedItemUid() const;
bool eventFilter(QObject *, QEvent *) Q_DECL_OVERRIDE;
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
QPoint contentsToGrid(const QPoint &pos) const;
QPoint gridToContents(const QPoint &gpos) const;
int timeToY(const QTime &time) const;
QTime gyToTime(int y) const;
QVector<int> minContentsY() const;
QVector<int> maxContentsY() const;
int visibleContentsYMin() const;
int visibleContentsYMax() const;
void setStartTime(const QTime &startHour);
AgendaItem::QPtr insertItem(const KCalCore::Incidence::Ptr &incidence, const KDateTime &recurrenceId, int X, int YTop,
int YBottom, int itemPos, int itemCount, bool isSelected);
AgendaItem::QPtr insertAllDayItem(const KCalCore::Incidence::Ptr &event, const KDateTime &recurrenceId, int XBegin,
int XEnd, bool isSelected);
void insertMultiItem(const KCalCore::Incidence::Ptr &event, const KDateTime &recurrenceId, int XBegin, int XEnd,
int YTop, int YBottom, bool isSelected);
/**
Removes an event and all its multi-items from the agenda. This function
removes the items from the view, but doesn't delete them immediately.
Instead, they are queued in mItemsToDelete and later deleted by the
slot deleteItemsToDelete() (called by QTimer::singleShot ).
@param incidence The pointer to the incidence that should be removed.
*/
void removeIncidence(const KCalCore::Incidence::Ptr &incidence);
void changeColumns(int columns);
int columns() const;
int rows() const;
double gridSpacingX() const;
double gridSpacingY() const;
void clear();
/** Update configuration from preference settings */
void updateConfig();
void checkScrollBoundaries();
void setHolidayMask(QVector<bool> *);
void setDateList(const KCalCore::DateList &selectedDates);
KCalCore::DateList dateList() const;
void setCalendar(const EventViews::MultiViewCalendar::Ptr &cal);
void setIncidenceChanger(Akonadi::IncidenceChanger *changer);
public Q_SLOTS:
void scrollUp();
void scrollDown();
void checkScrollBoundaries(int);
/** Deselect selected items. This function does not Q_EMIT any signals. */
void deselectItem();
void clearSelection();
/**
Select item. If the argument is 0, the currently selected item gets
deselected. This function emits the itemSelected(bool) signal to inform
about selection/deselection of events.
*/
void selectItem(const AgendaItem::QPtr &);
/**
Selects the item associated with a given Akonadi Item id.
Linear search, use carefully.
@param id the item id of the item that should be selected. If no such
item exists, the selection is not changed.
*/
void selectIncidenceByUid(const QString &id);
void selectItem(const Akonadi::Item &item);
bool removeAgendaItem(const AgendaItem::QPtr &item);
void showAgendaItem(const AgendaItem::QPtr &item);
Q_SIGNALS:
void newEventSignal();
void newTimeSpanSignal(const QPoint &, const QPoint &);
void newStartSelectSignal();
void showIncidenceSignal(const KCalCore::Incidence::Ptr &);
void editIncidenceSignal(const KCalCore::Incidence::Ptr &);
void deleteIncidenceSignal(const KCalCore::Incidence::Ptr &);
void showIncidencePopupSignal(const KCalCore::Incidence::Ptr &, const QDate &);
void showNewEventPopupSignal();
void incidenceSelected(const KCalCore::Incidence::Ptr &, const QDate &);
void lowerYChanged(int);
void upperYChanged(int);
void startDragSignal(const KCalCore::Incidence::Ptr &);
void droppedIncidences(const KCalCore::Incidence::List &, const QPoint &gpos, bool allDay);
void droppedIncidences(const QList<QUrl> &, const QPoint &gpos, bool allDay);
void enableAgendaUpdate(bool enable);
void zoomView(const int delta, const QPoint &pos, const Qt::Orientation);
void mousePosSignal(const QPoint &pos);
void enterAgenda();
void leaveAgenda();
void gridSpacingYChanged(double);
private:
enum MouseActionType {
NOP,
MOVE,
SELECT,
RESIZETOP,
RESIZEBOTTOM,
RESIZELEFT,
RESIZERIGHT
};
AgendaItem::QPtr createAgendaItem(const KCalCore::Incidence::Ptr &incidence, int itemPos,
int itemCount, const KDateTime &recurrentId, bool isSelected);
protected:
/**
Draw the background grid of the agenda.
@p cw grid width
@p ch grid height
*/
void drawContents(QPainter *p, int cx, int cy, int cw, int ch);
int columnWidth(int column) const;
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
/** Handles mouse events. Called from eventFilter */
virtual bool eventFilter_mouse(QObject *, QMouseEvent *);
#ifndef QT_NO_WHEELEVENT