kexi
kexipartinfo.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kexipartinfo_p.h"
00022
00023 #include <kexidb/global.h>
00024
00025 using namespace KexiPart;
00026
00027 Info::Private::Private(const KService::Ptr& aPtr)
00028 : ptr(aPtr)
00029 , groupName(aPtr->name())
00030 , mimeType(aPtr->property("X-Kexi-TypeMime").toCString())
00031 , itemIcon(aPtr->property("X-Kexi-ItemIcon").toString())
00032 , objectName(aPtr->property("X-Kexi-TypeName").toString())
00033 , broken(false)
00034 , idStoredInPartDatabase(false)
00035 {
00036 QVariant val = ptr->property("X-Kexi-NoObject");
00037 isVisibleInNavigator = val.isValid() ? (val.toInt() != 1) : true;
00038
00040 if(objectName == "table")
00041 projectPartID = KexiDB::TableObjectType;
00042 else if(objectName == "query")
00043 projectPartID = KexiDB::QueryObjectType;
00044
00045
00046 else
00047 projectPartID = -1;
00048 }
00049
00050 Info::Private::Private()
00051 : projectPartID(-1)
00052 , broken(false)
00053 , isVisibleInNavigator(false)
00054 , idStoredInPartDatabase(false)
00055 {
00056 }
00057
00058
00059
00060 Info::Info(KService::Ptr ptr)
00061 : d(new Private(ptr))
00062 {
00063 }
00064
00065 Info::Info()
00066 : d(new Private())
00067 {
00068 }
00069
00070 Info::~Info()
00071 {
00072 delete d;
00073 }
00074
00075 QString Info::groupName() const { return d->groupName; }
00076
00077 QCString Info::mimeType() const { return d->mimeType; }
00078
00079 QString Info::itemIcon() const { return d->itemIcon; }
00080
00081 QString Info::createItemIcon() const { return d->itemIcon+"_newobj"; }
00082
00083 QString Info::objectName() const { return d->objectName; }
00084
00085 KService::Ptr Info::ptr() const { return d->ptr; }
00086
00087 bool Info::isBroken() const { return d->broken; }
00088
00089 bool Info::isVisibleInNavigator() const { return d->isVisibleInNavigator; }
00090
00091 int Info::projectPartID() const { return d->projectPartID; }
00092
00093 void Info::setProjectPartID(int id) { d->projectPartID=id; }
00094
00095 void Info::setBroken(bool broken, const QString& errorMessage)
00096 { d->broken = broken; d->errorMessage = errorMessage; }
00097
00098 QString Info::errorMessage() const { return d->errorMessage; }
00099
00100 void Info::setIdStoredInPartDatabase(bool set)
00101 {
00102 d->idStoredInPartDatabase = set;
00103 }
00104
00105 bool Info::isIdStoredInPartDatabase() const
00106 {
00107 return d->idStoredInPartDatabase;
00108 }
00109
00110 bool Info::isDataExportSuppored() const
00111 {
00112 QVariant val = d->ptr ? d->ptr->property("X-Kexi-SupportsDataExport") : QVariant();
00113 return val.isValid() ? val.toBool() : false;
00114 }
00115
00116 bool Info::isPrintingSuppored() const
00117 {
00118 QVariant val = d->ptr ? d->ptr->property("X-Kexi-SupportsPrinting") : QVariant();
00119 return val.isValid() ? val.toBool() : false;
00120 }
00121
00122
00123
00124 QCString KexiPart::nameForCreateAction(const Info& info)
00125 {
00126 return (info.objectName()+"part_create").latin1();
00127 }
|