[Kde-bindings] KDE/kdepimlibs/kcal
David Jarvie
djarvie at kde.org
Thu May 20 18:43:24 UTC 2010
SVN commit 1128940 by djarvie:
Add customPropertyName() method to return the name of a custom property
CCMAIL:kde-bindings at kde.org
M +11 -2 customproperties.cpp
M +14 -2 customproperties.h
M +3 -0 tests/testcustomproperties.cpp
--- trunk/KDE/kdepimlibs/kcal/customproperties.cpp #1128939:1128940
@@ -1,7 +1,7 @@
/*
This file is part of the kcal library.
- Copyright (c) 2002,2006 David Jarvie <software at astrojar.org.uk>
+ Copyright (c) 2002,2006 David Jarvie <djarvie at kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -26,7 +26,7 @@
@brief
A class to manage custom calendar properties.
- @author David Jarvie \<software at astrojar.org.uk\>
+ @author David Jarvie \<djarvie at kde.org\>
*/
#include "customproperties.h"
@@ -117,6 +117,15 @@
return nonKDECustomProperty( QByteArray( "X-KDE-" + app + '-' + key ) );
}
+QByteArray CustomProperties::customPropertyName( const QByteArray &app, const QByteArray &key )
+{
+ QByteArray property( "X-KDE-" + app + '-' + key );
+ if ( !checkName( property ) ) {
+ return QByteArray();
+ }
+ return property;
+}
+
void CustomProperties::setNonKDECustomProperty( const QByteArray &name, const QString &value )
{
if ( value.isNull() || !checkName( name ) ) {
--- trunk/KDE/kdepimlibs/kcal/customproperties.h #1128939:1128940
@@ -1,7 +1,7 @@
/*
This file is part of the kcal library.
- Copyright (c) 2002,2006 David Jarvie <software at astrojar.org.uk>
+ Copyright (c) 2002,2006 David Jarvie <djarvie at kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -23,7 +23,7 @@
This file is part of the API for handling calendar data and
defines the CustomProperties class.
- @author David Jarvie \<software at astrojar.org.uk\>
+ @author David Jarvie \<djarvie at kde.org\>
*/
#ifndef KCAL_CUSTOMPROPERTIES_H
@@ -109,6 +109,18 @@
QString customProperty( const QByteArray &app, const QByteArray &key ) const;
/**
+ Validate and return the full name of a custom calendar property.
+
+ @param app Application name as it appears in the custom property name.
+ @param key Property identifier specific to the application.
+ @return Full property name, or empty string if it would contain invalid
+ characters
+
+ @since 4.5
+ */
+ static QByteArray customPropertyName( const QByteArray &app, const QByteArray &key );
+
+ /**
Create or modify a non-KDE or non-standard custom calendar property.
@param name Full property name
--- trunk/KDE/kdepimlibs/kcal/tests/testcustomproperties.cpp #1128939:1128940
@@ -33,8 +33,11 @@
QByteArray app( "KORG" );
QByteArray key( "TEXT" );
+ QByteArray name( "X-KDE-KORG-TEXT" );
+ QCOMPARE( cp.customPropertyName( app, key ), name );
cp.setCustomProperty( app, key, "rich" );
QCOMPARE( cp.customProperty( app, key ), QString( "rich" ) );
+ QCOMPARE( cp.nonKDECustomProperty( name ), QString( "rich" ) );
cp.removeCustomProperty( app, key );
cp.setCustomProperty( app, key, "foo" );
More information about the Kde-bindings
mailing list