void SubstitutionManager::clearRules()
{
    if (m_rules.size())
    {
        m_rules.clear();
        emit entryDeleted();
    }
}
/*!
	Displays the to-do viewer and populates the to-do entry attributes.

	\param entry Agenda entry from which attributes have to be read.
 */
void AgendaEventView::execute(AgendaEntry entry,
											AgendaEventViewer::Actions action)
{
    OstTraceFunctionEntry0( AGENDAEVENTVIEW_EXECUTE_ENTRY );

	mOriginalAgendaEntry = entry;
	mAgendaEntry = entry;
	
	// For later reference
	mParentId = mOwner->mAgendaUtil->parentEntry(mAgendaEntry).id();
	
	// Add the viewer data reading from the agenda entry.
	addViewerData();
	
	// Remove unnecessary widget from event viewer.
	removeWidget();
	
	// Add the menu items to event viewer.
	addMenuItem();
	
	// Add the toolbar items to event viewer
	addToolBarItem(action);

	// Connect for the entry updation and addtion signal to refresh the view
	// when the same is edited in editor.
	connect(mOwner->mAgendaUtil, SIGNAL(entryUpdated(ulong)),
				this, SLOT(handleEntryUpdation(ulong)));
	
	connect(mOwner->mAgendaUtil, SIGNAL(entryAdded(ulong)),
				this, SLOT(handleEntryUpdation(ulong)));

	// Connect for entry deletion signal to close the event viewer.
	connect(mOwner->mAgendaUtil, SIGNAL(entryDeleted(ulong)), this,
	        SLOT(handleEntryDeletion(ulong)));

	// Add the view to the main window.
	HbMainWindow *window = hbInstance->allMainWindows().first();
	if (!window) {
		// Might be some non-ui based app called us
		// so create mainwindow now
		mMainWindow = new HbMainWindow();
		mMainWindow->addView(mViewer);
		mMainWindow->setCurrentView(mViewer);
	    connect(mMainWindow,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation)));
	} else {
		window->addView(mViewer);
		window->setCurrentView(mViewer);
		connect(window,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation)));
	}
	
	// Add softkey after adding view on window
	mBackAction = new HbAction(Hb::BackNaviAction);
	mViewer->setNavigationAction(mBackAction);
		
	connect(mBackAction, SIGNAL(triggered()), this, SLOT(close()));

	OstTraceFunctionExit0( AGENDAEVENTVIEW_EXECUTE_EXIT );
}
Beispiel #3
0
Core::Core()
    : m_originalMangler(nullptr)
{
#if IDA_SDK_VERSION >= 670
    action_desc_t action = 
    {
        sizeof(action),
        "retypedef_open_name_subst_editor",
        "Edit name substitutions...",
        &m_optionsMenuItemClickedAction,
        &PLUGIN
    };

    register_action(action);
    attach_action_to_menu("Options/", "retypedef_open_name_subst_editor", 0);
#else
    add_menu_item("Options/", "Edit name substitutions...", nullptr, 0, 
        &Core::onOptionsMenuItemClicked, this);
#endif

    // First start? Initialize with default rules.
    Settings settings;
    if (settings.value(Settings::kFirstStart, true).toBool())
    {
        QSettings defaultRules(":/Misc/default_rules.ini", QSettings::IniFormat);
        SettingsImporterExporter importer(&m_substitutionManager, &defaultRules);
        importer.importRules();
        saveToSettings();
        settings.setValue(Settings::kFirstStart, false);
    }

    // Load rules from settings and subscribe to changes in the manager
    try
    {
        SettingsImporterExporter importer(&m_substitutionManager, &settings);
        importer.importRules();
    }
    catch (const SettingsImporterExporter::Error& e)
    {
        msg("[" PLUGIN_NAME "] Cannot load settings: %s\n", e.what());
    }
    connect(&m_substitutionManager, SIGNAL(entryAdded()), SLOT(saveToSettings()));
    connect(&m_substitutionManager, SIGNAL(entryDeleted()), SLOT(saveToSettings()));

    // Place demangler detour
    HMODULE hIdaWll = GetModuleHandleA("IDA.WLL");
    if (!hIdaWll)
        throw std::runtime_error("cannot find IDA.WLL");

    auto demangle = reinterpret_cast<demangler_t*>(GetProcAddress(hIdaWll, "demangle"));
    if (!demangle)
        throw std::runtime_error("cannot find exported function \"demangle\" in IDA.WLL");

    m_demanglerDetour.reset(new DemanglerDetour(demangle, &Core::demanglerHookCallback));
    m_demanglerDetour->attach(m_originalMangler);
}
void SubstitutionManager::removeRule(const Substitution* subst)
{
    for (auto it = m_rules.begin(), end = m_rules.end(); it != end; ++it)
    {
        if (it->get() == subst)
        {
            it = m_rules.erase(it);
            emit entryDeleted();
            if (it == m_rules.end())
                break;
        }
    }
}
Beispiel #5
0
void Entry::_deleteEntry(const QJsonObject& data)
{
    if (data.value("status") == "success")
    {
        emit entryDeleted();
        emit Tasty::instance()->entryDeleted(_id);
        emit Tasty::instance()->info("Запись удалена");

        _chat.clear();
    }
    else
        qDebug() << data;
}