summaryrefslogtreecommitdiffstats
path: root/keep/app/advancedbackupconfigdialog.cpp
blob: 0139391fb2cbdcad127b91f0a0a833102e7dedb2 (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
/* This file is part of the Keep project
   Copyright (C) 2005 Jean-Rémy Falleri <jr.falleri@laposte.net>

   Keep 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.

   Keep 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 Keep; if not, write to the
   Free Software Foundation, Inc.,
   51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.           */

#include "advancedbackupconfigdialog.h"

#include <klocale.h>
#include <layout.h>
#include <kurl.h>
#include <dcopref.h>
#include <kdebug.h>
#include <kactivelabel.h>
#include <kmimetype.h>
#include <tqpixmap.h>
#include <kapplication.h>
#include <kiconloader.h>
#include <tqstringlist.h>
#include <kactionselector.h>

AdvancedBackupConfigDialog::AdvancedBackupConfigDialog(TQWidget *parent):KDialogBase(Plain, i18n("Advanced Backup Configuration"),
	Help|Ok, Ok, parent, "advancedBackupConfigDialog", true, false)
{
	TQGridLayout *topLayout = new TQGridLayout(plainPage());
	m_advancedBackupConfigView = new AdvancedBackupConfigView(plainPage());

	topLayout->addWidget( m_advancedBackupConfigView,0,0 );
	m_advancedBackupConfigView->optionList->availableListBox()->insertStringList(allOptionList());
	resize( TQSize(350,450).expandedTo(minimumSizeHint()) );
}

TQStringList AdvancedBackupConfigDialog::optionList()
{
	TQStringList options;
	for (uint i=0;i<m_advancedBackupConfigView->optionList->selectedListBox()->count();i++)
	{
		options.append(m_advancedBackupConfigView->optionList->selectedListBox()->text(i));
	}
	return options;
}

void AdvancedBackupConfigDialog::setOptionList(TQStringList optionList)
{
	TQStringList alloptions = allOptionList();
	TQStringList available;
	for ( TQStringList::Iterator it = alloptions.begin(); it != alloptions.end(); ++it )
	{
		if ( optionList.grep(*it).size() == 0 )
		{
			available.append(*it);
		}
	}
	m_advancedBackupConfigView->optionList->availableListBox()->clear();
	m_advancedBackupConfigView->optionList->availableListBox()->insertStringList(available);
	m_advancedBackupConfigView->optionList->selectedListBox()->clear();
	m_advancedBackupConfigView->optionList->selectedListBox()->insertStringList(optionList);
}

TQStringList AdvancedBackupConfigDialog::allOptionList()
{
	TQStringList options;
	options.append("--no-hard-links");
	options.append("--exclude-special-files");
	options.append("--exclude-device-files");
	options.append("--exclude-fifos");
	options.append("--exclude-symbolic-links");
	options.append("--exclude-sockets");
	options.append("--never-drop-acls");
	options.append("--no-compare-inode");
	options.append("--no-file-statistics");
	options.append("--preserve-numerical-ids");
	options.append("--ssh-no-compression");
	options.append("--no-compression");
	options.append("--include-special-files");
	options.append("--include-symbolic-links");
	return options;
}

#include "advancedbackupconfigdialog.moc"