summaryrefslogtreecommitdiffstats
path: root/src/option/k3bdeviceoptiontab.cpp
blob: 1218c60b47e232d4dd3fa43d28e7726707088521 (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* 
 *
 * $Id: k3bdeviceoptiontab.cpp 619556 2007-01-03 17:38:12Z trueg $
 * Copyright (C) 2003 Sebastian Trueg <[email protected]>
 *
 * This file is part of the K3b project.
 * Copyright (C) 1998-2007 Sebastian Trueg <[email protected]>
 *
 * 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.
 * See the file "COPYING" for the exact licensing terms.
 */

#include "k3bdeviceoptiontab.h"
#include <k3bdevicemanager.h>
#include "k3bdevicewidget.h"
#include <k3bglobals.h>
#include <k3bcore.h>

#include <tqlabel.h>
#include <tqstring.h>
#include <tqlayout.h>
#include <tqcursor.h>
#include <tqapplication.h>

#include <kapplication.h>
#include <kdialog.h>
#include <klocale.h>
#include <kconfig.h>
#include <kstandarddirs.h>


K3bDeviceOptionTab::K3bDeviceOptionTab( TQWidget* parent, const char* name )
  : TQWidget( parent, name )
{
  TQGridLayout* frameLayout = new TQGridLayout( this );
  frameLayout->setSpacing( KDialog::spacingHint() );
  frameLayout->setMargin( 0 );


  // Info Label
  // ------------------------------------------------
  m_labelDevicesInfo = new TQLabel( this, "m_labelDevicesInfo" );
  m_labelDevicesInfo->setAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter | TQLabel::AlignLeft ) );
  m_labelDevicesInfo->setText( i18n( "K3b tries to detect all your devices properly. "
				     "You can add devices that have not been detected and change "
				     "the black values by clicking in the list. If K3b is unable "
				     "to detect your drive, you need to modify their permissions "
				     "to give K3b write access to all devices." ) );
  // ------------------------------------------------

  m_deviceWidget = new K3bDeviceWidget( k3bcore->deviceManager(), this );

  frameLayout->addWidget( m_labelDevicesInfo, 0, 0 );
  frameLayout->addWidget( m_deviceWidget, 1, 0 );

  connect( m_deviceWidget, TQT_SIGNAL(refreshButtonClicked()), this, TQT_SLOT(slotRefreshButtonClicked()) );
}


K3bDeviceOptionTab::~K3bDeviceOptionTab()
{
}


void K3bDeviceOptionTab::readDevices()
{
  m_deviceWidget->init();
}



void K3bDeviceOptionTab::saveDevices()
{
  // save changes to deviceManager
  m_deviceWidget->apply();

  // save the config
  k3bcore->deviceManager()->saveConfig( kapp->config() );
}


void K3bDeviceOptionTab::slotRefreshButtonClicked()
{
  TQApplication::setOverrideCursor( TQCursor(TQt::WaitCursor) );
  k3bcore->deviceManager()->clear();
  k3bcore->deviceManager()->scanBus();
  m_deviceWidget->init();
  TQApplication::restoreOverrideCursor();
}

#include "k3bdeviceoptiontab.moc"