All pastes #1818497 Raw Edit

Mine

public diff v1 · immutable
#1818497 ·published 2010-03-02 05:08 UTC
rendered paste body
Index: themes/defaultmenu/manage_recordings.xml===================================================================--- themes/defaultmenu/manage_recordings.xml	(revision 23637)+++ themes/defaultmenu/manage_recordings.xml	(working copy)@@ -96,6 +96,7 @@         <description>Remove television recordings</description>         <description lang="DE">TV-Aufnahmen lschen</description>         <action>TV_DELETE</action>+        <dependswindow xmlfile="recordings-ui.xml">deleterecordings</dependswindow>     </button>      <button>Index: libs/libmythui/myththemedmenu.h===================================================================--- libs/libmythui/myththemedmenu.h	(revision 23637)+++ libs/libmythui/myththemedmenu.h	(working copy)@@ -105,6 +105,7 @@      bool handleAction(const QString &action, const QString &password = QString());     bool findDepends(const QString &fileList);+    bool findDependsWindow(const QString &windowName, const QString &xmlFile);     QString findMenuFile(const QString &menuname);      bool checkPinCode(const QString &password_setting);Index: libs/libmythui/myththemedmenu.cpp===================================================================--- libs/libmythui/myththemedmenu.cpp	(revision 23637)+++ libs/libmythui/myththemedmenu.cpp	(working copy)@@ -545,6 +545,15 @@                 addit = GetMythMainWindow()->DestinationExists(                             getFirstText(info));             }+            else if (info.tagName() == "dependswindow")+            {+                QString xmlFile = info.attribute("xmlfile", "");+                QString windowName = getFirstText(info);+                if (xmlFile.isEmpty() || windowName.isEmpty())+                    addit = false;+                else+                    addit = XMLParseBase::WindowExists(xmlFile, windowName);+            }             else if (info.tagName() == "description")             {                 if (description.isEmpty() &&Index: libs/libmythui/xmlparsebase.cpp===================================================================--- libs/libmythui/xmlparsebase.cpp	(revision 23637)+++ libs/libmythui/xmlparsebase.cpp	(working copy)@@ -451,6 +451,58 @@     return uitype; } +bool XMLParseBase::WindowExists(const QString &xmlfile,+                                const QString &windowname)+{+    const QStringList searchpath = GetMythUI()->GetThemeSearchPath();+    QStringList::const_iterator it = searchpath.begin();+    for (; it != searchpath.end(); ++it)+    {+        QString themefile = *it + xmlfile;+		QFile f(themefile);++		if (!f.open(QIODevice::ReadOnly))+			continue;++		QDomDocument doc;+		QString errorMsg;+		int errorLine = 0;+		int errorColumn = 0;++		if (!doc.setContent(&f, false, &errorMsg, &errorLine, &errorColumn))+		{+			VERBOSE(VB_IMPORTANT, LOC_ERR ++					QString("Location: '%1' @ %2 column: %3"+							"\n\t\t\tError: %4")+					.arg(qPrintable(themefile)).arg(errorLine).arg(errorColumn)+					.arg(qPrintable(errorMsg)));+			f.close();+			continue;+		}++		f.close();++		QDomElement docElem = doc.documentElement();+		QDomNode n = docElem.firstChild();+		while (!n.isNull())+		{+			QDomElement e = n.toElement();+			if (!e.isNull())+			{+				if (e.tagName() == "window")+				{+					QString name = e.attribute("name", "");+					if (name == windowname)+                        return true;+                }+            }+            n = n.nextSibling();+        }+    }++    return false;+}+ bool XMLParseBase::LoadWindowFromXML(const QString &xmlfile,                                      const QString &windowname,                                      MythUIType *parent)Index: libs/libmythui/xmlparsebase.h===================================================================--- libs/libmythui/xmlparsebase.h	(revision 23637)+++ libs/libmythui/xmlparsebase.h	(working copy)@@ -42,6 +42,7 @@         MythUIType *parent, MythScreenType *screen,         bool showWarnings); +    static bool WindowExists(const QString &xmlfile, const QString &windowname);     static bool LoadWindowFromXML(const QString &xmlfile,                                   const QString &windowname,                                   MythUIType *parent);