summaryrefslogtreecommitdiffstats
path: root/kxkb/extension.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kxkb/extension.cpp')
-rw-r--r--kxkb/extension.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/kxkb/extension.cpp b/kxkb/extension.cpp
index 12b9b9bbe..3817a8c4c 100644
--- a/kxkb/extension.cpp
+++ b/kxkb/extension.cpp
@@ -24,14 +24,14 @@
TQMap<TQString, FILE*> XKBExtension::fileCache; //TODO: move to class?
-static TQString getLayoutKey(const TQString& tqlayout, const TQString& variant)
+static TQString getLayoutKey(const TQString& layout, const TQString& variant)
{
- return tqlayout + "." + variant;
+ return layout + "." + variant;
}
-TQString XKBExtension::getPrecompiledLayoutFilename(const TQString& tqlayoutKey)
+TQString XKBExtension::getPrecompiledLayoutFilename(const TQString& layoutKey)
{
- TQString compiledLayoutFileName = m_tempDir + tqlayoutKey + ".xkm";
+ TQString compiledLayoutFileName = m_tempDir + layoutKey + ".xkm";
return compiledLayoutFileName;
}
@@ -115,28 +115,28 @@ bool XKBExtension::setXkbOptions(const TQString& options, bool resetOld)
}
bool XKBExtension::setLayout(const TQString& model,
- const TQString& tqlayout, const TQString& variant,
+ const TQString& layout, const TQString& variant,
const TQString& includeGroup, bool useCompiledLayouts)
{
if( useCompiledLayouts == false ) {
- return setLayoutInternal( model, tqlayout, variant, includeGroup );
+ return setLayoutInternal( model, layout, variant, includeGroup );
}
- const TQString tqlayoutKey = getLayoutKey(tqlayout, variant);
+ const TQString layoutKey = getLayoutKey(layout, variant);
bool res;
- if( fileCache.tqcontains(tqlayoutKey) ) {
- res = setCompiledLayout( tqlayoutKey );
- kdDebug() << "setCompiledLayout " << tqlayoutKey << ": " << res << endl;
+ if( fileCache.contains(layoutKey) ) {
+ res = setCompiledLayout( layoutKey );
+ kdDebug() << "setCompiledLayout " << layoutKey << ": " << res << endl;
if( res )
return res;
}
// else {
- res = setLayoutInternal( model, tqlayout, variant, includeGroup );
- kdDebug() << "setRawLayout " << tqlayoutKey << ": " << res << endl;
+ res = setLayoutInternal( model, layout, variant, includeGroup );
+ kdDebug() << "setRawLayout " << layoutKey << ": " << res << endl;
if( res )
- compileCurrentLayout( tqlayoutKey );
+ compileCurrentLayout( layoutKey );
// }
return res;
@@ -144,10 +144,10 @@ bool XKBExtension::setLayout(const TQString& model,
// private
bool XKBExtension::setLayoutInternal(const TQString& model,
- const TQString& tqlayout, const TQString& variant,
+ const TQString& layout, const TQString& variant,
const TQString& includeGroup)
{
- if ( tqlayout.isEmpty() )
+ if ( layout.isEmpty() )
return false;
TQString exe = KGlobal::dirs()->findExe("setxkbmap");
@@ -156,12 +156,12 @@ bool XKBExtension::setLayoutInternal(const TQString& model,
return false;
}
- TQString fullLayout = tqlayout;
+ TQString fullLayout = layout;
TQString fullVariant = variant;
if( includeGroup.isEmpty() == false ) {
fullLayout = includeGroup;
fullLayout += ",";
- fullLayout += tqlayout;
+ fullLayout += layout;
// fullVariant = baseVar;
fullVariant = ",";
@@ -173,7 +173,7 @@ bool XKBExtension::setLayoutInternal(const TQString& model,
// p << "-rules" << rule;
if( model.isEmpty() == false )
p << "-model" << model;
- p << "-tqlayout" << fullLayout;
+ p << "-layout" << fullLayout;
if( !fullVariant.isNull() && !fullVariant.isEmpty() )
p << "-variant" << fullVariant;
@@ -209,25 +209,25 @@ unsigned int XKBExtension::getGroup() const
}
/**
- * @brief Gets the current tqlayout in its binary compiled form
+ * @brief Gets the current layout in its binary compiled form
* and write it to the file specified by 'fileName'
- * @param[in] fileName file to store compiled tqlayout to
+ * @param[in] fileName file to store compiled layout to
* @return true if no problem, false otherwise
*/
-bool XKBExtension::compileCurrentLayout(const TQString &tqlayoutKey)
+bool XKBExtension::compileCurrentLayout(const TQString &layoutKey)
{
XkbFileInfo result;
memset(&result, 0, sizeof(result));
result.type = XkmKeymapFile;
XkbReadFromServer(m_dpy, XkbAllMapComponentsMask, XkbAllMapComponentsMask, &result);
- const TQString fileName = getPrecompiledLayoutFilename(tqlayoutKey);
+ const TQString fileName = getPrecompiledLayoutFilename(layoutKey);
- kdDebug() << "compiling tqlayout " << this << " cache size: " << fileCache.count() << endl;
- if( fileCache.tqcontains(tqlayoutKey) ) {
- kdDebug() << "trashing old compiled tqlayout for " << fileName << endl;
- if( fileCache[ tqlayoutKey ] != NULL )
- fclose( fileCache[ tqlayoutKey ] ); // recompiling - trash the old file
+ kdDebug() << "compiling layout " << this << " cache size: " << fileCache.count() << endl;
+ if( fileCache.contains(layoutKey) ) {
+ kdDebug() << "trashing old compiled layout for " << fileName << endl;
+ if( fileCache[ layoutKey ] != NULL )
+ fclose( fileCache[ layoutKey ] ); // recompiling - trash the old file
fileCache.remove(fileName);
}
@@ -241,41 +241,41 @@ bool XKBExtension::compileCurrentLayout(const TQString &tqlayoutKey)
}
if( !XkbWriteXKMFile(output, &result) ) {
- kdWarning() << "Could not write compiled tqlayout to " << fileName << endl;
+ kdWarning() << "Could not write compiled layout to " << fileName << endl;
fclose(output);
return false;
}
fclose(output); // TODO: can we change mode w/out reopening?
FILE *input = fopen(TQFile::encodeName(fileName), "r");
- fileCache[ tqlayoutKey ] = input;
+ fileCache[ layoutKey ] = input;
XkbFreeKeyboard(result.xkb, XkbAllControlsMask, True);
return true;
}
/**
- * @brief takes tqlayout from its compiled binary snapshot in file
+ * @brief takes layout from its compiled binary snapshot in file
* and sets it as current
- * TODO: cache tqlayout in memory rather than in file
+ * TODO: cache layout in memory rather than in file
*/
-bool XKBExtension::setCompiledLayout(const TQString &tqlayoutKey)
+bool XKBExtension::setCompiledLayout(const TQString &layoutKey)
{
FILE *input = NULL;
- if( fileCache.tqcontains(tqlayoutKey) ) {
- input = fileCache[ tqlayoutKey ];
+ if( fileCache.contains(layoutKey) ) {
+ input = fileCache[ layoutKey ];
}
if( input == NULL ) {
kdWarning() << "setCompiledLayout trying to reopen xkb file" << endl; // should never happen
- const TQString fileName = getPrecompiledLayoutFilename(tqlayoutKey);
+ const TQString fileName = getPrecompiledLayoutFilename(layoutKey);
input = fopen(TQFile::encodeName(fileName), "r");
// FILE *input = fopen(TQFile::encodeName(fileName), "r");
if ( input == NULL ) {
kdDebug() << "Unable to open " << fileName << ": " << strerror(errno) << endl;
- fileCache.remove(tqlayoutKey);
+ fileCache.remove(layoutKey);
return false;
}
}
@@ -288,7 +288,7 @@ bool XKBExtension::setCompiledLayout(const TQString &tqlayoutKey)
if ((result.xkb = XkbAllocKeyboard())==NULL) {
kdWarning() << "Unable to allocate memory for keyboard description" << endl;
// fclose(input);
-// fileCache.remove(tqlayoutKey);
+// fileCache.remove(layoutKey);
return false;
}
@@ -299,7 +299,7 @@ bool XKBExtension::setCompiledLayout(const TQString &tqlayoutKey)
kdWarning() << "Unable to load map from file" << endl;
XkbFreeKeyboard(result.xkb, XkbAllControlsMask, True);
fclose(input);
- fileCache.remove(tqlayoutKey);
+ fileCache.remove(layoutKey);
return false;
}
@@ -309,14 +309,14 @@ bool XKBExtension::setCompiledLayout(const TQString &tqlayoutKey)
{
if (!XkbWriteToServer(&result))
{
- kdWarning() << "Unable to write the keyboard tqlayout to X display" << endl;
+ kdWarning() << "Unable to write the keyboard layout to X display" << endl;
XkbFreeKeyboard(result.xkb, XkbAllControlsMask, True);
return false;
}
}
else
{
- kdWarning() << "Unable prepare the keyboard tqlayout for X display" << endl;
+ kdWarning() << "Unable prepare the keyboard layout for X display" << endl;
}
XkbFreeKeyboard(result.xkb, XkbAllControlsMask, True);
@@ -324,7 +324,7 @@ bool XKBExtension::setCompiledLayout(const TQString &tqlayoutKey)
}
-// Deletes the precompiled tqlayouts stored in temporary files
+// Deletes the precompiled layouts stored in temporary files
// void XKBExtension::deletePrecompiledLayouts()
// {
// TQMapConstIterator<LayoutUnit, TQString> it, end;