Permalink
Browse files

Implemented some class methods.

  • Loading branch information...
1 parent 6edebcd commit d4a13c9e3bf6fcb7e900338b73e89d87844d567c @dezelin committed Jan 7, 2012
@@ -43,6 +43,11 @@ ServiceProviderMetaStore::~ServiceProviderMetaStore()
{
}
+unsigned int ServiceProviderMetaStore::getServiceStorageVersion() const
+{
+ return 0;
+}
+
} // namespace Storage
} // namespace Services
} // namespace Maily
@@ -41,6 +41,8 @@ class ServiceProviderMetaStore : public Store
explicit ServiceProviderMetaStore(QObject *parent,
const QString& storeName = kServiceProviderMetaStore, int version = 1);
virtual ~ServiceProviderMetaStore();
+
+ unsigned int getServiceStorageVersion() const;
signals:
@@ -137,17 +137,26 @@ void ServiceProviderStorage::upgrade(int fromVersion)
int ServiceProviderStorage::version() const
{
- Q_D(const ServiceProviderStorage);
+ const ServiceProviderMetaStore *meta =
+ static_cast<const ServiceProviderMetaStore*>(metaStore());
+ Q_ASSERT(meta);
+ return meta->getServiceStorageVersion();
}
ServiceProviderInfo *ServiceProviderStorage::getProviderInfo() const
{
- Q_D(const ServiceProviderStorage);
+ return 0;
}
bool ServiceProviderStorage::isOpened() const
{
- Q_D(const ServiceProviderStorage);
+ const Store *meta = metaStore();
+ const Store *account = accountStore();
+ Q_ASSERT(meta && account);
+ if (!meta || !account)
+ return false;
+
+ return meta->isOpened() && account->isOpened();
}
StorageTransaction *ServiceProviderStorage::beginTransaction(
@@ -156,16 +165,26 @@ StorageTransaction *ServiceProviderStorage::beginTransaction(
return 0;
}
-ServiceProviderMetaStore *ServiceProviderStorage::metaStore()
+inline ServiceProviderMetaStore *ServiceProviderStorage::metaStore()
{
return static_cast<ServiceProviderMetaStore*>(
- store(kServiceProviderMetaStore));
+ store(kServiceProviderMetaStore));
+}
+
+inline const ServiceProviderMetaStore *ServiceProviderStorage::metaStore() const
+{
+ return metaStore();
}
-ServiceProviderAccountStore *ServiceProviderStorage::accountStore()
+inline ServiceProviderAccountStore *ServiceProviderStorage::accountStore()
{
return static_cast<ServiceProviderAccountStore*>(
- store(kServiceProviderAccountStore));
+ store(kServiceProviderAccountStore));
+}
+
+inline const ServiceProviderAccountStore *ServiceProviderStorage::accountStore() const
+{
+ return accountStore();
}
} // namespace Storage
@@ -64,7 +64,10 @@ public slots:
protected:
ServiceProviderMetaStore *metaStore();
+ const ServiceProviderMetaStore *metaStore() const;
+
ServiceProviderAccountStore *accountStore();
+ const ServiceProviderAccountStore *accountStore() const;
private:
Q_DISABLE_COPY(ServiceProviderStorage)

0 comments on commit d4a13c9

Please sign in to comment.