TQt4 port compizconfig-backend-kconfig

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/compizconfig-backend-kconfig@1239859 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 5c45a37ac3
commit 2b852a7188

@ -19,7 +19,7 @@
*
*/
#include <qdir.h>
#include <tqdir.h>
#include <kconfig.h>
#include <ksimpleconfig.h>
@ -57,7 +57,7 @@ static KInstance *instance = NULL;
typedef struct _ConfigFiles
{
KSimpleConfig *main;
QString profile;
TQString profile;
KConfig *kwin;
KConfig *global;
Bool modified;
@ -82,9 +82,9 @@ SpecialOptionType;
struct _SpecialOption
{
QString settingName;
QString pluginName;
QString kdeName;
TQString settingName;
TQString pluginName;
TQString kdeName;
bool global;
SpecialOptionType type;
}
@ -95,8 +95,8 @@ const specialOptions[] =
{"lower_window_key", CORE_NAME, "Window Lower", true, OptionKey},
{"toggle_window_maximized_key", CORE_NAME, "Window Maximize", true, OptionKey},
{"minimize_window_key", CORE_NAME, "Window Minimize", true, OptionKey},
{"toggle_window_maximized_horizontally_key", CORE_NAME, "Window Maximize Horizontal", true, OptionKey},
{"toggle_window_maximized_vertically_key", CORE_NAME, "Window Maximize Vertical", true, OptionKey},
{"toggle_window_maximized_horizontally_key", CORE_NAME, "Window MaximizeQt::Horizontal", true, OptionKey},
{"toggle_window_maximized_vertically_key", CORE_NAME, "Window MaximizeQt::Vertical", true, OptionKey},
{"show_desktop_key", CORE_NAME, "Toggle Showing Desktop", true, OptionKey},
{"window_menu_key", CORE_NAME, "Window Operations Menu", true, OptionKey},
{"toggle_window_shaded_key", CORE_NAME, "Window Shade", true, OptionKey},
@ -199,11 +199,11 @@ const specialOptions[] =
#define N_SOPTIONS (sizeof (specialOptions) / sizeof (struct _SpecialOption))
static void
createFile (QString name)
createFile (TQString name)
{
if (!QFile::exists(name))
if (!TQFile::exists(name))
{
QFile file (name);
TQFile file (name);
file.open (IO_WriteOnly | IO_Append);
file.close ();
}
@ -234,7 +234,7 @@ isIntegratedOption (CCSSetting *setting)
for (unsigned int i = 0; i < N_SOPTIONS; i++)
{
if (setting->name == specialOptions[i].settingName &&
QString (setting->parent->name) == specialOptions[i].pluginName)
TQString (setting->parent->name) == specialOptions[i].pluginName)
return true;
}
@ -305,7 +305,7 @@ readIntegratedOption (CCSSetting *setting)
for (unsigned int i = 0; i < N_SOPTIONS; i++)
{
if (setting->name == specialOptions[i].settingName &&
QString (setting->parent->name) == specialOptions[i].pluginName)
TQString (setting->parent->name) == specialOptions[i].pluginName)
{
option = i;
break;
@ -363,7 +363,7 @@ readIntegratedOption (CCSSetting *setting)
else if (specialOptions[option].settingName == "mode" &&
specialOptions[option].pluginName == "resize")
{
QString mode = cFiles->kwin->readEntry ("ResizeMode");
TQString mode = cFiles->kwin->readEntry ("ResizeMode");
int imode = -1;
int result = 0;
@ -521,7 +521,7 @@ readIntegratedOption (CCSSetting *setting)
else if (specialOptions[option].settingName == "mode" &&
specialOptions[option].pluginName == "place")
{
QString mode = cFiles->kwin->readEntry ("Placement");
TQString mode = cFiles->kwin->readEntry ("Placement");
int result = 0;
@ -566,7 +566,7 @@ getSettingIsReadOnly (CCSSetting *setting)
for (unsigned int i = 0; i < N_SOPTIONS; i++)
{
if (setting->name == specialOptions[i].settingName &&
QString (setting->parent->name) == specialOptions[i].pluginName)
TQString (setting->parent->name) == specialOptions[i].pluginName)
{
option = i;
break;
@ -612,21 +612,21 @@ getExistingProfiles (CCSContext *)
if (!instance)
instance = new KInstance ("ccs-backend-kconfig");
QDir dir (KGlobal::dirs()->saveLocation ("config", QString::null, false),
TQDir dir (KGlobal::dirs()->saveLocation ("config", TQString(), false),
"compizrc.*");
QStringList files = dir.entryList();
TQStringList files = dir.entryList();
CCSStringList ret = NULL;
QStringList::iterator it;
TQStringList::iterator it;
for (it = files.begin(); it != files.end(); it++)
{
QString str = (*it);
TQString str = (*it);
if (str.length() > 9)
{
QString profile = str.right (str.length() - 9);
TQString profile = str.right (str.length() - 9);
if (!profile.isEmpty() )
ret = ccsStringListAppend (ret, strdup (profile.ascii() ) );
@ -643,13 +643,13 @@ readSetting (CCSContext *c,
KSimpleConfig *cfg = cFiles->main;
QString key (setting->name);
QString group (setting->parent->name);
TQString key (setting->name);
TQString group (setting->parent->name);
if (setting->isScreen)
{
group += "_screen";
group += QString::number (setting->screenNum);
group += TQString::number (setting->screenNum);
}
else
group += "_display";
@ -697,7 +697,7 @@ readSetting (CCSContext *c,
case TypeColor:
{
QString str = cfg->readEntry (key);
TQString str = cfg->readEntry (key);
CCSSettingColorValue color;
int c[4];
@ -721,12 +721,12 @@ readSetting (CCSContext *c,
case TypeBool:
{
QValueList<int> list = cfg->readIntListEntry (key);
TQValueList<int> list = cfg->readIntListEntry (key);
Bool *array = new Bool[list.count() ];
int i = 0;
QValueList<int>::iterator it;
TQValueList<int>::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -745,12 +745,12 @@ readSetting (CCSContext *c,
case TypeInt:
{
QValueList<int> list = cfg->readIntListEntry (key);
TQValueList<int> list = cfg->readIntListEntry (key);
int *array = new int[list.count() ];
int i = 0;
QValueList<int>::iterator it;
TQValueList<int>::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -769,7 +769,7 @@ readSetting (CCSContext *c,
case TypeString:
{
QStringList list = cfg->readListEntry (key);
TQStringList list = cfg->readListEntry (key);
if (!list.count() )
break;
@ -778,7 +778,7 @@ readSetting (CCSContext *c,
int i = 0;
QStringList::iterator it;
TQStringList::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -802,7 +802,7 @@ readSetting (CCSContext *c,
case TypeMatch:
{
QStringList list = cfg->readListEntry (key);
TQStringList list = cfg->readListEntry (key);
if (!list.count() )
break;
@ -811,7 +811,7 @@ readSetting (CCSContext *c,
int i = 0;
QStringList::iterator it;
TQStringList::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -835,12 +835,12 @@ readSetting (CCSContext *c,
case TypeFloat:
{
QStringList list = cfg->readListEntry (key);
TQStringList list = cfg->readListEntry (key);
float *array = new float[list.count() ];
int i = 0;
QStringList::iterator it;
TQStringList::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -859,13 +859,13 @@ readSetting (CCSContext *c,
case TypeColor:
{
QStringList list = cfg->readListEntry (key);
TQStringList list = cfg->readListEntry (key);
CCSSettingColorValue *array =
new CCSSettingColorValue[list.count() ];
int i = 0;
QStringList::iterator it;
TQStringList::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -894,12 +894,12 @@ readSetting (CCSContext *c,
case TypeKey:
{
QStringList list = cfg->readListEntry (key);
TQStringList list = cfg->readListEntry (key);
CCSSettingValue *val = NULL;
CCSSettingValueList l = NULL;
QStringList::iterator it;
TQStringList::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -919,12 +919,12 @@ readSetting (CCSContext *c,
break;
case TypeButton:
{
QStringList list = cfg->readListEntry (key);
TQStringList list = cfg->readListEntry (key);
CCSSettingValue *val = NULL;
CCSSettingValueList l = NULL;
QStringList::iterator it;
TQStringList::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -944,12 +944,12 @@ readSetting (CCSContext *c,
break;
case TypeEdge:
{
QStringList list = cfg->readListEntry (key);
TQStringList list = cfg->readListEntry (key);
CCSSettingValue *val = NULL;
CCSSettingValueList l = NULL;
QStringList::iterator it;
TQStringList::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -966,12 +966,12 @@ readSetting (CCSContext *c,
break;
case TypeBell:
{
QValueList<int> list = cfg->readIntListEntry (key);
TQValueList<int> list = cfg->readIntListEntry (key);
CCSSettingValue *val = NULL;
CCSSettingValueList l = NULL;
QValueList<int>::iterator it;
TQValueList<int>::iterator it;
for (it = list.begin(); it != list.end(); it++)
{
@ -993,7 +993,7 @@ readSetting (CCSContext *c,
case TypeKey:
{
QString str = cfg->readEntry (key);
TQString str = cfg->readEntry (key);
CCSSettingKeyValue value;
@ -1004,7 +1004,7 @@ readSetting (CCSContext *c,
break;
case TypeButton:
{
QString str = cfg->readEntry (key);
TQString str = cfg->readEntry (key);
CCSSettingButtonValue value;
@ -1015,7 +1015,7 @@ readSetting (CCSContext *c,
break;
case TypeEdge:
{
QString str = cfg->readEntry (key);
TQString str = cfg->readEntry (key);
unsigned int value;
@ -1118,7 +1118,7 @@ writeIntegratedOption (CCSSetting *setting)
for (unsigned int i = 0; i < N_SOPTIONS; i++)
{
if (setting->name == specialOptions[i].settingName &&
QString (setting->parent->name) == specialOptions[i].pluginName)
TQString (setting->parent->name) == specialOptions[i].pluginName)
{
option = i;
break;
@ -1150,8 +1150,8 @@ writeIntegratedOption (CCSSetting *setting)
if (specialOptions[option].settingName == "click_to_focus")
{
QString mode = cFiles->kwin->readEntry ("FocusPolicy");
QString val = "ClickToFocus";
TQString mode = cFiles->kwin->readEntry ("FocusPolicy");
TQString val = "ClickToFocus";
Bool bVal;
if (!ccsGetBool (setting, &bVal) )
@ -1178,8 +1178,8 @@ writeIntegratedOption (CCSSetting *setting)
if (specialOptions[option].settingName == "mode" &&
specialOptions[option].pluginName == "resize")
{
QString mode = cFiles->kwin->readEntry("ResizeMode");
QString val = "Opaque";
TQString mode = cFiles->kwin->readEntry("ResizeMode");
TQString val = "Opaque";
int iVal;
if (ccsGetInt(setting, &iVal) && (iVal == 1 || iVal == 2))
{
@ -1396,13 +1396,13 @@ writeSetting (CCSContext *c,
{
KSimpleConfig *cfg = cFiles->main;
QString key (setting->name);
QString group (setting->parent->name);
TQString key (setting->name);
TQString group (setting->parent->name);
if (setting->isScreen)
{
group += "_screen";
group += QString::number (setting->screenNum);
group += TQString::number (setting->screenNum);
}
else
group += "_display";
@ -1477,7 +1477,7 @@ writeSetting (CCSContext *c,
color.color.blue / 256,
color.color.alpha / 256);
cfg->writeEntry (key, QString (tmp));
cfg->writeEntry (key, TQString (tmp));
}
break;
@ -1488,7 +1488,7 @@ writeSetting (CCSContext *c,
case TypeBool:
{
QValueList<int> list;
TQValueList<int> list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1506,7 +1506,7 @@ writeSetting (CCSContext *c,
case TypeInt:
{
QValueList<int> list;
TQValueList<int> list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1524,7 +1524,7 @@ writeSetting (CCSContext *c,
case TypeString:
{
QStringList list;
TQStringList list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1542,7 +1542,7 @@ writeSetting (CCSContext *c,
case TypeMatch:
{
QStringList list;
TQStringList list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1560,7 +1560,7 @@ writeSetting (CCSContext *c,
case TypeFloat:
{
QStringList list;
TQStringList list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1568,7 +1568,7 @@ writeSetting (CCSContext *c,
while (l)
{
list.append (QString::number (l->data->value.asFloat) );
list.append (TQString::number (l->data->value.asFloat) );
l = l->next;
}
@ -1578,7 +1578,7 @@ writeSetting (CCSContext *c,
case TypeColor:
{
QStringList list;
TQStringList list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1594,7 +1594,7 @@ writeSetting (CCSContext *c,
l->data->value.asColor.array.array[2] / 256,
l->data->value.asColor.array.array[3] / 256);
list.append (QString (tmp));
list.append (TQString (tmp));
l = l->next;
}
@ -1603,7 +1603,7 @@ writeSetting (CCSContext *c,
break;
case TypeKey:
{
QStringList list;
TQStringList list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1611,7 +1611,7 @@ writeSetting (CCSContext *c,
while (l)
{
QString str;
TQString str;
char *val;
val = ccsKeyBindingToString (&l->data->value.asKey);
@ -1627,7 +1627,7 @@ writeSetting (CCSContext *c,
break;
case TypeButton:
{
QStringList list;
TQStringList list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1635,7 +1635,7 @@ writeSetting (CCSContext *c,
while (l)
{
QString str;
TQString str;
char *val;
val = ccsButtonBindingToString (
&l->data->value.asButton);
@ -1652,7 +1652,7 @@ writeSetting (CCSContext *c,
break;
case TypeEdge:
{
QStringList list;
TQStringList list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1660,7 +1660,7 @@ writeSetting (CCSContext *c,
while (l)
{
QString str;
TQString str;
char *val;
val = ccsEdgesToString (l->data->value.asEdge);
@ -1676,7 +1676,7 @@ writeSetting (CCSContext *c,
break;
case TypeBell:
{
QValueList<int> list;
TQValueList<int> list;
CCSSettingValueList l;
if (!ccsGetList (setting, &l) )
@ -1764,7 +1764,7 @@ readInit (CCSContext *c)
if (cFiles->profile != ccsGetProfile (c) )
{
QString configName ("compizrc");
TQString configName ("compizrc");
if (ccsGetProfile (c) && strlen (ccsGetProfile (c) ) )
{
@ -1775,8 +1775,8 @@ readInit (CCSContext *c)
delete cFiles->main;
QString wFile = KGlobal::dirs()->saveLocation ("config",
QString::null, false) + configName;
TQString wFile = KGlobal::dirs()->saveLocation ("config",
TQString(), false) + configName;
createFile (wFile);
cFiles->main = new KSimpleConfig (configName);
@ -1800,7 +1800,7 @@ writeInit (CCSContext *c)
if (cFiles->profile != ccsGetProfile (c) )
{
QString configName ("compizrc");
TQString configName ("compizrc");
if (ccsGetProfile (c) && strlen (ccsGetProfile (c) ) )
{
@ -1811,8 +1811,8 @@ writeInit (CCSContext *c)
delete cFiles->main;
QString wFile = KGlobal::dirs()->saveLocation ("config",
QString::null, false) + configName;
TQString wFile = KGlobal::dirs()->saveLocation ("config",
TQString(), false) + configName;
createFile (wFile);
@ -1840,7 +1840,7 @@ writeDone (CCSContext *)
DCOPClient *client = kapp->dcopClient();
if (!client->isAttached())
client->attach();
client->send("kwin", "KWinInterface", "reconfigure()", "");
client->send("kwin", "KWinInterface", "reconfigure()", TQString(""));
cFiles->modified = false;
}
ccsEnableFileWatch (cFiles->watch);
@ -1857,7 +1857,7 @@ init (CCSContext *c)
cFiles = new ConfigFiles;
QString configName ("compizrc");
TQString configName ("compizrc");
if (ccsGetProfile (c) && strlen (ccsGetProfile (c) ) )
{
@ -1866,8 +1866,8 @@ init (CCSContext *c)
cFiles->profile = ccsGetProfile (c);
}
QString wFile = KGlobal::dirs()->saveLocation ("config",
QString::null, false) + configName;
TQString wFile = KGlobal::dirs()->saveLocation ("config",
TQString(), false) + configName;
createFile (wFile);
@ -1881,11 +1881,11 @@ init (CCSContext *c)
cFiles->watch = ccsAddFileWatch (wFile.ascii(), TRUE, reload, (void *) c);
wFile = KGlobal::dirs()->saveLocation ("config",
QString::null, false) + "kwinrc";
TQString(), false) + "kwinrc";
cFiles->kwinWatch = ccsAddFileWatch (wFile.ascii(), TRUE, reload,
(void *) c);
wFile = KGlobal::dirs()->saveLocation ("config",
QString::null, false) + "kdeglobals";
TQString(), false) + "kdeglobals";
cFiles->globalWatch = ccsAddFileWatch (wFile.ascii(), TRUE, reload,
(void *) c);
@ -1922,8 +1922,8 @@ static Bool
deleteProfile (CCSContext *,
char *profile)
{
QString file (KGlobal::dirs()->saveLocation ("config",
QString::null, false) );
TQString file (KGlobal::dirs()->saveLocation ("config",
TQString(), false) );
file += "compizrc";
if (profile && strlen (profile) )
@ -1932,8 +1932,8 @@ deleteProfile (CCSContext *,
file += profile;
}
if (QFile::exists (file) )
return QFile::remove (file);
if (TQFile::exists (file) )
return TQFile::remove (file);
return FALSE;
}

Loading…
Cancel
Save