~ubuntu-branches/ubuntu/intrepid/digikam/intrepid

« back to all changes in this revision

Viewing changes to digikam/digikam/album.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2008-07-17 20:25:39 UTC
  • mfrom: (1.3.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 39.
  • Revision ID: james.westby@ubuntu.com-20080717202539-ttj4and3ds1ldgn1
Tags: upstream-0.9.4
ImportĀ upstreamĀ versionĀ 0.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * Description : digiKam album types
8
8
 *
9
9
 * Copyright (C) 2004-2005 by Renchi Raju <renchi@pooh.tam.uiuc.edu>
 
10
 * Copyright (C) 2006-2008 by Gilles Caulier <caulier dot gilles at gmail dot com>
10
11
 *
11
12
 * This program is free software; you can redistribute it
12
13
 * and/or modify it under the terms of the GNU General
415
416
 
416
417
int DAlbum::m_uniqueID = 0;
417
418
 
418
 
DAlbum::DAlbum(const QDate& date, bool root)
419
 
      : Album(Album::DATE, root ? 0 : ++m_uniqueID, root),
420
 
              m_date(date)
 
419
DAlbum::DAlbum(const QDate& date, bool root, Range range)
 
420
      : Album(Album::DATE, root ? 0 : ++m_uniqueID, root)
421
421
{
 
422
    m_date  = date;
 
423
    m_range = range;
 
424
 
422
425
    // Set the name of the date album
423
 
    QString dateTitle = date.toString("MMMM yyyy");
 
426
    QString dateTitle;
 
427
 
 
428
    if (m_range == Month)
 
429
        dateTitle = m_date.toString("MMMM yyyy");
 
430
    else 
 
431
        dateTitle = m_date.toString("yyyy");
 
432
 
424
433
    setTitle(dateTitle);
425
434
}
426
435
 
433
442
    return m_date;
434
443
}
435
444
 
 
445
DAlbum::Range DAlbum::range() const
 
446
{
 
447
    return m_range;
 
448
}
 
449
 
436
450
KURL DAlbum::kurl() const
437
451
{
 
452
    QDate endDate;
 
453
    if (m_range == Month)
 
454
        endDate = m_date.addMonths(1);
 
455
    else 
 
456
        endDate = m_date.addYears(1);
 
457
 
438
458
    KURL u;
439
459
    u.setProtocol("digikamdates");
440
 
    u.setPath(QString("/%1/%2")
 
460
    u.setPath(QString("/%1/%2/%3/%4")
441
461
              .arg(m_date.year())
442
 
              .arg(m_date.month()));
 
462
              .arg(m_date.month())
 
463
              .arg(endDate.year())
 
464
              .arg(endDate.month()));
443
465
 
444
466
    return u;
445
467
}