summaryrefslogtreecommitdiffstats
path: root/src/kbfxplasmacanvasstack.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:43:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-17 00:43:50 +0000
commitceea23677c61f20759ae986bd77b0d5c4d673edb (patch)
tree3fcec1702eaf9c14d1dd736e594f5df08dab4001 /src/kbfxplasmacanvasstack.cpp
downloadkbfx-ceea23677c61f20759ae986bd77b0d5c4d673edb.tar.gz
kbfx-ceea23677c61f20759ae986bd77b0d5c4d673edb.zip
Added old KDE3 version of kbfx
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kbfx@1091549 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kbfxplasmacanvasstack.cpp')
-rw-r--r--src/kbfxplasmacanvasstack.cpp179
1 files changed, 179 insertions, 0 deletions
diff --git a/src/kbfxplasmacanvasstack.cpp b/src/kbfxplasmacanvasstack.cpp
new file mode 100644
index 0000000..bfe5b36
--- /dev/null
+++ b/src/kbfxplasmacanvasstack.cpp
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2006
+ * Siraj Razick <siraj@kdemail.net>
+ * PhobosK <phobosk@mail.kbfx.org>
+ * see Also AUTHORS
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Library General Public License version 2 as
+ * published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kbfxplasmacanvasstack.h"
+
+KbfxPlasmaCanvasStack::KbfxPlasmaCanvasStack()
+{
+
+ m_current= 0;//set to NULL
+ m_count = 0;
+ m_height = 0;
+ m_width = 0;
+ m_groupChain.setAutoDelete ( TRUE );
+ m_name = "Unset:Faulty plugin";
+}
+
+KbfxPlasmaCanvasStack::~KbfxPlasmaCanvasStack()
+{
+//TODO: needs to manage memory here
+
+
+ for ( uint i = 0; i < ( uint ) m_count; ++i )
+ {
+
+ m_groupChain.at ( i )->~KbfxPlasmaCanvasGroupView();
+ m_groupChain.remove ( m_groupChain.at ( i ) );
+
+ }
+
+ Dict::Iterator it;
+
+ for ( it = m_dict.begin();it != m_dict.end();++it )
+ {
+ m_dict.remove ( it );
+ }
+
+ delete m_current;
+
+}
+
+
+void
+KbfxPlasmaCanvasStack::raise ( uint id )
+{
+
+ KbfxPlasmaCanvasGroupView * _gvPtr = m_groupChain.at ( id );
+
+ if ( !_gvPtr )
+ qDebug ( "Error item not in Stack" );
+ else
+ {
+ for ( uint i = 0; i < m_groupChain.count (); ++i )
+ {
+ m_groupChain.at ( i )->hide();
+ }
+ m_height = _gvPtr->height();
+ _gvPtr->show();
+ }
+
+
+}
+
+
+
+bool
+KbfxPlasmaCanvasStack::contains ( QString name )
+{
+//FIXME:Depricated Data Structure Needs fixing
+ if ( m_dict.contains ( name ) == true )
+ return true;
+ else
+ return false;
+
+}
+
+
+void
+KbfxPlasmaCanvasStack::addGroup ( KbfxPlasmaCanvasGroupView * gPtr )
+{
+ if ( gPtr == NULL )
+ {
+ qDebug
+ ( "KbfxPlasmaCanvasStack.cpp:34:Null Pointer Passed to addGroup()" );
+ return;
+ }
+ else
+ {
+ m_groupChain.append ( gPtr );
+ m_height = gPtr->height();
+ m_width = gPtr->width();
+ // KbfxPlasmaDataStack stackinfo;
+/// stackinfo
+ m_dict[gPtr->name() ] = m_count;
+
+ m_count++;
+ }
+}
+
+KbfxPlasmaCanvasStack::Dict
+KbfxPlasmaCanvasStack::getDict()
+{
+ return m_dict;
+}
+
+void
+KbfxPlasmaCanvasStack::hide()
+{
+ for ( uint i = 0; i < m_groupChain.count (); ++i )
+ {
+ m_groupChain.at ( i )->hide();
+ }
+}
+
+
+void
+KbfxPlasmaCanvasStack::raiseByName ( QString name )
+{
+ for ( uint i = 0; i < m_groupChain.count (); ++i )
+ {
+ m_groupChain.at ( i )->hide();
+ }
+
+
+ for ( uint i = 0; i < m_groupChain.count (); ++i )
+ {
+ if ( m_groupChain.at ( i )->name() == name )
+ {
+ m_groupChain.at ( i )->show();
+ m_height = m_groupChain.at ( i )->height();
+ }
+ }
+
+}
+
+
+
+
+KbfxPlasmaCanvasGroupView *
+KbfxPlasmaCanvasStack::activeViewByName ( QString name )
+{
+
+
+ for ( uint i = 0; i < m_groupChain.count (); ++i )
+ {
+ if ( m_groupChain.at ( i )->name() == name )
+ {
+ return m_groupChain.at ( i );
+ }
+ }
+
+ return new KbfxPlasmaCanvasGroupView();
+}
+
+
+QString
+KbfxPlasmaCanvasStack::getItemName ( int id )
+{
+ return m_groupChain.at ( id )->name();
+}
+
+#include "kbfxplasmacanvasstack.moc"