folderitem.cpp
00001 /* 00002 This file is part of Akregator. 00003 00004 Copyright (C) 2004 Frank Osterfeld <frank.osterfeld at kdemail.net> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of TQt, and distribute the resulting executable, 00022 without including the source code for TQt in the source distribution. 00023 */ 00024 00025 #include "actionmanager.h" 00026 #include "folder.h" 00027 #include "folderitem.h" 00028 #include "treenode.h" 00029 00030 #include <tqpopupmenu.h> 00031 #include <kaction.h> 00032 #include <kiconloader.h> 00033 00034 namespace Akregator { 00035 00036 FolderItem::FolderItem(FolderItem* parent, Folder* node) : TreeNodeItem(parent, node) 00037 { 00038 initialize(node); 00039 } 00040 00041 FolderItem::FolderItem(FolderItem* parent, TreeNodeItem* after, Folder* node) : TreeNodeItem(parent, after, node) 00042 { 00043 initialize(node); 00044 } 00045 00046 FolderItem::FolderItem(KListView* parent, Folder* node) : TreeNodeItem(parent, node) 00047 { 00048 initialize(node); 00049 } 00050 00051 FolderItem::FolderItem(KListView* parent, TreeNodeItem* after, Folder* node) : TreeNodeItem(parent, after, node) 00052 { 00053 initialize(node); 00054 } 00055 00056 void FolderItem::initialize(Folder* node) 00057 { 00058 setOpen(node->isOpen()); 00059 setPixmap ( 0, KGlobal::iconLoader()->loadIcon("folder", KIcon::Small) ); 00060 if (node) 00061 setText(0, node->title()); 00062 } 00063 00064 Folder* FolderItem::node() 00065 { 00066 return static_cast<Folder*> (m_node); 00067 } 00068 00069 void FolderItem::setOpen(bool open) 00070 { 00071 node()->setOpen(open); 00072 KListViewItem::setOpen(open); 00073 } 00074 00075 FolderItem::~FolderItem() 00076 {} 00077 00078 00079 void FolderItem::showContextMenu(const TQPoint& p) 00080 { 00081 TQWidget* w = ActionManager::getInstance()->container("feedgroup_popup"); 00082 if (w) 00083 static_cast<TQPopupMenu *>(w)->exec(p); 00084 } 00085 00086 } // namespace Akregator