Annotations: Author name request. Configure::generalDialog: changes.

svn path=/branches/kpdf_annotations/kdegraphics/kpdf/; revision=397322
This commit is contained in:
Enrico Ros 2005-03-13 17:23:12 +00:00
parent 9023b05e16
commit 0de54211f1
3 changed files with 116 additions and 26 deletions

View file

@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>328</width>
<height>305</height>
<width>296</width>
<height>311</height>
</rect>
</property>
<vbox>
@ -38,6 +38,14 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowScrollBars</cstring>
</property>
<property name="text">
<string>Show scroll&amp;bars</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowSearchBar</cstring>
@ -60,14 +68,6 @@
<string>Link the &amp;thumbnails with the page</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowScrollBars</cstring>
</property>
<property name="text">
<string>Show scroll&amp;bars</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ShowOSD</cstring>
@ -76,22 +76,6 @@
<string>Show &amp;hints and info messages</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ObeyDRM</cstring>
</property>
<property name="text">
<string>&amp;Obey DRM limitations</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_WatchFile</cstring>
</property>
<property name="text">
<string>&amp;Watch File</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QLayoutWidget">
@ -139,6 +123,88 @@
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>groupBox3</cstring>
</property>
<property name="title">
<string>Program Features</string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout4</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_ObeyDRM</cstring>
</property>
<property name="text">
<string>&amp;Obey DRM limitations</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>kcfg_WatchFile</cstring>
</property>
<property name="text">
<string>&amp;Watch File</string>
</property>
</widget>
</vbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout3_2_2</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>pixmapLabel1_2_2</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="pixmap">
<pixmap>"exec", 32</pixmap>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacerV1_2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Minimum</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>1</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>groupBox2_2</cstring>

View file

@ -46,6 +46,9 @@
<max>6</max>
</entry>
</group>
<group name="Annotations" >
<entry key="AnnotationsAuthor" type="String" />
</group>
<group name="General" >
<entry key="ShowOSD" type="Bool" >
<default>true</default>

View file

@ -15,6 +15,8 @@
#include <kiconloader.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kinputdialog.h>
#include <kuser.h>
#include <kdebug.h>
// system includes
@ -358,6 +360,25 @@ void PageViewAnnotator::setEnabled( bool on )
// show the toolBar
m_toolBar->showItems( (PageViewToolBar::Side)Settings::editToolBarPlacement(), items );
// ask for Author's name if not already set
if ( Settings::annotationsAuthor().isEmpty() )
{
// get default username from the kdelibs/kdecore/KUser
KUser currentUser;
QString userName = currentUser.fullName();
// ask the user for confirmation/change
bool firstTry = true;
while ( firstTry || userName.isEmpty() )
{
QString prompt = firstTry ? i18n( "Please insert your name or initials:" ) :
i18n( "You must set this name:" );
userName = KInputDialog::getText( i18n("Annotations author"), prompt, userName );
firstTry = false;
}
// save the name
Settings::setAnnotationsAuthor( userName );
}
}
bool PageViewAnnotator::routeEvents() const