summaryrefslogtreecommitdiffstats
path: root/krusader/GUI/syncbrowsebutton.cpp
blob: bcd2b9149218d28d586d43006da08488d0a38836 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/***************************************************************************
                          syncbrowsebutton.h  -  description
                             -------------------
    copyright            : (C) 2004 by Jonas Bähr
    e-mail               : krusader@users.sourceforge.net
    web site             : http://krusader.sourceforge.net
 ---------------------------------------------------------------------------
  Description
 ***************************************************************************
This is the button which toggles the synchron-browse-mode (a directory-change
is done in both panels)
I could imagine an optional extension which also performs mkdir etc. in the other panel
or in ALL tabs on the other side (this could also include copy-actions to this panels)
This is very handy if you have several identical clients which you want to update
simoultanious.

The current version only manages sync-browse and got no mode-switch options.
 
 ***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#include "syncbrowsebutton.h"

#include <klocale.h>
#include <kiconloader.h>

//#include <kdebug.h>

SyncBrowseButton::SyncBrowseButton(TQWidget *parent, const char *name) : TQToolButton(parent,name)
{
  KIconLoader *iconLoader = new KIconLoader();
  _icon_on = iconLoader->loadIcon( "kr_syncbrowse_on", KIcon::Toolbar, 16 );
  _icon_off = iconLoader->loadIcon( "kr_syncbrowse_off", KIcon::Toolbar, 16 );

  setFixedSize( _icon_off.width() + 4, _icon_off.height() + 4 );
  setPixmap( _icon_off );
  setToggleButton( true );
  
  setTextLabel( i18n( "This button toggles the sync-browse mode.\n"
			"When active, each directory change is performed in the\n"
			"active and inactive panel - if possible." ), true );	//set this as toop-tip (somehow whatsthis::add(this, ...) don't work)

  connect( this, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotToggled(bool)) );
}

SyncBrowseButton::~SyncBrowseButton() {
}

void SyncBrowseButton::slotToggled( bool on ) {
  if ( on )
    setPixmap( _icon_on );
  else
    setPixmap( _icon_off );
}

int SyncBrowseButton::state() {
  if ( isOn() )
    _state = SYNCBROWSE_CD;
  else
    _state = SYNCBROWSE_OFF;
  
  return _state;
}


#include "syncbrowsebutton.moc"