--- a/dirbrowser/cdbrowser.cpp
+++ b/dirbrowser/cdbrowser.cpp
@@ -300,7 +300,17 @@
}
}
+// This gets called by actual signals actual events. We need to
+// separate the implementation in processOnLinkClicked() for counting
+// automatic calls (when seeing a container with a single container
+// entry for example, and to avoid unlimited recursion on a pathologic tree).
void CDBrowser::onLinkClicked(const QUrl &url)
+{
+ m_autoclickcnt = 0;
+ processOnLinkClicked(url);
+}
+
+void CDBrowser::processOnLinkClicked(const QUrl &url)
{
m_timer.stop();
string scurl = qs2utf8s(url.toString());
@@ -676,12 +686,18 @@
void CDBrowser::onBrowseDone(int)
{
- //qDebug() <<"CDBrowser::onBrowseDone";
+ //qDebug() <<"CDBrowser::onBrowseDone: " << m_entries.size() << " entries";
if (!m_reader) {
qDebug() << "CDBrowser::onBrowseDone(int) no reader: cancelled";
return;
}
-
+ if (m_autoclickcnt++ < 3 && m_entries.size() == 1 &&
+ m_entries[0].m_type == UPnPDirObject::container) {
+ QUrl cturl(QString("http://h/C%1").arg(0));
+ processOnLinkClicked(cturl);
+ return;
+ }
+
vector<string> sortcrits;
int sortkind = CSettingsStorage::getInstance()->getSortKind();
if (sortkind == CSettingsStorage::SK_MINIMFNORDER &&