示例#1
0
void KMFolder::setIgnoreNewMail( bool b )
{
  mIgnoreNewMail = b;
#ifdef INDICATEQT_FOUND
  if ( b && mIndicator ) {
    delete mIndicator;
    mIndicator = 0;
  } else if ( !b && !mIndicator ) {
    mIndicator = new QIndicate::Indicator( this );
    connect( mIndicator, SIGNAL( display( QIndicate::Indicator* ) ),
      SLOT( slotIndicatorClicked() ) );
    connect( mStorage, SIGNAL( numUnreadMsgsChanged( KMFolder* ) ),
      SLOT( updateIndicatorCount() ) );
    connect( this, SIGNAL( iconsChanged() ),
      SLOT( updateIndicatorIcon() ) );
    connect( kmkernel, SIGNAL( configChanged() ),
      SLOT( updateIndicatorCount() ) );

    // Update components of the indicator, but delay it because it's not good
    // to ask for a folder count while the application is still starting up
    // (for example search folder manager in KMKernel might not have been
    // initialized yet)
    QMetaObject::invokeMethod( this, "updateIndicatorText", Qt::QueuedConnection );
    QMetaObject::invokeMethod( this, "updateIndicatorIcon", Qt::QueuedConnection );
    QMetaObject::invokeMethod( this, "updateIndicatorCount", Qt::QueuedConnection );
  }
#endif
}
void IconProducer::onIconThemeChanged()
{
    // Oxygen and Breeze has these
    if (QIcon::hasThemeIcon("network-wired") &&
        QIcon::hasThemeIcon("network-connect") &&
        QIcon::hasThemeIcon("network-wireless-connected-00") &&
        QIcon::hasThemeIcon("network-wireless-connected-25") &&
        QIcon::hasThemeIcon("network-wireless-connected-50") &&
        QIcon::hasThemeIcon("network-wireless-connected-75") &&
        QIcon::hasThemeIcon("network-wireless-connected-100"))
    {
        iconThemeType = IconThemeType::oxygen;
    }
    else if (// Gnome and several other themes has these
             QIcon::hasThemeIcon("network-offline") &&
             QIcon::hasThemeIcon("network-wired") &&
             QIcon::hasThemeIcon("network-wireless-signal-none-symbolic") &&
             QIcon::hasThemeIcon("network-wireless-signal-weak-symbolic") &&
             QIcon::hasThemeIcon("network-wireless-signal-ok-symbolic") &&
             QIcon::hasThemeIcon("network-wireless-signal-good-symbolic") &&
             QIcon::hasThemeIcon("network-wireless-signal-excellent-symbolic"))
    {
        iconThemeType = IconThemeType::gnome;
    }
    else // Fallback to ugly built-in icons
    {
        iconThemeType = IconThemeType::none;
    }
    emit iconsChanged();
}
示例#3
0
void KMFolder::setIconPaths( const QString &normalPath,
                             const QString &unreadPath )
{
  mNormalIconPath = normalPath;
  mUnreadIconPath = unreadPath;
  mStorage->writeConfig();
  emit iconsChanged();
}
void IconProducer::onIconThemeChanged()
{
    qDebug() << "themeName:" << QIcon::themeName();

    if (QIcon::themeName() == "oxygen")
    {
        mWired_connected = QIcon::fromTheme("network-connect");
        mDisconnected = QIcon::fromTheme("network-wired");

        mWireless_signal_none      = QIcon::fromTheme("network-wireless-connected-00");
        mWireless_signal_weak      = QIcon::fromTheme("network-wireless-connected-25");
        mWireless_signal_ok        = QIcon::fromTheme("network-wireless-connected-50");
        mWireless_signal_good      = QIcon::fromTheme("network-wireless-connected-75");
        mWireless_signal_excellent = QIcon::fromTheme("network-wireless-connected-100");
    }
    else
    {
        // Most themes other than oxygen seems to have these two
        mDisconnected = QIcon::fromTheme("network-offline");
        mWired_connected = QIcon::fromTheme("network-wired");

        if (QIcon::hasThemeIcon("network-wireless-signal-none-symbolic") && // Gnome (and others) uses these
            QIcon::hasThemeIcon("network-wireless-signal-weak-symbolic") &&
            QIcon::hasThemeIcon("network-wireless-signal-ok-symbolic") &&
            QIcon::hasThemeIcon("network-wireless-signal-good-symbolic") &&
            QIcon::hasThemeIcon("network-wireless-signal-excellent-symbolic"))
        {
            mWireless_signal_none =      QIcon::fromTheme("network-wireless-signal-none-symbolic");
            mWireless_signal_weak =      QIcon::fromTheme("network-wireless-signal-weak-symbolic");
            mWireless_signal_ok =        QIcon::fromTheme("network-wireless-signal-ok-symbolic");
            mWireless_signal_good =      QIcon::fromTheme("network-wireless-signal-good-symbolic");
            mWireless_signal_excellent = QIcon::fromTheme("network-wireless-signal-excellent-symbolic");
        }
        else if (QIcon::hasThemeIcon("network-wireless-signal-none") &&   // AwOken (and others) uses these
                QIcon::hasThemeIcon("network-wireless-signal-weak") &&
                QIcon::hasThemeIcon("network-wireless-signal-ok") &&
                QIcon::hasThemeIcon("network-wireless-signal-good") &&
                QIcon::hasThemeIcon("network-wireless-signal-excellent"))
        {
        mWireless_signal_none =      QIcon::fromTheme("network-wireless-signal-none");
        mWireless_signal_weak =      QIcon::fromTheme("network-wireless-signal-weak");
        mWireless_signal_ok =        QIcon::fromTheme("network-wireless-signal-ok");
        mWireless_signal_good =      QIcon::fromTheme("network-wireless-signal-good");
        mWireless_signal_excellent = QIcon::fromTheme("network-wireless-signal-excellent");
        }
        else // Fallback to ugly built-in icons
        {
            mWireless_signal_none = mBuilt_in_wireless_signal_none;
            mWireless_signal_weak = mBuilt_in_wireless_signal_weak;
            mWireless_signal_ok = mBuilt_in_wireless_signal_ok;
            mWireless_signal_good = mBuilt_in_wireless_signal_good;
            mWireless_signal_excellent = mBuilt_in_wireless_signal_excellent;
        }
    }

    emit iconsChanged();
}
示例#5
0
void KMFolder::readConfig( KConfigGroup & configGroup )
{
  // KConfigGroup configGroup(config, "");
  if ( !configGroup.readEntry( "SystemLabel" ).isEmpty() )
    mSystemLabel = configGroup.readEntry( "SystemLabel" );
  mExpireMessages = configGroup.readEntry( "ExpireMessages", false );
  mReadExpireAge = configGroup.readEntry( "ReadExpireAge", 3 );
  mReadExpireUnits = (ExpireUnits)configGroup.readEntry( "ReadExpireUnits", (int)expireMonths );
  mUnreadExpireAge = configGroup.readEntry( "UnreadExpireAge", 12 );
  mUnreadExpireUnits = (ExpireUnits)
      configGroup.readEntry( "UnreadExpireUnits", (int)expireNever );
  mExpireAction = configGroup.readEntry( "ExpireAction", "Delete") == "Move" ? ExpireMove : ExpireDelete;
  mExpireToFolderId = configGroup.readEntry( "ExpireToFolder" );

  mUseCustomIcons = configGroup.readEntry( "UseCustomIcons", false );
  mNormalIconPath = configGroup.readEntry( "NormalIconPath" );
  mUnreadIconPath = configGroup.readEntry( "UnreadIconPath" );

  mMailingListEnabled = configGroup.readEntry( "MailingListEnabled", false );
  mMailingList.readConfig( configGroup );

  mUseDefaultIdentity = configGroup.readEntry( "UseDefaultIdentity", true );
  uint defaultIdentity = kmkernel->identityManager()->defaultIdentity().uoid();
  mIdentity = configGroup.readEntry("Identity", defaultIdentity );
  slotIdentitiesChanged();

  setUserWhoField( configGroup.readEntry( "WhoField" ), false );
  uint savedId = configGroup.readEntry( "Id", 0 );
  // make sure that we don't overwrite a valid id
  if ( savedId != 0 && mId == 0 )
    mId = savedId;
  mPutRepliesInSameFolder = configGroup.readEntry( "PutRepliesInSameFolder", false );
  mHideInSelectionDialog = configGroup.readEntry( "HideInSelectionDialog", false );
  setIgnoreNewMail( configGroup.readEntry( "IgnoreNewMail", false ) );

  if ( mUseCustomIcons )
    emit iconsChanged();

  QString shortcut( configGroup.readEntry( "Shortcut" ) );
  if ( !shortcut.isEmpty() ) {
    KShortcut sc( shortcut );
    setShortcut( sc );
  }
}
示例#6
0
void KMFolder::slotContentsTypeChanged( KMail::FolderContentsType type )
{
  kmkernel->iCalIface().folderContentsTypeChanged( this, type );
  emit iconsChanged();
}
示例#7
0
void SystemTray::invertTrayIconChanged(const QVariant& v)
{
    _trayIconInverted = v.toBool();
    emit iconsChanged();
}
示例#8
0
void Icona::addReceiver(const QObject *receiver, const char *receiverSlot)
{
    connect(_instance, SIGNAL(iconsChanged()), receiver, receiverSlot);
}
示例#9
0
void Icona::signalIconsChanged()
{
    emit iconsChanged();
}
示例#10
0
StatusNotifierItem::StatusNotifierItem(QWidget *parent)
    : StatusNotifierItemParent(parent)
#if QT_VERSION >= 0x050000
    , _iconThemeDir{QDir::tempPath() + QLatin1String{"/quassel-sni-XXXXXX"}}
#endif
{
    static bool registered = []() -> bool {
        qDBusRegisterMetaType<DBusImageStruct>();
        qDBusRegisterMetaType<DBusImageVector>();
        qDBusRegisterMetaType<DBusToolTipStruct>();
        return true;
    }();
    Q_UNUSED(registered)

    setMode(Mode::StatusNotifier);

    connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(onVisibilityChanged(bool)));
    connect(this, SIGNAL(modeChanged(Mode)), this, SLOT(onModeChanged(Mode)));
    connect(this, SIGNAL(stateChanged(State)), this, SLOT(onStateChanged(State)));

    trayMenu()->installEventFilter(this);

    // Create a temporary directory that holds copies of the tray icons. That way, visualizers can find our icons.
    // For Qt4 the relevant icons are installed in hicolor already, so nothing to be done.
#if QT_VERSION >= 0x050000
    if (_iconThemeDir.isValid()) {
        _iconThemePath = _iconThemeDir.path();
    }
    else {
        qWarning() << "Could not create temporary directory for themed tray icons!";
    }
#endif

    connect(this, SIGNAL(iconsChanged()), this, SLOT(refreshIcons()));
    refreshIcons();

    // Our own SNI service
    _statusNotifierItemDBus = new StatusNotifierItemDBus(this);
    connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewIcon()));
    connect(this, SIGNAL(currentIconNameChanged()), _statusNotifierItemDBus, SIGNAL(NewAttentionIcon()));
    connect(this, SIGNAL(toolTipChanged(QString, QString)), _statusNotifierItemDBus, SIGNAL(NewToolTip()));

    // Service watcher to keep track of the StatusNotifierWatcher service
    QDBusServiceWatcher *watcher = new QDBusServiceWatcher(kSniWatcherService,
                                                           QDBusConnection::sessionBus(),
                                                           QDBusServiceWatcher::WatchForOwnerChange,
                                                           this);
    connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), SLOT(serviceChange(QString, QString, QString)));

    // Client instance for StatusNotifierWatcher
    _statusNotifierWatcher = new org::kde::StatusNotifierWatcher(kSniWatcherService,
                                                                 kSniWatcherPath,
                                                                 QDBusConnection::sessionBus(),
                                                                 this);
    connect(_statusNotifierWatcher, SIGNAL(StatusNotifierHostRegistered()), SLOT(checkForRegisteredHosts()));
    connect(_statusNotifierWatcher, SIGNAL(StatusNotifierHostUnregistered()), SLOT(checkForRegisteredHosts()));

    // Client instance for notifications
    _notificationsClient = new org::freedesktop::Notifications(kXdgNotificationsService,
                                                               kXdgNotificationsPath,
                                                               QDBusConnection::sessionBus(),
                                                               this);
    connect(_notificationsClient, SIGNAL(NotificationClosed(uint, uint)), SLOT(notificationClosed(uint, uint)));
    connect(_notificationsClient, SIGNAL(ActionInvoked(uint, QString)), SLOT(notificationInvoked(uint, QString)));

    if (_notificationsClient->isValid()) {
        QStringList desktopCapabilities = _notificationsClient->GetCapabilities();
        _notificationsClientSupportsMarkup = desktopCapabilities.contains("body-markup");
        _notificationsClientSupportsActions = desktopCapabilities.contains("actions");
    }

#ifdef HAVE_DBUSMENU
    new QuasselDBusMenuExporter(menuObjectPath(), trayMenu(), _statusNotifierItemDBus->dbusConnection()); // will be added as menu child
#endif
}