kexi
kexibrowseritem.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "kexibrowseritem.h"
00022
00023 #include <kdebug.h>
00024 #include <kiconloader.h>
00025 #include <core/kexipartinfo.h>
00026
00027 KexiBrowserItem::KexiBrowserItem(KListView *parent, KexiPart::Info *i)
00028 : KListViewItem(parent, i->groupName())
00029 , m_info(i)
00030 , m_item(0)
00031 {
00032 setPixmap(0, SmallIcon(i->itemIcon()));
00033 setOpen(true);
00034
00035 initItem();
00036 m_fifoSorting = 1;
00037 }
00038
00039 KexiBrowserItem::KexiBrowserItem(KListViewItem *parent, KexiPart::Info *i, KexiPart::Item *item)
00040 : KListViewItem(parent, item->name())
00041 , m_info(i)
00042 , m_item(item)
00043 {
00044 setPixmap(0, SmallIcon(i->itemIcon()));
00045 initItem();
00046 }
00047
00048 KexiBrowserItem::KexiBrowserItem(KListView *parent, KexiPart::Info *i, KexiPart::Item *item)
00049 : KListViewItem(parent, item->name())
00050 , m_info(i)
00051 , m_item(item)
00052 {
00053 setPixmap(0, SmallIcon(i->itemIcon()));
00054 initItem();
00055 }
00056
00057 KexiBrowserItem::~KexiBrowserItem()
00058 {
00059 }
00060
00061 void KexiBrowserItem::initItem()
00062 {
00063 m_fifoSorting = 0;
00064 int sortKey = 0;
00065
00066 if (parent()) {
00067 sortKey = parent()->childCount();
00068 } else if (listView()) {
00069 sortKey = listView()->childCount();
00070 }
00071 m_sortKey.sprintf("%2.2d",sortKey);
00072
00073 }
00074
00075 void
00076 KexiBrowserItem::clearChildren()
00077 {
00078 KexiBrowserItem* child;
00079
00080 while((child = static_cast<KexiBrowserItem*>(firstChild())))
00081 {
00082 delete child;
00083 }
00084 }
00085
00086 QString KexiBrowserItem::key( int column, bool ascending ) const
00087 {
00088
00089 return m_fifoSorting ? m_sortKey : KListViewItem::key(column,ascending);
00090 }
00091
|