~ubuntu-branches/ubuntu/maverick/kdeutils/maverick-proposed

« back to all changes in this revision

Viewing changes to okteta/kasten/gui/io/streamencoder/uuencoding/bytearrayuuencodingstreamencoderconfigeditor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-05-28 09:49:30 UTC
  • mfrom: (1.2.44 upstream)
  • Revision ID: james.westby@ubuntu.com-20100528094930-jzynf0obv1n2v13a
Tags: 4:4.4.80-0ubuntu1~ppa1
New upstream beta release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    This file is part of the Kasten Framework, part of the KDE project.
 
3
 
 
4
    Copyright 2010 Friedrich W. H. Kossebau <kossebau@kde.org>
 
5
 
 
6
    This library is free software; you can redistribute it and/or
 
7
    modify it under the terms of the GNU Lesser General Public
 
8
    License as published by the Free Software Foundation; either
 
9
    version 2.1 of the License, or (at your option) version 3, or any
 
10
    later version accepted by the membership of KDE e.V. (or its
 
11
    successor approved by the membership of KDE e.V.), which shall
 
12
    act as a proxy defined in Section 6 of version 3 of the license.
 
13
 
 
14
    This library is distributed in the hope that it will be useful,
 
15
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
17
    Lesser General Public License for more details.
 
18
 
 
19
    You should have received a copy of the GNU Lesser General Public
 
20
    License along with this library. If not, see <http://www.gnu.org/licenses/>.
 
21
*/
 
22
 
 
23
#include "bytearrayuuencodingstreamencoderconfigeditor.h"
 
24
 
 
25
// lib
 
26
#include "bytearraytextstreamencoderpreview.h"
 
27
// KDE
 
28
#include <KLocale>
 
29
#include <KLineEdit>
 
30
#include <KComboBox>
 
31
// Qt
 
32
#include <QtGui/QFormLayout>
 
33
#include <QtGui/QLabel>
 
34
 
 
35
 
 
36
namespace Kasten
 
37
{
 
38
 
 
39
ByteArrayUuencodingStreamEncoderConfigEditor::ByteArrayUuencodingStreamEncoderConfigEditor( ByteArrayUuencodingStreamEncoder* encoder, QWidget* parent )
 
40
 : AbstractModelStreamEncoderConfigEditor( parent ),
 
41
   mEncoder( encoder )
 
42
{
 
43
    mSettings = mEncoder->settings();
 
44
 
 
45
    QFormLayout* pageLayout = new QFormLayout( this );
 
46
    pageLayout->setMargin( 0 );
 
47
 
 
48
    // internal file name
 
49
    const QString fileNameLabel =
 
50
        i18nc( "@label:textbox file name internally given to the encoded data",
 
51
               "Internal name of file:" );
 
52
 
 
53
    mFileNameEdit = new KLineEdit( this );
 
54
    mFileNameEdit->setText( mSettings.fileName );
 
55
    connect( mFileNameEdit, SIGNAL(textChanged( const QString& )), SLOT(onSettingsChanged()) );
 
56
    pageLayout->addRow( fileNameLabel, mFileNameEdit );
 
57
 
 
58
    // data type
 
59
    const QString encodingTypeLabel =
 
60
        i18nc( "@label:listbox the type of the used encoding: historical or Base64.",
 
61
               "Encoding:" );
 
62
 
 
63
    mEncodingSelect = new KComboBox( this );
 
64
    QStringList list;
 
65
    list.append( i18nc("@item:inmenu Doing the uuencoding using the historical encoding",
 
66
                       "Historical") );
 
67
    list.append( i18nc("@item:inmenu Doing the uuencoding using the base64 encoding",
 
68
                       "Base64") );
 
69
    mEncodingSelect->addItems( list );
 
70
    mEncodingSelect->setCurrentIndex( mSettings.algorithmId );
 
71
    connect( mEncodingSelect, SIGNAL(activated(int)), SLOT(onSettingsChanged()) );
 
72
    pageLayout->addRow( encodingTypeLabel, mEncodingSelect );
 
73
}
 
74
 
 
75
AbstractSelectionView* ByteArrayUuencodingStreamEncoderConfigEditor::createPreviewView() const
 
76
{
 
77
    return new ByteArrayTextStreamEncoderPreview( mEncoder );
 
78
}
 
79
 
 
80
void ByteArrayUuencodingStreamEncoderConfigEditor::onSettingsChanged()
 
81
{
 
82
    mSettings.algorithmId = (UuencodingStreamEncoderSettings::AlgorithmId) mEncodingSelect->currentIndex();
 
83
    mSettings.fileName = mFileNameEdit->text();
 
84
 
 
85
    mEncoder->setSettings( mSettings );
 
86
}
 
87
 
 
88
ByteArrayUuencodingStreamEncoderConfigEditor::~ByteArrayUuencodingStreamEncoderConfigEditor()
 
89
{
 
90
}
 
91
 
 
92
}