~smartboyhw/ubuntu/raring/calligra/2.6.0-0ubuntu1

« back to all changes in this revision

Viewing changes to kexi/widget/navigator/KexiProjectListViewItem.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2012-10-23 21:09:16 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20121023210916-m82w6zxnxhaxz7va
Tags: 1:2.5.90-0ubuntu1
* New upstream alpha release (LP: #1070436)
  - Add libkactivities-dev and libopenimageio-dev to build-depends
  - Add kubuntu_build_calligraactive.diff to build calligraactive by default
  - Add package for calligraauthor and move files that are shared between
    calligrawords and calligraauthor to calligrawords-common
* Document the patches
* Remove numbers from patches so they follow the same naming scheme as
  the rest of our patches.
* calligra-data breaks replaces krita-data (<< 1:2.5.3) (LP: #1071686)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* This file is part of the KDE project
2
 
   Copyright (C) 2002-2003 Lucijan Busch <lucijan@gmx.at>
3
 
   Copyright (C) 2003-2004 Jarosław Staniek <staniek@kde.org>
4
 
 
5
 
   This library is free software; you can redistribute it and/or
6
 
   modify it under the terms of the GNU Library General Public
7
 
   License as published by the Free Software Foundation; either
8
 
   version 2 of the License, or (at your option) any later version.
9
 
 
10
 
   This library is distributed in the hope that it will be useful,
11
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
   Library General Public License for more details.
14
 
 
15
 
   You should have received a copy of the GNU Library General Public License
16
 
   along with this library; see the file COPYING.LIB.  If not, write to
17
 
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18
 
 * Boston, MA 02110-1301, USA.
19
 
*/
20
 
 
21
 
#include "KexiProjectListViewItem.h"
22
 
 
23
 
#include <core/kexipartinfo.h>
24
 
 
25
 
#include <kdebug.h>
26
 
#include <kiconloader.h>
27
 
 
28
 
KexiProjectListViewItem::KexiProjectListViewItem(K3ListView *parent, KexiPart::Info *i)
29
 
        : K3ListViewItem(parent, i->groupName())
30
 
        , m_info(i)
31
 
        , m_item(0)
32
 
{
33
 
    setPixmap(0, SmallIcon(i->itemIcon()));
34
 
    setOpen(true);
35
 
//ugly setSelectable(false);
36
 
    initItem();
37
 
    m_fifoSorting = 1; //because this is top level item
38
 
}
39
 
 
40
 
KexiProjectListViewItem::KexiProjectListViewItem(K3ListViewItem *parent, KexiPart::Info *i, KexiPart::Item *item)
41
 
        : K3ListViewItem(parent, item->name())
42
 
        , m_info(i)
43
 
        , m_item(item)
44
 
{
45
 
    setPixmap(0, SmallIcon(i->itemIcon()));
46
 
    initItem();
47
 
}
48
 
 
49
 
KexiProjectListViewItem::KexiProjectListViewItem(K3ListView *parent, KexiPart::Info *i, KexiPart::Item *item)
50
 
        : K3ListViewItem(parent, item->name())
51
 
        , m_info(i)
52
 
        , m_item(item)
53
 
{
54
 
    setPixmap(0, SmallIcon(i->itemIcon()));
55
 
    initItem();
56
 
}
57
 
 
58
 
KexiProjectListViewItem::~KexiProjectListViewItem()
59
 
{
60
 
}
61
 
 
62
 
void KexiProjectListViewItem::initItem()
63
 
{
64
 
    m_fifoSorting = 0;
65
 
    int sortKey = 0;
66
 
    // set sorting key with FIFO order
67
 
    if (parent()) {
68
 
        sortKey = parent()->childCount();
69
 
    } else if (listView()) {
70
 
        sortKey = listView()->childCount();
71
 
    }
72
 
    m_sortKey.sprintf("%2.2d", sortKey);
73
 
// kDebug() << "m_sortKey=" << m_sortKey;
74
 
}
75
 
 
76
 
void
77
 
KexiProjectListViewItem::clearChildren()
78
 
{
79
 
    KexiProjectListViewItem* child;
80
 
 
81
 
    while ((child = static_cast<KexiProjectListViewItem*>(firstChild()))) {
82
 
        delete child;
83
 
    }
84
 
}
85
 
 
86
 
QString KexiProjectListViewItem::key(int column, bool ascending) const
87
 
{
88
 
// kDebug() << "KexiBrowserItem::key() : " << (m_fifoSorting ? m_sortKey : K3ListViewItem::key(column,ascending));
89
 
    return m_fifoSorting ? m_sortKey : K3ListViewItem::key(column, ascending);
90
 
}
91