~ubuntu-branches/ubuntu/natty/digikam/natty

« back to all changes in this revision

Viewing changes to libs/widgets/common/rexpanderboxexclusive.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2010-08-26 19:25:16 UTC
  • mfrom: (1.2.30 upstream)
  • Revision ID: james.westby@ubuntu.com-20100826192516-mkbdww0h5v2x4yoy
Tags: 2:1.4.0-0ubuntu1
* New upstream bugfix release (LP: #626751)
* Install the file NEWS as upstream changelog because "ChangeLog" is
  too verbose.
* Don't copy the desktop .pot file to imageplugins, not needed anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ============================================================
 
2
 *
 
3
 * This file is a part of digiKam project
 
4
 * http://www.digikam.org
 
5
 *
 
6
 * Date        : 2008-03-14
 
7
 * Description : a widget to host settings as expander box in exclusive mode
 
8
 *
 
9
 * Copyright (C) 2008-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
 
10
 * Copyright (C) 2008-2010 by Marcel Wiesweg <marcel dot wiesweg at gmx dot de>
 
11
 * Copyright (C) 2010      by Manuel Viet    <contact at 13zenrv dot fr>
 
12
 *
 
13
 * This program is free software; you can redistribute it
 
14
 * and/or modify it under the terms of the GNU General
 
15
 * Public License as published by the Free Software Foundation;
 
16
 * either version 2, or (at your option)
 
17
 * any later version.
 
18
 *
 
19
 * This program is distributed in the hope that it will be useful,
 
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
22
 * GNU General Public License for more details.
 
23
 *
 
24
 * ============================================================ */
 
25
 
 
26
#include "rexpanderboxexclusive.moc"
 
27
 
 
28
namespace Digikam
 
29
{
 
30
 
 
31
RExpanderBoxExclusive::RExpanderBoxExclusive(QWidget* parent)
 
32
                     : KDcrawIface::RExpanderBox(parent)
 
33
{
 
34
    setIsToolBox(true);
 
35
}
 
36
 
 
37
RExpanderBoxExclusive::~RExpanderBoxExclusive()
 
38
{
 
39
}
 
40
 
 
41
void RExpanderBoxExclusive::slotItemExpanded(bool b)
 
42
{
 
43
    KDcrawIface::RLabelExpander* exp = dynamic_cast<KDcrawIface::RLabelExpander*>(sender());
 
44
    if (!exp) return;
 
45
 
 
46
    if (isToolBox() && b)
 
47
    {
 
48
        int item = 0;
 
49
 
 
50
        while (item < count())
 
51
        {
 
52
            if (isItemExpanded(item) && item != indexOf(exp))
 
53
            {
 
54
                setItemExpanded(item, false);
 
55
            }
 
56
            item++;
 
57
        }
 
58
    }
 
59
    emit signalItemExpanded(indexOf(exp), b);
 
60
}
 
61
 
 
62
void RExpanderBoxExclusive::setIsToolBox(bool b)
 
63
{
 
64
    m_toolbox = b;
 
65
}
 
66
 
 
67
bool RExpanderBoxExclusive::isToolBox() const
 
68
{
 
69
    return (m_toolbox);
 
70
}
 
71
 
 
72
} // namespace Digikam