[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeplasma-addons/dataengines/comic
From:       Petri Damstén <petri.damsten () kdemail ! net>
Date:       2008-10-22 7:46:38
Message-ID: 1224661598.336742.3133.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 874664 by pdamsten:

Use StaticDateWrapper for static date functions and add that as object to kross action.

 M  +16 -12    comicproviderwrapper.cpp  
 M  +12 -3     comicproviderwrapper.h  


--- trunk/KDE/kdeplasma-addons/dataengines/comic/comicproviderwrapper.cpp #874663:874664
@@ -182,52 +182,57 @@
     return mDate.year();
 }
 
-QObject* DateWrapper::currentDate()
+StaticDateWrapper::StaticDateWrapper( QObject *parent )
+: QObject( parent )
 {
+}
+
+QObject* StaticDateWrapper::currentDate()
+{
     return new DateWrapper( this, QDate::currentDate() );
 }
 
-QObject* DateWrapper::fromJulianDay( int jd )
+QObject* StaticDateWrapper::fromJulianDay( int jd )
 {
     return new DateWrapper( this, QDate::fromJulianDay( jd ) );
 }
 
-QObject* DateWrapper::fromString( const QString &string, int format )
+QObject* StaticDateWrapper::fromString( const QString &string, int format )
 {
     return new DateWrapper( this, QDate::fromString( string, ( Qt::DateFormat )format ) );
 }
 
-QObject* DateWrapper::fromString( const QString &string, const QString &format )
+QObject* StaticDateWrapper::fromString( const QString &string, const QString &format )
 {
     return new DateWrapper( this, QDate::fromString( string, format ) );
 }
 
-bool DateWrapper::isLeapYear ( int year )
+bool StaticDateWrapper::isLeapYear ( int year )
 {
     return QDate::isLeapYear( year );
 }
 
-bool DateWrapper::isValid ( int year, int month, int day )
+bool StaticDateWrapper::isValid ( int year, int month, int day )
 {
     return QDate::isValid( year, month, day );
 }
 
-QString DateWrapper::longDayName ( int weekday )
+QString StaticDateWrapper::longDayName ( int weekday )
 {
     return QDate::longDayName( weekday );
 }
 
-QString DateWrapper::longMonthName ( int month )
+QString StaticDateWrapper::longMonthName ( int month )
 {
     return QDate::longMonthName( month );
 }
 
-QString DateWrapper::shortDayName ( int weekday )
+QString StaticDateWrapper::shortDayName ( int weekday )
 {
     return QDate::shortDayName( weekday );
 }
 
-QString DateWrapper::shortMonthName ( int month )
+QString StaticDateWrapper::shortMonthName ( int month )
 {
     return QDate::shortMonthName( month );
 }
@@ -268,6 +273,7 @@
                 mAction = new Kross::Action( parent(), mProvider->pluginName() );
                 if ( mAction ) {
                     mAction->addObject( this, "comic" );
+                    mAction->addObject( new StaticDateWrapper( this ), "date" );
                     mAction->setFile( info.filePath() );
                     mAction->trigger();
                     mFunctions = mAction->functionNames();
@@ -309,7 +315,6 @@
             result = ComicProvider::StringIdentifier;
         }
     }
-    kDebug() << result;
     return result;
 }
 
@@ -344,7 +349,6 @@
             break;
         }
     }
-    kDebug() << result;
     return result;
 }
 
--- trunk/KDE/kdeplasma-addons/dataengines/comic/comicproviderwrapper.h #874663:874664
@@ -80,6 +80,18 @@
         QString toString( int format = 0 ) const;
         int weekNumber() const;
         int year() const;
+
+    private:
+        QDate mDate;
+};
+
+class StaticDateWrapper : public QObject
+{
+        Q_OBJECT
+    public:
+        StaticDateWrapper( QObject *parent = 0 );
+
+    public slots:
         QObject* currentDate();
         QObject* fromJulianDay( int jd );
         QObject* fromString( const QString & string, int format = Qt::TextDate );
@@ -90,9 +102,6 @@
         QString longMonthName ( int month );
         QString shortDayName ( int weekday );
         QString shortMonthName ( int month );
-
-    private:
-        QDate mDate;
 };
 
 class ComicProviderWrapper : public QObject
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic