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 |
|
@ -49,8 +49,8 @@ else return QString(tr("Unknown Error"));
|
|||
QString PwDatabase::getErrors(){
|
||||
QString r;
|
||||
for(int i=0; i<Errors.size(); i++){
|
||||
r+=Errors[i];
|
||||
r+='\n';
|
||||
r+=Errors[i];
|
||||
r+='\n';
|
||||
}
|
||||
Errors.clear();
|
||||
return r;
|
||||
|
@ -244,11 +244,21 @@ return true;
|
|||
}
|
||||
|
||||
bool PwDatabase::parseMetaStream(const CEntry& entry){
|
||||
if(entry.Additional=="KPX_CUSTOM_ICONS")
|
||||
|
||||
if(entry.Additional=="KPX_CUSTOM_ICONS_2")
|
||||
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){
|
||||
|
@ -275,13 +285,17 @@ for(int i=0;i<NumIcons;i++){
|
|||
return false;}
|
||||
}
|
||||
for(int i=0;i<NumEntries;i++){
|
||||
quint32 Entry,Icon;
|
||||
memcpyFromLEnd32(&Entry,dta.data()+offset);
|
||||
offset+=4;
|
||||
quint32 Icon;
|
||||
KpxUuid EntryUuid;
|
||||
EntryUuid.fromRaw(dta.data()+offset);
|
||||
offset+=16;
|
||||
memcpyFromLEnd32(&Icon,dta.data()+offset);
|
||||
offset+=4;
|
||||
Entries[Entry].OldImgID=Entries[Entry].ImageID;
|
||||
Entries[Entry].ImageID=Icon;
|
||||
CEntry* entry=getEntry(EntryUuid);
|
||||
if(entry){
|
||||
entry->OldImgID=entry->ImageID;
|
||||
entry->ImageID=Icon;
|
||||
}
|
||||
}
|
||||
for(int i=0;i<NumGroups;i++){
|
||||
quint32 Group,Icon;
|
||||
|
@ -295,17 +309,20 @@ for(int i=0;i<NumGroups;i++){
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PwDatabase::createCustomIconsMetaStream(CEntry* e){
|
||||
/* Rev 2 */
|
||||
e->BinaryDesc="bin-stream";
|
||||
e->Title="Meta-Info";
|
||||
e->UserName="SYSTEM";
|
||||
e->Additional="KPX_CUSTOM_ICONS";
|
||||
e->Additional="KPX_CUSTOM_ICONS_2";
|
||||
e->URL="$";
|
||||
e->ImageID=0;
|
||||
if(Groups.size())e->GroupID=Groups[0].ID;
|
||||
int Size=12;
|
||||
quint32 NumEntries=Entries.size();
|
||||
quint32 NumGroups=Groups.size();
|
||||
Size+=8*(NumEntries+NumGroups);
|
||||
Size+=8*NumGroups+20*NumEntries;
|
||||
Size+=CustomIcons.size()*1000; // 1KB
|
||||
e->BinaryData.reserve(Size);
|
||||
e->BinaryData.resize(12);
|
||||
|
@ -327,11 +344,11 @@ for(int i=0;i<CustomIcons.size();i++){
|
|||
e->BinaryData.append(png);
|
||||
}
|
||||
for(quint32 i=0;i<Entries.size();i++){
|
||||
char Bin[8];
|
||||
memcpyToLEnd32(Bin,&i);
|
||||
char Bin[20];
|
||||
Entries[i].Uuid.toRaw(Bin);
|
||||
quint32 id=Entries[i].ImageID;
|
||||
memcpyToLEnd32(Bin+4,&id);
|
||||
e->BinaryData.append(QByteArray::fromRawData(Bin,8));
|
||||
memcpyToLEnd32(Bin+16,&id);
|
||||
e->BinaryData.append(QByteArray::fromRawData(Bin,20));
|
||||
}
|
||||
for(quint32 i=0;i<Groups.size();i++){
|
||||
char Bin[8];
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
QList<int> getChildIds(CGroup* pGroup);
|
||||
|
||||
CEntry& entry(unsigned long index);
|
||||
CEntry* getEntry(const KpxUuid& uuid);
|
||||
void setEntry(unsigned long index,CEntry& Entry);
|
||||
int numEntries();
|
||||
CEntry* cloneEntry(CEntry* pEntry);
|
||||
|
|
|
@ -8,135 +8,147 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>302</width>
|
||||
<height>105</height>
|
||||
<width>350</width>
|
||||
<height>120</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>302</width>
|
||||
<height>105</height>
|
||||
<width>350</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>302</width>
|
||||
<height>105</height>
|
||||
<width>350</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Group Properties</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="EditTitle" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>10</y>
|
||||
<width>230</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="Label1" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>27</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<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" >
|
||||
<string>Icon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line1" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>62</y>
|
||||
<width>290</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="ButtonOK" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>76</y>
|
||||
<width>70</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>O&K</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Alt+K</string>
|
||||
</property>
|
||||
</widget>
|
||||
<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" >
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Alt+C</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="ComboIconPicker" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>68</x>
|
||||
<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>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="Label2" >
|
||||
<property name="text" >
|
||||
<string>Icon:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="Label1" >
|
||||
<property name="text" >
|
||||
<string>Title:</string>
|
||||
</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" >
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</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" >
|
||||
<string>O&K</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Alt+K</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ButtonCancel" >
|
||||
<property name="text" >
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="shortcut" >
|
||||
<string>Alt+C</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11" />
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
|
|
|
@ -89,6 +89,7 @@ if(DragType==GROUP){
|
|||
item->setFont(0,f);
|
||||
LastHoverItem=item;
|
||||
event->setAccepted(true);
|
||||
///@FIXME does not work for top level groups
|
||||
}
|
||||
else{
|
||||
LastHoverItem=NULL;
|
||||
|
@ -277,7 +278,7 @@ QPen pen(QColor(100,100,100));
|
|||
pen.setWidth(2);
|
||||
pen.setStyle(Qt::DotLine);
|
||||
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()){
|
||||
painter.drawLine(InsertionMarker);
|
||||
}
|
||||
|
|
|
@ -202,10 +202,14 @@ if(color1!=color2){
|
|||
else{
|
||||
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);
|
||||
painter.setPen(pen);
|
||||
painter.drawText(50,30,text);
|
||||
painter.drawText(50,35,text);
|
||||
Banner->setPixmap(*banner_pixmap);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue