~ubuntu-branches/ubuntu/saucy/digikam/saucy

« back to all changes in this revision

Viewing changes to libs/widgets/metadata/iptcwidget.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-12-21 23:19:11 UTC
  • mfrom: (1.2.33 upstream) (3.1.7 experimental)
  • Revision ID: james.westby@ubuntu.com-20101221231911-z9jip7s5aht1jqn9
Tags: 2:1.7.0-1ubuntu1
* Merge from Debian Experimental. Remaining Ubuntu changes:
  - Export .pot name and copy to plugins in debian/rules
  - Version build-depends on kipi-plugins-dev to ensure build is against the
    same version on all archs
* Drop debian/patches/kubuntu_01_linker.diff, incoporated upstream
* Remove patches directory and unused patches

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
static const char* StandardIptcEntryList[] =
44
44
{
45
 
     "Envelope",
46
 
     "Application2",
47
 
     "-1"
 
45
    "Envelope",
 
46
    "Application2",
 
47
    "-1"
48
48
};
49
49
 
50
50
IptcWidget::IptcWidget(QWidget* parent, const char* name)
51
 
          : MetadataWidget(parent, name)
 
51
    : MetadataWidget(parent, name)
52
52
{
53
53
    for (int i=0 ; QString(StandardIptcEntryList[i]) != QString("-1") ; ++i)
 
54
    {
54
55
        m_keysFilter << StandardIptcEntryList[i];
 
56
    }
55
57
}
56
58
 
57
59
IptcWidget::~IptcWidget()
82
84
            return false;
83
85
        }
84
86
        else
 
87
        {
85
88
            setMetadata(metadata);
 
89
        }
86
90
    }
87
91
 
88
92
    return true;
91
95
bool IptcWidget::decodeMetadata()
92
96
{
93
97
    DMetadata data = getMetadata();
 
98
 
94
99
    if (!data.hasIptc())
 
100
    {
95
101
        return false;
 
102
    }
96
103
 
97
104
    // Update all metadata contents.
98
105
    setMetadataMap(data.getIptcTagsDataList(m_keysFilter));
119
126
    QString title = metadataIface.getIptcTagTitle(key.toAscii());
120
127
 
121
128
    if (title.isEmpty())
 
129
    {
122
130
        return key.section('.', -1);
 
131
    }
123
132
 
124
133
    return title;
125
134
}
130
139
    QString desc = metadataIface.getIptcTagDescription(key.toAscii());
131
140
 
132
141
    if (desc.isEmpty())
 
142
    {
133
143
        return i18n("No description available");
 
144
    }
134
145
 
135
146
    return desc;
136
147
}
137
148
 
138
149
void IptcWidget::slotSaveMetadataToFile()
139
150
{
140
 
        KUrl url = saveMetadataToFile(i18n("IPTC File to Save"),
141
 
                                    QString("*.iptc|"+i18n("IPTC binary Files (*.iptc)")));
 
151
    KUrl url = saveMetadataToFile(i18n("IPTC File to Save"),
 
152
                                  QString("*.iptc|"+i18n("IPTC binary Files (*.iptc)")));
142
153
    storeMetadataToFile(url, getMetadata().getIptc());
143
154
}
144
155