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

« back to all changes in this revision

Viewing changes to libs/widgets/common/searchtextbar.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:
48
48
namespace Digikam
49
49
{
50
50
 
51
 
bool operator==(const SearchTextSettings &a, const SearchTextSettings &b)
 
51
bool operator==(const SearchTextSettings& a, const SearchTextSettings& b)
52
52
{
53
53
    return a.caseSensitive == b.caseSensitive && a.text == b.text;
54
54
}
80
80
    QColor             hasResultColor;
81
81
    QColor             hasNoResultColor;
82
82
 
83
 
    ModelCompletion   *completion;
 
83
    ModelCompletion*   completion;
84
84
 
85
85
    QPointer<AlbumFilterModel>   filterModel;
86
86
 
87
87
    SearchTextSettings settings;
88
88
};
89
89
 
90
 
SearchTextBar::SearchTextBar(QWidget *parent, const char* name, const QString& msg)
91
 
             : KLineEdit(parent), StateSavingObject(this),
92
 
               d(new SearchTextBarPriv)
 
90
SearchTextBar::SearchTextBar(QWidget* parent, const char* name, const QString& msg)
 
91
    : KLineEdit(parent), StateSavingObject(this),
 
92
      d(new SearchTextBarPriv)
93
93
{
94
94
    setAttribute(Qt::WA_DeleteOnClose);
95
95
    setClearButtonShown(true);
121
121
    setCompletionMode((KGlobalSettings::Completion)group.readEntry(entryName(d->optionAutoCompletionModeEntry),
122
122
                      (int)KGlobalSettings::completionMode()));
123
123
    d->settings.caseSensitive = (Qt::CaseSensitivity)group.readEntry(entryName(d->optionCaseSensitiveEntry),
124
 
                                                                     (int)Qt::CaseInsensitive);
 
124
                                (int)Qt::CaseInsensitive);
125
125
    setIgnoreCase(d->settings.caseSensitive == Qt::CaseInsensitive);
126
126
}
127
127
 
128
128
void SearchTextBar::doSaveState()
129
129
{
130
130
    KConfigGroup group = getConfigGroup();
 
131
 
131
132
    if (completionMode() != KGlobalSettings::completionMode())
 
133
    {
132
134
        group.writeEntry(entryName(d->optionAutoCompletionModeEntry), (int)completionMode());
 
135
    }
133
136
    else
 
137
    {
134
138
        group.deleteEntry(entryName(d->optionAutoCompletionModeEntry));
 
139
    }
 
140
 
135
141
    group.writeEntry(entryName(d->optionCaseSensitiveEntry), (int)d->settings.caseSensitive);
136
142
    group.sync();
137
143
}
149
155
void SearchTextBar::setHighlightOnResult(bool highlight)
150
156
{
151
157
    d->highlightOnResult = highlight;
 
158
 
152
159
    if (!highlight)
153
160
    {
154
161
        setPalette(QPalette());
165
172
    d->completion->setModel(model, AbstractAlbumModel::AlbumIdRole, AbstractAlbumModel::AlbumTitleRole);
166
173
}
167
174
 
168
 
void SearchTextBar::setFilterModel(AlbumFilterModel *filterModel)
 
175
void SearchTextBar::setFilterModel(AlbumFilterModel* filterModel)
169
176
{
170
177
 
171
178
    // if there already was a model, disconnect from this model
245
252
void SearchTextBar::slotTextChanged(const QString& text)
246
253
{
247
254
    if (text.isEmpty())
 
255
    {
248
256
        setPalette(QPalette());
 
257
    }
249
258
 
250
259
    d->settings.text = text;
251
260
 
273
282
 
274
283
void SearchTextBar::contextMenuEvent(QContextMenuEvent* e)
275
284
{
276
 
    QAction *cs = 0;
277
 
    QMenu *menu = createStandardContextMenu();
 
285
    QAction* cs = 0;
 
286
    QMenu* menu = createStandardContextMenu();
278
287
 
279
288
    if (d->hasCaseSensitive)
280
289
    {