Example #1
0
void WPAccount::slotGotNewMessage(const QString &Body, const QDateTime &Arrival, const QString &From)
{
//	kdDebug(14170) <<  "WPAccount::slotGotNewMessage(" << Body << ", " << Arrival.toString() << ", " << From << ")" << endl;

	// Ignore messages from own host or IPs.
	// IPs can not be matched to an account anyway.
	// This should happen rarely but they make kopete crash.
	// The reason for this seems to be in ChatSessionManager? GF
	QRegExp ip("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");

//	kdDebug(14170) << "ip.search: " << From << " match: " << ip.search(From) << endl;

	if (From == accountId() || ip.exactMatch(From)) {
		kdDebug(14170) << "Ignoring message from own host/account or IP." << endl;
		return;
	}

	if (isConnected()) {
		if (!isAway()) {
			if(!contacts()[From]) {
				addContact(From, From, 0, Kopete::Account::DontChangeKABC);
			}
			static_cast<WPContact *>(contacts()[From])->slotNewMessage(Body, Arrival);
		}
		else {
			if (!theAwayMessage.isEmpty()) mProtocol->sendMessage(theAwayMessage, From);
		}
	 } else {
		// What to do with offline received messages?
		kdDebug(14170) << "That's strange - we got a message while offline! Ignoring." << endl;
	}
}
Example #2
0
void SoundNotifier::notify(const Notification &notification)
{
	auto chat = notification.data["chat"].value<Chat>();
	if (chat && chat.property("sound:use_custom_sound", false).toBool())
	{
		// we need abstraction for that
		auto customSound = chat.property("sound:custom_sound", QString{}).toString();
		auto fileInfo = QFileInfo{customSound};
		if (fileInfo.exists())
		{
			m_soundManager->playFile(customSound);
			return;
		}
	}

	if (!chat.contacts().isEmpty())
	{
		auto buddy = chat.contacts().begin()->ownerBuddy();
		if (buddy && buddy.property("sound:use_custom_sound", false).toBool())
		{
			auto customSound = buddy.property("sound:custom_sound", QString{}).toString();
			auto fileInfo = QFileInfo{customSound};
			if (fileInfo.exists())
			{
				m_soundManager->playFile(customSound);
				return;
			}
		}
	}

	auto key = m_notificationConfiguration->notifyConfigurationKey(notification.type);
	m_soundManager->playSoundByName(key);
}
Example #3
0
void gui_filterbar_c::get_link_prolog(ts::wstr_c &r, int linknum) const
{
    bool is_active = false;
    if (linknum < BIT_count)
    {
        is_active = 0 != (bitags & (1 << linknum));
    } else
    {
        is_active = contacts().is_tag_enabled(linknum - BIT_count);
    }

    bool all = (0 != (bitags & (1 << BIT_ALL))) && linknum != BIT_ALL;

    ts::TSCOLOR c;
    if (linknum == overlink)
    {
        r.set(CONSTWSTR("<u>"));
        c = get_default_text_color(is_active ? ( all ? COL_ACTIVE_MUTED_HOVER : COL_ACTIVE_HOVER) : COL_INACTIVE_HOVER);
    } else
    {
        c = get_default_text_color(is_active ? (all ? COL_ACTIVE_MUTED : COL_ACTIVE) : COL_INACTIVE);
    }
    r.append(CONSTWSTR("<color=#")).append_as_hex(ts::RED(c))
        .append_as_hex(ts::GREEN(c))
        .append_as_hex(ts::BLUE(c))
        .append_as_hex(ts::ALPHA(c))
        .append_char('>');

}
Example #4
0
void GaduRosterService::exportContactList()
{
	if (!m_connection || !m_connection.data()->hasSession())
	{
		putFinished(false);
		return;
	}

	m_synchronizingContacts = contacts();
	for (auto &&contact : m_synchronizingContacts)
		contact.rosterEntry()->setSynchronizingToRemote();

	auto contacts = m_gaduListHelper->contactListToByteArray(m_synchronizingContacts);

	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "\n%s\n", contacts.constData());

	auto accountData = GaduAccountData{account()};
	auto writableSessionToken = m_connection.data()->writableSessionToken();
	auto ret = gg_userlist100_request(writableSessionToken.rawSession(),
			GG_USERLIST100_PUT, accountData.userlistVersion(), GG_USERLIST100_FORMAT_TYPE_GG70, contacts.constData());
	if (-1 == ret)
	{
		markSynchronizingAsSynchronized();
		putFinished(false);
	}
}
Example #5
0
ts::uint32 active_protocol_c::gm_handler(gmsg<ISOGM_MESSAGE>&msg) // send message to other peer
{
    if (msg.pass == 0 && msg.post.sender.is_self()) // handle only self-to-other messages
    {
        if (msg.post.receiver.protoid != id)
            return 0;

        contact_c *target = contacts().find( msg.post.receiver );
        if (!target) return 0;


        for(;;)
        {
            if (CS_INVITE_RECEIVE == target->get_state() || CS_INVITE_SEND == target->get_state())
                if (0 != (get_features() & PF_UNAUTHORIZED_CHAT))
                    break;

            if (0 == (get_features() & PF_OFFLINE_MESSAGING))
                if (target->get_state() != CS_ONLINE)
                    return 0;

            break;
        }

        if (typingsendcontact == target->getkey().contactid)
            typingsendcontact = 0;

        ipcp->send( ipcw(AQ_MESSAGE ) << target->getkey().contactid << (int)MTA_MESSAGE << msg.post.utag << msg.post.cr_time << msg.post.message_utf8 );
    }
    return 0;
}
Example #6
0
void IRCAccount::updateContactStatus()
{
	QHashIterator<QString, Kopete::Contact*>itr( contacts() );
	for ( ; itr.hasNext(); ) {
		itr.next();
		itr.value()->setOnlineStatus( myself()->onlineStatus() );
	}
}
Example #7
0
void                    UserWin::refreshList()
{
    std::string         contacts(_dataSC->_infos);

    this->refreshContacts(QString::fromStdString(contacts));
    this->_modelOn.setStringList(this->getContactOn());
    this->_modelOff.setStringList(this->getContactOff());
}
Example #8
0
ts::uint32 active_protocol_c::gm_handler(gmsg<GM_UI_EVENT>&e)
{
    if (UE_THEMECHANGED == e.evt)
    {
        // self avatar must be recreated to fit new gui theme
        set_avatar( contacts().find_subself(id) );
        icons_cache.clear(); // FREE MEMORY
    }
    return 0;
}
Example #9
0
ts::uint32 active_protocol_c::gm_handler(gmsg<ISOGM_CHANGED_SETTINGS>&ch)
{
    if (ch.pass == 0 && ipcp && (ch.protoid == 0 || ch.protoid == id))
    {
        switch (ch.sp)
        {
        case PP_USERNAME:
            if (ch.protoid == id)
            {
                syncdata.lock_write()().data.user_name = ch.s;
                ipcp->send(ipcw(AQ_SET_NAME) << ch.s);
            } else if (syncdata.lock_read()().data.user_name.is_empty())
                ipcp->send(ipcw(AQ_SET_NAME) << ch.s);
            return GMRBIT_CALLAGAIN;
        case PP_USERSTATUSMSG:
            if (ch.protoid == id)
            {
                syncdata.lock_write()().data.user_statusmsg = ch.s;
                ipcp->send(ipcw(AQ_SET_STATUSMSG) << ch.s);
            } else if (syncdata.lock_read()().data.user_statusmsg.is_empty())
                ipcp->send(ipcw(AQ_SET_STATUSMSG) << ch.s);
            return GMRBIT_CALLAGAIN;
        case PP_NETWORKNAME:
            if (ch.protoid == id)
                syncdata.lock_write()().data.name = ch.s;
            return GMRBIT_CALLAGAIN;
        case PP_ONLINESTATUS:
            if (contact_c *c = contacts().get_self().subget( contact_key_s(0, id) ))
                set_ostate(c->get_ostate());
            break;
        case PP_PROFILEOPTIONS:
            if (0 != (ch.bits & UIOPT_PROTOICONS) && !prf().get_options().is(UIOPT_PROTOICONS))
                icons_cache.clear(); // FREE MEMORY
            break;
        case CFG_TALKVOLUME:
            syncdata.lock_write()().volume = cfg().vol_talk();
            break;
        case CFG_MICVOLUME:
            cvt.volume = cfg().vol_mic();
            break;
        case CFG_DSPFLAGS:
        {
            int flags = cfg().dsp_flags();
            cvt.filter_options.init( fmt_converter_s::FO_NOISE_REDUCTION, FLAG(flags, DSP_MIC_NOISE) );
            cvt.filter_options.init( fmt_converter_s::FO_GAINER, FLAG(flags, DSP_MIC_AGC) );
            syncdata.lock_write()().dsp_flags = flags;
        }
        break;
        case CFG_DEBUG:
            push_debug_settings();
            break;
        }
    }
    return 0;
}
/*!
 * The contact database version implementation for QContactManager::contacts
 * function. See filterSupported for the list of supported filters.
 * All the other filtering flags fallback to the generic filtering done
 * in QContactManagerEngine (expected to be done by to the caller). Contacts
 * are sorted only if the sort order is supported by contacts database. See
 * CntSymbianSorterDbms::filterSupportLevel for the list of supported sort
 * orders.
 * 
 * Using detail filter with match flag MatchPhoneNumber is implemented by the
 * contact model "phone number match" that filters by comparing the search
 * string characters (digits) starting from the rightmost digit. The detail
 * filter value must be at least 7 digits, otherwise an error code
 * NotSupportedError is given. The actual digit count that is used is 7 to 15
 * digits, depending on the configuration of the device.
 *
 * \a filter The QContactFilter to be used.
 * \a sortOrders The sort orders to be used. If the sort orders are not
 * supported by contacts database this parameter is ignored and sorting needs
 * to be done by the caller.
 * \a error On return, contains the possible error in filtering/sorting.
 */
QList<QContactLocalId> CntSymbianFilter::contacts(
    const QContactFilter &filter,
    const QList<QContactSortOrder> &sortOrders,
    bool &filterSupportedFlag,
    QContactManager::Error* error)
{
    QList<QContactLocalId> result;

    // No need to proceed if some of the filters in the chain is not supported
    if(!filterSupportedFlag) return result;

    // Intersection filter is handled by a recursive function call for each
    // contained filter (unless at least one requires slow filtering)
    if (filter.type() == QContactFilter::IntersectionFilter) {
        QList<QContactFilter> filters = ((QContactIntersectionFilter) filter).filters();
        for(int i(0); filterSupportedFlag && i < filters.count(); i++) {
            if(result.isEmpty())
                result = contacts(filters[i], sortOrders, filterSupportedFlag, error);
            else
                result = contacts(filters[i], sortOrders, filterSupportedFlag, error).toSet().intersect(result.toSet()).toList();
        }
    // Union filter is handled by a recursive function call for each
    // contained filter (unless at least one requires slow filtering)
    } else if (filter.type() == QContactFilter::UnionFilter) {
        QList<QContactFilter> filters = ((QContactUnionFilter) filter).filters();
        for(int i(0); filterSupportedFlag && i < filters.count(); i++) {
            if(result.isEmpty())
                result = contacts(filters[i], sortOrders, filterSupportedFlag, error);
            else
                result = (contacts(filters[i], sortOrders, filterSupportedFlag, error).toSet() + result.toSet()).toList();
        }
    // Detail filter with a string list is split and re-constructed into
    // an intersection filter
    } else if (filter.type() == QContactFilter::ContactDetailFilter
            && (static_cast<const QContactDetailFilter &>(filter)).value().type() == QVariant::StringList) {
        QStringList values = (static_cast<const QContactDetailFilter &>(filter)).value().toStringList();
        QContactIntersectionFilter intersectionFilter;
        foreach(const QString& value, values) {
            QContactDetailFilter detailFilter = filter;
            detailFilter.setValue(value);
            intersectionFilter.append(detailFilter);
        }
Example #11
0
File: save.c Project: OPSF/uClinux
/*
 * Process REGISTER request and save it's contacts
 */
static inline int save_real(struct sip_msg* _m, udomain_t* _t, char* _s, int doreply)
{
	contact_t* c;
	int st;
	str aor, ua;

	rerrno = R_FINE;

	if (parse_message(_m) < 0) {
		goto error;
	}

	if (check_contacts(_m, &st) > 0) {
		goto error;
	}
	
	get_act_time();
	c = get_first_contact(_m);

	if (extract_aor(&get_to(_m)->uri, &aor) < 0) {
		LOG(L_ERR, "save(): Error while extracting Address Of Record\n");
		goto error;
	}

	ua.len = 0;
	if (parse_headers(_m, HDR_USERAGENT, 0) != -1 && _m->user_agent &&
	    _m->user_agent->body.len > 0) {
		ua.len = _m->user_agent->body.len;
		ua.s = _m->user_agent->body.s;
	}
	if (ua.len == 0) {
		ua.len = UA_DUMMY_LEN;
		ua.s = UA_DUMMY_STR;
	}

	if (c == 0) {
		if (st) {
			if (star(_t, &aor) < 0) goto error;
		} else {
			if (no_contacts(_t, &aor) < 0) goto error;
		}
	} else {
		if (contacts(_m, c, _t, &aor, &ua) < 0) goto error;
	}

	if (doreply && (send_reply(_m) < 0)) return -1;
	else return 1;
	
 error:
	if (doreply) send_reply(_m);
	return 0;
}
Example #12
0
bool WPAccount::createContact(const QString &contactId, Kopete::MetaContact *parentContact )
{
//	kdDebug(14170) << "[WPAccount::createContact] contactId: " << contactId << endl;

	if (!contacts()[contactId]) {
		WPContact *newContact = new WPContact(this, contactId, parentContact->displayName(), parentContact);
		return newContact != 0;
	} else {
		kdDebug(14170) << "[WPAccount::addContact] Contact already exists" << endl;
	}

	return false;
}
Example #13
0
bool gui_filterbar_c::do_contact_check(RID, GUIPARAM p)
{
    for (int n = ts::tmax(1, contacts().count() / 10 ); contact_index < contacts().count() && n > 0; --n)
    {
        contact_c &c = contacts().get(contact_index++);
        if (c.is_rootcontact())
        {
            contact_root_c *cr = ts::ptr_cast<contact_root_c *>(&c);

            if (cr->is_full_search_result())
            {
                cr->full_search_result(false);
                if (cr->gui_item) cr->gui_item->update_text();
            }

            if (cr->gui_item)
            {
                MODIFY(*cr->gui_item).visible(check_one(cr));
            }
        }
    }

    if (contact_index < contacts().count())
    {
        if (active)
        {
            gui_contactlist_c &cl = HOLD(getparent()).as<gui_contactlist_c>();
            cl.scroll_to_child(active, false);
        }
        DEFERRED_UNIQUE_CALL(0, DELEGATE(this, do_contact_check), 0);
    }
    else
    {
        apply_full_text_search_result();
    }

    return true;
}
Example #14
0
/*virtual*/ void mainrect_c::created()
{
    defaultthrdraw = DTHRO_BORDER | /*DTHRO_CENTER_HOLE |*/ DTHRO_CAPTION | DTHRO_CAPTION_TEXT;
    set_theme_rect(CONSTASTR("mainrect"), false);
    __super::created();
    gui->make_app_buttons( m_rid );

    auto uiroot = [](RID p)->RID
    {
        gui_hgroup_c &g = MAKE_VISIBLE_CHILD<gui_hgroup_c>(p);
        g.allow_move_splitter(true);
        g.leech(TSNEW(leech_fill_parent_s));
        g.leech(TSNEW(leech_save_proportions_s, CONSTASTR("main_splitter"), CONSTASTR("7060,12940")));
        return g.getrid();
    };

    RID hg = uiroot(m_rid);
    RID cl = MAKE_CHILD<gui_contactlist_c>( hg );
    RID chat = MAKE_CHILD<gui_conversation_c>( hg );
    hg.call_restore_signal();
    
    gmsg<ISOGM_SELECT_CONTACT>(&contacts().get_self(), 0).send(); // 1st selected item, yo

    g_app->F_ALLOW_AUTOUPDATE = !g_app->F_READONLY_MODE;


    if (const theme_rect_s *tr = themerect())
    {
        if (tr->captextadd.x >= 18)
        {
            int sz = tr->captextadd.x - 2;
            ts::bitmap_c icon, rsz;
            if (icon.load_from_file(CONSTWSTR("icon.png")))
            {
                rsz.create_ARGB(ts::ivec2(sz));
                icon.resize_to( rsz.extbody(), ts::FILTER_BOX_LANCZOS3 );
                rsz.premultiply();
                icons[0] = rsz;
            }

            if (icon.load_from_file(CONSTWSTR("icon-offline.png")))
            {
                rsz.create_ARGB(ts::ivec2(sz));
                icon.resize_to(rsz.extbody(), ts::FILTER_BOX_LANCZOS3);
                rsz.premultiply();
                icons[1] = rsz;
            }
        }
    }
}
Example #15
0
void GaduRosterService::prepareRoster()
{
	auto requiresSynchronization = false;
	for (auto &&contact : contacts())
		if (contact.rosterEntry())
		{
			if (contact.rosterEntry()->state() == RosterEntryState::Detached) // GG does not support detached contacts
				contact.rosterEntry()->setHasLocalChanges();
			else
				contact.rosterEntry()->fixupInitialState();
			requiresSynchronization |= contact.rosterEntry()->requiresSynchronization();
		}
	if (requiresSynchronization)
		rosterChanged();
}
Example #16
0
void gui_filterbar_c::do_tag_click(int lnk)
{
    if ( lnk < BIT_count )
    {
        // process buildin tags
        INVERTFLAG( bitags, (1<<lnk) );
        prf().bitags( bitags );
    } else
    {
        lnk -= BIT_count;
        contacts().toggle_tag(lnk);
    }
    refresh_list();
    textrect.make_dirty();
    getengine().redraw();
}
Example #17
0
ts::wstr_c gui_filterbar_c::tagname( int index ) const
{
    if (index < BIT_count)
    {
        if ( const ts::wstr_c * n = binames.find( ts::wmake(index) ) )
            return *n;

        ts::wsptr bit[BIT_count] =
        {
            TTT("All", 83),
            TTT("Online", 86),
            TTT("Untagged",263),
        };
        return bit[index];
    }
    return from_utf8( contacts().get_all_tags().get(index - BIT_count) );
}
Example #18
0
void IRCAccount::receivedMessage( const QString &message )
{
	// Look up the contact the message is from
	QString from;
	IRCContact* messageSender;

	from = message.section( ':', 0, 0 );
	Kopete::Contact* contact = contacts().value(from);
	messageSender = dynamic_cast<IRCContact *>( contact );

	kDebug( 14210 ) << " got a message from " << from << ", " << messageSender << ", is: " << message;
	// Pass it on to the contact to process and display via a KMM
	if ( messageSender )
		messageSender->receivedMessage( message );
	else
		kWarning(14210) << "unable to look up contact for delivery";
}
Example #19
0
void GaduRosterService::importContactList()
{
	if (!m_connection || !m_connection.data()->hasSession())
	{
		emit getFinished(false);
		return;
	}

	m_synchronizingContacts = contacts();
	for (auto &&contact : m_synchronizingContacts)
		contact.rosterEntry()->setSynchronizingFromRemote();

	auto writableSessionToken = m_connection.data()->writableSessionToken();
	int ret = gg_userlist100_request(writableSessionToken.rawSession(), GG_USERLIST100_GET, 0, GG_USERLIST100_FORMAT_TYPE_GG70, 0);
	if (-1 == ret)
	{
		markSynchronizingAsSynchronized();
		emit getFinished(false);
	}
}
Example #20
0
void active_protocol_c::set_avatar( const ts::blob_c &ava )
{
    auto w = syncdata.lock_write();
    w().data.avatar = ava;
    w().data.avatar.set_size(ava.size()); // make copy due refcount not multithreaded
    w.unlock();

    tableview_active_protocol_s &t = prf().get_table_active_protocol();
    if (auto *r = t.find<true>(id))
    {
        r->other.avatar = ava;
        r->changed();
        prf().changed();
    }

    ipcp->send(ipcw(AQ_SET_AVATAR) << ava);

    if (contact_c *c = contacts().find_subself(getid()))
        c->set_avatar(ava.data(), ava.size(), 1);

}
Example #21
0
void ChatNotifier::notify(Notification *notification)
{
	if (!m_chatWidgetRepository)
		return;

	auto aggregateNotification = qobject_cast<AggregateNotification *>(notification);
	if (!aggregateNotification)
		return;

	auto latestNotification = aggregateNotification->notifications().last();

	auto buddies = BuddySet();
	auto chat = latestNotification->data()["chat"].value<Chat>();
	if (chat)
		buddies = chat.contacts().toBuddySet();

	for (auto chatWidget : m_chatWidgetRepository.data())
		// warning: do not exchange intersect caller and argument, it will modify buddies variable if you do
		if (buddies.isEmpty() || !chatWidget->chat().contacts().toBuddySet().intersect(buddies).isEmpty())
			sendNotificationToChatWidget(latestNotification, chatWidget);
}
void JabberTransport::removeAllContacts( )
{
//	XMPP::JT_Register * task = (XMPP::JT_Register *) sender ();

/*	if ( ! task->success ())
	KMessageBox::queuedMessageBox ( 0L, KMessageBox::Error,
									i18n ("An error occured when trying to remove the transport:\n%1").arg(task->statusString()),
									i18n ("Jabber Service Unregistration"));
	*/ //we don't really care, we remove everithing anyway.

	kdDebug(JABBER_DEBUG_GLOBAL) << k_funcinfo << "delete all contacts of the transport"<< endl;
	QDictIterator<Kopete::Contact> it( contacts() ); 
	for( ; it.current(); ++it )
	{
		XMPP::JT_Roster * rosterTask = new XMPP::JT_Roster ( account()->client()->rootTask () );
		rosterTask->remove ( static_cast<JabberBaseContact*>(it.current())->rosterItem().jid() );
		rosterTask->go ( true );
	}
	m_status = Removing; //in theory that's already our status
	Kopete::AccountManager::self()->removeAccount( this ); //this will delete this
}
Example #23
0
void gui_filterbar_c::fill_tags()
{
    int lnki = 0;
    auto make_ht = [&]( const ts::wsptr &htt ) -> ts::wstr_c
    {
        ts::wstr_c x( CONSTWSTR("<cstm=a\1>"), htt );
        x.append( CONSTWSTR("<cstm=b\1>, ") );
        x.replace_all( CONSTWSTR("\1"), ts::wmake<int>( lnki++ ) );
        return x;
    };

    ts::wstr_c t;
    for (int i = 0; i < BIT_count; ++i)
        t.append( make_ht(tagname(i)) );

    for(const ts::str_c &ht : contacts().get_all_tags())
        t.append(make_ht(from_utf8(ht)));
    
    t.trunc_length(2);
    set_text(t);
}
Example #24
0
ts::uint32 active_protocol_c::gm_handler( gmsg<ISOGM_PROFILE_TABLE_SAVED>&p )
{
    if (p.tabi == pt_active_protocol && p.pass == 0)
    {
        tableview_active_protocol_s &t = prf().get_table_active_protocol();
        bool dematerialization = false;
        if (id < 0)
        {
            if (auto *v = t.new2ins.find(id))
                id = v->value;
            else
                dematerialization = true;
        } else
        {
            auto *row = t.find<true>(id);
            dematerialization = row == nullptr /*|| FLAG(row->other.options, active_protocol_data_s::O_SUSPENDED)*/;
            if (!dematerialization)
            {
                auto w = syncdata.lock_write();
                w().data.name = row->other.name;
                w().data.user_name = row->other.user_name;
                w().data.user_statusmsg = row->other.user_statusmsg;
                w().data.options = row->other.options;

                if (row->other.configurable.initialized)
                    set_configurable(row->other.configurable);
            }
        }
        if (dematerialization)
        {
            int protoid = id;
            stop_and_die();
            contacts().nomore_proto(protoid);
            g_app->recreate_ctls(true, true);
        }
    }
    return 0;
}
Example #25
0
void gui_filterbar_c::apply_full_text_search_result()
{
    for (found_item_s &itm : found_stuff.items)
        if (contact_root_c *c = contacts().rfind(itm.historian))
        {
            c->full_search_result(true);
            if (c->gui_item)
            {
                c->gui_item->update_text();
                MODIFY(*c->gui_item).show();
            }
        }

    if (active)
    {
        gui_contactlist_c &cl = HOLD(getparent()).as<gui_contactlist_c>();
        cl.scroll_to_child(active, false);
    }

    gmsg<ISOGM_REFRESH_SEARCH_RESULT>().send();


}
Example #26
0
bool gui_filterbar_c::renamed(const ts::wstr_c &tn, const ts::str_c &tis)
{
    int ti = tis.as_int();

    if (ti < BIT_count)
    {
        if (tn.is_empty())
        {
            binames.unset( to_wstr(tis) );
        } else
        {
            binames.set( to_wstr(tis) ) = tn;
        }
        prf().bitagnames( binames.to_str() );
    } else
    {
        ti -= BIT_count;
        contacts().replace_tags( ti, to_utf8(tn) );
    }

    g_app->recreate_ctls(true, false);
    return true;
}
LOCAL_C void InitL()
	{
	CActiveScheduler* scheduler = new (ELeave) CActiveScheduler;
	CActiveScheduler::Install(scheduler);
	CleanupStack::PushL(scheduler);

	testUtils = CEmailTestUtils::NewLC(test);
	testUtils->CreateAllTestDirectories();
	CContactDatabase* contacts(NULL);
	TRAPD(err, contacts = CContactDatabase::OpenL());
	delete contacts;
	if (err==KErrNotFound)
		{
		testUtils->WriteComment(_L("contacts file is missing from system data"));		
		testFailed=ETrue;
		return;
		}
	testUtils->FileSession().SetSessionPath(_L("C:\\"));
	testUtils->ClearEmailAccountsL();
	testUtils->CleanMessageFolderL();
	testUtils->GoServerSideL();

	testUtils->WriteComment(_L("CImEmailOperation Tests"));
	}
         else
             result = (contacts(filters[i], sortOrders, filterSupportedFlag, error).toSet() + result.toSet()).toList();
     }
 // Detail filter with a string list is split and re-constructed into
 // an intersection filter
 } else if (filter.type() == QContactFilter::ContactDetailFilter
         && (static_cast<const QContactDetailFilter &>(filter)).value().type() == QVariant::StringList) {
     QStringList values = (static_cast<const QContactDetailFilter &>(filter)).value().toStringList();
     QContactIntersectionFilter intersectionFilter;
     foreach(const QString& value, values) {
         QContactDetailFilter detailFilter = filter;
         detailFilter.setValue(value);
         intersectionFilter.append(detailFilter);
     }
     // The resulting filter is handled with a recursive function call
     result = contacts(intersectionFilter, sortOrders, filterSupportedFlag, error);
 } else if (filter == QContactFilter()) {
     // Empty filter -> don't do any filtering and tell the caller to not
     // to do any filtering either
     filterSupportedFlag = true;
     result = filterContacts(QContactInvalidFilter(), error);
 } else {
     FilterSupport filterSupport = filterSupportLevel(filter);
     if (filterSupport == Supported) {
         filterSupportedFlag = true;
         // Filter supported, use as the result directly
         result = filterContacts(filter, error);
     } else if (filterSupport == SupportedPreFilterOnly) {
         // Filter only does pre-filtering, the caller is responsible of
         // removing possible false positives after filtering
         filterSupportedFlag = false;
void main()
{
 clrscr();
 contacts();
 getch();
}
Example #30
0
void gui_filterbar_c::full_search_result( found_stuff_s::FOUND_STUFF_T &&stuff )
{
    found_stuff.items = std::move( stuff );
    if (contact_index >= contacts().count())
        apply_full_text_search_result();
}