playlistsplitter.cpp 19.4 KB
Newer Older
1 2 3 4 5
/***************************************************************************
                          playlistsplitter.cpp  -  description
                             -------------------
    begin                : Fri Sep 13 2002
    copyright            : (C) 2002 by Scott Wheeler
6
    email                : wheeler@kde.org
7 8 9 10 11 12 13 14 15 16 17
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

18
#include <kstandarddirs.h>
19
#include <kmessagebox.h>
Nadeem Hasan's avatar
Nadeem Hasan committed
20
#include <klineeditdlg.h>
21 22
#include <kdebug.h>

23
#include <qpopupmenu.h>
24

25
#include "playlistsplitter.h"
26
#include "directorylist.h"
27
#include "playlistsearch.h"
28
#include "dynamicplaylist.h"
29
#include "mediafiles.h"
30 31

////////////////////////////////////////////////////////////////////////////////
32
// helper functions
33 34
////////////////////////////////////////////////////////////////////////////////

35
void processEvents()
36
{
37 38 39
    static int processed = 0;
    if(processed == 0)
        kapp->processEvents();
40
    processed = (processed + 1) % 5;
41 42
}

43
////////////////////////////////////////////////////////////////////////////////
44
// public methods
45 46
////////////////////////////////////////////////////////////////////////////////

47
PlaylistSplitter::PlaylistSplitter(QWidget *parent, bool restore, const char *name) :
48
    QSplitter(Qt::Horizontal, parent, name),
49
    m_playingItem(0), m_searchWidget(0), m_dynamicList(0), m_restore(restore),
50
    m_nextPlaylistItem(0)
51
{
52 53
    setupLayout();
    readConfig();
54 55

    m_editor->slotUpdateCollection();
56
}
57

58
PlaylistSplitter::~PlaylistSplitter()
59
{
Scott Wheeler's avatar
Scott Wheeler committed
60
    delete m_dirWatch;
61
    saveConfig();
62 63
}

64
QString PlaylistSplitter::uniquePlaylistName(const QString &startingWith, bool useParenthesis)
65
{
66
    if(!m_playlistBox)
67
	return QString::null;
68

69
    QStringList names = m_playlistBox->names();
70 71 72

    int playlistNumber = 1;

73
    // while the list contains more than zero instances of the generated
74 75
    // string...

76 77 78
    if(useParenthesis) {
	while(names.contains(startingWith + " (" + QString::number(playlistNumber) + ")") != 0)
	    playlistNumber++;
79 80

	return startingWith + " (" + QString::number(playlistNumber) + ")";
81 82 83 84 85
    }
    else
    {
	while(names.contains(startingWith + ' ' + QString::number(playlistNumber)) != 0)
	    playlistNumber++;
86

87
	return startingWith + " " + QString::number(playlistNumber);
88
    }
89 90
}

91
QString PlaylistSplitter::playNextFile(bool random, bool loopPlaylist)
92
{
93 94
    PlaylistItem *i;

95
    // Four basic cases here:  (1) We've asked for a specific next item, (2) play
96
    // the item that's after the currently playing item, (3) play the selected
97
    // item or (4) play the first item in the list.
98

99
    // (1) we've asked for a specific next item
100
    if(m_nextPlaylistItem && m_nextPlaylistItem != m_playingItem) {
101 102 103
        i = m_nextPlaylistItem;
        m_nextPlaylistItem = 0;
    }
104
    // (2) play the item after the currently selected item
105
    else if(m_playingItem) {
106 107
        Playlist *p = static_cast<Playlist *>(m_playingItem->listView());
        i = p->nextItem(m_playingItem, random);
108
        if(!i && loopPlaylist)
109
            i = static_cast<PlaylistItem *>(p->firstChild());
110
    }
111 112
    // (3) play the selected item
    else if(playlistSelection().size() > 0) {
113
        i = playlistSelection().first();
114 115
        if(!i)
            i = static_cast<PlaylistItem *>(visiblePlaylist()->firstChild());
116
    }
117 118 119
    // (4) play the first item in the list
    else
        i = static_cast<PlaylistItem *>(visiblePlaylist()->firstChild());
120

121
    return play(i);
122 123
}

124
QString PlaylistSplitter::playPreviousFile(bool random)
125
{
126
    if(!m_playingItem)
127
	return QString::null;
128

129 130
    Playlist *p = static_cast<Playlist *>(m_playingItem->listView());
    PlaylistItem *i = p->previousItem(m_playingItem, random);
131

132
    return play(i);
133 134
}

135 136 137 138 139 140 141 142 143 144 145 146
void PlaylistSplitter::populatePlayHistoryMenu(QPopupMenu* menu, bool random)
{
    Playlist *p = static_cast<Playlist *>(m_playingItem->listView());
    PlaylistItemList list = p->historyItems(m_playingItem, random);
    menu->clear();
    int i = 0;
    for (PlaylistItemList::iterator it = list.begin(); it != list.end(); ++it)
    {
        menu->insertItem((*it)->tag()->track(), ++i);
    }
}

147 148 149 150 151 152 153 154
QString PlaylistSplitter::playSelectedFile()
{
    if(playlistSelection().isEmpty())
	return QString::null;
    else
	return play(playlistSelection().first());
}

155 156 157 158
QString PlaylistSplitter::playFirstFile()
{
    Playlist *p = visiblePlaylist();
    PlaylistItem *i = static_cast<PlaylistItem *>(p->firstChild());
159

160
    return play(i);
161 162
}

163 164 165 166 167 168 169 170 171
QString PlaylistSplitter::playRandomFile()
{
    Playlist *p = visiblePlaylist();
    PlaylistItem *i = static_cast<PlaylistItem *>(p->firstChild());

    // Not exactly random (the first item won't be taken into account)
    return play(p->nextItem(i, true));
}

172 173
void PlaylistSplitter::stop()
{
174 175
    m_nextPlaylistItem = 0;

176 177 178 179 180
    if(!m_playingItem)
	return;

    Playlist *p = static_cast<Playlist *>(m_playingItem->listView());

181 182 183
    if(p)
	p->setPlaying(m_playingItem, false);

184
    m_playingItem = 0;
185 186 187 188
}

QString PlaylistSplitter::playingArtist() const
{
189 190
    if(m_playingItem)
	return m_playingItem->text(PlaylistItem::ArtistColumn);
191
    else
192
	return QString::null;
193 194 195 196
}

QString PlaylistSplitter::playingTrack() const
{
197 198
    if(m_playingItem)
	return m_playingItem->text(PlaylistItem::TrackColumn);
199
    else
200
	return QString::null;
201 202 203 204
}

QString PlaylistSplitter::playingList() const
{
205 206
    if(m_playingItem)
	return static_cast<Playlist *>(m_playingItem->listView())->name();
207
    else
208
	return QString::null;
209 210
}

211
void PlaylistSplitter::open(const QString &file)
212
{
213 214 215
    if(file.isEmpty())
	return;

216 217 218 219 220
    if(visiblePlaylist() == m_collection ||
       KMessageBox::questionYesNo(this,
				  i18n("Do you want to add this item to the current list or to the collection list?"),
				  QString::null,
				  KGuiItem(i18n("Current")),
221 222
				  KGuiItem(i18n("Collection"))) == KMessageBox::No)
    {
223
	slotAddToPlaylist(file, m_collection);
224
    }
225
    else
226
	slotAddToPlaylist(file, visiblePlaylist());
227 228
}

229
void PlaylistSplitter::open(const QStringList &files)
230
{
231 232
    if(files.isEmpty())
	return;
233 234 235 236 237 238 239

    if(visiblePlaylist() == m_collection ||
       KMessageBox::questionYesNo(this,
				  i18n("Do you want to add these items to the current list or to the collection list?"),
				  QString::null,
				  KGuiItem(i18n("Current")),
				  KGuiItem(i18n("Collection"))) == KMessageBox::No)
240
    {
241
	slotAddToPlaylist(files, m_collection);
242
    }
243
    else
244
	slotAddToPlaylist(files, visiblePlaylist());
245 246 247 248
}

Playlist *PlaylistSplitter::createPlaylist(const QString &name)
{
249
    Playlist *p = new Playlist(m_playlistStack, name.latin1());
250 251
    setupPlaylist(p, true);
    return p;
252 253
}

254 255 256 257
////////////////////////////////////////////////////////////////////////////////
// public slots
////////////////////////////////////////////////////////////////////////////////

258
void PlaylistSplitter::slotOpen()
259
{
260
    open(MediaFiles::openDialog(this));
261 262
}

263
void PlaylistSplitter::slotOpenDirectory()
264
{
265
    DirectoryList *l = new DirectoryList(m_directoryList, this, "directoryList");
266

267
    m_directoryQueue.clear();
268
    m_directoryQueueRemove.clear();
269

270
    connect(l, SIGNAL(signalDirectoryAdded(const QString &)),
271
	    this, SLOT(slotQueueDirectory(const QString &)));
272
    connect(l, SIGNAL(signalDirectoryRemoved(const QString &)),
273
	    this, SLOT(slotQueueDirectoryRemove(const QString &)));
274 275

    if(l->exec() == QDialog::Accepted) {
276
	open(m_directoryQueue);
277 278
	for(QStringList::Iterator it = m_directoryQueue.begin(); it !=  m_directoryQueue.end(); it++)
	    m_dirWatch->addDir(*it, false, true);
279

280
	m_directoryList += m_directoryQueue;
281 282 283

	QStringList::Iterator it = m_directoryQueueRemove.begin();
	for(; it !=  m_directoryQueueRemove.end(); it++) {
284
	    m_dirWatch->removeDir(*it);
285
	    m_directoryList.remove(*it);
286
	}
287 288
    }
}
289

290
Playlist *PlaylistSplitter::slotCreatePlaylist()
291 292 293
{
    bool ok;

294
    // If this text is changed, please also change it in PlaylistBox::duplicate().
295

296
    QString name = KLineEditDlg::getText(i18n("Create New Playlist"),
Nadeem Hasan's avatar
Nadeem Hasan committed
297 298
	i18n("Please enter a name for the new playlist:"),
	uniquePlaylistName(), &ok);
299
    if(ok)
300
	return createPlaylist(name);
301
    else
302
	return 0;
303 304
}

305
void PlaylistSplitter::slotSelectPlaying()
306
{
307
    if(!m_playingItem)
308 309
	return;

310
    Playlist *l = static_cast<Playlist *>(m_playingItem->listView());
311

312 313
    if(!l)
	return;
314

315
    l->clearSelection();
316 317
    l->setSelected(m_playingItem, true);
    l->ensureItemVisible(m_playingItem);
Nadeem Hasan's avatar
Nadeem Hasan committed
318

319 320
    if(l != visiblePlaylist())
	m_playlistBox->raise(l);
321 322
}

323
void PlaylistSplitter::slotDeleteSelectedItems()
324 325 326
{
    Playlist *p = visiblePlaylist();
    if(p)
327
	p->slotDeleteSelectedItems();
328 329
}

330 331 332 333 334
void PlaylistSplitter::slotAddToPlaylist(const QString &file, Playlist *list)
{
    KApplication::setOverrideCursor(Qt::waitCursor);
    addImpl(file, list);
    KApplication::restoreOverrideCursor();
Nadeem Hasan's avatar
Nadeem Hasan committed
335

336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
    if(m_editor)
	m_editor->slotUpdateCollection();
}

void PlaylistSplitter::slotAddToPlaylist(const QStringList &files, Playlist *list)
{
    KApplication::setOverrideCursor(Qt::waitCursor);
    for(QStringList::ConstIterator it = files.begin(); it != files.end(); ++it)
        addImpl(*it, list);
    KApplication::restoreOverrideCursor();

    if(m_editor)
	m_editor->slotUpdateCollection();
}

351
void PlaylistSplitter::slotGuessTagInfoFile()
352
{
353 354 355 356 357 358 359 360
    visiblePlaylist()->slotGuessTagInfoFile();
    if(m_editor)
        m_editor->slotRefresh();
}

void PlaylistSplitter::slotGuessTagInfoInternet()
{
    visiblePlaylist()->slotGuessTagInfoInternet();
361 362 363 364
    if(m_editor)
        m_editor->slotRefresh();
}

365 366 367 368 369 370 371
void PlaylistSplitter::slotRenameFile()
{
    visiblePlaylist()->slotRenameFile();
    if(m_editor)
        m_editor->slotRefresh();
}

372 373 374 375 376 377
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////

void PlaylistSplitter::setupLayout()
{
378 379
    setOpaqueResize(true);

380
    m_playlistBox = new PlaylistBox(this, "playlistBox");
381 382 383 384 385 386

    // Create a splitter to go between the playlists and the editor.

    QSplitter *editorSplitter = new QSplitter(Qt::Vertical, this, "editorSplitter");

    // Create the playlist and the editor.
387

388 389
    m_playlistStack = new QWidgetStack(editorSplitter, "playlistStack");
    m_editor = new TagEditor(editorSplitter, "tagEditor");
390 391 392

    // Make the editor as small as possible (or at least as small as recommended)

393
    editorSplitter->setResizeMode(m_editor, QSplitter::FollowSizeHint);
394

395
    // Make the connection that will update the selected playlist when a
396 397
    // selection is made in the playlist box.

398
    connect(m_playlistBox, SIGNAL(signalCurrentChanged(const PlaylistList &)),
399
	    this, SLOT(slotChangePlaylist(const PlaylistList &)));
400

401
    connect(m_playlistBox, SIGNAL(signalDoubleClicked()), this, SIGNAL(signalListBoxDoubleClicked()));
402

403
    // Create the collection list; this should always exist.  This has a
404
    // slightly different creation process than normal playlists (since it in
405
    // fact is a subclass) so it is created here rather than by using
406
    // slotCreatePlaylist().
407

408
    CollectionList::initialize(m_playlistStack, m_restore);
409 410
    m_collection = CollectionList::instance();
    setupPlaylist(m_collection, true, "folder_sound");
411
    connect(m_collection, SIGNAL(signalCollectionChanged()), m_editor, SLOT(slotUpdateCollection()));
412
    connect(m_collection, SIGNAL(signalRequestPlaylistCreation(const PlaylistItemList &)),
413
	    this, SLOT(slotCreatePlaylist(const PlaylistItemList &)));
414

415 416 417 418

    // Create the search widget -- this must be done after the CollectionList is created.
    m_searchWidget = new SearchWidget(editorSplitter, CollectionList::instance(), "searchWidget");
    editorSplitter->moveToFirst(m_searchWidget);
419 420
    connect(m_searchWidget, SIGNAL(signalQueryChanged(const QString &, bool, bool)),
	    this, SLOT(slotShowSearchResults(const QString &, bool, bool)));
421 422 423
    connect(CollectionList::instance(), SIGNAL(signalVisibleColumnsChanged()),
	    this, SLOT(slotVisibleColumnsChanged()));

424
    // Show the collection on startup.
425
    m_playlistBox->setSelected(0, true);
426 427 428 429
}

void PlaylistSplitter::readConfig()
{
430 431 432 433
    KConfig *config = KGlobal::config();
    { // block for Playlists group
	KConfigGroupSaver saver(config, "Playlists");

434 435 436 437 438 439
	QValueList<int> splitterSizes = config->readIntListEntry("PlaylistSplitterSizes");
	if(splitterSizes.isEmpty()) {
	    splitterSizes.append(100);
	    splitterSizes.append(640);
	}
	setSizes(splitterSizes);
440

441
	if(m_restore) {
442 443 444 445

	    QString playlistsFile = KGlobal::dirs()->saveLocation("appdata") + "playlists";

	    QFile f(playlistsFile);
Nadeem Hasan's avatar
Nadeem Hasan committed
446

447 448 449
	    if(f.open(IO_ReadOnly)) {
		QDataStream s(&f);
		while(!s.atEnd()) {
450
		    Playlist *p = new Playlist(m_playlistStack);
451 452 453 454
		    s >> *p;

		    // check to see if we've alredy loaded this item before continuing

455
		    if(p->fileName().isEmpty() || !m_playlistFiles.insert(p->fileName()))
456 457 458 459
			setupPlaylist(p);
		    else
			delete p;
		}
460
	    }
461

462
	    m_directoryList = config->readListEntry("DirectoryList");
463
	    QTimer::singleShot(0, this, SLOT(slotScanDirectories()));
464 465

	    m_dirWatch = new KDirWatch();
466
	    connect(m_dirWatch, SIGNAL(dirty(const QString &)),
467
		    this, SLOT(slotDirChanged(const QString &)));
468

469 470
	    QStringList::Iterator it = m_directoryList.begin();
            for(; it != m_directoryList.end(); ++it)
471 472 473
		m_dirWatch->addDir(*it, false, true);

	    m_dirWatch->startScan();
474
	}
475 476 477

	// restore the list of hidden and shown columns

478
	if(m_collection) {
479
	    for(int i = 0; i < m_collection->columns(); i++)
480
		m_columnNames.append(m_collection->columnText(i));
481
	}
482

483
    }
484
}
485 486 487 488

void PlaylistSplitter::saveConfig()
{
    KConfig *config = KGlobal::config();
489

490
    // Save the list of open playlists.
Nadeem Hasan's avatar
Nadeem Hasan committed
491

492
    if(m_restore && m_playlistBox) {
493 494 495

	// Start at item 1.  We want to skip the collection list.

496 497
	QString playlistsFile = KGlobal::dirs()->saveLocation("appdata") + "playlists";
	QFile f(playlistsFile);
498

499 500 501 502
	if(f.open(IO_WriteOnly)) {

	    QDataStream s(&f);

503
	    PlaylistList l = m_playlistBox->playlists();
504

505 506
	    for(PlaylistList::Iterator it = l.begin(); it != l.end(); it++)
		s << *(*it);
507

508
	    f.close();
509 510 511
	}
	{ // block for Playlists group
	    KConfigGroupSaver saver(config, "Playlists");
512
	    config->writeEntry("DirectoryList", m_directoryList);
513
	    config->writeEntry("SortColumn", m_collection->sortColumn());
514
	    config->writeEntry("PlaylistSplitterSizes", sizes());
515 516
	}
    }
517 518
}

519 520 521 522 523 524 525 526 527 528 529 530 531
void PlaylistSplitter::addImpl(const QString &file, Playlist *list)
{
    processEvents();
    QFileInfo fileInfo(QDir::cleanDirPath(file));
    if(fileInfo.exists()) {
        if(fileInfo.isDir()) {
            QDir dir(fileInfo.filePath());
            QStringList dirContents=dir.entryList();
            for(QStringList::Iterator it = dirContents.begin(); it != dirContents.end(); ++it)
                if(*it != "." && *it != "..")
                    addImpl(fileInfo.filePath() + QDir::separator() + *it, list);
        }
        else {
532
            if(MediaFiles::isMediaFile(file))
533
		list->createItem(fileInfo);
534
	    else if(MediaFiles::isPlaylistFile(file))
535 536
		openPlaylist(fileInfo.absFilePath());
        }
Nadeem Hasan's avatar
Nadeem Hasan committed
537
    }
538 539
}

540
void PlaylistSplitter::setupPlaylist(Playlist *p, bool raise, const char *icon)
541
{
542 543 544 545 546 547
    connect(p, SIGNAL(signalSelectionChanged(const PlaylistItemList &)),
	    m_editor, SLOT(slotSetItems(const PlaylistItemList &)));
    connect(p, SIGNAL(signalDoubleClicked()),
	    this, SIGNAL(signalDoubleClicked()));
    connect(p, SIGNAL(signalNumberOfItemsChanged(Playlist *)),
	    this, SLOT(slotPlaylistCountChanged(Playlist *)));
548
    connect(p, SIGNAL(signalAboutToRemove(PlaylistItem *)),
549
	    this, SLOT(slotPlaylistItemRemoved(PlaylistItem *)));
550
    connect(p, SIGNAL(signalFilesDropped(const QStringList &, Playlist *)),
551 552 553
	    this, SLOT(slotAddToPlaylist(const QStringList &, Playlist *)));
    connect(p, SIGNAL(signalSetNext(PlaylistItem *)),
	    this, SLOT(slotSetNextItem(PlaylistItem *)));
554

555 556
    if(icon)
	m_playlistBox->createItem(p, icon, raise);
557

558
    if(raise)
559
	m_playlistStack->raiseWidget(p);
560 561
}

562 563 564
Playlist *PlaylistSplitter::openPlaylist(const QString &file)
{
    QFileInfo fileInfo(file);
565 566 567
    if(!fileInfo.exists() ||
       !fileInfo.isFile() ||
       !fileInfo.isReadable() ||
568 569
       m_playlistFiles.insert(fileInfo.absFilePath()))
    {
570
	return 0;
571
    }
572

573
    Playlist *p = new Playlist(file, m_playlistStack, fileInfo.baseName(true).latin1());
574
    setupPlaylist(p);
575
    return p;
576 577
}

578 579 580 581 582 583 584
QString PlaylistSplitter::play(PlaylistItem *item)
{
    stop();

    if(!item)
	return QString::null;

585 586 587 588
    Playlist *p = static_cast<Playlist *>(item->listView());

    p->setPlaying(item, true);

589 590 591 592 593
    m_playingItem = item;

    return item->absFilePath();
}

594 595 596 597
////////////////////////////////////////////////////////////////////////////////
// private slots
////////////////////////////////////////////////////////////////////////////////

598
void PlaylistSplitter::slotChangePlaylist(const PlaylistList &l)
599
{
600
    if(l.isEmpty())
601
	return;
602

603 604
    Playlist *current = m_dynamicList;

605 606
    if(m_searchWidget)
	m_searchWidget->clear();
607 608

    m_nextPlaylistItem = 0;
609 610 611 612 613 614 615
    if(l.count() == 1) {
	m_playlistStack->raiseWidget(l.first());
	m_editor->slotSetItems(playlistSelection());
	m_dynamicList = 0;
	emit signalPlaylistChanged();
    }
    else {
616
	m_dynamicList = new DynamicPlaylist(l, m_playlistStack, i18n("Dynamic List"));
617 618 619 620 621
	setupPlaylist(m_dynamicList, true, 0);
    }

    if(current)
	delete current;
622 623
}

624
void PlaylistSplitter::slotPlaylistCountChanged(Playlist *p)
625
{
626 627
    if(p && p == m_playlistStack->visibleWidget())
	emit signalSelectedPlaylistCountChanged(p->childCount());
628 629
}

630
void PlaylistSplitter::slotPlaylistItemRemoved(PlaylistItem *item)
631
{
632 633
    if(item == m_playingItem)
	m_playingItem = 0;
634 635 636

    if(item == m_nextPlaylistItem)
	m_nextPlaylistItem = 0;
637 638
}

639
void PlaylistSplitter::slotCreatePlaylist(const PlaylistItemList &items)
640
{
641 642 643
    if(items.isEmpty())
	return;

644
    Playlist *playlist = slotCreatePlaylist();
645

646
    if(!playlist)
647
        return;
648

649
    playlist->createItems(items);
650 651
}

652
void PlaylistSplitter::slotShowSearchResults(const QString &query, bool caseSensitive, bool regExp)
653 654 655 656 657 658 659 660 661
{
    if(query.isEmpty()) {
	visiblePlaylist()->setItemsVisible(visiblePlaylist()->items(), true);
	return;
    }

    PlaylistList playlists;
    playlists.append(visiblePlaylist());

662 663 664 665 666 667 668 669 670 671 672
    PlaylistSearch::Component *component;

    if (regExp)
    {
        component = new PlaylistSearch::Component(QRegExp(query, caseSensitive), m_searchWidget->searchedColumns(0));
    }
    else
    {
        component = new PlaylistSearch::Component(query, caseSensitive, m_searchWidget->searchedColumns(0));
    }

673
    PlaylistSearch::ComponentList components;
674
    components.append(*component);
675 676 677

    PlaylistSearch search(playlists, components);

678
    Playlist::setItemsVisible(search.matchedItems(), true);
679
    Playlist::setItemsVisible(search.unmatchedItems(), false);
680
    delete component;
681 682
}

683 684 685 686 687
void PlaylistSplitter::slotVisibleColumnsChanged()
{
    m_searchWidget->slotUpdateColumns();
    m_searchWidget->slotQueryChanged();
    if(m_searchWidget->searchedColumns(0).count() > 1)
688
        slotShowSearchResults(m_searchWidget->query(), m_searchWidget->caseSensitive(), m_searchWidget->regExp());
689 690
}

691
#include "playlistsplitter.moc"
Nadeem Hasan's avatar
Nadeem Hasan committed
692 693

// vim:ts=8