summaryrefslogtreecommitdiff
path: root/libresourceqt
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-15 10:12:24 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-02-15 10:12:24 +0200
commitf15d3608dc4d6444fb587f9dfbb93c7a8b02c740 (patch)
treef009d0b34ab8d6ef3a5efd72a6633b1b46598da3 /libresourceqt
parent410064fe1545400b0939b0cff7534b23b1c390dc (diff)
downloadlibresourceqt-f15d3608dc4d6444fb587f9dfbb93c7a8b02c740.tar.gz
added slots for connected, acquire and deny
Diffstat (limited to 'libresourceqt')
-rw-r--r--libresourceqt/include/qt4/policy/resource-set.h6
-rw-r--r--libresourceqt/src/resource-set.cpp34
2 files changed, 40 insertions, 0 deletions
diff --git a/libresourceqt/include/qt4/policy/resource-set.h b/libresourceqt/include/qt4/policy/resource-set.h
index ea54b8a..447dc8b 100644
--- a/libresourceqt/include/qt4/policy/resource-set.h
+++ b/libresourceqt/include/qt4/policy/resource-set.h
@@ -212,6 +212,12 @@ private:
bool alwaysReply;
bool initialized;
bool pendingAcquire;
+
+private slots:
+ void connectedHandler();
+ void handleAcquire(quint32);
+ void handleDeny();
+
};
}
diff --git a/libresourceqt/src/resource-set.cpp b/libresourceqt/src/resource-set.cpp
index 80974d2..64f7645 100644
--- a/libresourceqt/src/resource-set.cpp
+++ b/libresourceqt/src/resource-set.cpp
@@ -144,3 +144,37 @@ void ResourceSet::setAlwaysReply()
alwaysReply = true;
}
+void ResourceSet::connectedHandler()
+{
+ if (pendingAcquire) {
+ resourceEngine->acquireResources();
+ }
+}
+
+void ResourceSet::handleAcquire(quint32 bitmaskOfGrantedResources)
+{
+ QList<ResourceType> optionalResources;
+ qDebug("Acquired resources: 0x%04x", bitmaskOfGrantedResources);
+ for(int i=0;i < NumberOfTypes; i++) {
+ ResourceType type = (ResourceType)i;
+ quint32 bitmask = resourceTypeToLibresourceType(type);
+ qDebug("Checking if resource %x(%x) is in the set", i, bitmask);
+ if ((bitmask & bitmaskOfGrantedResources) == bitmask) {
+ if (resourceSet[i]->isOptional()) {
+ optionalResources << type;
+ }
+ resourceSet[i]->setGranted();
+ }
+ }
+ emit resourcesGranted(optionalResources);
+}
+
+void ResourceSet::handleDeny()
+{
+ for(int i=0;i < NumberOfTypes; i++) {
+ if(resourceSet[i] != NULL) {
+ resourceSet[i]->unsetGranted();
+ }
+ }
+}
+