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

« back to all changes in this revision

Viewing changes to digikam/searchmodificationhelper.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:
55
55
};
56
56
 
57
57
SearchModificationHelper::SearchModificationHelper(QObject* parent, QWidget* dialogParent)
58
 
                        : QObject(parent), d(new SearchModificationHelperPriv)
 
58
    : QObject(parent), d(new SearchModificationHelperPriv)
59
59
{
60
60
    d->dialogParent = dialogParent;
61
61
}
75
75
    // Make sure that a complicated search is not deleted accidentally
76
76
    int result = KMessageBox::warningYesNo(d->dialogParent,
77
77
                                           i18n("Are you sure you want to "
78
 
                                                "delete the selected Date Search "
79
 
                                                "\"%1\"?", searchAlbum->title()),
 
78
                                                   "delete the selected Date Search "
 
79
                                                   "\"%1\"?", searchAlbum->title()),
80
80
                                           i18n("Delete Date Search?"),
81
81
                                           KGuiItem(i18n("Delete")),
82
82
                                           KStandardGuiItem::cancel());
95
95
 
96
96
    for (AlbumList::ConstIterator it = list.constBegin() ; it != list.constEnd() ; ++it)
97
97
    {
98
 
        SAlbum *album = (SAlbum*)(*it);
 
98
        SAlbum* album = (SAlbum*)(*it);
 
99
 
99
100
        if (album->title() == name)
100
101
        {
101
102
            return false;
102
103
        }
103
104
    }
 
105
 
104
106
    return true;
105
107
}
106
108
 
114
116
                              "Please enter a new name:" );
115
117
        bool ok;
116
118
        QString newTitle = KInputDialog::getText(i18n("Name exists"), label,
117
 
                                                 name, &ok, d->dialogParent);
 
119
                           name, &ok, d->dialogParent);
 
120
 
118
121
        if (!ok)
119
122
        {
120
123
            return false;
155
158
}
156
159
 
157
160
void SearchModificationHelper::slotCreateTimeLineSearch(const QString& desiredName,
158
 
                                                        const DateRangeList& dateRanges,
159
 
                                                        bool overwriteIfExisting)
 
161
        const DateRangeList& dateRanges,
 
162
        bool overwriteIfExisting)
160
163
{
161
164
    QString name = desiredName;
 
165
 
162
166
    if (!overwriteIfExisting && !checkName(name))
163
167
    {
164
168
        return;
184
188
        writer.finishField();
185
189
        writer.finishGroup();
186
190
    }
 
191
 
187
192
    writer.finish();
188
193
 
189
194
    kDebug() << "Date search XML:\n" << writer.xml();
194
199
}
195
200
 
196
201
SAlbum* SearchModificationHelper::createFuzzySearchFromSketch(const QString& proposedName,
197
 
                                                              SketchWidget* sketchWidget,
198
 
                                                              unsigned int numberOfResults,
199
 
                                                              bool overwriteIfExisting)
 
202
        SketchWidget* sketchWidget,
 
203
        unsigned int numberOfResults,
 
204
        bool overwriteIfExisting)
200
205
{
201
206
    if (sketchWidget->isClear())
202
207
    {
204
209
    }
205
210
 
206
211
    QString name = proposedName;
 
212
 
207
213
    if (!overwriteIfExisting && !checkName(name))
208
214
    {
209
215
        return 0;
225
231
    writer.finishGroup();
226
232
 
227
233
    SAlbum* salbum = AlbumManager::instance()->createSAlbum(name,
228
 
                    DatabaseSearch::HaarSearch, writer.xml());
 
234
                     DatabaseSearch::HaarSearch, writer.xml());
229
235
    AlbumManager::instance()->setCurrentAlbum(salbum);
230
236
 
231
237
    return salbum;
232
238
}
233
239
 
234
240
void SearchModificationHelper::slotCreateFuzzySearchFromSketch(const QString& proposedName,
235
 
                                                               SketchWidget* sketchWidget,
236
 
                                                               unsigned int numberOfResults,
237
 
                                                               bool overwriteIfExisting)
 
241
        SketchWidget* sketchWidget,
 
242
        unsigned int numberOfResults,
 
243
        bool overwriteIfExisting)
238
244
{
239
245
    createFuzzySearchFromSketch(proposedName, sketchWidget, numberOfResults, overwriteIfExisting);
240
246
}
241
247
 
242
248
SAlbum* SearchModificationHelper::createFuzzySearchFromImage(const QString& proposedName,
243
 
                                                             const ImageInfo& image,
244
 
                                                             float threshold,
245
 
                                                             bool overwriteIfExisting)
 
249
        const ImageInfo& image,
 
250
        float threshold,
 
251
        bool overwriteIfExisting)
246
252
{
247
253
    if (image.isNull())
248
254
    {
250
256
    }
251
257
 
252
258
    QString name = proposedName;
 
259
 
253
260
    if (!overwriteIfExisting && !checkName(name))
254
261
    {
255
262
        return 0;
269
276
    writer.finishGroup();
270
277
 
271
278
    SAlbum* salbum = AlbumManager::instance()->createSAlbum(name,
272
 
                    DatabaseSearch::HaarSearch, writer.xml());
 
279
                     DatabaseSearch::HaarSearch, writer.xml());
273
280
    AlbumManager::instance()->setCurrentAlbum(salbum);
274
281
 
275
282
    return salbum;
276
283
}
277
284
 
278
285
void SearchModificationHelper::slotCreateFuzzySearchFromImage(const QString& proposedName,
279
 
                                                              const ImageInfo& image,
280
 
                                                              float threshold,
281
 
                                                              bool overwriteIfExisting)
 
286
        const ImageInfo& image,
 
287
        float threshold,
 
288
        bool overwriteIfExisting)
282
289
{
283
290
    createFuzzySearchFromImage(proposedName, image, threshold, overwriteIfExisting);
284
291
}