metastreams get correct group IDs (instead of 0),
new CustomIcon metastream format (Rev 2), alpha blending for banner icons, new banner standard icon (key.png) git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@98 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
c980d277f2
commit
5775eaae36
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -244,11 +244,21 @@ return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PwDatabase::parseMetaStream(const CEntry& entry){
|
bool PwDatabase::parseMetaStream(const CEntry& entry){
|
||||||
if(entry.Additional=="KPX_CUSTOM_ICONS")
|
|
||||||
|
if(entry.Additional=="KPX_CUSTOM_ICONS_2")
|
||||||
return parseCustomIconsMetaStream(entry.BinaryData);
|
return parseCustomIconsMetaStream(entry.BinaryData);
|
||||||
|
|
||||||
|
/* Old stream format will be ignored*/
|
||||||
|
if(entry.Additional=="KPX_CUSTOM_ICONS")
|
||||||
|
return true; //return true to avoid that this stream get saved
|
||||||
|
|
||||||
return false; //unknown MetaStreams
|
return false; //unknown MetaStream
|
||||||
|
}
|
||||||
|
|
||||||
|
CEntry* PwDatabase::getEntry(const KpxUuid& uuid){
|
||||||
|
for(int i=0; i<Entries.size();i++)
|
||||||
|
if(Entries[i].Uuid==uuid)return &Entries[i];
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PwDatabase::parseCustomIconsMetaStream(const QByteArray& dta){
|
bool PwDatabase::parseCustomIconsMetaStream(const QByteArray& dta){
|
||||||
|
@ -275,13 +285,17 @@ for(int i=0;i<NumIcons;i++){
|
||||||
return false;}
|
return false;}
|
||||||
}
|
}
|
||||||
for(int i=0;i<NumEntries;i++){
|
for(int i=0;i<NumEntries;i++){
|
||||||
quint32 Entry,Icon;
|
quint32 Icon;
|
||||||
memcpyFromLEnd32(&Entry,dta.data()+offset);
|
KpxUuid EntryUuid;
|
||||||
offset+=4;
|
EntryUuid.fromRaw(dta.data()+offset);
|
||||||
|
offset+=16;
|
||||||
memcpyFromLEnd32(&Icon,dta.data()+offset);
|
memcpyFromLEnd32(&Icon,dta.data()+offset);
|
||||||
offset+=4;
|
offset+=4;
|
||||||
Entries[Entry].OldImgID=Entries[Entry].ImageID;
|
CEntry* entry=getEntry(EntryUuid);
|
||||||
Entries[Entry].ImageID=Icon;
|
if(entry){
|
||||||
|
entry->OldImgID=entry->ImageID;
|
||||||
|
entry->ImageID=Icon;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for(int i=0;i<NumGroups;i++){
|
for(int i=0;i<NumGroups;i++){
|
||||||
quint32 Group,Icon;
|
quint32 Group,Icon;
|
||||||
|
@ -295,17 +309,20 @@ for(int i=0;i<NumGroups;i++){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PwDatabase::createCustomIconsMetaStream(CEntry* e){
|
void PwDatabase::createCustomIconsMetaStream(CEntry* e){
|
||||||
|
/* Rev 2 */
|
||||||
e->BinaryDesc="bin-stream";
|
e->BinaryDesc="bin-stream";
|
||||||
e->Title="Meta-Info";
|
e->Title="Meta-Info";
|
||||||
e->UserName="SYSTEM";
|
e->UserName="SYSTEM";
|
||||||
e->Additional="KPX_CUSTOM_ICONS";
|
e->Additional="KPX_CUSTOM_ICONS_2";
|
||||||
e->URL="$";
|
e->URL="$";
|
||||||
e->ImageID=0;
|
e->ImageID=0;
|
||||||
|
if(Groups.size())e->GroupID=Groups[0].ID;
|
||||||
int Size=12;
|
int Size=12;
|
||||||
quint32 NumEntries=Entries.size();
|
quint32 NumEntries=Entries.size();
|
||||||
quint32 NumGroups=Groups.size();
|
quint32 NumGroups=Groups.size();
|
||||||
Size+=8*(NumEntries+NumGroups);
|
Size+=8*NumGroups+20*NumEntries;
|
||||||
Size+=CustomIcons.size()*1000; // 1KB
|
Size+=CustomIcons.size()*1000; // 1KB
|
||||||
e->BinaryData.reserve(Size);
|
e->BinaryData.reserve(Size);
|
||||||
e->BinaryData.resize(12);
|
e->BinaryData.resize(12);
|
||||||
|
@ -327,11 +344,11 @@ for(int i=0;i<CustomIcons.size();i++){
|
||||||
e->BinaryData.append(png);
|
e->BinaryData.append(png);
|
||||||
}
|
}
|
||||||
for(quint32 i=0;i<Entries.size();i++){
|
for(quint32 i=0;i<Entries.size();i++){
|
||||||
char Bin[8];
|
char Bin[20];
|
||||||
memcpyToLEnd32(Bin,&i);
|
Entries[i].Uuid.toRaw(Bin);
|
||||||
quint32 id=Entries[i].ImageID;
|
quint32 id=Entries[i].ImageID;
|
||||||
memcpyToLEnd32(Bin+4,&id);
|
memcpyToLEnd32(Bin+16,&id);
|
||||||
e->BinaryData.append(QByteArray::fromRawData(Bin,8));
|
e->BinaryData.append(QByteArray::fromRawData(Bin,20));
|
||||||
}
|
}
|
||||||
for(quint32 i=0;i<Groups.size();i++){
|
for(quint32 i=0;i<Groups.size();i++){
|
||||||
char Bin[8];
|
char Bin[8];
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
QList<int> getChildIds(CGroup* pGroup);
|
QList<int> getChildIds(CGroup* pGroup);
|
||||||
|
|
||||||
CEntry& entry(unsigned long index);
|
CEntry& entry(unsigned long index);
|
||||||
|
CEntry* getEntry(const KpxUuid& uuid);
|
||||||
void setEntry(unsigned long index,CEntry& Entry);
|
void setEntry(unsigned long index,CEntry& Entry);
|
||||||
int numEntries();
|
int numEntries();
|
||||||
CEntry* cloneEntry(CEntry* pEntry);
|
CEntry* cloneEntry(CEntry* pEntry);
|
||||||
|
|
|
@ -8,70 +8,92 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>302</width>
|
<width>350</width>
|
||||||
<height>105</height>
|
<height>120</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizePolicy" >
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>0</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="minimumSize" >
|
<property name="minimumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>302</width>
|
<width>350</width>
|
||||||
<height>105</height>
|
<height>120</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize" >
|
<property name="maximumSize" >
|
||||||
<size>
|
<size>
|
||||||
<width>302</width>
|
<width>350</width>
|
||||||
<height>105</height>
|
<height>120</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle" >
|
||||||
<string>Group Properties</string>
|
<string>Group Properties</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QLineEdit" name="EditTitle" >
|
<layout class="QVBoxLayout" >
|
||||||
<property name="geometry" >
|
<property name="margin" >
|
||||||
<rect>
|
<number>9</number>
|
||||||
<x>70</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>230</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="spacing" >
|
||||||
<widget class="QLabel" name="Label1" >
|
<number>6</number>
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>27</width>
|
|
||||||
<height>20</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text" >
|
<item>
|
||||||
<string>Title:</string>
|
<layout class="QGridLayout" >
|
||||||
|
<property name="margin" >
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
<property name="spacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="0" >
|
||||||
<widget class="QLabel" name="Label2" >
|
<widget class="QLabel" name="Label2" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>40</y>
|
|
||||||
<width>43</width>
|
|
||||||
<height>20</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Icon:</string>
|
<string>Icon:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="Line" name="line1" >
|
</item>
|
||||||
<property name="geometry" >
|
<item row="0" column="0" >
|
||||||
<rect>
|
<widget class="QLabel" name="Label1" >
|
||||||
<x>10</x>
|
<property name="text" >
|
||||||
<y>62</y>
|
<string>Title:</string>
|
||||||
<width>290</width>
|
|
||||||
<height>16</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QComboBox" name="ComboIconPicker" />
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3" >
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>172</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="3" >
|
||||||
|
<widget class="QLineEdit" name="EditTitle" />
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" >
|
||||||
|
<widget class="QToolButton" name="Button_Icon" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line1" >
|
||||||
<property name="frameShape" >
|
<property name="frameShape" >
|
||||||
<enum>QFrame::HLine</enum>
|
<enum>QFrame::HLine</enum>
|
||||||
</property>
|
</property>
|
||||||
|
@ -82,15 +104,30 @@
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="ButtonOK" >
|
</item>
|
||||||
<property name="geometry" >
|
<item>
|
||||||
<rect>
|
<layout class="QHBoxLayout" >
|
||||||
<x>140</x>
|
<property name="margin" >
|
||||||
<y>76</y>
|
<number>0</number>
|
||||||
<width>70</width>
|
|
||||||
<height>24</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
</property>
|
||||||
|
<property name="spacing" >
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>121</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="ButtonOK" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>O&K</string>
|
<string>O&K</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -98,15 +135,9 @@
|
||||||
<string>Alt+K</string>
|
<string>Alt+K</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QPushButton" name="ButtonCancel" >
|
<widget class="QPushButton" name="ButtonCancel" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>220</x>
|
|
||||||
<y>76</y>
|
|
||||||
<width>70</width>
|
|
||||||
<height>24</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>&Cancel</string>
|
<string>&Cancel</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -114,29 +145,10 @@
|
||||||
<string>Alt+C</string>
|
<string>Alt+C</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QComboBox" name="ComboIconPicker" >
|
</item>
|
||||||
<property name="geometry" >
|
</layout>
|
||||||
<rect>
|
</item>
|
||||||
<x>68</x>
|
</layout>
|
||||||
<y>37</y>
|
|
||||||
<width>62</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="Button_Icon" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>135</x>
|
|
||||||
<y>38</y>
|
|
||||||
<width>21</width>
|
|
||||||
<height>23</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>></string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11" />
|
||||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||||
|
|
|
@ -89,6 +89,7 @@ if(DragType==GROUP){
|
||||||
item->setFont(0,f);
|
item->setFont(0,f);
|
||||||
LastHoverItem=item;
|
LastHoverItem=item;
|
||||||
event->setAccepted(true);
|
event->setAccepted(true);
|
||||||
|
///@FIXME does not work for top level groups
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
LastHoverItem=NULL;
|
LastHoverItem=NULL;
|
||||||
|
@ -277,7 +278,7 @@ QPen pen(QColor(100,100,100));
|
||||||
pen.setWidth(2);
|
pen.setWidth(2);
|
||||||
pen.setStyle(Qt::DotLine);
|
pen.setStyle(Qt::DotLine);
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
qDebug("UPDATE: (%i,%i) %ix%i",event->rect().x(),event->rect().y(),event->rect().width(),event->rect().height());
|
//qDebug("UPDATE: (%i,%i) %ix%i",event->rect().x(),event->rect().y(),event->rect().width(),event->rect().height());
|
||||||
if(!InsertionMarker.isNull()){
|
if(!InsertionMarker.isNull()){
|
||||||
painter.drawLine(InsertionMarker);
|
painter.drawLine(InsertionMarker);
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,10 +202,14 @@ if(color1!=color2){
|
||||||
else{
|
else{
|
||||||
banner_pixmap->fill(color1);
|
banner_pixmap->fill(color1);
|
||||||
}
|
}
|
||||||
painter.drawPixmap(10,10,*symbol);
|
QPixmap icon(32,32);
|
||||||
|
icon.fill(textcolor);
|
||||||
|
icon.setAlphaChannel(*symbol);
|
||||||
|
painter.drawPixmap(10,10,icon);
|
||||||
|
|
||||||
pen.setColor(textcolor);
|
pen.setColor(textcolor);
|
||||||
painter.setPen(pen);
|
painter.setPen(pen);
|
||||||
painter.drawText(50,30,text);
|
painter.drawText(50,35,text);
|
||||||
Banner->setPixmap(*banner_pixmap);
|
Banner->setPixmap(*banner_pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue