File: cdlgabout.cpp

package info (click to toggle)
gpgkeys 0.3.1-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 276 kB
  • ctags: 241
  • sloc: cpp: 2,007; makefile: 53
file content (79 lines) | stat: -rw-r--r-- 2,637 bytes parent folder | download | duplicates (3)
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
/*
 * GPG Keys 
 * cdlgabout.cpp
 * (c) 2001 Peter Mathiasson <peter@mathiasson.nu>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2, as
 * published by the Free Software Foundation
 */

#include <qdialog.h>
#include <qlistview.h>
#include <qtextview.h>
#include <qfile.h>
#include "cdlgabout.h"
#include "functions.h"
#include "config.h"

/* --------------------------------------------------------------------------------- */

#ifndef VERSION
    #define VERSION "UNKNOWN"
#endif

/* --------------------------------------------------------------------------------- */

CDlgAbout::CDlgAbout( QWidget *parent ) : CDlgAboutUI( parent, 0, TRUE )
{

    /* Set Fonts */
    setFont( readConfigFont( "stdfont", STD_FONT ) );
    QFont fixedFont = readConfigFont( "fixedfont", FIX_FONT );
    tvCopyright->setFont( fixedFont );
    lvAuthors->setFont( fixedFont );
    tvLicense->setFont( fixedFont );

    /* Set Copyright Information */
    tvCopyright->setWordWrap( QTextView::NoWrap );
    tvCopyright->setText( "GPG Keys v" VERSION "\n"
                          "(c) 2001 Peter Mathiasson <peter@mathiasson.nu>\n\n"
                          "This program is free software; you can redistribute it\n"
                          "and/or modify it under the terms of the GNU General Public\n"
                          "License version 2, as published by the Free Software\n"
                          "Foundation" );

    /* Set Authors Information */
    lvAuthors->setSorting( -1 );
    QListViewItem *tmpItem = NULL;
    QString line;
    QFile authFile( AUTHORSFILE );
    if ( authFile.open( IO_ReadOnly ) ) {
        QTextStream tsAuth( &authFile );
        while( line = tsAuth.readLine() ) {
            QStringList author = QStringList::split( '\t', line );
            tmpItem = new QListViewItem( lvAuthors, tmpItem );
            for ( unsigned int i = 0; i < author.size(); i++ ) {
                tmpItem->setText( i, author[i] + " " );
            }
        }
    } else {
        tmpItem = new QListViewItem( lvAuthors );
        tmpItem->setText( 0, tr( "Authors file not found!" ) );
    }

    
    /* Set License */
    tvLicense->setWordWrap( QTextView::NoWrap );
    QFile licFile( LICENSEFILE );
    if ( licFile.open( IO_ReadOnly ) ) {
        QTextStream tsLic( &licFile );
        tvLicense->setText( tsLic.read() );
    } else {
        tvLicense->setText( tr( "License file not found!" ) );
    }
                          
}

/* --------------------------------------------------------------------------------- */