/*
    KSocrat
    Version 3.1.2, 28 April 2003    
    (C) 2000-2003 Zavolzhsky Alexandr <zavolzhsky@mail.ru>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    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 General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/* XPM */
static char *dw_xpm[] = {
"24 24 82 1",
" 	c None",
".	c #020202",
"+	c #023636",
"@	c #76ACA8",
"#	c #83B4B3",
"$	c #1C7674",
"%	c #1E1E1E",
"&	c #FEFEFE",
"*	c #F0E8D9",
"=	c #6C604B",
"-	c #6FACA8",
";	c #FAFAFA",
">	c #FEFAF6",
",	c #70644F",
"'	c #6BABA7",
")	c #008080",
"!	c #000000",
"~	c #FDFDFC",
"{	c #FAFAF6",
"]	c #746853",
"^	c #66AAA6",
"/	c #F2DEC2",
"(	c #FFFFFF",
"_	c #FEFAFA",
":	c #786C57",
"<	c #B2A790",
"[	c #E2DACA",
"}	c #FBF6EE",
"|	c #5FA8A4",
"1	c #F6F6F6",
"2	c #040404",
"3	c #DAC296",
"4	c #00FFFF",
"5	c #7B6F5B",
"6	c #0A6B69",
"7	c #58A5A1",
"8	c #F6F5F5",
"9	c #AA9E86",
"0	c #DABE96",
"a	c #FAF6F2",
"b	c #7F735F",
"c	c #DED6C6",
"d	c #50A29D",
"e	c #F2F2F0",
"f	c #A69A80",
"g	c #837763",
"h	c #DED6C2",
"i	c #479D99",
"j	c #F5F1E9",
"k	c #A1957B",
"l	c #867A67",
"m	c #3D9893",
"n	c #FEFEFA",
"o	c #F1ECE2",
"p	c #338F8A",
"q	c #FAF6EE",
"r	c #F6F2EA",
"s	c #EEE6D5",
"t	c #FAF6EA",
"u	c #268782",
"v	c #FAF2E2",
"w	c #F6F2E2",
"x	c #FAEEDE",
"y	c #FAF2EA",
"z	c #1A7C76",
"A	c #E6D6B6",
"B	c #F6EAD6",
"C	c #0F8A84",
"D	c #EEE2D2",
"E	c #080000",
"F	c #DECEAE",
"G	c #D6BE92",
"H	c #A2967E",
"I	c #AA9A7E",
"J	c #C6B69A",
"K	c #9A8E72",
"L	c #B2A27E",
"M	c #D2C6AE",
"N	c #C5BFB2",
"O	c #7E7A62",
"P	c #328381",
"Q	c #022E2E",
".+                      ",
".@.                     ",
".#$.           .%       ",
".#$&.        ..*=       ",
".-$&;.     ..*&>,       ",
".'$&&&.   .)!~~{]...    ",
".^$&&&;. ./)(!__:<[}.   ",
".|$&&&&123)(4)!{5<[}6.  ",
".7$&&&&890)(44!ab<c}6.  ",
".d$&&&&ef)(4)4)!g<h}6.  ",
".i$&&&&jk)(4)44!l<h}6.  ",
".m$n_>ao)(4!a)4)!<h}6.  ",
".p$qqqrs)(4!t)44!<c}6.  ",
".u$vwxx)(4!wyt)4)!c}6.  ",
".z$ABBB)(4!!!!!44!c}6.  ",
" .C6AD)(444444444)!}6.  ",
"  EC6F)(4!!!!!!!44!}6.  ",
"   EC)(4!G/HIJc))4)!6.  ",
"    .)(4!3KLMNNN)44!6.  ",
"   )))4!!!OPP!!!!44!!!  ",
"   )44444!C..!4444444!  ",
"   !!!!!!!Q  !!!!!!!!!  ",
"                        ",
"                        "};

#include <qpixmap.h>
#include <kaboutapplication.h>
#include "dockwidget.h"

DockWidget::DockWidget(QWidget *parent, const char *name ) : KSystemTray( parent, name )
{
  mainWin = parent;
  
  pm =this->contextMenu();
  pm->insertItem(i18n("About"),this,SLOT(about()));
  pm->insertItem(i18n("Show/Hide"),this,SLOT(show_hide()),CTRL+ALT+Key_S);  
                                                                    
  this->setPixmap(QPixmap((const char**)dw_xpm));
  this->show();
}

DockWidget::~DockWidget(){
}

void DockWidget::about(){  
  KAboutApplication *ap = new KAboutApplication(this,"ksocrat-about");
  ap->exec();
}

void DockWidget::show_hide(){
  if (mainWin->isVisible()) {
    mainWin->hide();
  }
  else {
    mainWin->show();
  }  
}
