propertiesdialog.cpp 2.02 KB
Newer Older
Albert Astals Cid's avatar
Albert Astals Cid committed
1
2
3
4
5
6
7
8
9
/***************************************************************************
 *   Copyright (C) 2004 by Albert Astals Cid <tsdgeos@terra.es>            *
 *                                                                         *
 *   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.                                   *
 ***************************************************************************/

10
// qt/kde includes
Albert Astals Cid's avatar
Albert Astals Cid committed
11
12
13
#include <klocale.h>
#include <qlabel.h>

14
// local includes
Albert Astals Cid's avatar
Albert Astals Cid committed
15
#include "propertiesdialog.h"
16
17
#include "properties.h"
#include "core/document.h"
Albert Astals Cid's avatar
Albert Astals Cid committed
18

19
propertiesDialog::propertiesDialog(QWidget *parent, KPDFDocument *doc) : KDialogBase(parent, 0, true, i18n( "Unknown File" ), Ok)
Albert Astals Cid's avatar
Albert Astals Cid committed
20
{
21
  // embed the properties widget (TODO switch to a dynamic generated one)
Albert Astals Cid's avatar
Albert Astals Cid committed
22
23
  properties *p = new properties(this);
  setMainWidget(p);
24
  // get document info, if not present display blank data and a warning
25
26
27
28
29
30
  const DocumentInfo * info = doc->documentInfo();
  if ( !info )
  {
    p->titleValue->setText( i18n( "No document opened!" ) );
    return;
  }
31
32
  // mime name based on mimetype id
  QString mimeName = info->mimeType.section( '/', -1 ).upper();
33
  setCaption( i18n("%1 Properties").arg( mimeName ) );
34
  // fill in document property values
35
36
37
38
39
40
41
42
43
44
45
46
  p->pagesValue->setText( QString::number( doc->pages() ) );
  p->authorValue->setText( info->author );
  p->titleValue->setText( info->title );
  p->subjectValue->setText( info->subject );
  p->keywordsValue->setText( info->keywords );
  p->producerValue->setText( info->producer );
  p->creatorValue->setText( info->creator );
  p->optimizedValue->setText( info->optimization );
  p->securityValue->setText( info->encryption );
  p->versionValue->setText( info->format + " v." + info->formatVersion );
  p->createdValue->setText( info->creationDate );
  p->modifiedValue->setText( info->modificationDate );
Albert Astals Cid's avatar
Albert Astals Cid committed
47
}