File indexing completed on 2024-04-14 15:01:14

0001 /**
0002  * Copyright (C) 2006 by Koos Vriezen <koos.vriezen@gmail.com>
0003  *
0004  *  This library is free software; you can redistribute it and/or
0005  *  modify it under the terms of the GNU Library General Public
0006  *  License version 2 as published by the Free Software Foundation.
0007  *
0008  *  This library is distributed in the hope that it will be useful,
0009  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0010  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011  *  Library General Public License for more details.
0012  *
0013  *  You should have received a copy of the GNU Library General Public License
0014  *  along with this library; see the file COPYING.LIB.  If not, write to
0015  *  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
0016  *  Boston, MA 02110-1301, USA.
0017  **/
0018 
0019 #include <stdio.h>
0020 
0021 #include "config-kmplayer.h"
0022 // include files for Qt
0023 #include <qapplication.h>
0024 #include <qclipboard.h>
0025 #include <QMenu>
0026 #include <QIcon>
0027 #include <qdrawutil.h>
0028 #include <qpainter.h>
0029 #include <QAbstractItemDelegate>
0030 #include <QDropEvent>
0031 #include <qstyle.h>
0032 #include <QDropEvent>
0033 #include <QPalette>
0034 #include <qregexp.h>
0035 #include <QtCore/QAbstractItemModel>
0036 #include <QtCore/QList>
0037 #include <QItemSelectionModel>
0038 #include <QMimeData>
0039 
0040 #include <kiconloader.h>
0041 #include <kstandardaction.h>
0042 #include <kfinddialog.h>
0043 #include <kfind.h>
0044 #include <kaction.h>
0045 #include <klocalizedstring.h>
0046 #include <kdebug.h>
0047 #include <KActionCollection>
0048 
0049 #include "playlistview.h"
0050 #include "playmodel.h"
0051 #include "kmplayerview.h"
0052 #include "kmplayercontrolpanel.h"
0053 
0054 #include <kurl.h>
0055 
0056 using namespace KMPlayer;
0057 
0058 namespace {
0059 
0060 class ItemDelegate : public QAbstractItemDelegate
0061 {
0062     QAbstractItemDelegate *default_item_delegate;
0063     PlayListView *playlist_view;
0064 public:
0065     ItemDelegate (PlayListView *v, QAbstractItemDelegate *def)
0066         : QAbstractItemDelegate (v),
0067           default_item_delegate (def),
0068           playlist_view (v)
0069     {}
0070     QWidget *createEditor (QWidget *w, const QStyleOptionViewItem &o, const QModelIndex &i) const
0071     {
0072         return default_item_delegate->createEditor (w, o, i);
0073     }
0074     bool editorEvent (QEvent *e, QAbstractItemModel *m, const QStyleOptionViewItem &o, const QModelIndex &i)
0075     {
0076         return default_item_delegate->editorEvent (e, m, o, i);
0077     }
0078     bool eventFilter (QObject *editor, QEvent *event)
0079     {
0080         return default_item_delegate->eventFilter (editor, event);
0081     }
0082     void paint (QPainter *p, const QStyleOptionViewItem &o, const QModelIndex &i) const
0083     {
0084         playlist_view->paintCell (default_item_delegate, p, o, i);
0085     }
0086     void setEditorData (QWidget *e, const QModelIndex &i) const
0087     {
0088         default_item_delegate->setEditorData (e, i);
0089     }
0090     void setModelData (QWidget *e, QAbstractItemModel *m, const QModelIndex &i) const
0091     {
0092         default_item_delegate->setModelData (e, m, i);
0093     }
0094     QSize sizeHint (const QStyleOptionViewItem &o, const QModelIndex &i) const
0095     {
0096         QSize size = default_item_delegate->sizeHint (o, i);
0097         return QSize (size.width (), size.height () + 2);
0098     }
0099     void updateEditorGeometry (QWidget *e, const QStyleOptionViewItem &o, const QModelIndex &i) const
0100     {
0101         default_item_delegate->updateEditorGeometry (e, o, i);
0102     }
0103 };
0104 
0105 }
0106 
0107 //-----------------------------------------------------------------------------
0108 
0109 KDE_NO_CDTOR_EXPORT PlayListView::PlayListView (QWidget *, View *view, KActionCollection * ac)
0110  : //QTreeView (parent),
0111    m_view (view),
0112    m_find_dialog (0L),
0113    m_active_color (30, 0, 255),
0114    last_drag_tree_id (0),
0115    m_ignore_expanded (false) {
0116     setHeaderHidden (true);
0117     setSortingEnabled (false);
0118     setAcceptDrops (true);
0119     setDragDropMode (DragDrop);
0120     setDropIndicatorShown (true);
0121     setDragDropOverwriteMode (false);
0122     setRootIsDecorated (false);
0123     setSelectionMode (SingleSelection);
0124     setSelectionBehavior (SelectItems);
0125     setIndentation (4);
0126     //setItemsExpandable (false);
0127     //setAnimated (true);
0128     setUniformRowHeights (true);
0129     setItemDelegateForColumn (0, new ItemDelegate (this, itemDelegate ()));
0130     setEditTriggers (EditKeyPressed);
0131     QPalette palette;
0132     palette.setColor (foregroundRole(), QColor (0, 0, 0));
0133     palette.setColor (backgroundRole(), QColor (0xB2, 0xB2, 0xB2));
0134     setPalette (palette);
0135     m_itemmenu = new QMenu (this);
0136     m_find = KStandardAction::find (this, SLOT (slotFind ()), this);
0137     m_find_next = KStandardAction::findNext (this, SLOT(slotFindNext()), this);
0138     m_find_next->setEnabled (false);
0139     m_edit_playlist_item = ac->addAction ("edit_playlist_item");
0140     m_edit_playlist_item->setText (i18n ("Edit &item"));
0141     connect (m_edit_playlist_item, SIGNAL (triggered (bool)),
0142              this, SLOT (renameSelected ()));
0143     connect (this, SIGNAL (expanded (const QModelIndex&)),
0144              this, SLOT (slotItemExpanded (const QModelIndex&)));
0145 }
0146 
0147 KDE_NO_CDTOR_EXPORT PlayListView::~PlayListView () {
0148 }
0149 
0150 void PlayListView::paintCell (const QAbstractItemDelegate *def,
0151         QPainter *p, const QStyleOptionViewItem &o, const QModelIndex i)
0152 {
0153     PlayItem *item = playModel ()->itemFromIndex (i);
0154     if (item) {
0155         TopPlayItem *ritem = item->rootItem ();
0156         if (ritem == item) {
0157             QStyleOptionViewItem option (o);
0158             if (currentIndex () == i) {
0159                 // no highlighting for the top items
0160                 option.palette.setColor (QPalette::Highlight,
0161                         topLevelWidget()->palette ().color (QPalette::Background));
0162                 option.palette.setColor (QPalette::HighlightedText,
0163                         topLevelWidget()->palette ().color (QPalette::Foreground));
0164             } else {
0165                 p->fillRect(o.rect, QBrush (topLevelWidget()->palette ().color (QPalette::Background)));
0166                 option.palette.setColor (QPalette::Text,
0167                         topLevelWidget()->palette ().color (QPalette::Foreground));
0168             }
0169             option.font = topLevelWidget()->font ();
0170             def->paint (p, option, i);
0171             qDrawShadeRect (p, o.rect, option.palette, !isExpanded (i));
0172         } else {
0173             QStyleOptionViewItem option (o);
0174             option.palette.setColor (QPalette::Text,
0175                     item->node && item->node->state == Node::state_began
0176                     ? m_active_color
0177                     : palette ().color (foregroundRole ()));
0178             def->paint (p, option, i);
0179         }
0180     }
0181 }
0182 
0183 void PlayListView::modelUpdating (const QModelIndex &)
0184 {
0185     m_ignore_expanded = true;
0186     QModelIndex index = selectionModel()->currentIndex ();
0187     if (index.isValid ())
0188         closePersistentEditor(index);
0189 }
0190 
0191 void PlayListView::modelUpdated (const QModelIndex& r, const QModelIndex& i, bool sel, bool exp)
0192 {
0193     if (exp)
0194         setExpanded (r, true);
0195     if (i.isValid () && sel) {
0196         setCurrentIndex (i);
0197         scrollTo (i);
0198     }
0199     m_find_next->setEnabled (!!m_current_find_elm);
0200     TopPlayItem *ti = static_cast<TopPlayItem*>(playModel()->itemFromIndex(r));
0201     if (!ti->have_dark_nodes && ti->show_all_nodes && !m_view->editMode())
0202         toggleShowAllNodes (); // redo, because the user can't change it anymore
0203     m_ignore_expanded = false;
0204 }
0205 
0206 QModelIndex PlayListView::index (PlayItem *item) const
0207 {
0208     return playModel ()->indexFromItem (item);
0209 }
0210 
0211 void PlayListView::selectItem(const QString&) {
0212     /*QTreeWidgetItem * item = selectedItem ();
0213     if (item && item->text (0) == txt)
0214         return;
0215     item = findItem (txt, 0);
0216     if (item) {
0217         item->setSelected (true);
0218         //ensureItemVisible (item);
0219     }*/
0220 }
0221 
0222 /*KDE_NO_EXPORT Q3DragObject * PlayListView::dragObject () {
0223     PlayItem * item = static_cast <PlayItem *> (selectedItem ());
0224     if (item && item->node) {
0225         QString txt = item->node->isPlayable ()
0226             ? item->node->mrl ()->src : item->node->outerXML ();
0227         Q3TextDrag * drag = new Q3TextDrag (txt, this);
0228         last_drag_tree_id = rootItem (item)->id;
0229         m_last_drag = item->node;
0230         drag->setIcon (*item->pixmap (0));
0231         if (!item->node->isPlayable ())
0232             drag->setSubtype ("xml");
0233         return drag;
0234     }
0235     return 0;
0236 }*/
0237 
0238 KDE_NO_EXPORT void PlayListView::setFont (const QFont & fnt) {
0239     //setTreeStepSize (QFontMetrics (fnt).boundingRect ('m').width ());
0240     QTreeView::setFont (fnt);
0241 }
0242 
0243 KDE_NO_EXPORT void PlayListView::contextMenuEvent (QContextMenuEvent *event)
0244 {
0245     PlayItem *item = playModel ()->itemFromIndex (indexAt (event->pos ()));
0246     if (item) {
0247         if (item->node || item->attribute) {
0248             TopPlayItem *ritem = item->rootItem ();
0249             if (m_itemmenu->actions().count () > 0) {
0250                 m_find->setVisible (false);
0251                 m_find_next->setVisible (false);
0252                 m_itemmenu->clear ();
0253             }
0254             m_itemmenu->addAction (QIcon::fromTheme("edit-copy"),
0255                     i18n ("&Copy to Clipboard"),
0256                     this, SLOT (copyToClipboard ()));
0257             if (item->attribute ||
0258                     (item->node && (item->node->isPlayable () ||
0259                                     item->node->isDocument ()) &&
0260                      item->node->mrl ()->bookmarkable))
0261                 m_itemmenu->addAction (QIcon::fromTheme("bookmark-new"),
0262                         i18n ("&Add Bookmark"),
0263                         this, SLOT (addBookMark ()));
0264             if (ritem->have_dark_nodes) {
0265                 QAction *act = m_itemmenu->addAction (i18n ("&Show all"),
0266                         this, SLOT (toggleShowAllNodes ()));
0267                 act->setCheckable (true);
0268                 act->setChecked (ritem->show_all_nodes);
0269             }
0270             if (item->item_flags & Qt::ItemIsEditable)
0271                 m_itemmenu->addAction (m_edit_playlist_item);
0272             m_itemmenu->addSeparator ();
0273             m_find->setVisible (true);
0274             m_find_next->setVisible (true);
0275             emit prepareMenu (item, m_itemmenu);
0276             m_itemmenu->exec (event->globalPos ());
0277         }
0278     } else {
0279         m_view->controlPanel ()->popupMenu->exec (event->globalPos ());
0280     }
0281 }
0282 
0283 void PlayListView::slotItemExpanded (const QModelIndex &index) {
0284     int chlds = model ()->rowCount (index);
0285     if (chlds > 0) {
0286         if (!m_ignore_expanded && chlds == 1)
0287             setExpanded (model ()->index (0, 0, index), true);
0288         scrollTo (model ()->index (chlds - 1, 0, index));
0289         scrollTo (index);
0290     }
0291 }
0292 
0293 TopPlayItem * PlayListView::rootItem (int id) const {
0294     PlayItem *root_item = playModel ()->rootItem ();
0295     return static_cast<TopPlayItem*>(root_item->child (id));
0296 }
0297 
0298 PlayItem *PlayListView::selectedItem () const {
0299     return playModel ()->itemFromIndex (currentIndex ());
0300 }
0301 
0302 void PlayListView::copyToClipboard () {
0303     QModelIndex i = currentIndex ();
0304     if (i.isValid ()) {
0305         QString s;
0306 
0307         QVariant v = i.data (PlayModel::UrlRole);
0308         if (v.isValid ())
0309             s = v.toString ();
0310         if (s.isEmpty ())
0311             s = i.data ().toString ();
0312 
0313         if (!s.isEmpty ())
0314             QApplication::clipboard()->setText (s);
0315     }
0316 }
0317 
0318 void PlayListView::addBookMark () {
0319     PlayItem * item = selectedItem ();
0320     if (item->node) {
0321         Mrl * mrl = item->node->mrl ();
0322         KURL url (mrl ? mrl->src : QString (item->node->nodeName ()));
0323         emit addBookMark (mrl->title.isEmpty () ? url.prettyUrl () : mrl->title, url.url ());
0324     }
0325 }
0326 
0327 void PlayListView::toggleShowAllNodes () {
0328     PlayItem * cur_item = selectedItem ();
0329     if (cur_item) {
0330         TopPlayItem *ritem = cur_item->rootItem ();
0331         showAllNodes (ritem, !ritem->show_all_nodes);
0332     }
0333 }
0334 
0335 KDE_NO_EXPORT void PlayListView::showAllNodes(TopPlayItem *ri, bool show) {
0336     if (ri && ri->show_all_nodes != show) {
0337         PlayItem * cur_item = selectedItem ();
0338         ri->show_all_nodes = show;
0339         playModel()->updateTree (ri->id, ri->node, cur_item->node, true, false);
0340         if (m_current_find_elm &&
0341                 ri->node->document() == m_current_find_elm->document() &&
0342                 !ri->show_all_nodes) {
0343             if (!m_current_find_elm->role (RolePlaylist))
0344                 m_current_find_elm = 0L;
0345             m_current_find_attr = 0L;
0346         }
0347     }
0348 }
0349 
0350 KDE_NO_EXPORT bool PlayListView::isDragValid (QDropEvent *event) {
0351     if (event->source() == this &&
0352             event->mimeData ()
0353                 ->hasFormat ("application/x-qabstractitemmodeldatalist"))
0354         return true;
0355     if (event->mimeData()->hasFormat ("text/uri-list")) {
0356         KUrl::List uriList = KUrl::List::fromMimeData (event->mimeData ());
0357         if (!uriList.isEmpty ())
0358             return true;
0359     } else {
0360         QString text = event->mimeData ()->text ();
0361         if (!text.isEmpty () && KUrl (text).isValid ())
0362             return true;
0363     }
0364     return false;
0365 }
0366 
0367 KDE_NO_EXPORT void PlayListView::dragMoveEvent (QDragMoveEvent *event)
0368 {
0369     PlayItem *itm = playModel ()->itemFromIndex (indexAt (event->pos ()));
0370     if (itm) {
0371         TopPlayItem *ritem = itm->rootItem ();
0372         if (ritem->itemFlags() & PlayModel::AllowDrops && isDragValid (event))
0373             event->accept ();
0374         else
0375             event->ignore();
0376     }
0377 }
0378 
0379 void PlayListView::dragEnterEvent (QDragEnterEvent *event)
0380 {
0381     if (isDragValid (event))
0382         event->accept ();
0383     else
0384         event->ignore();
0385 }
0386 
0387 KDE_NO_EXPORT void PlayListView::dropEvent (QDropEvent *event) {
0388     PlayItem *itm = playModel ()->itemFromIndex (indexAt (event->pos ()));
0389     if (itm && itm->node) {
0390         TopPlayItem *ritem = itm->rootItem ();
0391         NodePtr n = itm->node;
0392         if (ritem->id > 0 || n->isDocument ()) {
0393             emit dropped (event, itm);
0394         } else {
0395             KUrl::List uris = KUrl::List::fromMimeData (event->mimeData());
0396             if (uris.isEmpty ()) {
0397                 KUrl url (event->mimeData ()->text ());
0398                 if (url.isValid ())
0399                     uris.push_back (url);
0400             }
0401             if (uris.size () > 0) {
0402                 bool as_child = itm->node->hasChildNodes ();
0403                 NodePtr d = n->document ();
0404                 for (int i = uris.size (); i > 0; i--) {
0405                     Node * ni = new KMPlayer::GenericURL (d, uris[i-1].url ());
0406                     if (as_child)
0407                         n->insertBefore (ni, n->firstChild ());
0408                     else
0409                         n->parentNode ()->insertBefore (ni, n->nextSibling ());
0410                 }
0411                 PlayItem * citem = selectedItem ();
0412                 NodePtr cn;
0413                 if (citem)
0414                     cn = citem->node;
0415                 m_ignore_expanded = true;
0416                 citem = playModel()->updateTree (ritem, cn);
0417                 modelUpdated (playModel()->indexFromItem(ritem), playModel()->indexFromItem(citem), true, false);
0418                 m_ignore_expanded = false;
0419             }
0420         }
0421     }
0422 }
0423 
0424 PlayModel *PlayListView::playModel () const
0425 {
0426     return static_cast <PlayModel *> (model());
0427 }
0428 
0429 
0430 KDE_NO_EXPORT void PlayListView::renameSelected () {
0431     QModelIndex i = currentIndex ();
0432     PlayItem *itm = playModel ()->itemFromIndex (i);
0433     if (itm && itm->item_flags & Qt::ItemIsEditable)
0434         edit (i);
0435 }
0436 
0437 KDE_NO_EXPORT void PlayListView::slotCurrentItemChanged (QModelIndex /*cur*/, QModelIndex)
0438 {
0439     //TopPlayItem * ri = rootItem (qitem);
0440     //setItemsRenameable (ri && (ri->item_flagsTreeEdit) && ri != qitem);
0441 }
0442 
0443 KDE_NO_EXPORT void PlayListView::slotFind () {
0444     /*m_current_find_elm = 0L;
0445     if (!m_find_dialog) {
0446         m_find_dialog = new KFindDialog (this, KFind::CaseSensitive);
0447         m_find_dialog->setHasSelection (false);
0448         connect(m_find_dialog, SIGNAL(okClicked ()), this, SLOT(slotFindOk ()));
0449     } else
0450         m_find_dialog->setPattern (QString ());
0451     m_find_dialog->show ();*/
0452 }
0453 
0454 /*static QTreeWidgetItem * findNodeInTree (NodePtr n, QTreeWidgetItem * item) {
0455     //kDebug () << "item:" << item->text (0) << " n:" << (n ? n->nodeName () : "null" );
0456     PlayItem * pi = static_cast <PlayItem *> (item);
0457     if (!n || !pi->node)
0458         return 0L;
0459     if (n == pi->node)
0460         return item;
0461     for (int i = 0; i < item->childCount (); ++i) {
0462         //kDebug () << "ci:" << ci->text (0) << " n:" << n->nodeName ();
0463         QTreeWidgetItem *vi = findNodeInTree (n, item->child (i));
0464         if (vi)
0465             return vi;
0466     }
0467     return 0L;
0468 
0469 }*/
0470 
0471 KDE_NO_EXPORT void PlayListView::slotFindOk () {
0472     /*if (!m_find_dialog)
0473         return;
0474     m_find_dialog->hide ();
0475     long opt = m_find_dialog->options ();
0476     current_find_tree_id = 0;
0477     if (opt & KFind::FromCursor && currentItem ()) {
0478         PlayItem * lvi = selectedItem ();
0479         if (lvi && lvi->node) {
0480              m_current_find_elm = lvi->node;
0481              current_find_tree_id = rootItem (lvi)->id;
0482         } else if (lvi && lvi->attribute) {
0483             PlayItem*pi=static_cast<PlayItem*>(currentItem()->parent());
0484             if (pi) {
0485                 m_current_find_attr = lvi->attribute;
0486                 m_current_find_elm = pi->node;
0487             }
0488         }
0489     } else if (!(opt & KFind::FindIncremental))
0490         m_current_find_elm = 0L;
0491     if (!m_current_find_elm && topLevelItemCount ())
0492         m_current_find_elm = static_cast <PlayItem*>(topLevelItem(0))->node;
0493     if (m_current_find_elm)
0494         slotFindNext ();*/
0495 }
0496 
0497 /* A bit tricky, but between the find's PlayItems might be gone, so
0498  * try to match on the generated tree following the source's document tree
0499  */
0500 KDE_NO_EXPORT void PlayListView::slotFindNext () {
0501     /*if (!m_find_dialog)
0502         return;
0503     QString str = m_find_dialog->pattern();
0504     if (!m_current_find_elm || str.isEmpty ())
0505         return;
0506     long opt = m_find_dialog->options ();
0507     QRegExp regexp;
0508     if (opt & KFind::RegularExpression)
0509         regexp = QRegExp (str);
0510     bool cs = (opt & KFind::CaseSensitive);
0511     bool found = false;
0512     Node *node = NULL, *n = m_current_find_elm.ptr ();
0513     TopPlayItem * ri = rootItem (current_find_tree_id);
0514     while (!found && n) {
0515         if (ri->show_all_nodes || n->role (RolePlaylist)) {
0516             bool elm = n->isElementNode ();
0517             QString val = n->nodeName ();
0518             if (elm && !ri->show_all_nodes) {
0519                 Mrl * mrl = n->mrl ();
0520                 if (mrl) {
0521                     if (mrl->title.isEmpty ()) {
0522                         if (!mrl->src.isEmpty())
0523                             val = KURL(mrl->src).prettyUrl();
0524                     } else
0525                         val = mrl->title;
0526                 }
0527             } else if (!elm)
0528                 val = n->nodeValue ();
0529             if (((opt & KFind::RegularExpression) &&
0530                     val.find (regexp, 0) > -1) ||
0531                     (!(opt & KFind::RegularExpression) &&
0532                      val.find (str, 0, cs) > -1)) {
0533                 node = n;
0534                 m_current_find_attr = 0L;
0535                 found = true;
0536             } else if (elm && ri->show_all_nodes) {
0537                 for (Attribute *a = static_cast <Element *> (n)->attributes ().first (); a; a = a->nextSibling ()) {
0538                     QString attr = a->name ().toString ();
0539                     if (((opt & KFind::RegularExpression) &&
0540                                 (attr.find (regexp, 0) || a->value ().find (regexp, 0) > -1)) ||
0541                                 (!(opt & KFind::RegularExpression) &&
0542                                  (attr.find (str, 0, cs) > -1 || a->value ().find (str, 0, cs) > -1))) {
0543                         node = n;
0544                         m_current_find_attr = a;
0545                         found = true;
0546                         break;
0547                     }
0548                 }
0549             }
0550         }
0551         if (n) { //set pointer to next
0552             if (opt & KFind::FindBackwards) {
0553                 if (n->lastChild ()) {
0554                     n = n->lastChild ();
0555                 } else if (n->previousSibling ()) {
0556                     n = n->previousSibling ();
0557                 } else {
0558                     for (n = n->parentNode (); n; n = n->parentNode ())
0559                         if (n->previousSibling ()) {
0560                             n = n->previousSibling ();
0561                             break;
0562                         }
0563                     while (!n && current_find_tree_id > 0) {
0564                         ri = rootItem (--current_find_tree_id);
0565                         if (ri)
0566                             n = ri->node;
0567                     }
0568                 }
0569             } else {
0570                 if (n->firstChild ()) {
0571                     n = n->firstChild ();
0572                 } else if (n->nextSibling ()) {
0573                     n = n->nextSibling ();
0574                 } else {
0575                     for (n = n->parentNode (); n; n = n->parentNode ())
0576                         if (n->nextSibling ()) {
0577                             n = n->nextSibling ();
0578                             break;
0579                         }
0580                     while (!n) {
0581                         ri = rootItem (++current_find_tree_id);
0582                         if (!ri)
0583                             break;
0584                         n = ri->node;
0585                     }
0586                 }
0587             }
0588         }
0589     }
0590     m_current_find_elm = n;
0591     kDebug () << " search for " << str << "=" << (node ? node->nodeName () : "not found") << " next:" << (n ? n->nodeName () : " not found");
0592     if (found) {
0593         QTreeWidgetItem *fc = findNodeInTree (node, ri);
0594         if (!fc) {
0595             m_current_find_elm = 0L;
0596             kDebug () << "node not found in tree tree:" << ri->id;
0597         } else {
0598             fc->setSelected (true);
0599             if (m_current_find_attr && fc->childCount () && fc->child (0)->childCount ())
0600                 scrollToItem (fc->child (0)->child (0));
0601             scrollToItem (fc);
0602         }
0603     }
0604     m_find_next->setEnabled (!!m_current_find_elm);*/
0605 }
0606 
0607 #include "playlistview.moc"