blokkalactiontargetrelay.cpp
00001 /*************************************************************************** 00002 * Copyright (C) 2008 by Martin Mueller * 00003 * orvio@orvio.de * 00004 * * 00005 * This program is free software; you can redistribute it and/or modify * 00006 * it under the terms of the GNU General Public License as published by * 00007 * the Free Software Foundation; either version 2 of the License, or * 00008 * (at your option) any later version. * 00009 * * 00010 * This program is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00013 * GNU General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU General Public License * 00016 * along with this program; if not, write to the * 00017 * Free Software Foundation, Inc., * 00018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00019 ***************************************************************************/ 00020 #include "blokkalactiontargetrelay.h" 00021 #include "blokkalactiontargetrelay.moc" 00022 00023 #include <kglobal.h> 00024 00025 class Blokkal::ActionTargetRelayPrivate { 00026 public: 00027 ActionTargetRelayPrivate( void ) : 00028 currentAccount( 0 ), 00029 currentBlog( 0 ){} 00030 00031 ActionTargetRelay instance; 00032 00033 Account * currentAccount; 00034 Blog * currentBlog; 00035 }; 00036 00037 K_GLOBAL_STATIC( Blokkal::ActionTargetRelayPrivate, _batrp ); 00038 00039 Blokkal::ActionTargetRelay::ActionTargetRelay( void ): 00040 QObject( 0 ) 00041 { 00042 setObjectName( "ActionTargetRelay" ); 00043 } 00044 00045 Blokkal::ActionTargetRelay::~ActionTargetRelay( void ) 00046 {} 00047 00048 Blokkal::ActionTargetRelay * Blokkal::ActionTargetRelay::self( void ) 00049 { 00050 return &_batrp->instance; 00051 } 00052 00053 Blokkal::Account * Blokkal::ActionTargetRelay::currentAccount( void ) 00054 { 00055 return _batrp->currentAccount; 00056 } 00057 00058 Blokkal::Blog * Blokkal::ActionTargetRelay::currentBlog( void ) 00059 { 00060 return _batrp->currentBlog; 00061 } 00062 00063 void Blokkal::ActionTargetRelay::setCurrentAccount( Blokkal::Account * account ) 00064 { 00065 if(_batrp->currentAccount == account ) { 00066 return; 00067 } 00068 00069 _batrp->currentAccount = account; 00070 emit self()->currentAccountChanged( account ); 00071 } 00072 00073 void Blokkal::ActionTargetRelay::setCurrentBlog( Blokkal::Blog * blog ) 00074 { 00075 if( _batrp->currentBlog == blog ) { 00076 return; 00077 } 00078 00079 _batrp->currentBlog = blog; 00080 emit self()->currentBlogChanged( blog ); 00081 }