Allow EditEntry Dialog to be smaller

Fixed: Line breaks are ignored in Entry Detail View

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@206 b624d157-de02-0410-bad0-e51aec6abb33
master
sniperbeamer 17 years ago
parent 0c7ad0dcaa
commit bc8ec1b520
  1. 34
      src/forms/EditEntryDlg.ui
  2. 171
      src/mainwindow.cpp

@ -20,18 +20,12 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="horizontalSpacing" > <property name="spacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item rowspan="2" row="5" column="1" > <item rowspan="2" row="5" column="1" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="horizontalSpacing" > <property name="spacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="1" > <item row="1" column="1" >
@ -240,6 +234,12 @@
</item> </item>
<item row="8" column="1" > <item row="8" column="1" >
<widget class="QTextEdit" name="Edit_Comment" > <widget class="QTextEdit" name="Edit_Comment" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>40</height>
</size>
</property>
<property name="tabChangesFocus" > <property name="tabChangesFocus" >
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -282,7 +282,9 @@
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset/> <iconset>
<normaloff/>
</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize" >
<size> <size>
@ -298,7 +300,9 @@
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset/> <iconset>
<normaloff/>
</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize" >
<size> <size>
@ -314,7 +318,9 @@
<string/> <string/>
</property> </property>
<property name="icon" > <property name="icon" >
<iconset/> <iconset>
<normaloff/>
</iconset>
</property> </property>
<property name="iconSize" > <property name="iconSize" >
<size> <size>
@ -424,7 +430,7 @@
<property name="sizeType" > <property name="sizeType" >
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Fixed</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0" >
<size> <size>
<width>100</width> <width>100</width>
<height>20</height> <height>20</height>
@ -460,7 +466,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons" > <property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>
@ -472,7 +478,7 @@
<property name="sizeType" > <property name="sizeType" >
<enum>QSizePolicy::Minimum</enum> <enum>QSizePolicy::Minimum</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0" >
<size> <size>
<width>20</width> <width>20</width>
<height>50</height> <height>50</height>

@ -660,7 +660,7 @@ void KeepassMainWindow::updateDetailView(){
templ.replace("%lastmod%",entry->lastMod().toString(Qt::DefaultLocaleShortDate)); templ.replace("%lastmod%",entry->lastMod().toString(Qt::DefaultLocaleShortDate));
templ.replace("%lastaccess%",entry->lastAccess().toString(Qt::DefaultLocaleShortDate)); templ.replace("%lastaccess%",entry->lastAccess().toString(Qt::DefaultLocaleShortDate));
templ.replace("%expire%",entry->expire().toString(Qt::DefaultLocaleShortDate)); templ.replace("%expire%",entry->expire().toString(Qt::DefaultLocaleShortDate));
templ.replace("%comment%",entry->comment()); templ.replace("%comment%",entry->comment().replace("\n","<br/>"));
templ.replace("%attachment%",entry->binaryDesc()); templ.replace("%attachment%",entry->binaryDesc());
if(entry->expire()!=Date_Never){ if(entry->expire()!=Date_Never){
@ -715,100 +715,105 @@ void KeepassMainWindow::updateDetailView(){
void KeepassMainWindow::setStateEntrySelected(SelectionState s){ void KeepassMainWindow::setStateEntrySelected(SelectionState s){
EntrySelection=s; EntrySelection = s;
if(GroupSelection == NONE || GroupSelection == SINGLE) if (GroupSelection == NONE || GroupSelection == SINGLE){
switch(EntrySelection){ switch (EntrySelection){
case NONE: case NONE:
EditPasswordToClipboardAction->setEnabled(false); EditPasswordToClipboardAction->setEnabled(false);
EditUsernameToClipboardAction->setEnabled(false); EditUsernameToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false); EditOpenUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false); EditSaveAttachmentAction->setEnabled(false);
EditEditEntryAction->setEnabled(false); EditEditEntryAction->setEnabled(false);
EditCloneEntryAction->setEnabled(false); EditCloneEntryAction->setEnabled(false);
EditCloneEntryAction->setText(tr("Clone Entry")); EditCloneEntryAction->setText(tr("Clone Entry"));
EditDeleteEntryAction->setEnabled(false); EditDeleteEntryAction->setEnabled(false);
EditDeleteEntryAction->setText(tr("Delete Entry")); EditDeleteEntryAction->setText(tr("Delete Entry"));
#ifdef AUTOTYPE #ifdef AUTOTYPE
EditAutoTypeAction->setEnabled(false); EditAutoTypeAction->setEnabled(false);
#endif #endif
break; break;
case SINGLE: case SINGLE:
EditPasswordToClipboardAction->setEnabled(true); EditPasswordToClipboardAction->setEnabled(true);
EditUsernameToClipboardAction->setEnabled(true); EditUsernameToClipboardAction->setEnabled(true);
EditOpenUrlAction->setEnabled(true); EditOpenUrlAction->setEnabled(true);
EditSaveAttachmentAction->setEnabled(((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle->binarySize() > 0); EditSaveAttachmentAction->setEnabled(((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle->binarySize() > 0);
EditEditEntryAction->setEnabled(true); EditEditEntryAction->setEnabled(true);
EditCloneEntryAction->setEnabled(true); EditCloneEntryAction->setEnabled(true);
EditCloneEntryAction->setText(tr("Clone Entry")); EditCloneEntryAction->setText(tr("Clone Entry"));
EditDeleteEntryAction->setEnabled(true); EditDeleteEntryAction->setEnabled(true);
EditDeleteEntryAction->setText(tr("Delete Entry")); EditDeleteEntryAction->setText(tr("Delete Entry"));
#ifdef AUTOTYPE #ifdef AUTOTYPE
EditAutoTypeAction->setEnabled(true); EditAutoTypeAction->setEnabled(true);
#endif #endif
break; break;
case MULTIPLE: case MULTIPLE:
EditPasswordToClipboardAction->setEnabled(false); EditPasswordToClipboardAction->setEnabled(false);
EditUsernameToClipboardAction->setEnabled(false); EditUsernameToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false); EditOpenUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false); EditSaveAttachmentAction->setEnabled(false);
EditEditEntryAction->setEnabled(false); EditEditEntryAction->setEnabled(false);
EditCloneEntryAction->setEnabled(true); EditCloneEntryAction->setEnabled(true);
EditCloneEntryAction->setText(tr("Clone Entries")); EditCloneEntryAction->setText(tr("Clone Entries"));
EditDeleteEntryAction->setEnabled(true); EditDeleteEntryAction->setEnabled(true);
EditDeleteEntryAction->setText(tr("Delete Entries")); EditDeleteEntryAction->setText(tr("Delete Entries"));
#ifdef AUTOTYPE #ifdef AUTOTYPE
EditAutoTypeAction->setEnabled(false); EditAutoTypeAction->setEnabled(false);
#endif #endif
break; break;
default: Q_ASSERT(false); default:
} Q_ASSERT(false);
else if(GroupSelection == SEARCHGROUP) }
switch(EntrySelection){ }
case NONE: else if (GroupSelection == SEARCHGROUP){
EditUsernameToClipboardAction->setEnabled(false); switch(EntrySelection){
EditPasswordToClipboardAction->setEnabled(false); case NONE:
EditOpenUrlAction->setEnabled(false); EditUsernameToClipboardAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false); EditPasswordToClipboardAction->setEnabled(false);
EditEditEntryAction->setEnabled(false); EditOpenUrlAction->setEnabled(false);
EditCloneEntryAction->setEnabled(false); EditSaveAttachmentAction->setEnabled(false);
EditCloneEntryAction->setText(tr("Clone Entry")); EditEditEntryAction->setEnabled(false);
EditDeleteEntryAction->setEnabled(false); EditCloneEntryAction->setEnabled(false);
EditDeleteEntryAction->setText(tr("Delete Entry")); EditCloneEntryAction->setText(tr("Clone Entry"));
EditDeleteEntryAction->setEnabled(false);
EditDeleteEntryAction->setText(tr("Delete Entry"));
#ifdef AUTOTYPE #ifdef AUTOTYPE
EditAutoTypeAction->setEnabled(false); EditAutoTypeAction->setEnabled(false);
#endif #endif
break; break;
case SINGLE: case SINGLE:
EditUsernameToClipboardAction->setEnabled(true); EditUsernameToClipboardAction->setEnabled(true);
EditPasswordToClipboardAction->setEnabled(true); EditPasswordToClipboardAction->setEnabled(true);
EditOpenUrlAction->setEnabled(true); EditOpenUrlAction->setEnabled(true);
EditSaveAttachmentAction->setEnabled(((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle->binarySize() > 0); EditSaveAttachmentAction->setEnabled(((EntryViewItem*)(EntryView->selectedItems()[0]))->EntryHandle->binarySize() > 0);
EditEditEntryAction->setEnabled(true); EditEditEntryAction->setEnabled(true);
EditCloneEntryAction->setEnabled(false); EditCloneEntryAction->setEnabled(false);
EditCloneEntryAction->setText(tr("Clone Entry")); EditCloneEntryAction->setText(tr("Clone Entry"));
EditDeleteEntryAction->setEnabled(true); EditDeleteEntryAction->setEnabled(true);
EditDeleteEntryAction->setText(tr("Delete Entry")); EditDeleteEntryAction->setText(tr("Delete Entry"));
#ifdef AUTOTYPE #ifdef AUTOTYPE
EditAutoTypeAction->setEnabled(true); EditAutoTypeAction->setEnabled(true);
#endif #endif
break; break;
case MULTIPLE: case MULTIPLE:
EditUsernameToClipboardAction->setEnabled(false); EditUsernameToClipboardAction->setEnabled(false);
EditPasswordToClipboardAction->setEnabled(false); EditPasswordToClipboardAction->setEnabled(false);
EditOpenUrlAction->setEnabled(false); EditOpenUrlAction->setEnabled(false);
EditSaveAttachmentAction->setEnabled(false); EditSaveAttachmentAction->setEnabled(false);
EditEditEntryAction->setEnabled(false); EditEditEntryAction->setEnabled(false);
EditCloneEntryAction->setEnabled(false); EditCloneEntryAction->setEnabled(false);
EditCloneEntryAction->setText(tr("Clone Entries")); EditCloneEntryAction->setText(tr("Clone Entries"));
EditDeleteEntryAction->setEnabled(true); EditDeleteEntryAction->setEnabled(true);
EditDeleteEntryAction->setText(tr("Delete Entries")); EditDeleteEntryAction->setText(tr("Delete Entries"));
#ifdef AUTOTYPE #ifdef AUTOTYPE
EditAutoTypeAction->setEnabled(false); EditAutoTypeAction->setEnabled(false);
#endif #endif
break; break;
default: Q_ASSERT(false); default:
} Q_ASSERT(false);
else Q_ASSERT(false); }
}
else
Q_ASSERT(false);
} }