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

List:       kde-commits
Subject:    [akonadi-sugarcrm] /: Cleanup: coding style, removal of commented code, etc
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2012-01-25 19:34:38
Message-ID: 20120125193438.0A523A60D1 () git ! kde ! org
[Download RAW message or body]

Git commit f8d5b36b30f8a45017d967c573e2ff4649b5438a by Kevin Krammer.
Committed on 25/01/2012 at 17:30.
Pushed by krake into branch 'master'.

Cleanup: coding style, removal of commented code, etc

M  +6    -8    sugarcrmresource.cpp
M  +0    -6    taskaccessorpair.cpp
M  +1    -5    taskaccessorpair.h
M  +42   -42   taskshandler.cpp
M  +1    -8    taskshandler.h

http://commits.kde.org/akonadi-sugarcrm/f8d5b36b30f8a45017d967c573e2ff4649b5438a

diff --git a/sugarcrmresource.cpp b/sugarcrmresource.cpp
index 8dc9cd3..d51e297 100644
--- a/sugarcrmresource.cpp
+++ b/sugarcrmresource.cpp
@@ -21,11 +21,10 @@
 
 #include "conflicthandler.h"
 #include "contactshandler.h"
-#include "leadshandler.h"
-#include "taskshandler.h"
 #include "createentryjob.h"
 #include "deleteentryjob.h"
 #include "fetchentryjob.h"
+#include "leadshandler.h"
 #include "listentriesjob.h"
 #include "listmodulesjob.h"
 #include "loginerrordialog.h"
@@ -36,6 +35,7 @@
 #include "settingsadaptor.h"
 #include "sugarconfigdialog.h"
 #include "sugarsession.h"
+#include "taskshandler.h"
 #include "updateentryjob.h"
 
 #include <akonadi/changerecorder.h>
@@ -43,8 +43,6 @@
 #include <akonadi/itemfetchscope.h>
 #include <akonadi/itemmodifyjob.h>
 
-#include <kabc/addressee.h>
-
 #include <KLocale>
 #include <KWindowSystem>
 
@@ -408,10 +406,10 @@ void SugarCRMResource::listModulesResult( KJob *job )
             ModuleHandler* handler = 0;
             if ( module == QLatin1String( "Contacts" ) ) {
                 handler = new ContactsHandler( mSession );
-            } else if(module == QLatin1String("Leads")) {
-                handler = new LeadsHandler(mSession);
-            } else if(module == QLatin1String("Tasks")) {
-                handler = new TasksHandler(mSession);
+            } else if ( module == QLatin1String( "Leads" ) ) {
+                handler = new LeadsHandler( mSession );
+            } else if ( module == QLatin1String( "Tasks" ) ) {
+                handler = new TasksHandler( mSession );
 	    } else {
                 //kDebug() << "No module handler for" << module;
                 continue;
diff --git a/taskaccessorpair.cpp b/taskaccessorpair.cpp
index bf3c714..8cd8742 100644
--- a/taskaccessorpair.cpp
+++ b/taskaccessorpair.cpp
@@ -23,9 +23,3 @@ TaskAccessorPair::TaskAccessorPair( taskValueGetter get, taskValueSetter set, co
 {
     setter.vSetter = set;
 }
-
-/*TaskAccessorPair::TaskAccessorPair( taskValueGetter get, taskDateTimeSetter set, const QString &name )
-    : getter( get ), diffName( name )
-{
-    setter.dSetter = set;
-}*/
\ No newline at end of file
diff --git a/taskaccessorpair.h b/taskaccessorpair.h
index 2dfb37b..6250078 100644
--- a/taskaccessorpair.h
+++ b/taskaccessorpair.h
@@ -24,20 +24,16 @@
 
 typedef QString (*taskValueGetter)( const KCalCore::Todo& );
 typedef void (*taskValueSetter)( const QString&, KCalCore::Todo&);
-//typedef void (*taskDateTimeSetter)( const KDateTime&, KCalCore::Todo&);
 
 class TaskAccessorPair
 {
 public:
     TaskAccessorPair( taskValueGetter get, taskValueSetter set, const QString &name );
 
-    //TaskAccessorPair( taskValueGetter get, taskDateTimeSetter set, const QString &name );
-    
 public:
     taskValueGetter getter;
     union tsetter {
         taskValueSetter vSetter;
-        //taskDateTimeSetter dSetter;
     } setter;
     const QString diffName;
-};
\ No newline at end of file
+};
diff --git a/taskshandler.cpp b/taskshandler.cpp
index 6d46f0f..cc62f8f 100644
--- a/taskshandler.cpp
+++ b/taskshandler.cpp
@@ -127,35 +127,35 @@ static void setAssignedUserId( const QString &value, KCalCore::Todo &todo )
 
 static QString getStatus( const KCalCore::Todo &todo )
 {
-    if(todo.status() == KCalCore::Todo::StatusConfirmed) {
-        return "Not Started";
-    } else if(todo.status() == KCalCore::Todo::StatusInProcess) {
-        return "In Progress";
-    } else if(todo.status() == KCalCore::Todo::StatusCompleted) {
-        return "Completed";
-    } else if(todo.status() == KCalCore::Todo::StatusNeedsAction) {
-        return "Pending Input";
-    } else if(todo.customStatus() == "StatusDeferred") {
-        return "Deferred";
+    if ( todo.status() == KCalCore::Todo::StatusConfirmed ) {
+        return QLatin1String( "Not Started" );
+    } else if ( todo.status() == KCalCore::Todo::StatusInProcess ) {
+        return QLatin1String( "In Progress" );
+    } else if ( todo.status() == KCalCore::Todo::StatusCompleted ) {
+        return QLatin1String( "Completed" );
+    } else if ( todo.status() == KCalCore::Todo::StatusNeedsAction ) {
+        return QLatin1String( "Pending Input" );
+    } else if ( todo.customStatus() == "StatusDeferred" ) {
+        return QLatin1String( "Deferred" );
     } else {
-        return "None";
+        return QLatin1String( "None" );
     }
 }
 
 static void setStatus( const QString &value, KCalCore::Todo &todo )
 {
-    if(value == "Not Started") {
-        todo.setStatus(KCalCore::Todo::StatusConfirmed);
-    } else if(value == "In Progress") {
-        todo.setStatus(KCalCore::Todo::StatusInProcess);
-    } else if(value == "Completed") {
-        todo.setStatus(KCalCore::Todo::StatusCompleted);
-    } else if(value == "Pending Input") {
-        todo.setStatus(KCalCore::Todo::StatusNeedsAction);
-    } else if(value == "Deferred") {
-        todo.setCustomStatus("StatusDeferred");
+    if ( value == QLatin1String( "Not Started" ) ) {
+        todo.setStatus( KCalCore::Todo::StatusConfirmed );
+    } else if ( value == QLatin1String( "In Progress" ) ) {
+        todo.setStatus( KCalCore::Todo::StatusInProcess );
+    } else if ( value == QLatin1String( "Completed" ) ) {
+        todo.setStatus( KCalCore::Todo::StatusCompleted );
+    } else if ( value == QLatin1String( "Pending Input" ) ) {
+        todo.setStatus( KCalCore::Todo::StatusNeedsAction );
+    } else if ( value == QLatin1String( "Deferred" ) ) {
+        todo.setCustomStatus( QLatin1String( "StatusDeferred" ) );
     } else {
-        todo.setStatus(KCalCore::Todo::StatusNone);
+        todo.setStatus( KCalCore::Todo::StatusNone );
     }
 }
 
@@ -172,12 +172,12 @@ static void setDateDueFlag( const QString &value, KCalCore::Todo &todo )
 static QString getDateDue( const KCalCore::Todo &todo )
 {
     KDateTime dateDue = todo.dtDue();
-    return dateDue.toString("%Y-%m-%d %H:%M:%S");
+    return dateDue.toString( "%Y-%m-%d %H:%M:%S" );
 }
 
 static void setDateDue( const QString &value, KCalCore::Todo &todo )
 {
-    todo.setDtDue( KDateTime::fromString(value, "%Y-%m-%d %H:%M:%S", new KTimeZones, true) );
+    todo.setDtDue( KDateTime::fromString( value, "%Y-%m-%d %H:%M:%S", 0, true ) );
 }
 
 static QString getDateStartFlag( const KCalCore::Todo &todo )
@@ -193,12 +193,12 @@ static void setDateStartFlag( const QString &value, KCalCore::Todo &todo )
 static QString getDateStart( const KCalCore::Todo &todo )
 {
     KDateTime dateStart = todo.dtStart();
-    return dateStart.toString("%Y-%m-%d %H:%M:%S");
+    return dateStart.toString( "%Y-%m-%d %H:%M:%S" );
 }
 
 static void setDateStart( const QString &value, KCalCore::Todo &todo )
 {
-    todo.setDtStart( KDateTime::fromString(value, "%Y-%m-%d %H:%M:%S", new KTimeZones, true) );
+    todo.setDtStart( KDateTime::fromString( value, "%Y-%m-%d %H:%M:%S", 0, true ) );
 }
 
 static QString getParentType( const KCalCore::Todo &todo )
@@ -233,27 +233,27 @@ static void setContactId( const QString &value, KCalCore::Todo &todo )
 
 static QString getPriority( const KCalCore::Todo &todo )
 {
-    if(todo.priority() == 1) {
-	return "High";
-    } else if(todo.priority() == 5) {
-	return "Medium";
-    } else if(todo.priority() == 9) {
-	return "Low";
+    if ( todo.priority() == 1 ) {
+	return QLatin1String( "High" );
+    } else if ( todo.priority() == 5 ) {
+	return QLatin1String( "Medium" );
+    } else if ( todo.priority() == 9 ) {
+	return QLatin1String( "Low" );
     } else {
-	return "None";
+	return QLatin1String( "None" );
     }
 }
 
 static void setPriority( const QString &value, KCalCore::Todo &todo )
 {
-    if(value == "High") {
-	todo.setPriority(1);
-    } else if(value == "Medium") {
-	todo.setPriority(5);
-    } else if(value == "Low") {
-	todo.setPriority(9);
+    if ( value == QLatin1String( "High" ) ) {
+	todo.setPriority( 1 );
+    } else if ( value == QLatin1String( "Medium" ) ) {
+	todo.setPriority( 5 );
+    } else if ( value == QLatin1String( "Low" ) ) {
+	todo.setPriority( 9 );
     } else {
-	todo.setPriority(0);
+	todo.setPriority( 0 );
     }
 }
 
@@ -317,8 +317,8 @@ Akonadi::Collection TasksHandler::collection() const
     taskCollection.setContentMimeTypes( QStringList() << KCalCore::Todo::todoMimeType() );
     taskCollection.setName( i18nc( "@item folder name", "Tasks" ) );
     taskCollection.setRights( Akonadi::Collection::CanChangeItem |
-                                 Akonadi::Collection::CanCreateItem |
-                                 Akonadi::Collection::CanDeleteItem );
+                              Akonadi::Collection::CanCreateItem |
+                              Akonadi::Collection::CanDeleteItem );
 
     return taskCollection;
 }
diff --git a/taskshandler.h b/taskshandler.h
index c67077a..10b5839 100644
--- a/taskshandler.h
+++ b/taskshandler.h
@@ -44,15 +44,8 @@ public:
                   const Akonadi::Item &leftItem, const Akonadi::Item &rightItem );
 
 private:
-    /*inline bool isAddressValue( const QString& value ) const
-    { return ( isAltAddressValue( value ) || isPrimaryAddressValue( value ) );}
-    inline bool isAltAddressValue( const QString& value ) const
-    { return value.startsWith( QString( "alt_address_" ) );}
-    inline bool isPrimaryAddressValue( const QString& value ) const
-    { return value.startsWith( QString( "primary_address_" ) );}*/
-
     QString adjustedTime( const QString datetime ) const;
 
     typedef QHash<QString, TaskAccessorPair*> AccessorHash;
     AccessorHash *mAccessors;
-};};
+};

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

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