Improved display of date strings in the EntryView
git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@204 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
a018fee162
commit
56bc995cc2
|
@ -74,13 +74,35 @@ bool KpxUuid::operator!=(const KpxUuid& other)const{
|
|||
|
||||
|
||||
QString KpxDateTime::toString(Qt::DateFormat format) const{
|
||||
if(*this==Date_Never)return QCoreApplication::translate("Database","Never");
|
||||
else return QDateTime::toString(format);
|
||||
if (*this==Date_Never)
|
||||
return QCoreApplication::translate("Database","Never");
|
||||
else if (format==Qt::DefaultLocaleShortDate){
|
||||
QString strFormat = QLocale::system().dateFormat(QLocale::ShortFormat);
|
||||
if (!strFormat.contains("dd")) strFormat.replace("d", "dd");
|
||||
if (!strFormat.contains("MM")) strFormat.replace("M", "MM");
|
||||
if (!strFormat.contains("yyyy")) strFormat.replace("yy", "yyyy");
|
||||
if (!strFormat.contains("hh")) strFormat.replace("h", "hh");
|
||||
if (!strFormat.contains("HH")) strFormat.replace("H", "HH");
|
||||
if (!strFormat.contains("mm")) strFormat.replace("m", "mm");
|
||||
if (!strFormat.contains("ss")) strFormat.replace("s", "ss");
|
||||
return date().toString(strFormat);
|
||||
}
|
||||
else
|
||||
return QDateTime::toString(format);
|
||||
}
|
||||
|
||||
QString KpxDateTime::dateToString(Qt::DateFormat format) const{
|
||||
if(*this==Date_Never)return QCoreApplication::translate("Database","Never");
|
||||
else return date().toString(format);
|
||||
if (*this==Date_Never)
|
||||
return QCoreApplication::translate("Database","Never");
|
||||
else if (format==Qt::DefaultLocaleShortDate){
|
||||
QString strFormat = QLocale::system().dateFormat(QLocale::ShortFormat);
|
||||
if (!strFormat.contains("dd")) strFormat.replace("d", "dd");
|
||||
if (!strFormat.contains("MM")) strFormat.replace("M", "MM");
|
||||
if (!strFormat.contains("yyyy")) strFormat.replace("yy", "yyyy");
|
||||
return date().toString(strFormat);
|
||||
}
|
||||
else
|
||||
return date().toString(format);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ AboutDialog::AboutDialog(QWidget* parent):QDialog(parent)
|
|||
labelAppName->setText(APP_DISPLAY_NAME);
|
||||
labelAppFunc->setText(QString(" - ").append(APP_LONG_FUNC));
|
||||
|
||||
QString AboutTr=tr("<b>Current Translation: None</b><br><br>","Please replace 'None' with the language of your translation");
|
||||
QString AboutTr=QString("<b>%1: %2</b><br><br>").arg(tr("Current Translation")).arg(tr("None","Please replace 'None' with the language of your translation"));
|
||||
if(TrActive){
|
||||
AboutTr+=tr("<b>Author:</b> %1<br>").arg(tr("$TRANSLATION_AUTHOR"));
|
||||
AboutTr+=QString("<b>%1:</b> %2<br>").arg(tr("Author")).arg(tr("$TRANSLATION_AUTHOR"));
|
||||
QString mail=tr("$TRANSLATION_AUTHOR_EMAIL","Here you can enter your email or homepage if you want.");
|
||||
if(!mail.isEmpty()){
|
||||
AboutTr+=mail+"<br>";
|
||||
|
|
|
@ -30,7 +30,7 @@ ExpiredEntriesDialog::ExpiredEntriesDialog(QWidget* parent,IDatabase* database,c
|
|||
item->setText(0,Entries[i]->group()->title());
|
||||
item->setText(1,Entries[i]->title());
|
||||
item->setText(2,Entries[i]->username());
|
||||
item->setText(3,Entries[i]->expire().dateToString(Qt::LocalDate));
|
||||
item->setText(3,Entries[i]->expire().dateToString(Qt::DefaultLocaleShortDate));
|
||||
item->setIcon(0,database->icon(Entries[i]->group()->image()));
|
||||
item->setIcon(1,database->icon(Entries[i]->image()));
|
||||
|
||||
|
|
|
@ -112,8 +112,8 @@ void AutoType::perform(IEntryHandle* entry, QString& err,bool hideWindow,int nr)
|
|||
|
||||
bool capsEnabled = HelperX11::keyboardModifiers(pDisplay)&LockMask;
|
||||
if (capsEnabled){
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),true,CurrentTime);
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),false,CurrentTime);
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),true,0);
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),false,0);
|
||||
AutoTypePrivate::sleepKeyStrokeDelay();
|
||||
}
|
||||
|
||||
|
@ -150,8 +150,8 @@ void AutoType::perform(IEntryHandle* entry, QString& err,bool hideWindow,int nr)
|
|||
}
|
||||
|
||||
if (capsEnabled){
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),true,CurrentTime);
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),false,CurrentTime);
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),true,0);
|
||||
XTestFakeKeyEvent(pDisplay,XKeysymToKeycode(pDisplay,XK_Caps_Lock),false,0);
|
||||
}
|
||||
|
||||
if (hideWindow && !(config->showSysTrayIcon() && config->minimizeTray()) )
|
||||
|
|
|
@ -183,13 +183,13 @@ void KeepassEntryView::updateEntry(EntryViewItem* item){
|
|||
if (Columns.at(4)){
|
||||
item->setText(j++,entry->comment().section('\n',0,0));}
|
||||
if (Columns.at(5)){
|
||||
item->setText(j++,entry->expire().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entry->expire().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(6)){
|
||||
item->setText(j++,entry->creation().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entry->creation().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(7)){
|
||||
item->setText(j++,entry->lastMod().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entry->lastMod().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(8)){
|
||||
item->setText(j++,entry->lastAccess().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entry->lastAccess().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(9)){
|
||||
item->setText(j++,entry->binaryDesc());}
|
||||
if(Columns.at(10) && ViewMode==ShowSearchResults){
|
||||
|
@ -376,13 +376,13 @@ void KeepassEntryView::createItems(QList<IEntryHandle*>& entries){
|
|||
if (Columns.at(4)){
|
||||
item->setText(j++,entries[i]->comment().section('\n',0,0));}
|
||||
if (Columns.at(5)){
|
||||
item->setText(j++,entries[i]->expire().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entries[i]->expire().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(6)){
|
||||
item->setText(j++,entries[i]->creation().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entries[i]->creation().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(7)){
|
||||
item->setText(j++,entries[i]->lastMod().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entries[i]->lastMod().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(8)){
|
||||
item->setText(j++,entries[i]->lastAccess().dateToString(Qt::LocalDate));}
|
||||
item->setText(j++,entries[i]->lastAccess().dateToString(Qt::DefaultLocaleShortDate));}
|
||||
if (Columns.at(9)){
|
||||
item->setText(j++,entries[i]->binaryDesc());}
|
||||
if(Columns.at(10) && ViewMode==ShowSearchResults){
|
||||
|
|
|
@ -887,9 +887,8 @@ quint16 HelperX11::getKeysym(const QChar& c){
|
|||
/*if((unicode & 0xFF000000)==0x00)
|
||||
return (unicode & 0x00FFFFFF)|0x01FFFFFF;*/
|
||||
|
||||
int MapSize=sizeof(KeysymMap);
|
||||
|
||||
for(int i=0; i<MapSize;i++){
|
||||
int MapSize = sizeof(KeysymMap) / sizeof(quint16) / 2;
|
||||
for (int i=0; i<MapSize; i++){
|
||||
if(unicode==KeysymMap[i][0])
|
||||
return KeysymMap[i][1];
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ int main(int argc, char **argv)
|
|||
QTranslator* translator = new QTranslator;
|
||||
QTranslator* qtTranslator = new QTranslator;
|
||||
|
||||
if(loadTranslation(translator,"keepass-",loc.name(),QStringList()
|
||||
if(loadTranslation(translator,"keepassx-",loc.name(),QStringList()
|
||||
<< DataDir+"/i18n/"
|
||||
<< HomeDir))
|
||||
{
|
||||
|
|
|
@ -656,10 +656,10 @@ void KeepassMainWindow::updateDetailView(){
|
|||
}
|
||||
else templ.replace("%password%","****");
|
||||
templ.replace("%url%",entry->url());
|
||||
templ.replace("%creation%",entry->creation().toString(Qt::LocalDate));
|
||||
templ.replace("%lastmod%",entry->lastMod().toString(Qt::LocalDate));
|
||||
templ.replace("%lastaccess%",entry->lastAccess().toString(Qt::LocalDate));
|
||||
templ.replace("%expire%",entry->expire().toString(Qt::LocalDate));
|
||||
templ.replace("%creation%",entry->creation().toString(Qt::DefaultLocaleShortDate));
|
||||
templ.replace("%lastmod%",entry->lastMod().toString(Qt::DefaultLocaleShortDate));
|
||||
templ.replace("%lastaccess%",entry->lastAccess().toString(Qt::DefaultLocaleShortDate));
|
||||
templ.replace("%expire%",entry->expire().toString(Qt::DefaultLocaleShortDate));
|
||||
templ.replace("%comment%",entry->comment());
|
||||
templ.replace("%attachment%",entry->binaryDesc());
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue