mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 02:12:51 +00:00
kde-menu: keep references to QByteArray objects
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
8a4df31980
commit
1f8c7b9f4d
1 changed files with 10 additions and 8 deletions
|
@ -39,18 +39,21 @@ static bool utf8 = false;
|
|||
static bool bPrintMenuId = false;
|
||||
static bool bPrintMenuName = false;
|
||||
|
||||
static QByteArray convert(const QString &txt)
|
||||
{
|
||||
return (utf8 ? txt.toUtf8() : txt.toLocal8Bit());
|
||||
}
|
||||
|
||||
static void result(const QString &txt)
|
||||
{
|
||||
if (utf8) {
|
||||
puts(txt.toUtf8());
|
||||
} else {
|
||||
puts(txt.toLocal8Bit());
|
||||
}
|
||||
const QByteArray txtbytes = convert(txt);
|
||||
puts(txtbytes.constData());
|
||||
}
|
||||
|
||||
static void error(int exitCode, const QString &txt)
|
||||
{
|
||||
qWarning("kde-menu: %s", txt.toLocal8Bit().data());
|
||||
const QByteArray txtbytes = convert(txt);
|
||||
qWarning("kde-menu: %s", txtbytes.constData());
|
||||
exit(exitCode);
|
||||
}
|
||||
|
||||
|
@ -62,7 +65,7 @@ static void findMenuEntry(KServiceGroup::Ptr parent, const QString &name, const
|
|||
KSycocaEntry::Ptr e = (*it);
|
||||
|
||||
if (e->isType(KST_KServiceGroup)) {
|
||||
KServiceGroup::Ptr g = KServiceGroup::Ptr::staticCast( e );
|
||||
KServiceGroup::Ptr g = KServiceGroup::Ptr::staticCast(e);
|
||||
|
||||
findMenuEntry(g, name.isEmpty() ? g->caption() : name + '/' + g->caption(), menuId);
|
||||
} else if (e->isType(KST_KService)) {
|
||||
|
@ -80,7 +83,6 @@ static void findMenuEntry(KServiceGroup::Ptr parent, const QString &name, const
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *description = I18N_NOOP(
|
||||
|
|
Loading…
Add table
Reference in a new issue