Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KAlarm
Commits
0ac34c53
Commit
0ac34c53
authored
Sep 10, 2014
by
David Jarvie
Browse files
Remove deprecated methods, constify local variables, adjust spacing
parent
23c09b27
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
src/alarmtext.cpp
View file @
0ac34c53
...
...
@@ -158,7 +158,7 @@ void AlarmText::setTodo(const KCalCore::Todo::Ptr &todo)
KDateTime
due
=
todo
->
dtDue
(
false
);
// fetch the next due date
if
(
todo
->
hasStartDate
()
&&
todo
->
dtStart
()
!=
due
)
{
d
->
mTime
=
todo
->
allDay
()
?
KLocale
::
global
()
->
formatDate
(
due
.
date
(),
KLocale
::
ShortDate
)
:
KLocale
::
global
()
->
formatDateTime
(
due
.
dateTime
());
:
KLocale
::
global
()
->
formatDateTime
(
due
.
dateTime
());
}
}
}
...
...
@@ -175,44 +175,44 @@ QString AlarmText::Private::displayText() const
{
QString
text
;
switch
(
mType
)
{
case
Email
:
// Format the email into a text alarm
setUpTranslations
();
text
=
mFromPrefix
+
QLatin1Char
(
'\t'
)
+
mFrom
+
QLatin1Char
(
'\n'
);
text
+=
mToPrefix
+
QLatin1Char
(
'\t'
)
+
mTo
+
QLatin1Char
(
'\n'
);
if
(
!
mCc
.
isEmpty
())
{
text
+=
mCcPrefix
+
QLatin1Char
(
'\t'
)
+
mCc
+
QLatin1Char
(
'\n'
);
}
if
(
!
mTime
.
isEmpty
())
{
text
+=
mDatePrefix
+
QLatin1Char
(
'\t'
)
+
mTime
+
QLatin1Char
(
'\n'
);
}
text
+=
mSubjectPrefix
+
QLatin1Char
(
'\t'
)
+
mSubject
;
if
(
!
mBody
.
isEmpty
())
{
text
+=
QLatin1String
(
"
\n\n
"
);
text
+=
mBody
;
}
break
;
case
Todo
:
// Format the todo into a text alarm
setUpTranslations
();
if
(
!
mSubject
.
isEmpty
())
{
text
=
mTitlePrefix
+
QLatin1Char
(
'\t'
)
+
mSubject
+
QLatin1Char
(
'\n'
);
}
if
(
!
mTo
.
isEmpty
())
{
text
+=
mLocnPrefix
+
QLatin1Char
(
'\t'
)
+
mTo
+
QLatin1Char
(
'\n'
);
}
if
(
!
mTime
.
isEmpty
())
{
text
+=
mDuePrefix
+
QLatin1Char
(
'\t'
)
+
mTime
+
QLatin1Char
(
'\n'
);
}
if
(
!
mBody
.
isEmpty
())
{
if
(
!
text
.
isEmpty
())
{
text
+=
QLatin1Char
(
'\n'
);
case
Email
:
// Format the email into a text alarm
setUpTranslations
();
text
=
mFromPrefix
+
QLatin1Char
(
'\t'
)
+
mFrom
+
QLatin1Char
(
'\n'
);
text
+=
mToPrefix
+
QLatin1Char
(
'\t'
)
+
mTo
+
QLatin1Char
(
'\n'
);
if
(
!
mCc
.
isEmpty
())
{
text
+=
mCcPrefix
+
QLatin1Char
(
'\t'
)
+
mCc
+
QLatin1Char
(
'\n'
);
}
text
+=
mBody
;
}
break
;
default:
break
;
if
(
!
mTime
.
isEmpty
())
{
text
+=
mDatePrefix
+
QLatin1Char
(
'\t'
)
+
mTime
+
QLatin1Char
(
'\n'
);
}
text
+=
mSubjectPrefix
+
QLatin1Char
(
'\t'
)
+
mSubject
;
if
(
!
mBody
.
isEmpty
())
{
text
+=
QLatin1String
(
"
\n\n
"
);
text
+=
mBody
;
}
break
;
case
Todo
:
// Format the todo into a text alarm
setUpTranslations
();
if
(
!
mSubject
.
isEmpty
())
{
text
=
mTitlePrefix
+
QLatin1Char
(
'\t'
)
+
mSubject
+
QLatin1Char
(
'\n'
);
}
if
(
!
mTo
.
isEmpty
())
{
text
+=
mLocnPrefix
+
QLatin1Char
(
'\t'
)
+
mTo
+
QLatin1Char
(
'\n'
);
}
if
(
!
mTime
.
isEmpty
())
{
text
+=
mDuePrefix
+
QLatin1Char
(
'\t'
)
+
mTime
+
QLatin1Char
(
'\n'
);
}
if
(
!
mBody
.
isEmpty
())
{
if
(
!
text
.
isEmpty
())
{
text
+=
QLatin1Char
(
'\n'
);
}
text
+=
mBody
;
}
break
;
default:
break
;
}
return
!
text
.
isEmpty
()
?
text
:
mBody
;
}
...
...
@@ -312,47 +312,47 @@ QString AlarmText::summary(const KAEvent &event, int maxLines, bool *truncated)
static
const
QRegExp
localfile
(
QLatin1String
(
"^file:/+"
));
QString
text
;
switch
(
event
.
actionSubType
())
{
case
KAEvent
::
AUDIO
:
text
=
event
.
audioFile
();
if
(
localfile
.
indexIn
(
text
)
>=
0
)
{
text
=
text
.
mid
(
localfile
.
matchedLength
()
-
1
);
}
break
;
case
KAEvent
::
EMAIL
:
text
=
event
.
emailSubject
();
break
;
case
KAEvent
::
COMMAND
:
text
=
event
.
cleanText
();
if
(
localfile
.
indexIn
(
text
)
>=
0
)
{
text
=
text
.
mid
(
localfile
.
matchedLength
()
-
1
);
}
break
;
case
KAEvent
::
FILE
:
text
=
event
.
cleanText
();
break
;
case
KAEvent
::
MESSAGE
:
{
text
=
event
.
cleanText
();
// If the message is the text of an email, return its headers or just subject line
QString
subject
=
emailHeaders
(
text
,
(
maxLines
<=
1
));
if
(
!
subject
.
isNull
())
{
if
(
truncated
)
{
*
truncated
=
true
;
case
KAEvent
::
AUDIO
:
text
=
event
.
audioFile
();
if
(
localfile
.
indexIn
(
text
)
>=
0
)
{
text
=
text
.
mid
(
localfile
.
matchedLength
()
-
1
);
}
return
subject
;
}
if
(
maxLines
==
1
)
{
// If the message is the text of a todo, return either the
// title/description or the whole text.
subject
=
Private
::
todoTitle
(
text
);
if
(
!
subject
.
isEmpty
())
{
break
;
case
KAEvent
::
EMAIL
:
text
=
event
.
emailSubject
();
break
;
case
KAEvent
::
COMMAND
:
text
=
event
.
cleanText
();
if
(
localfile
.
indexIn
(
text
)
>=
0
)
{
text
=
text
.
mid
(
localfile
.
matchedLength
()
-
1
);
}
break
;
case
KAEvent
::
FILE
:
text
=
event
.
cleanText
();
break
;
case
KAEvent
::
MESSAGE
:
{
text
=
event
.
cleanText
();
// If the message is the text of an email, return its headers or just subject line
QString
subject
=
emailHeaders
(
text
,
(
maxLines
<=
1
));
if
(
!
subject
.
isNull
())
{
if
(
truncated
)
{
*
truncated
=
true
;
}
return
subject
;
}
if
(
maxLines
==
1
)
{
// If the message is the text of a todo, return either the
// title/description or the whole text.
subject
=
Private
::
todoTitle
(
text
);
if
(
!
subject
.
isEmpty
())
{
if
(
truncated
)
{
*
truncated
=
true
;
}
return
subject
;
}
}
break
;
}
break
;
}
}
if
(
truncated
)
{
*
truncated
=
false
;
...
...
@@ -381,7 +381,7 @@ QString AlarmText::summary(const KAEvent &event, int maxLines, bool *truncated)
*/
bool
AlarmText
::
checkIfEmail
(
const
QString
&
text
)
{
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
),
QString
::
SkipEmptyParts
);
const
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
),
QString
::
SkipEmptyParts
);
return
Private
::
emailHeaderCount
(
lines
);
}
...
...
@@ -393,7 +393,7 @@ bool AlarmText::checkIfEmail(const QString &text)
QString
AlarmText
::
emailHeaders
(
const
QString
&
text
,
bool
subjectOnly
)
{
const
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
),
QString
::
SkipEmptyParts
);
int
n
=
Private
::
emailHeaderCount
(
lines
);
const
int
n
=
Private
::
emailHeaderCount
(
lines
);
if
(
!
n
)
{
return
QString
();
}
...
...
@@ -418,17 +418,17 @@ QString AlarmText::fromCalendarText(const QString &text, bool &email)
{
Private
::
initialise
();
const
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
),
QString
::
SkipEmptyParts
);
int
maxn
=
lines
.
count
();
const
int
maxn
=
lines
.
count
();
if
(
maxn
>=
4
&&
lines
[
0
].
startsWith
(
Private
::
mFromPrefixEn
)
&&
lines
[
1
].
startsWith
(
Private
::
mToPrefixEn
))
{
&&
lines
[
0
].
startsWith
(
Private
::
mFromPrefixEn
)
&&
lines
[
1
].
startsWith
(
Private
::
mToPrefixEn
))
{
int
n
=
2
;
if
(
lines
[
2
].
startsWith
(
Private
::
mCcPrefixEn
))
{
++
n
;
}
if
(
maxn
>
n
+
1
&&
lines
[
n
].
startsWith
(
Private
::
mDatePrefixEn
)
&&
lines
[
n
+
1
].
startsWith
(
Private
::
mSubjectPrefixEn
))
{
&&
lines
[
n
].
startsWith
(
Private
::
mDatePrefixEn
)
&&
lines
[
n
+
1
].
startsWith
(
Private
::
mSubjectPrefixEn
))
{
Private
::
setUpTranslations
();
QString
dispText
;
dispText
=
Private
::
mFromPrefix
+
lines
[
0
].
mid
(
Private
::
mFromPrefixEn
.
length
())
+
QLatin1Char
(
'\n'
);
...
...
@@ -459,17 +459,17 @@ QString AlarmText::toCalendarText(const QString &text)
{
Private
::
setUpTranslations
();
const
QStringList
lines
=
text
.
split
(
QLatin1Char
(
'\n'
),
QString
::
SkipEmptyParts
);
int
maxn
=
lines
.
count
();
const
int
maxn
=
lines
.
count
();
if
(
maxn
>=
4
&&
lines
[
0
].
startsWith
(
Private
::
mFromPrefix
)
&&
lines
[
1
].
startsWith
(
Private
::
mToPrefix
))
{
&&
lines
[
0
].
startsWith
(
Private
::
mFromPrefix
)
&&
lines
[
1
].
startsWith
(
Private
::
mToPrefix
))
{
int
n
=
2
;
if
(
lines
[
2
].
startsWith
(
Private
::
mCcPrefix
))
{
++
n
;
}
if
(
maxn
>
n
+
1
&&
lines
[
n
].
startsWith
(
Private
::
mDatePrefix
)
&&
lines
[
n
+
1
].
startsWith
(
Private
::
mSubjectPrefix
))
{
&&
lines
[
n
].
startsWith
(
Private
::
mDatePrefix
)
&&
lines
[
n
+
1
].
startsWith
(
Private
::
mSubjectPrefix
))
{
// Format the email into a text alarm
QString
calText
;
calText
=
Private
::
mFromPrefixEn
+
lines
[
0
].
mid
(
Private
::
mFromPrefix
.
length
())
+
QLatin1Char
(
'\n'
);
...
...
@@ -528,17 +528,17 @@ void AlarmText::Private::setUpTranslations()
int
AlarmText
::
Private
::
emailHeaderCount
(
const
QStringList
&
lines
)
{
setUpTranslations
();
int
maxn
=
lines
.
count
();
const
int
maxn
=
lines
.
count
();
if
(
maxn
>=
4
&&
lines
[
0
].
startsWith
(
mFromPrefix
)
&&
lines
[
1
].
startsWith
(
mToPrefix
))
{
&&
lines
[
0
].
startsWith
(
mFromPrefix
)
&&
lines
[
1
].
startsWith
(
mToPrefix
))
{
int
n
=
2
;
if
(
lines
[
2
].
startsWith
(
mCcPrefix
))
{
++
n
;
}
if
(
maxn
>
n
+
1
&&
lines
[
n
].
startsWith
(
mDatePrefix
)
&&
lines
[
n
+
1
].
startsWith
(
mSubjectPrefix
))
{
&&
lines
[
n
].
startsWith
(
mDatePrefix
)
&&
lines
[
n
+
1
].
startsWith
(
mSubjectPrefix
))
{
return
n
+
2
;
}
}
...
...
@@ -582,4 +582,3 @@ QString AlarmText::Private::todoTitle(const QString &text)
}
}
// namespace KAlarmCal
src/alarmtext.h
View file @
0ac34c53
...
...
@@ -93,26 +93,32 @@ public:
* - A script or plain text is returned without interpretation.
*/
QString
displayText
()
const
;
/** Return the 'To' header parameter for an email alarm.
* @return 'from' value, or empty if not an email text.
*/
QString
to
()
const
;
/** Return the 'From' header parameter for an email alarm.
* @return 'from' value, or empty if not an email text.
*/
QString
from
()
const
;
/** Return the 'Cc' header parameter for an email alarm.
* @return 'cc' value, or empty if not an email text.
*/
QString
cc
()
const
;
/** Return the 'Date' header parameter for an email alarm.
* @return 'date' value, or empty if not an email text.
*/
QString
time
()
const
;
/** Return the 'Subject' header parameter for an email alarm.
* @return 'subject' value, or empty if not an email text.
*/
QString
subject
()
const
;
/** Return the email message body.
* @return message body, or empty if not an email text.
*/
...
...
@@ -122,14 +128,17 @@ public:
* @return summary text, or empty if not a todo.
*/
QString
summary
()
const
;
/** Return the location text for a todo.
* @return location text, or empty if not a todo.
*/
QString
location
()
const
;
/** Return the due date text for a todo.
* @return due date text, or empty if not a todo.
*/
QString
due
()
const
;
/** Return the description text for a todo.
* @return description text, or empty if not a todo.
*/
...
...
@@ -137,10 +146,13 @@ public:
/** Return whether there is any text. */
bool
isEmpty
()
const
;
/** Return whether the instance contains the text of an email. */
bool
isEmail
()
const
;
/** Return whether the instance contains the text of a script. */
bool
isScript
()
const
;
/** Return whether the instance contains the text of a todo. */
bool
isTodo
()
const
;
...
...
src/collectionattribute.cpp
View file @
0ac34c53
...
...
@@ -30,7 +30,8 @@ namespace KAlarmCal
class
CollectionAttribute
::
Private
{
public:
Private
()
:
mEnabled
(
CalEvent
::
EMPTY
),
Private
()
:
mEnabled
(
CalEvent
::
EMPTY
),
mStandard
(
CalEvent
::
EMPTY
),
mKeepFormat
(
false
)
{}
...
...
@@ -83,12 +84,12 @@ CalEvent::Types CollectionAttribute::enabled() const
void
CollectionAttribute
::
setEnabled
(
CalEvent
::
Type
type
,
bool
enabled
)
{
switch
(
type
)
{
case
CalEvent
::
ACTIVE
:
case
CalEvent
::
ARCHIVED
:
case
CalEvent
::
TEMPLATE
:
break
;
default:
return
;
case
CalEvent
::
ACTIVE
:
case
CalEvent
::
ARCHIVED
:
case
CalEvent
::
TEMPLATE
:
break
;
default:
return
;
}
if
(
enabled
)
{
d
->
mEnabled
|=
type
;
...
...
@@ -107,12 +108,12 @@ void CollectionAttribute::setEnabled(CalEvent::Types types)
bool
CollectionAttribute
::
isStandard
(
CalEvent
::
Type
type
)
const
{
switch
(
type
)
{
case
CalEvent
::
ACTIVE
:
case
CalEvent
::
ARCHIVED
:
case
CalEvent
::
TEMPLATE
:
return
d
->
mStandard
&
type
;
default:
return
false
;
case
CalEvent
::
ACTIVE
:
case
CalEvent
::
ARCHIVED
:
case
CalEvent
::
TEMPLATE
:
return
d
->
mStandard
&
type
;
default:
return
false
;
}
}
...
...
@@ -124,17 +125,17 @@ CalEvent::Types CollectionAttribute::standard() const
void
CollectionAttribute
::
setStandard
(
CalEvent
::
Type
type
,
bool
standard
)
{
switch
(
type
)
{
case
CalEvent
::
ACTIVE
:
case
CalEvent
::
ARCHIVED
:
case
CalEvent
::
TEMPLATE
:
if
(
standard
)
{
d
->
mStandard
=
static_cast
<
CalEvent
::
Types
>
(
d
->
mStandard
|
type
);
}
else
{
d
->
mStandard
=
static_cast
<
CalEvent
::
Types
>
(
d
->
mStandard
&
~
type
);
}
break
;
default:
break
;
case
CalEvent
::
ACTIVE
:
case
CalEvent
::
ARCHIVED
:
case
CalEvent
::
TEMPLATE
:
if
(
standard
)
{
d
->
mStandard
=
static_cast
<
CalEvent
::
Types
>
(
d
->
mStandard
|
type
);
}
else
{
d
->
mStandard
=
static_cast
<
CalEvent
::
Types
>
(
d
->
mStandard
&
~
type
);
}
break
;
default:
break
;
}
}
...
...
@@ -176,15 +177,15 @@ QByteArray CollectionAttribute::name()
QByteArray
CollectionAttribute
::
serialized
()
const
{
QByteArray
v
=
QByteArray
::
number
(
d
->
mEnabled
)
+
' '
+
QByteArray
::
number
(
d
->
mStandard
)
+
' '
+
QByteArray
(
d
->
mKeepFormat
?
"1"
:
"0"
)
+
' '
+
QByteArray
(
d
->
mBackgroundColour
.
isValid
()
?
"1"
:
"0"
);
+
QByteArray
::
number
(
d
->
mStandard
)
+
' '
+
QByteArray
(
d
->
mKeepFormat
?
"1"
:
"0"
)
+
' '
+
QByteArray
(
d
->
mBackgroundColour
.
isValid
()
?
"1"
:
"0"
);
if
(
d
->
mBackgroundColour
.
isValid
())
v
+=
' '
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
red
())
+
' '
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
green
())
+
' '
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
blue
())
+
' '
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
alpha
());
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
red
())
+
' '
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
green
())
+
' '
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
blue
())
+
' '
+
QByteArray
::
number
(
d
->
mBackgroundColour
.
alpha
());
qDebug
()
<<
v
;
return
v
;
}
...
...
@@ -202,7 +203,7 @@ void CollectionAttribute::deserialize(const QByteArray &data)
bool
ok
;
int
c
[
4
];
const
QList
<
QByteArray
>
items
=
data
.
simplified
().
split
(
' '
);
int
count
=
items
.
count
();
const
int
count
=
items
.
count
();
int
index
=
0
;
if
(
count
>
index
)
{
// 0: type(s) of alarms for which the collection is enabled
...
...
@@ -256,4 +257,3 @@ void CollectionAttribute::deserialize(const QByteArray &data)
}
}
// namespace KAlarmCal
src/collectionattribute.h
View file @
0ac34c53
...
...
@@ -133,13 +133,13 @@ public:
*/
void
setKeepFormat
(
bool
keep
);
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
QByteArray
type
()
const
;
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
CollectionAttribute
*
clone
()
const
;
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
QByteArray
serialized
()
const
;
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
void
deserialize
(
const
QByteArray
&
data
);
/** Return the attribute name. */
...
...
src/compatibilityattribute.cpp
View file @
0ac34c53
...
...
@@ -101,8 +101,8 @@ QByteArray CompatibilityAttribute::name()
QByteArray
CompatibilityAttribute
::
serialized
()
const
{
QByteArray
v
=
QByteArray
::
number
(
d
->
mCompatibility
)
+
' '
+
QByteArray
::
number
(
d
->
mVersion
);
const
QByteArray
v
=
QByteArray
::
number
(
d
->
mCompatibility
)
+
' '
+
QByteArray
::
number
(
d
->
mVersion
);
qDebug
()
<<
v
;
return
v
;
}
...
...
@@ -117,12 +117,12 @@ void CompatibilityAttribute::deserialize(const QByteArray &data)
bool
ok
;
const
QList
<
QByteArray
>
items
=
data
.
simplified
().
split
(
' '
);
int
count
=
items
.
count
();
const
int
count
=
items
.
count
();
int
index
=
0
;
if
(
count
>
index
)
{
// 0: calendar format compatibility
int
c
=
items
[
index
++
].
toInt
(
&
ok
);
KACalendar
::
Compat
AllCompat
(
KACalendar
::
Current
|
KACalendar
::
Converted
|
KACalendar
::
Convertible
|
KACalendar
::
Incompatible
|
KACalendar
::
Unknown
);
const
int
c
=
items
[
index
++
].
toInt
(
&
ok
);
const
KACalendar
::
Compat
AllCompat
(
KACalendar
::
Current
|
KACalendar
::
Converted
|
KACalendar
::
Convertible
|
KACalendar
::
Incompatible
|
KACalendar
::
Unknown
);
if
(
!
ok
||
(
c
&
AllCompat
)
!=
c
)
{
qCritical
()
<<
"Invalid compatibility:"
<<
c
;
return
;
...
...
@@ -131,7 +131,7 @@ void CompatibilityAttribute::deserialize(const QByteArray &data)
}
if
(
count
>
index
)
{
// 1: KAlarm calendar version number
int
c
=
items
[
index
++
].
toInt
(
&
ok
);
const
int
c
=
items
[
index
++
].
toInt
(
&
ok
);
if
(
!
ok
)
{
qCritical
()
<<
"Invalid version:"
<<
c
;
return
;
...
...
@@ -141,4 +141,3 @@ void CompatibilityAttribute::deserialize(const QByteArray &data)
}
}
// namespace KAlarmCal
src/compatibilityattribute.h
View file @
0ac34c53
...
...
@@ -74,13 +74,13 @@ public:
*/
void
setVersion
(
int
v
);
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
QByteArray
type
()
const
;
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
CompatibilityAttribute
*
clone
()
const
;
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
QByteArray
serialized
()
const
;
/
**
Reimplemented from Attribute
*/
/
/
Reimplemented from Attribute
virtual
void
deserialize
(
const
QByteArray
&
data
);
/** Return the attribute name. */
...
...
src/datetime.cpp
View file @
0ac34c53
...
...
@@ -389,4 +389,3 @@ bool operator<(const DateTime &dt1, const DateTime &dt2)
}
}
// namespace KAlarmCal
src/datetime.h
View file @
0ac34c53
...
...
@@ -46,20 +46,27 @@ public:
* Constructs an invalid date-time.
*/
DateTime
();
/** Constructor for a date-only value. */
DateTime
(
const
QDate
&
d
,
const
KDateTime
::
Spec
&
spec
);
/** Constructor for a date-time value. */
DateTime
(
const
QDate
&
d
,
const
QTime
&
t
,
const
KDateTime
::
Spec
&
spec
);
/** Constructor for a date-time value. */
DateTime
(
const
QDateTime
&
dt
,
const
KDateTime
::
Spec
&
spec
);
/** Constructor for a date-time value. */
DateTime
(
const
KDateTime
&
dt
);
/** Copy constructor. */
DateTime
(
const
DateTime
&
dt
);
~
DateTime
();
/** Assignment operator. */
DateTime
&
operator
=
(
const
DateTime
&
dt
);
/** Assignment operator.
* Sets the value to a specified date-time.
*/
...
...
@@ -67,10 +74,13 @@ public:
/** Returns true if the date is null and, if it is a date-time value, the time is also null. */
bool
isNull
()
const
;
/** Returns true if the date is valid and, if it is a date-time value, the time is also valid. */
bool
isValid
()
const
;
/** Returns true if it is date-only value. */
bool
isDateOnly
()
const
;
/** Sets the value to be either date-only or date-time.
* @param d True to set the value to be date-only; false to set it to a date-time value.
*/
...
...
@@ -78,26 +88,32 @@ public:
/** Returns the date part of the value. */
QDate
date
()
const
;
/** Sets the date component of the value. */
void
setDate
(
const
QDate
&
d
);
/** Returns the date and time of the value.
* If the value is date-only, the time part returned is 00:00:00. */
QDateTime
rawDateTime
()
const
;
/** Returns the date and time of the value as a KDateTime. */
KDateTime
kDateTime
()
const
;
/** Returns the time part of the value.
* If the value is date-only, the time returned is the start-of-day time set by setStartOfDay().
*/
QTime
effectiveTime
()
const
;
/** Sets the time component of the value.
* The value is converted if necessary to be a date-time value. */
void
setTime
(
const
QTime
&
t
);
/** Returns the date and time of the value.
* If the value is date-only, the time part returned is equal to the start-of-day time set
* by setStartOfDay().
*/
QDateTime
effectiveDateTime
()
const
;
/** Sets the date/time component of the value. */
void
setDateTime
(
const
QDateTime
&
dt
);
...
...
@@ -106,6 +122,7 @@ public:
* by setStartOfDay().
*/
KDateTime
effectiveKDateTime
()
const
;
/** Returns the date and time of the value as written in the calendar.
* If the value is date-only, the time part returned is 00:00.
*/
...
...
@@ -113,48 +130,64 @@ public:
/** Returns the time zone of the value. */
KTimeZone
timeZone
()
const
;
/** Returns the time specification of the value. */
KDateTime
::
Spec
timeSpec
()
const
;
/** Changes the time specification of the value. */
void
setTimeSpec
(
const
KDateTime
::
Spec
&
spec
);
/** Returns the time specification type of the date/time, i.e. whether it is
* UTC, has a time zone, etc. */
KDateTime
::
SpecType
timeType
()
const
;