~ubuntu-branches/ubuntu/vivid/kdepim/vivid

« back to all changes in this revision

Viewing changes to messagelist/core/theme.h

  • Committer: Package Import Robot
  • Author(s): Scott Kitterman, Jonathan Riddell, Rohan Garg, Scott Kitterman
  • Date: 2012-11-21 13:12:36 UTC
  • mfrom: (0.2.33)
  • Revision ID: package-import@ubuntu.com-20121121131236-32ijw9a2txrar80k
Tags: 4:4.9.80-0ubuntu1
[ Jonathan Riddell ]
* New upstream beta release

[ Rohan Garg ]
* Add nepomuk-core-dev to build-deps

[ Scott Kitterman ]
* Add new package, libpimcommon4
  - Add libpimcommon4.install
  - Add to debian/control, including kdepim-dbg and kdepim-dev depends
  - Add to kdepim-dev.install
* Remove usr/bin/backupmail and related files from kmail.install as they are
  not provided by upstream anymore
* Add usr/bin/pimsettingexporter and related files to kmail.install
* Add libnepomukwidgets-dev to build-depends

Show diffs side-by-side

added added

removed removed

Lines of Context:
262
262
     * Returns the type of this content item
263
263
     */
264
264
    Type type() const
265
 
      { return mType; };
 
265
      { return mType; }
266
266
 
267
267
    /**
268
268
     * Returns true if this ContentItem can be in a "disabled" state.
271
271
     * and SoftenByBlendingWhenDisabled flags are meaningful.
272
272
     */
273
273
    bool canBeDisabled() const
274
 
      { return ( static_cast< int >( mType ) & CanBeDisabled ) != 0; };
 
274
      { return ( static_cast< int >( mType ) & CanBeDisabled ) != 0; }
275
275
 
276
276
    /**
277
277
     * Returns true if this ContentItem can make use of a custom color.
278
278
     */
279
279
    bool canUseCustomColor() const
280
 
      { return ( static_cast< int >( mType ) & CanUseCustomColor ) != 0; };
 
280
      { return ( static_cast< int >( mType ) & CanUseCustomColor ) != 0; }
281
281
 
282
282
    /**
283
283
     * Returns true if this item displays some kind of text.
284
284
     * Items that display text make use of the customFont() setting.
285
285
     */
286
286
    bool displaysText() const
287
 
      { return ( static_cast< int >( mType ) & DisplaysText ) != 0; };
 
287
      { return ( static_cast< int >( mType ) & DisplaysText ) != 0; }
288
288
 
289
289
    /**
290
290
     * Returns true if this item displays a long text.
291
291
     * The returned value makes sense only if displaysText() returned true.
292
292
     */
293
293
    bool displaysLongText() const
294
 
      { return ( static_cast< int >( mType ) & LongText ) != 0; };
 
294
      { return ( static_cast< int >( mType ) & LongText ) != 0; }
295
295
 
296
296
    /**
297
297
     * Returns true if this item displays an icon.
298
298
     */
299
299
    bool isIcon() const
300
 
      { return ( static_cast< int >( mType ) & IsIcon ) != 0; };
301
 
 
 
300
      { return ( static_cast< int >( mType ) & IsIcon ) != 0; }
302
301
    /**
303
302
     * Returns true if clicking on this kind of item can perform an action
304
303
     */
305
304
    bool isClickable() const
306
 
      { return ( static_cast< int >( mType ) & IsClickable ) != 0; };
 
305
      { return ( static_cast< int >( mType ) & IsClickable ) != 0; }
307
306
 
308
307
    /**
309
308
     * Returns true if this item is a small spacer
310
309
     */
311
310
    bool isSpacer() const
312
 
      { return ( static_cast< int >( mType ) & IsSpacer ) != 0; };
 
311
      { return ( static_cast< int >( mType ) & IsSpacer ) != 0; }
313
312
 
314
313
    /**
315
314
     * Static test that returns true if an instance of ContentItem with the
333
332
     * The return value of this function is valid only if canUseCustomColor() returns true.
334
333
     */
335
334
    bool useCustomColor() const
336
 
      { return mFlags & UseCustomColor; };
 
335
      { return mFlags & UseCustomColor; }
337
336
 
338
337
    /**
339
338
     * Makes this item use the custom color that can be set by setCustomColor().
340
339
     * The custom color is meaningful only if canUseCustomColor() returns true.
341
340
     */
342
341
    void setUseCustomColor( bool useCustomColor )
343
 
      { if ( useCustomColor )mFlags |= UseCustomColor; else mFlags &= ~UseCustomColor; };
 
342
      { if ( useCustomColor )mFlags |= UseCustomColor; else mFlags &= ~UseCustomColor; }
344
343
 
345
344
    /**
346
345
     * Returns true if this item uses a custom font.
347
346
     * The return value of this function is valid only if displaysText() returns true.
348
347
     */
349
348
    bool useCustomFont() const
350
 
      { return mFlags & UseCustomFont; };
 
349
      { return mFlags & UseCustomFont; }
351
350
 
352
351
    /**
353
352
     * Makes this item use the custom font that can be set by setCustomFont().
354
353
     * The custom font is meaningful only if canUseCustomFont() returns true.
355
354
     */
356
355
    void setUseCustomFont( bool useCustomFont )
357
 
      { if ( useCustomFont )mFlags |= UseCustomFont; else mFlags &= ~UseCustomFont; };
 
356
      { if ( useCustomFont )mFlags |= UseCustomFont; else mFlags &= ~UseCustomFont; }
358
357
 
359
358
    /**
360
359
     * Returns true if this item should be hidden when in disabled state.
362
361
     * This flag has meaning only on items for that canBeDisabled() returns true.
363
362
     */
364
363
    bool hideWhenDisabled() const
365
 
      { return mFlags & HideWhenDisabled; };
 
364
      { return mFlags & HideWhenDisabled; }
366
365
 
367
366
    /**
368
367
     * Sets the flag that causes this item to be hidden when disabled.
371
370
     * This flag has meaning only on items for that canBeDisabled() returns true.
372
371
     */
373
372
    void setHideWhenDisabled( bool hideWhenDisabled )
374
 
      { if ( hideWhenDisabled )mFlags |= HideWhenDisabled; else mFlags &= ~HideWhenDisabled; };
 
373
      { if ( hideWhenDisabled )mFlags |= HideWhenDisabled; else mFlags &= ~HideWhenDisabled; }
375
374
 
376
375
    /**
377
376
     * Returns true if this item should be painted in a "soft" fashion when
379
378
     * This flag has meaning only on items for that canBeDisabled() returns true.
380
379
     */
381
380
    bool softenByBlendingWhenDisabled() const
382
 
      { return mFlags & SoftenByBlendingWhenDisabled; };
 
381
      { return mFlags & SoftenByBlendingWhenDisabled; }
383
382
 
384
383
    /**
385
384
     * Sets the flag that causes this item to be painted "softly" when disabled.
388
387
     * This flag has meaning only on items for that canBeDisabled() returns true.
389
388
     */
390
389
    void setSoftenByBlendingWhenDisabled( bool softenByBlendingWhenDisabled )
391
 
      { if ( softenByBlendingWhenDisabled )mFlags |= SoftenByBlendingWhenDisabled; else mFlags &= ~SoftenByBlendingWhenDisabled; };
 
390
      { if ( softenByBlendingWhenDisabled )mFlags |= SoftenByBlendingWhenDisabled; else mFlags &= ~SoftenByBlendingWhenDisabled; }
392
391
 
393
392
    /**
394
393
     * Returns true if this item should be always painted in a "soft" fashion.
395
394
     * Meaningful only for text items.
396
395
     */
397
396
    bool softenByBlending() const
398
 
      { return mFlags & SoftenByBlending; };
 
397
      { return mFlags & SoftenByBlending; }
399
398
 
400
399
    /**
401
400
     * Sets the flag that causes this item to be painted "softly".
402
401
     * Meaningful only for text items.
403
402
     */
404
403
    void setSoftenByBlending( bool softenByBlending )
405
 
      { if ( softenByBlending )mFlags |= SoftenByBlending; else mFlags &= ~SoftenByBlending; };
 
404
      { if ( softenByBlending )mFlags |= SoftenByBlending; else mFlags &= ~SoftenByBlending; }
406
405
 
407
406
    /**
408
407
     * Sets the custom font to be used with this item.
418
417
     * with the appropriate paint device.
419
418
     */
420
419
    const QFont & font() const
421
 
      { return mFont; };
 
420
      { return mFont; }
422
421
 
423
422
    /**
424
423
     * Returns the font key used by this item. It may be a custom font key set by setFont()
428
427
     * It is primary used to avoid to calculate the key every time an item is displayed.
429
428
     */
430
429
    const QString & fontKey() const
431
 
      { return mFontKey; };
 
430
      { return mFontKey; }
432
431
 
433
432
    /**
434
433
     * Returns the custom color set for this item.
436
435
     * returns true and setUseCustomColor( true ) has been called.
437
436
     */
438
437
    const QColor & customColor() const
439
 
      { return mCustomColor; };
 
438
      { return mCustomColor; }
440
439
 
441
440
    /**
442
441
     * Sets the custom color for this item. Meaningful only if canUseCustomColor()
443
442
     * returns true and you call setUseCustomColor( true )
444
443
     */
445
444
    void setCustomColor( const QColor &clr )
446
 
      { mCustomColor = clr; };
 
445
      { mCustomColor = clr; }
447
446
 
448
447
    // Stuff used by ThemeDelegate. This section should be protected but some gcc
449
448
    // versions seem to get confused with nested class and friend declarations
480
479
     * Returns the list of left aligned items for this row
481
480
     */
482
481
    const QList< ContentItem * > & leftItems() const
483
 
      { return mLeftItems; };
 
482
      { return mLeftItems; }
484
483
 
485
484
    /**
486
485
     * Removes all the left items from this row: the items are deleted.
492
491
     * of the ContentItem pointer.
493
492
     */
494
493
    void addLeftItem( ContentItem * item )
495
 
      { mLeftItems.append( item ); };
 
494
      { mLeftItems.append( item ); }
496
495
 
497
496
    /**
498
497
     * Adds a left aligned item at the specified position in this row. The row takes the ownership
505
504
     * The item is NOT deleted.
506
505
     */
507
506
    void removeLeftItem( ContentItem * item )
508
 
      { mLeftItems.removeAll( item ); };
 
507
      { mLeftItems.removeAll( item ); }
509
508
 
510
509
    /**
511
510
     * Returns the list of right aligned items for this row
512
511
     */
513
512
    const QList< ContentItem * > & rightItems() const
514
 
      { return mRightItems; };
 
513
      { return mRightItems; }
515
514
 
516
515
    /**
517
516
     * Removes all the right items from this row. The items are deleted.
524
523
     * will start at the right edge, the second right aligned item will come after it etc...
525
524
     */
526
525
    void addRightItem( ContentItem * item )
527
 
      { mRightItems.append( item ); };
 
526
      { mRightItems.append( item ); }
528
527
 
529
528
    /**
530
529
     * Adds a right aligned item at the specified position in this row. The row takes the ownership
537
536
     * The item is NOT deleted.
538
537
     */
539
538
    void removeRightItem( ContentItem * item )
540
 
      { mRightItems.removeAll( item ); };
 
539
      { mRightItems.removeAll( item ); }
541
540
 
542
541
    /**
543
542
     * Returns true if this row contains text items.
603
602
         * Theme::Column objects that use this SharedRuntimeData instance.
604
603
         */
605
604
        int referenceCount() const 
606
 
          { return mReferences; };
 
605
          { return mReferences; }
607
606
 
608
607
        /**
609
608
         * Returns the current visibility state
610
609
         */
611
610
        bool currentlyVisible() const
612
 
          { return mCurrentlyVisible; };
 
611
          { return mCurrentlyVisible; }
613
612
 
614
613
        /**
615
614
         * Sets the current visibility state
616
615
         */
617
616
        void setCurrentlyVisible( bool visible )
618
 
          { mCurrentlyVisible = visible; };
 
617
          { mCurrentlyVisible = visible; }
619
618
 
620
619
        /**
621
620
         * Returns the current width or -1 if the width is unspecified/invalid
622
621
         */
623
622
        int currentWidth() const
624
 
          { return mCurrentWidth; };
 
623
          { return mCurrentWidth; }
625
624
 
626
625
        /**
627
626
         * Sets the current width of the column
628
627
         */
629
628
        void setCurrentWidth( int currentWidth )
630
 
          { mCurrentWidth = currentWidth; };
 
629
          { mCurrentWidth = currentWidth; }
631
630
 
632
631
        /**
633
632
         * Saves this runtime data to the specified stream
673
672
     * Returns the label set for this column
674
673
     */
675
674
    const QString & label() const
676
 
      { return mLabel; };
 
675
      { return mLabel; }
677
676
 
678
677
    /**
679
678
     * Sets the label for this column
680
679
     */
681
680
    void setLabel( const QString &label )
682
 
      { mLabel = label; };
 
681
      { mLabel = label; }
683
682
 
684
683
    /**
685
684
     * Returns the icon's name (used in SmallIcon) set for this column
691
690
     * Sets the icon's name (used in SmallIcon) for this column
692
691
     */
693
692
    void setPixmapName( const QString &pixmapName )
694
 
      { mPixmapName = pixmapName; };
 
693
      { mPixmapName = pixmapName; }
695
694
 
696
695
    /**
697
696
     * Returns true if this column is marked as "sender/receiver" and we should
698
697
     * update its label on-the-fly.
699
698
     */
700
699
    bool isSenderOrReceiver() const
701
 
      { return mIsSenderOrReceiver; };
 
700
      { return mIsSenderOrReceiver; }
702
701
 
703
702
    /**
704
703
     * Marks this column as containing the "sender/receiver" field.
705
704
     * Such columns will have the label automatically updated.
706
705
     */
707
706
    void setIsSenderOrReceiver( bool sor )
708
 
      { mIsSenderOrReceiver = sor; };
 
707
      { mIsSenderOrReceiver = sor; }
709
708
 
710
709
    /**
711
710
     * Returns true if this column has to be shown by default
712
711
     */
713
712
    bool visibleByDefault() const
714
 
      { return mVisibleByDefault; };
 
713
      { return mVisibleByDefault; }
715
714
 
716
715
    /**
717
716
     * Sets the "visible by default" tag for this column.
718
717
     */
719
718
    void setVisibleByDefault( bool vbd )
720
 
      { mVisibleByDefault = vbd; };
 
719
      { mVisibleByDefault = vbd; }
721
720
 
722
721
    /**
723
722
     * Detaches the shared runtime data object and makes this object
730
729
     * when clicking on this column's header (if visible at all).
731
730
     */
732
731
    SortOrder::MessageSorting messageSorting() const
733
 
      { return mMessageSorting; };
 
732
      { return mMessageSorting; }
734
733
 
735
734
    /**
736
735
     * Sets the sort order for messages that we should switch to
737
736
     * when clicking on this column's header (if visible at all).
738
737
     */
739
738
    void setMessageSorting( SortOrder::MessageSorting ms )
740
 
      { mMessageSorting = ms; };
 
739
      { mMessageSorting = ms; }
741
740
 
742
741
    /**
743
742
     * Returns the current shared visibility state for this column.
744
743
     * This state is shared between all the instances of this theme.
745
744
     */
746
745
    bool currentlyVisible() const
747
 
      { return mSharedRuntimeData->currentlyVisible(); };
 
746
      { return mSharedRuntimeData->currentlyVisible(); }
748
747
 
749
748
    /**
750
749
     * Sets the current shared visibility state for this column.
751
750
     * This state is shared between all the instances of this theme.
752
751
     */
753
752
    void setCurrentlyVisible( bool currentlyVisible )
754
 
      { mSharedRuntimeData->setCurrentlyVisible( currentlyVisible ); };
 
753
      { mSharedRuntimeData->setCurrentlyVisible( currentlyVisible ); }
755
754
 
756
755
    /**
757
756
     * Returns the current shared width setting for this column
759
758
     * This state is shared between all the instances of this theme.
760
759
     */
761
760
    int currentWidth() const
762
 
      { return mSharedRuntimeData->currentWidth(); };
 
761
      { return mSharedRuntimeData->currentWidth(); }
763
762
 
764
763
    /**
765
764
     * Sets the current shared width setting for this column.
766
765
     * This state is shared between all the instances of this theme.
767
766
     */
768
767
    void setCurrentWidth( int currentWidth )
769
 
      { mSharedRuntimeData->setCurrentWidth( currentWidth ); };
 
768
      { mSharedRuntimeData->setCurrentWidth( currentWidth ); }
770
769
 
771
770
    /**
772
771
     * Returns the list of rows visible in this column for a MessageItem
773
772
     */
774
773
    const QList< Row * > & messageRows() const
775
 
      { return mMessageRows; };
 
774
      { return mMessageRows; }
776
775
 
777
776
    /**
778
777
     * Removes all the message rows from this column.
784
783
     * the ownership of the Row pointer.
785
784
     */
786
785
    void addMessageRow( Row * row )
787
 
      { mMessageRows.append( row ); };
 
786
      { mMessageRows.append( row ); }
788
787
 
789
788
    /**
790
789
     * Inserts a message row to this theme column in the specified position. The Theme takes
796
795
     * Removes the specified message row. The row is NOT deleted.
797
796
     */
798
797
    void removeMessageRow( Row * row )
799
 
      { mMessageRows.removeAll( row ); };
 
798
      { mMessageRows.removeAll( row ); }
800
799
 
801
800
    /**
802
801
     * Returns the list of rows visible in this column for a GroupHeaderItem
803
802
     */
804
803
    const QList< Row * > & groupHeaderRows() const
805
 
      { return mGroupHeaderRows; };
 
804
      { return mGroupHeaderRows; }
806
805
 
807
806
    /**
808
807
     * Removes all the group header rows from this column.
814
813
     * the ownership of the Row pointer.
815
814
     */
816
815
    void addGroupHeaderRow( Row * row )
817
 
      { mGroupHeaderRows.append( row ); };
 
816
      { mGroupHeaderRows.append( row ); }
818
817
 
819
818
    /**
820
819
     * Inserts a group header row to this theme column in the specified position. The Theme takes
826
825
     * Removes the specified group header row. The row is NOT deleted.
827
826
     */
828
827
    void removeGroupHeaderRow( Row * row )
829
 
      { mGroupHeaderRows.removeAll( row ); };
 
828
      { mGroupHeaderRows.removeAll( row ); }
830
829
 
831
830
    /**
832
831
     * Returns true if this column contains text items.
939
938
   * Returns the list of columns available in this theme
940
939
   */
941
940
  const QList< Column * > & columns() const
942
 
    { return mColumns; };
 
941
    { return mColumns; }
943
942
 
944
943
  /**
945
944
   * Returns a pointer to the column at the specified index or 0 if there is no such column
946
945
   */
947
946
  Column * column( int idx ) const
948
 
    { return mColumns.count() > idx ? mColumns.at( idx ) : 0; };
 
947
    { return mColumns.count() > idx ? mColumns.at( idx ) : 0; }
 
948
 
 
949
  void moveColumn(int idx, int newPosition);
949
950
 
950
951
  /**
951
952
   * Removes all columns from this theme
956
957
   * Appends a column to this theme
957
958
   */
958
959
  void addColumn( Column * column )
959
 
    { mColumns.append( column ); };
 
960
    { mColumns.append( column ); }
960
961
 
961
962
  /**
962
963
   * Inserts a column to this theme at the specified position.
967
968
   * Removes the specified message row. The row is NOT deleted.
968
969
   */
969
970
  void removeColumn( Column * col )
970
 
    { mColumns.removeAll( col ); };
 
971
    { mColumns.removeAll( col ); }
971
972
 
972
973
  /**
973
974
   * Returns the group header background mode for this theme.
974
975
   */
975
976
  GroupHeaderBackgroundMode groupHeaderBackgroundMode() const
976
 
    { return mGroupHeaderBackgroundMode; };
 
977
    { return mGroupHeaderBackgroundMode; }
977
978
 
978
979
  /**
979
980
   * Sets the group header background mode for this theme.
986
987
   * This color is used only if groupHeaderBackgroundMode() is set to CustomColor.
987
988
   */
988
989
  const QColor & groupHeaderBackgroundColor() const
989
 
    { return mGroupHeaderBackgroundColor; };
 
990
    { return mGroupHeaderBackgroundColor; }
990
991
 
991
992
  /**
992
993
   * Sets the group header background color for this theme.
993
994
   * This color is used only if groupHeaderBackgroundMode() is set to CustomColor.
994
995
   */
995
996
  void setGroupHeaderBackgroundColor( const QColor &clr )
996
 
    { mGroupHeaderBackgroundColor = clr; };
 
997
    { mGroupHeaderBackgroundColor = clr; }
997
998
 
998
999
  /**
999
1000
   * Returns the group header background style for this theme.
1001
1002
   * set to something different than Transparent.
1002
1003
   */
1003
1004
  GroupHeaderBackgroundStyle groupHeaderBackgroundStyle() const
1004
 
    { return mGroupHeaderBackgroundStyle; };
 
1005
    { return mGroupHeaderBackgroundStyle; }
1005
1006
 
1006
1007
  /**
1007
1008
   * Sets the group header background style for this theme.
1009
1010
   * set to something different than Transparent.
1010
1011
   */
1011
1012
  void setGroupHeaderBackgroundStyle( GroupHeaderBackgroundStyle groupHeaderBackgroundStyle )
1012
 
    { mGroupHeaderBackgroundStyle = groupHeaderBackgroundStyle; };
 
1013
    { mGroupHeaderBackgroundStyle = groupHeaderBackgroundStyle; }
1013
1014
 
1014
1015
  /**
1015
1016
   * Enumerates the available group header background styles.
1022
1023
   * Returns the currently set ViewHeaderPolicy
1023
1024
   */
1024
1025
  ViewHeaderPolicy viewHeaderPolicy() const
1025
 
    { return mViewHeaderPolicy; };
 
1026
    { return mViewHeaderPolicy; }
1026
1027
 
1027
1028
  /**
1028
1029
   * Sets the ViewHeaderPolicy for this theme
1029
1030
   */
1030
1031
  void setViewHeaderPolicy( ViewHeaderPolicy vhp )
1031
 
    { mViewHeaderPolicy = vhp; };
 
1032
    { mViewHeaderPolicy = vhp; }
1032
1033
 
1033
1034
  /**
1034
1035
   * Returns the currently set icon size
1035
1036
   */
1036
1037
  int iconSize() const
1037
 
    { return mIconSize; };
 
1038
    { return mIconSize; }
1038
1039
 
1039
1040
  /**
1040
1041
   * Sets the icon size for this theme.